pymecli 0.6.7__tar.gz → 0.6.9__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.
- {pymecli-0.6.7 → pymecli-0.6.9}/PKG-INFO +1 -1
- {pymecli-0.6.7 → pymecli-0.6.9}/core/clash.py +15 -25
- {pymecli-0.6.7 → pymecli-0.6.9}/pyproject.toml +1 -1
- {pymecli-0.6.7 → pymecli-0.6.9}/.gitignore +0 -0
- {pymecli-0.6.7 → pymecli-0.6.9}/README.md +0 -0
- {pymecli-0.6.7 → pymecli-0.6.9}/api/__init__.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.9}/api/v1/__init__.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.9}/api/v1/clash.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.9}/api/v1/redis.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.9}/cli/__init__.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.9}/cli/bitget.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.9}/cli/dnspod.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.9}/cli/dst.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.9}/cli/etcd_sync.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.9}/cli/example.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.9}/cli/fast.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.9}/cli/gate.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.9}/cli/okx.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.9}/cli/quark.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.9}/cli/redis_csv.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.9}/cli/tele.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.9}/cli/util.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.9}/core/__init__.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.9}/core/config.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.9}/core/redis_client.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.9}/crypto/__init__.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.9}/crypto/bitget.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.9}/crypto/gate.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.9}/crypto/okx.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.9}/data/__init__.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.9}/data/dou_dict.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.9}/data/dou_list.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.9}/data/main.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.9}/data/template.yaml +0 -0
- {pymecli-0.6.7 → pymecli-0.6.9}/models/__init__.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.9}/models/douzero_model.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.9}/models/ocr_model.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.9}/models/response.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.9}/utils/__init__.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.9}/utils/elapsed.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.9}/utils/etcd.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.9}/utils/helper.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.9}/utils/logger.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.9}/utils/mysql.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.9}/utils/notify.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.9}/utils/path.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.9}/utils/pd.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.9}/utils/pyredis.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.9}/utils/sendNotify.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.9}/utils/sleep.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.9}/utils/text.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.9}/utils/toml.py +0 -0
|
@@ -7,7 +7,9 @@ from fastapi import Depends
|
|
|
7
7
|
|
|
8
8
|
module_dir = Path(__file__).resolve().parent.parent
|
|
9
9
|
|
|
10
|
-
TEMPLATE_URL =
|
|
10
|
+
TEMPLATE_URL = (
|
|
11
|
+
"https://raw.githubusercontent.com/meme2046/data/main/clash/template.yaml"
|
|
12
|
+
)
|
|
11
13
|
|
|
12
14
|
# 白名单模式最终规则
|
|
13
15
|
WHITELIST_RULES = [
|
|
@@ -52,7 +54,9 @@ class ClashYamlGenerator:
|
|
|
52
54
|
|
|
53
55
|
# ---------- 通用 helpers ----------
|
|
54
56
|
|
|
55
|
-
def _dedupe_proxy_names(
|
|
57
|
+
def _dedupe_proxy_names(
|
|
58
|
+
self, existing_proxies: list, new_proxies: list, suffix: str = "_custom"
|
|
59
|
+
) -> list:
|
|
56
60
|
"""对 new_proxies 里与 existing_proxies 重名的节点改名加后缀。
|
|
57
61
|
|
|
58
62
|
例:已有 "lighthouse",custom 也有 "lighthouse" → 改名为 "lighthouse_custom"
|
|
@@ -123,10 +127,11 @@ class ClashYamlGenerator:
|
|
|
123
127
|
def _add_inline_rule_providers(self, template, proxies):
|
|
124
128
|
"""从 my_rule_base_url 拉取 inline 规则集并写入 template"""
|
|
125
129
|
rule_list = [
|
|
126
|
-
[f"{self.my_rule_base_url}/
|
|
130
|
+
[f"{self.my_rule_base_url}/reject.yaml", "REJECT"],
|
|
131
|
+
[f"{self.my_rule_base_url}/game.yaml", "手动选择"],
|
|
127
132
|
[f"{self.my_rule_base_url}/proxy.yaml", "全局选择"],
|
|
128
133
|
[f"{self.my_rule_base_url}/round.yaml", "轮询"],
|
|
129
|
-
[f"{self.my_rule_base_url}/
|
|
134
|
+
[f"{self.my_rule_base_url}/direct.yaml", "DIRECT"],
|
|
130
135
|
]
|
|
131
136
|
for url, target in rule_list:
|
|
132
137
|
response = requests.get(url, proxies=proxies)
|
|
@@ -268,25 +273,6 @@ class ClashYamlGenerator:
|
|
|
268
273
|
|
|
269
274
|
def _add_base_rules(self, template, with_dst_port=False):
|
|
270
275
|
"""IP-CIDR / DOMAIN 基础规则(genPB / genB),genB 含饥荒端口"""
|
|
271
|
-
# template["rules"].extend(
|
|
272
|
-
# [
|
|
273
|
-
# "IP-CIDR,192.168.0.0/16,DIRECT,no-resolve",
|
|
274
|
-
# "IP-CIDR,10.0.0.0/8,DIRECT,no-resolve",
|
|
275
|
-
# "IP-CIDR,172.16.0.0/12,DIRECT,no-resolve",
|
|
276
|
-
# "IP-CIDR,127.0.0.0/8,DIRECT,no-resolve",
|
|
277
|
-
# ]
|
|
278
|
-
# )
|
|
279
|
-
# if with_dst_port:
|
|
280
|
-
# template["rules"].extend(
|
|
281
|
-
# [
|
|
282
|
-
# "DST-PORT,10999,DIRECT",
|
|
283
|
-
# "DST-PORT,10998,DIRECT",
|
|
284
|
-
# "DST-PORT,27016,DIRECT",
|
|
285
|
-
# "DST-PORT,27017,DIRECT",
|
|
286
|
-
# "DST-PORT,8766,DIRECT",
|
|
287
|
-
# "DST-PORT,8767,DIRECT",
|
|
288
|
-
# ]
|
|
289
|
-
# )
|
|
290
276
|
template["rules"].extend(
|
|
291
277
|
[
|
|
292
278
|
"DOMAIN,clash.razord.top,DIRECT",
|
|
@@ -303,7 +289,9 @@ class ClashYamlGenerator:
|
|
|
303
289
|
template = self._load_template(proxies)
|
|
304
290
|
|
|
305
291
|
has_custom = bool(custom_proxies)
|
|
306
|
-
template["proxy-groups"].extend(
|
|
292
|
+
template["proxy-groups"].extend(
|
|
293
|
+
self._provider_proxy_groups(sub_list, has_custom)
|
|
294
|
+
)
|
|
307
295
|
|
|
308
296
|
subs, userinfo = self._fetch_subscriptions(sub_list, proxies)
|
|
309
297
|
for item, ps in subs:
|
|
@@ -339,7 +327,9 @@ class ClashYamlGenerator:
|
|
|
339
327
|
template = self._load_template(proxies)
|
|
340
328
|
|
|
341
329
|
has_custom = bool(custom_proxies)
|
|
342
|
-
template["proxy-groups"].extend(
|
|
330
|
+
template["proxy-groups"].extend(
|
|
331
|
+
self._provider_proxy_groups(sub_list, has_custom)
|
|
332
|
+
)
|
|
343
333
|
|
|
344
334
|
subs, userinfo = self._fetch_subscriptions(sub_list, proxies)
|
|
345
335
|
for item, ps in subs:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|