pymecli 0.6.7__tar.gz → 0.6.8__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.8}/PKG-INFO +1 -1
- {pymecli-0.6.7 → pymecli-0.6.8}/core/clash.py +14 -25
- {pymecli-0.6.7 → pymecli-0.6.8}/pyproject.toml +1 -1
- {pymecli-0.6.7 → pymecli-0.6.8}/.gitignore +0 -0
- {pymecli-0.6.7 → pymecli-0.6.8}/README.md +0 -0
- {pymecli-0.6.7 → pymecli-0.6.8}/api/__init__.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.8}/api/v1/__init__.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.8}/api/v1/clash.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.8}/api/v1/redis.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.8}/cli/__init__.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.8}/cli/bitget.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.8}/cli/dnspod.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.8}/cli/dst.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.8}/cli/etcd_sync.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.8}/cli/example.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.8}/cli/fast.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.8}/cli/gate.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.8}/cli/okx.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.8}/cli/quark.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.8}/cli/redis_csv.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.8}/cli/tele.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.8}/cli/util.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.8}/core/__init__.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.8}/core/config.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.8}/core/redis_client.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.8}/crypto/__init__.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.8}/crypto/bitget.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.8}/crypto/gate.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.8}/crypto/okx.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.8}/data/__init__.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.8}/data/dou_dict.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.8}/data/dou_list.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.8}/data/main.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.8}/data/template.yaml +0 -0
- {pymecli-0.6.7 → pymecli-0.6.8}/models/__init__.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.8}/models/douzero_model.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.8}/models/ocr_model.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.8}/models/response.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.8}/utils/__init__.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.8}/utils/elapsed.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.8}/utils/etcd.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.8}/utils/helper.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.8}/utils/logger.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.8}/utils/mysql.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.8}/utils/notify.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.8}/utils/path.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.8}/utils/pd.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.8}/utils/pyredis.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.8}/utils/sendNotify.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.8}/utils/sleep.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.8}/utils/text.py +0 -0
- {pymecli-0.6.7 → pymecli-0.6.8}/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,10 @@ 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"],
|
|
127
131
|
[f"{self.my_rule_base_url}/proxy.yaml", "全局选择"],
|
|
128
132
|
[f"{self.my_rule_base_url}/round.yaml", "轮询"],
|
|
129
|
-
[f"{self.my_rule_base_url}/
|
|
133
|
+
[f"{self.my_rule_base_url}/direct.yaml", "DIRECT"],
|
|
130
134
|
]
|
|
131
135
|
for url, target in rule_list:
|
|
132
136
|
response = requests.get(url, proxies=proxies)
|
|
@@ -268,25 +272,6 @@ class ClashYamlGenerator:
|
|
|
268
272
|
|
|
269
273
|
def _add_base_rules(self, template, with_dst_port=False):
|
|
270
274
|
"""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
275
|
template["rules"].extend(
|
|
291
276
|
[
|
|
292
277
|
"DOMAIN,clash.razord.top,DIRECT",
|
|
@@ -303,7 +288,9 @@ class ClashYamlGenerator:
|
|
|
303
288
|
template = self._load_template(proxies)
|
|
304
289
|
|
|
305
290
|
has_custom = bool(custom_proxies)
|
|
306
|
-
template["proxy-groups"].extend(
|
|
291
|
+
template["proxy-groups"].extend(
|
|
292
|
+
self._provider_proxy_groups(sub_list, has_custom)
|
|
293
|
+
)
|
|
307
294
|
|
|
308
295
|
subs, userinfo = self._fetch_subscriptions(sub_list, proxies)
|
|
309
296
|
for item, ps in subs:
|
|
@@ -339,7 +326,9 @@ class ClashYamlGenerator:
|
|
|
339
326
|
template = self._load_template(proxies)
|
|
340
327
|
|
|
341
328
|
has_custom = bool(custom_proxies)
|
|
342
|
-
template["proxy-groups"].extend(
|
|
329
|
+
template["proxy-groups"].extend(
|
|
330
|
+
self._provider_proxy_groups(sub_list, has_custom)
|
|
331
|
+
)
|
|
343
332
|
|
|
344
333
|
subs, userinfo = self._fetch_subscriptions(sub_list, proxies)
|
|
345
334
|
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
|