v2kit 0.0.0__tar.gz → 0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
v2kit-0.1/AUTHORS.md ADDED
@@ -0,0 +1,12 @@
1
+ # Core Developers
2
+ ----------
3
+ - [@sepandhaghighi](http://github.com/sepandhaghighi)
4
+
5
+
6
+ # Other Contributors
7
+ ----------
8
+ - [ChatGPT](https://chat.openai.com/) ++
9
+
10
+ ++ Graphic designer
11
+
12
+
v2kit-0.1/CHANGELOG.md ADDED
@@ -0,0 +1,22 @@
1
+ # Changelog
2
+ All notable changes to this project will be documented in this file.
3
+
4
+ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
5
+ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
6
+
7
+ ## [Unreleased]
8
+ ## [0.1] - 2026-05-16
9
+ ### Added
10
+ - `is_vmess` function
11
+ - `is_vless` function
12
+ - `is_trojan` function
13
+ - `is_shadowsocks` function
14
+ - `relabel` function
15
+ - `encode_subscription` function
16
+ - `decode_subscription` function
17
+
18
+ [Unreleased]: https://github.com/sepandhaghighi/v2kit/compare/v0.1...dev
19
+ [0.1]: https://github.com/sepandhaghighi/v2kit/compare/bb5a2cb...v0.1
20
+
21
+
22
+
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2024 OpenSciLab
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Sepand Haghighi
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
v2kit-0.1/MANIFEST.in ADDED
@@ -0,0 +1,6 @@
1
+ include LICENSE
2
+ include *.md
3
+ include *.spec
4
+ include *.txt
5
+ include *.yml
6
+ include *.ini
v2kit-0.1/PKG-INFO ADDED
@@ -0,0 +1,183 @@
1
+ Metadata-Version: 2.4
2
+ Name: v2kit
3
+ Version: 0.1
4
+ Summary: V2Kit: A Lightweight Toolkit for V2Ray Config Manipulation
5
+ Home-page: https://github.com/sepandhaghighi/v2kit
6
+ Download-URL: https://github.com/sepandhaghighi/v2kit/tarball/v0.1
7
+ Author: Sepand Haghighi
8
+ Author-email: me@sepand.tech
9
+ License: MIT
10
+ Project-URL: Source, https://github.com/sepandhaghighi/v2kit
11
+ Keywords: v2ray v2ray-config v2ray-tools vmess vless trojan shadowsocks proxy subscription network
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Natural Language :: English
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3.8
17
+ Classifier: Programming Language :: Python :: 3.9
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Programming Language :: Python :: 3.14
23
+ Classifier: Intended Audience :: Developers
24
+ Classifier: Topic :: Utilities
25
+ Classifier: Topic :: Internet
26
+ Classifier: Topic :: Internet :: Proxy Servers
27
+ Requires-Python: >=3.8
28
+ Description-Content-Type: text/markdown
29
+ License-File: LICENSE
30
+ License-File: AUTHORS.md
31
+ Dynamic: author
32
+ Dynamic: author-email
33
+ Dynamic: classifier
34
+ Dynamic: description
35
+ Dynamic: description-content-type
36
+ Dynamic: download-url
37
+ Dynamic: home-page
38
+ Dynamic: keywords
39
+ Dynamic: license
40
+ Dynamic: license-file
41
+ Dynamic: project-url
42
+ Dynamic: requires-python
43
+ Dynamic: summary
44
+
45
+
46
+ <div align="center">
47
+ <h1>V2Kit: A Lightweight Toolkit for V2Ray Config Manipulation</h1>
48
+ <br/>
49
+ <a href="https://www.python.org/"><img src="https://img.shields.io/badge/built%20with-Python3-green.svg" alt="built with Python3"></a>
50
+ <a href="https://github.com/sepandhaghighi/v2kit"><img alt="GitHub repo size" src="https://img.shields.io/github/repo-size/sepandhaghighi/v2kit"></a>
51
+ <a href="https://badge.fury.io/py/v2kit"><img src="https://badge.fury.io/py/v2kit.svg" alt="PyPI version"></a>
52
+ </div>
53
+
54
+ ## Overview
55
+
56
+ <p align="justify">
57
+ V2Kit is a lightweight and extensible Python toolkit for working with V2Ray proxy configurations and subscriptions. It provides a clean API for common operations such as protocol detection, configuration validation, config relabeling, and subscription encoding/decoding. The project is designed with simplicity, predictability, and composability in mind, making it suitable for automation scripts, proxy pipelines, networking tools, and future extensions around V2Ray ecosystem utilities.
58
+ </p>
59
+
60
+ <table>
61
+ <tr>
62
+ <td align="center">PyPI Counter</td>
63
+ <td align="center"><a href="http://pepy.tech/project/v2kit"><img src="http://pepy.tech/badge/v2kit"></a></td>
64
+ </tr>
65
+ <tr>
66
+ <td align="center">Github Stars</td>
67
+ <td align="center"><a href="https://github.com/sepandhaghighi/v2kit"><img src="https://img.shields.io/github/stars/sepandhaghighi/v2kit.svg?style=social&label=Stars"></a></td>
68
+ </tr>
69
+ </table>
70
+
71
+
72
+
73
+ <table>
74
+ <tr>
75
+ <td align="center">Branch</td>
76
+ <td align="center">main</td>
77
+ <td align="center">dev</td>
78
+ </tr>
79
+ <tr>
80
+ <td align="center">CI</td>
81
+ <td align="center"><img src="https://github.com/sepandhaghighi/v2kit/actions/workflows/test.yml/badge.svg?branch=main"></td>
82
+ <td align="center"><img src="https://github.com/sepandhaghighi/v2kit/actions/workflows/test.yml/badge.svg?branch=dev"></td>
83
+ </tr>
84
+ </table>
85
+
86
+ ## Installation
87
+
88
+ ### Source Code
89
+ - Download [Version 0.1](https://github.com/sepandhaghighi/v2kit/archive/v0.1.zip) or [Latest Source](https://github.com/sepandhaghighi/v2kit/archive/dev.zip)
90
+ - `pip install .`
91
+
92
+ ### PyPI
93
+
94
+ - Check [Python Packaging User Guide](https://packaging.python.org/installing/)
95
+ - `pip install v2kit==0.1`
96
+
97
+
98
+ ## Usage
99
+
100
+ ```python
101
+ from v2kit import (
102
+ decode_subscription,
103
+ encode_subscription,
104
+ is_vmess,
105
+ relabel,
106
+ )
107
+
108
+ config = "vmess://eyJhZGQiOiIxMjcuMC4wLjEiLCJwcyI6Im9sZCJ9"
109
+
110
+ new_config = relabel(config, "Germany-1")
111
+
112
+ if is_vmess(new_config):
113
+ print("VMESS config detected")
114
+
115
+ subscription = encode_subscription([new_config])
116
+
117
+ configs = decode_subscription(subscription)
118
+ ```
119
+
120
+ ## Issues & Bug Reports
121
+
122
+ Just fill an issue and describe it. We'll check it ASAP!
123
+
124
+ - Please complete the issue template
125
+
126
+ ## Show Your Support
127
+
128
+ <h3>Star This Repo</h3>
129
+
130
+ Give a ⭐️ if this project helped you!
131
+
132
+ <h3>Donate to Our Project</h3>
133
+
134
+ <h4>Bitcoin</h4>
135
+ 1KtNLEEeUbTEK9PdN6Ya3ZAKXaqoKUuxCy
136
+ <h4>Ethereum</h4>
137
+ 0xcD4Db18B6664A9662123D4307B074aE968535388
138
+ <h4>Litecoin</h4>
139
+ Ldnz5gMcEeV8BAdsyf8FstWDC6uyYR6pgZ
140
+ <h4>Doge</h4>
141
+ DDUnKpFQbBqLpFVZ9DfuVysBdr249HxVDh
142
+ <h4>Tron</h4>
143
+ TCZxzPZLcJHr2qR3uPUB1tXB6L3FDSSAx7
144
+ <h4>Ripple</h4>
145
+ rN7ZuRG7HDGHR5nof8nu5LrsbmSB61V1qq
146
+ <h4>Binance Coin</h4>
147
+ bnb1zglwcf0ac3d0s2f6ck5kgwvcru4tlctt4p5qef
148
+ <h4>Tether</h4>
149
+ 0xcD4Db18B6664A9662123D4307B074aE968535388
150
+ <h4>Dash</h4>
151
+ Xd3Yn2qZJ7VE8nbKw2fS98aLxR5M6WUU3s
152
+ <h4>Stellar</h4>
153
+ GALPOLPISRHIYHLQER2TLJRGUSZH52RYDK6C3HIU4PSMNAV65Q36EGNL
154
+ <h4>Zilliqa</h4>
155
+ zil1knmz8zj88cf0exr2ry7nav9elehxfcgqu3c5e5
156
+ <h4>Coffeete</h4>
157
+ <a href="http://www.coffeete.ir/opensource">
158
+ <img src="http://www.coffeete.ir/images/buttons/lemonchiffon.png" style="width:260px;" />
159
+ </a>
160
+
161
+
162
+ # Changelog
163
+ All notable changes to this project will be documented in this file.
164
+
165
+ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
166
+ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
167
+
168
+ ## [Unreleased]
169
+ ## [0.1] - 2026-05-16
170
+ ### Added
171
+ - `is_vmess` function
172
+ - `is_vless` function
173
+ - `is_trojan` function
174
+ - `is_shadowsocks` function
175
+ - `relabel` function
176
+ - `encode_subscription` function
177
+ - `decode_subscription` function
178
+
179
+ [Unreleased]: https://github.com/sepandhaghighi/v2kit/compare/v0.1...dev
180
+ [0.1]: https://github.com/sepandhaghighi/v2kit/compare/bb5a2cb...v0.1
181
+
182
+
183
+
v2kit-0.1/README.md ADDED
@@ -0,0 +1,115 @@
1
+ <div align="center">
2
+ <h1>V2Kit: A Lightweight Toolkit for V2Ray Config Manipulation</h1>
3
+ <br/>
4
+ <a href="https://www.python.org/"><img src="https://img.shields.io/badge/built%20with-Python3-green.svg" alt="built with Python3"></a>
5
+ <a href="https://github.com/sepandhaghighi/v2kit"><img alt="GitHub repo size" src="https://img.shields.io/github/repo-size/sepandhaghighi/v2kit"></a>
6
+ <a href="https://badge.fury.io/py/v2kit"><img src="https://badge.fury.io/py/v2kit.svg" alt="PyPI version"></a>
7
+ </div>
8
+
9
+ ## Overview
10
+
11
+ <p align="justify">
12
+ V2Kit is a lightweight and extensible Python toolkit for working with V2Ray proxy configurations and subscriptions. It provides a clean API for common operations such as protocol detection, configuration validation, config relabeling, and subscription encoding/decoding. The project is designed with simplicity, predictability, and composability in mind, making it suitable for automation scripts, proxy pipelines, networking tools, and future extensions around V2Ray ecosystem utilities.
13
+ </p>
14
+
15
+ <table>
16
+ <tr>
17
+ <td align="center">PyPI Counter</td>
18
+ <td align="center"><a href="http://pepy.tech/project/v2kit"><img src="http://pepy.tech/badge/v2kit"></a></td>
19
+ </tr>
20
+ <tr>
21
+ <td align="center">Github Stars</td>
22
+ <td align="center"><a href="https://github.com/sepandhaghighi/v2kit"><img src="https://img.shields.io/github/stars/sepandhaghighi/v2kit.svg?style=social&label=Stars"></a></td>
23
+ </tr>
24
+ </table>
25
+
26
+
27
+
28
+ <table>
29
+ <tr>
30
+ <td align="center">Branch</td>
31
+ <td align="center">main</td>
32
+ <td align="center">dev</td>
33
+ </tr>
34
+ <tr>
35
+ <td align="center">CI</td>
36
+ <td align="center"><img src="https://github.com/sepandhaghighi/v2kit/actions/workflows/test.yml/badge.svg?branch=main"></td>
37
+ <td align="center"><img src="https://github.com/sepandhaghighi/v2kit/actions/workflows/test.yml/badge.svg?branch=dev"></td>
38
+ </tr>
39
+ </table>
40
+
41
+ ## Installation
42
+
43
+ ### Source Code
44
+ - Download [Version 0.1](https://github.com/sepandhaghighi/v2kit/archive/v0.1.zip) or [Latest Source](https://github.com/sepandhaghighi/v2kit/archive/dev.zip)
45
+ - `pip install .`
46
+
47
+ ### PyPI
48
+
49
+ - Check [Python Packaging User Guide](https://packaging.python.org/installing/)
50
+ - `pip install v2kit==0.1`
51
+
52
+
53
+ ## Usage
54
+
55
+ ```python
56
+ from v2kit import (
57
+ decode_subscription,
58
+ encode_subscription,
59
+ is_vmess,
60
+ relabel,
61
+ )
62
+
63
+ config = "vmess://eyJhZGQiOiIxMjcuMC4wLjEiLCJwcyI6Im9sZCJ9"
64
+
65
+ new_config = relabel(config, "Germany-1")
66
+
67
+ if is_vmess(new_config):
68
+ print("VMESS config detected")
69
+
70
+ subscription = encode_subscription([new_config])
71
+
72
+ configs = decode_subscription(subscription)
73
+ ```
74
+
75
+ ## Issues & Bug Reports
76
+
77
+ Just fill an issue and describe it. We'll check it ASAP!
78
+
79
+ - Please complete the issue template
80
+
81
+ ## Show Your Support
82
+
83
+ <h3>Star This Repo</h3>
84
+
85
+ Give a ⭐️ if this project helped you!
86
+
87
+ <h3>Donate to Our Project</h3>
88
+
89
+ <h4>Bitcoin</h4>
90
+ 1KtNLEEeUbTEK9PdN6Ya3ZAKXaqoKUuxCy
91
+ <h4>Ethereum</h4>
92
+ 0xcD4Db18B6664A9662123D4307B074aE968535388
93
+ <h4>Litecoin</h4>
94
+ Ldnz5gMcEeV8BAdsyf8FstWDC6uyYR6pgZ
95
+ <h4>Doge</h4>
96
+ DDUnKpFQbBqLpFVZ9DfuVysBdr249HxVDh
97
+ <h4>Tron</h4>
98
+ TCZxzPZLcJHr2qR3uPUB1tXB6L3FDSSAx7
99
+ <h4>Ripple</h4>
100
+ rN7ZuRG7HDGHR5nof8nu5LrsbmSB61V1qq
101
+ <h4>Binance Coin</h4>
102
+ bnb1zglwcf0ac3d0s2f6ck5kgwvcru4tlctt4p5qef
103
+ <h4>Tether</h4>
104
+ 0xcD4Db18B6664A9662123D4307B074aE968535388
105
+ <h4>Dash</h4>
106
+ Xd3Yn2qZJ7VE8nbKw2fS98aLxR5M6WUU3s
107
+ <h4>Stellar</h4>
108
+ GALPOLPISRHIYHLQER2TLJRGUSZH52RYDK6C3HIU4PSMNAV65Q36EGNL
109
+ <h4>Zilliqa</h4>
110
+ zil1knmz8zj88cf0exr2ry7nav9elehxfcgqu3c5e5
111
+ <h4>Coffeete</h4>
112
+ <a href="http://www.coffeete.ir/opensource">
113
+ <img src="http://www.coffeete.ir/images/buttons/lemonchiffon.png" style="width:260px;" />
114
+ </a>
115
+
v2kit-0.1/SECURITY.md ADDED
@@ -0,0 +1,14 @@
1
+ # Security Policy
2
+
3
+ ## Supported Versions
4
+
5
+ | Version | Supported |
6
+ | ------------- | ------------------ |
7
+ | 0.1 | :white_check_mark: |
8
+ | < 0.1 | :x: |
9
+
10
+ ## Reporting a Vulnerability
11
+
12
+ Please report security vulnerabilities by email to [me@sepand.tech](mailto:me@sepand.tech "me@sepand.tech").
13
+
14
+ If the security vulnerability is accepted, a dedicated bugfix release will be issued as soon as possible (depending on the complexity of the fix).
@@ -0,0 +1,6 @@
1
+ pytest>=4.3.1
2
+ pytest-cov>=2.6.1
3
+ setuptools>=40.8.0
4
+ vulture>=1.0
5
+ bandit>=1.5.1
6
+ pydocstyle>=6.3.0
@@ -1,4 +1,4 @@
1
- [egg_info]
2
- tag_build =
3
- tag_date = 0
4
-
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
v2kit-0.1/setup.py ADDED
@@ -0,0 +1,67 @@
1
+ # -*- coding: utf-8 -*-
2
+ """Setup module."""
3
+ from typing import List
4
+ try:
5
+ from setuptools import setup
6
+ except ImportError:
7
+ from distutils.core import setup
8
+
9
+
10
+ def get_requires() -> List[str]:
11
+ """Read requirements.txt."""
12
+ requirements = open("requirements.txt", "r").read()
13
+ return list(filter(lambda x: x != "", requirements.split()))
14
+
15
+
16
+ def read_description() -> str:
17
+ """Read README.md and CHANGELOG.md."""
18
+ try:
19
+ with open("README.md") as r:
20
+ description = "\n"
21
+ description += r.read()
22
+ with open("CHANGELOG.md") as c:
23
+ description += "\n"
24
+ description += c.read()
25
+ return description
26
+ except Exception:
27
+ return '''V2Kit is a lightweight and extensible Python toolkit for working with V2Ray proxy configurations and subscriptions.
28
+ It provides a clean API for common operations such as protocol detection, configuration validation, config relabeling,
29
+ and subscription encoding/decoding. The project is designed with simplicity, predictability, and composability in mind,
30
+ making it suitable for automation scripts, proxy pipelines, networking tools, and future extensions around V2Ray ecosystem utilities.'''
31
+
32
+
33
+ setup(
34
+ name='v2kit',
35
+ packages=['v2kit'],
36
+ version='0.1',
37
+ description='V2Kit: A Lightweight Toolkit for V2Ray Config Manipulation',
38
+ long_description=read_description(),
39
+ long_description_content_type='text/markdown',
40
+ include_package_data=True,
41
+ author='Sepand Haghighi',
42
+ author_email='me@sepand.tech',
43
+ url='https://github.com/sepandhaghighi/v2kit',
44
+ download_url='https://github.com/sepandhaghighi/v2kit/tarball/v0.1',
45
+ keywords="v2ray v2ray-config v2ray-tools vmess vless trojan shadowsocks proxy subscription network",
46
+ project_urls={
47
+ 'Source': 'https://github.com/sepandhaghighi/v2kit'},
48
+ install_requires=get_requires(),
49
+ python_requires='>=3.8',
50
+ classifiers=[
51
+ 'Development Status :: 3 - Alpha',
52
+ 'Natural Language :: English',
53
+ 'License :: OSI Approved :: MIT License',
54
+ 'Operating System :: OS Independent',
55
+ 'Programming Language :: Python :: 3.8',
56
+ 'Programming Language :: Python :: 3.9',
57
+ 'Programming Language :: Python :: 3.10',
58
+ 'Programming Language :: Python :: 3.11',
59
+ 'Programming Language :: Python :: 3.12',
60
+ 'Programming Language :: Python :: 3.13',
61
+ 'Programming Language :: Python :: 3.14',
62
+ 'Intended Audience :: Developers',
63
+ 'Topic :: Utilities',
64
+ 'Topic :: Internet',
65
+ 'Topic :: Internet :: Proxy Servers',
66
+ ],
67
+ license='MIT')
@@ -0,0 +1,85 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ import pytest
4
+
5
+ from v2kit import relabel, encode_subscription, decode_subscription
6
+ from v2kit.utils import _validate_config
7
+
8
+
9
+ INVALID_PROTOCOL = "http://example.com"
10
+
11
+ INVALID_VMESS = "vmess://invalid-base64"
12
+
13
+ VALID_VLESS = (
14
+ "vless://uuid@example.com:443"
15
+ "?security=tls#test"
16
+ )
17
+
18
+
19
+ def test_validate_config_non_string():
20
+ with pytest.raises(TypeError):
21
+ _validate_config(123)
22
+
23
+
24
+ def test_validate_config_empty():
25
+ with pytest.raises(ValueError):
26
+ _validate_config("")
27
+
28
+
29
+ def test_validate_config_missing_scheme():
30
+ with pytest.raises(ValueError):
31
+ _validate_config("invalid-config")
32
+
33
+
34
+ def test_validate_config_unsupported_protocol():
35
+ with pytest.raises(ValueError):
36
+ _validate_config(INVALID_PROTOCOL)
37
+
38
+
39
+ def test_validate_invalid_vmess():
40
+ with pytest.raises(ValueError):
41
+ _validate_config(INVALID_VMESS)
42
+
43
+
44
+ def test_relabel_invalid_config():
45
+ with pytest.raises(ValueError):
46
+ relabel("invalid", "label")
47
+
48
+
49
+ def test_relabel_empty_label():
50
+ with pytest.raises(ValueError):
51
+ relabel(VALID_VLESS, "")
52
+
53
+
54
+ def test_relabel_non_string_label():
55
+ with pytest.raises(TypeError):
56
+ relabel(VALID_VLESS, 123)
57
+
58
+
59
+ def test_encode_subscription_invalid_config():
60
+ configs = [
61
+ VALID_VLESS,
62
+ "invalid-config",
63
+ ]
64
+
65
+ with pytest.raises(ValueError):
66
+ encode_subscription(configs)
67
+
68
+
69
+ def test_decode_subscription_non_string():
70
+ with pytest.raises(TypeError):
71
+ decode_subscription(123)
72
+
73
+
74
+ def test_decode_subscription_invalid_data():
75
+ with pytest.raises(Exception):
76
+ decode_subscription("invalid-base64")
77
+
78
+
79
+ def test_decode_subscription_invalid_config():
80
+ invalid_subscription = (
81
+ "aW52YWxpZC1jb25maWc="
82
+ )
83
+
84
+ with pytest.raises(ValueError):
85
+ decode_subscription(invalid_subscription)