pymecli 0.4.8__tar.gz → 0.5.0__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.
Files changed (44) hide show
  1. {pymecli-0.4.8 → pymecli-0.5.0}/PKG-INFO +3 -1
  2. {pymecli-0.4.8 → pymecli-0.5.0}/cli/util.py +45 -0
  3. {pymecli-0.4.8 → pymecli-0.5.0}/core/clash.py +6 -6
  4. {pymecli-0.4.8 → pymecli-0.5.0}/data/template.yaml +70 -70
  5. {pymecli-0.4.8 → pymecli-0.5.0}/pyproject.toml +4 -2
  6. {pymecli-0.4.8 → pymecli-0.5.0}/.gitignore +0 -0
  7. {pymecli-0.4.8 → pymecli-0.5.0}/README.md +0 -0
  8. {pymecli-0.4.8 → pymecli-0.5.0}/api/__init__.py +0 -0
  9. {pymecli-0.4.8 → pymecli-0.5.0}/api/v1/__init__.py +0 -0
  10. {pymecli-0.4.8 → pymecli-0.5.0}/api/v1/clash.py +0 -0
  11. {pymecli-0.4.8 → pymecli-0.5.0}/api/v1/redis.py +0 -0
  12. {pymecli-0.4.8 → pymecli-0.5.0}/cli/__init__.py +0 -0
  13. {pymecli-0.4.8 → pymecli-0.5.0}/cli/baidu.py +0 -0
  14. {pymecli-0.4.8 → pymecli-0.5.0}/cli/bitget.py +0 -0
  15. {pymecli-0.4.8 → pymecli-0.5.0}/cli/dst.py +0 -0
  16. {pymecli-0.4.8 → pymecli-0.5.0}/cli/example.py +0 -0
  17. {pymecli-0.4.8 → pymecli-0.5.0}/cli/fast.py +0 -0
  18. {pymecli-0.4.8 → pymecli-0.5.0}/cli/gate.py +0 -0
  19. {pymecli-0.4.8 → pymecli-0.5.0}/cli/redis_csv.py +0 -0
  20. {pymecli-0.4.8 → pymecli-0.5.0}/core/__init__.py +0 -0
  21. {pymecli-0.4.8 → pymecli-0.5.0}/core/config.py +0 -0
  22. {pymecli-0.4.8 → pymecli-0.5.0}/core/redis_client.py +0 -0
  23. {pymecli-0.4.8 → pymecli-0.5.0}/crypto/__init__.py +0 -0
  24. {pymecli-0.4.8 → pymecli-0.5.0}/crypto/bitget.py +0 -0
  25. {pymecli-0.4.8 → pymecli-0.5.0}/crypto/gate.py +0 -0
  26. {pymecli-0.4.8 → pymecli-0.5.0}/data/__init__.py +0 -0
  27. {pymecli-0.4.8 → pymecli-0.5.0}/data/dou_dict.py +0 -0
  28. {pymecli-0.4.8 → pymecli-0.5.0}/data/dou_list.py +0 -0
  29. {pymecli-0.4.8 → pymecli-0.5.0}/data/main.py +0 -0
  30. {pymecli-0.4.8 → pymecli-0.5.0}/models/__init__.py +0 -0
  31. {pymecli-0.4.8 → pymecli-0.5.0}/models/douzero_model.py +0 -0
  32. {pymecli-0.4.8 → pymecli-0.5.0}/models/ocr_model.py +0 -0
  33. {pymecli-0.4.8 → pymecli-0.5.0}/models/response.py +0 -0
  34. {pymecli-0.4.8 → pymecli-0.5.0}/utils/__init__.py +0 -0
  35. {pymecli-0.4.8 → pymecli-0.5.0}/utils/elapsed.py +0 -0
  36. {pymecli-0.4.8 → pymecli-0.5.0}/utils/helper.py +0 -0
  37. {pymecli-0.4.8 → pymecli-0.5.0}/utils/logger.py +0 -0
  38. {pymecli-0.4.8 → pymecli-0.5.0}/utils/mysql.py +0 -0
  39. {pymecli-0.4.8 → pymecli-0.5.0}/utils/path.py +0 -0
  40. {pymecli-0.4.8 → pymecli-0.5.0}/utils/pd.py +0 -0
  41. {pymecli-0.4.8 → pymecli-0.5.0}/utils/pyredis.py +0 -0
  42. {pymecli-0.4.8 → pymecli-0.5.0}/utils/sleep.py +0 -0
  43. {pymecli-0.4.8 → pymecli-0.5.0}/utils/text.py +0 -0
  44. {pymecli-0.4.8 → pymecli-0.5.0}/utils/toml.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pymecli
3
- Version: 0.4.8
3
+ Version: 0.5.0
4
4
  Summary: My CLI
5
5
  Project-URL: Homepage, https://pypi.org/project/pymecli
6
6
  Project-URL: Repository, https://github.com/meme2046/pymecli
@@ -14,6 +14,8 @@ Requires-Dist: babel>=2.17.0
14
14
  Requires-Dist: cowsay>=6.1
15
15
  Requires-Dist: dotenv>=0.9.9
16
16
  Requires-Dist: fastapi>=0.127.0
17
+ Requires-Dist: ifaddr>=0.2.0
18
+ Requires-Dist: netifaces-plus>=0.12.5
17
19
  Requires-Dist: numpy<2.0.0
18
20
  Requires-Dist: pandas>=2.3.3
19
21
  Requires-Dist: pydantic-settings>=2.14.2
@@ -1,3 +1,4 @@
1
+ import ipaddress
1
2
  import platform
2
3
  import secrets
3
4
  import string
@@ -6,11 +7,14 @@ import uuid as u
6
7
  from datetime import datetime
7
8
 
8
9
  import arrow
10
+ import ifaddr
9
11
  import pytz
10
12
  import typer
11
13
  from babel.dates import format_datetime
12
14
  from cowsay.__main__ import cli
13
15
 
16
+ from utils.pyredis import get_redis_client_sync
17
+
14
18
  app = typer.Typer()
15
19
 
16
20
 
@@ -140,6 +144,47 @@ def say():
140
144
  cli()
141
145
 
142
146
 
147
+ @app.command()
148
+ def ipv6():
149
+ """
150
+ 获取本地 IPV6 稳定地址
151
+ """
152
+ ips = []
153
+ adapters = ifaddr.get_adapters(include_unconfigured=False)
154
+ for adapter in adapters:
155
+ for ip in adapter.ips:
156
+ if not ip.is_IPv6:
157
+ continue
158
+
159
+ addr_str = ip.ip[0]
160
+ try:
161
+ v6 = ipaddress.IPv6Address(addr_str)
162
+
163
+ # 过滤条件:只保留稳定的公网地址
164
+ if (
165
+ v6.is_global # 全球可路由
166
+ and not v6.is_link_local # 非链路本地
167
+ and not v6.is_loopback # 非回环地址
168
+ and not v6.is_private # 非私有地址
169
+ and not v6.is_multicast # 非组播地址
170
+ and not v6.is_unspecified # 非未指定地址(::)
171
+ and ip.network_prefix == 64 # 宽带分配给内网的用户网段几乎统一 /64
172
+ ):
173
+ ips.append(addr_str)
174
+ except Exception:
175
+ continue
176
+
177
+ if not ips:
178
+ print("未找到稳定 IPV6 地址")
179
+ return ips
180
+
181
+ print(f"IPV6 稳定地址: {ips}")
182
+
183
+ r = get_redis_client_sync()
184
+ r.set("local.IPv6", ips[0])
185
+ return ips
186
+
187
+
143
188
  if __name__ == "__main__":
144
189
  usdc = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
145
190
  weth = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"
@@ -331,12 +331,12 @@ class ClashYamlGenerator:
331
331
  template["rules"].append("IP-CIDR,172.16.0.0/12,DIRECT,no-resolve")
332
332
  template["rules"].append("IP-CIDR,127.0.0.0/8,DIRECT,no-resolve")
333
333
  # ⬇️饥荒服务器相关端口
334
- template["rules"].append("DST-PORT,10999,DIRECT")
335
- template["rules"].append("DST-PORT,10998,DIRECT")
336
- template["rules"].append("DST-PORT,27016,DIRECT")
337
- template["rules"].append("DST-PORT,27017,DIRECT")
338
- template["rules"].append("DST-PORT,8766,DIRECT")
339
- template["rules"].append("DST-PORT,8767,DIRECT")
334
+ # template["rules"].append("DST-PORT,10999,DIRECT")
335
+ # template["rules"].append("DST-PORT,10998,DIRECT")
336
+ # template["rules"].append("DST-PORT,27016,DIRECT")
337
+ # template["rules"].append("DST-PORT,27017,DIRECT")
338
+ # template["rules"].append("DST-PORT,8766,DIRECT")
339
+ # template["rules"].append("DST-PORT,8767,DIRECT")
340
340
 
341
341
  template["rules"].append("DOMAIN,clash.razord.top,DIRECT")
342
342
  template["rules"].append("DOMAIN,yacd.haishan.me,DIRECT")
@@ -1,70 +1,70 @@
1
- mixed-port: 7897
2
- allow-lan: false
3
- mode: rule
4
- log-level: warning
5
- external-controller: "127.0.0.1:9097"
6
- client-fingerprint: chrome
7
- unified-delay: true
8
- ipv6: false
9
- profile:
10
- store-selected: true
11
- tun:
12
- mtu: 1500
13
- dns:
14
- enable: true
15
- listen: ":53"
16
- enhanced-mode: "fake-ip"
17
- fake-ip-range: "198.18.0.1/16"
18
- fake-ip-filter-mode: "blacklist"
19
- prefer-h3: false
20
- respect-rules: false
21
- use-hosts: false
22
- use-system-hosts: false
23
- ipv6: true
24
- fake-ip-filter:
25
- - "*.lan"
26
- - "*.local"
27
- - "*.arpa"
28
- - "time.*.com"
29
- - "ntp.*.com"
30
- - "time.*.com"
31
- - "+.market.xiaomi.com"
32
- - "localhost.ptlogin2.qq.com"
33
- - "*.msftncsi.com"
34
- - "www.msftconnecttest.com"
35
- default-nameserver:
36
- - "system"
37
- - "223.6.6.6"
38
- - "8.8.8.8"
39
- - "2400:3200::1"
40
- - "2001:4860:4860::8888"
41
- nameserver:
42
- - "8.8.8.8"
43
- - "https://doh.pub/dns-query"
44
- - "https://dns.alidns.com/dns-query"
45
- direct-nameserver-follow-policy: false
46
- fallback-filter:
47
- geoip: true
48
- geoip-code: "CN"
49
- ipcidr:
50
- - "240.0.0.0/4"
51
- - "0.0.0.0/32"
52
- domain:
53
- - "+.google.com"
54
- - "+.facebook.com"
55
- - "+.youtube.com"
56
- fallback: []
57
- proxy-server-nameserver:
58
- - "https://doh.pub/dns-query"
59
- - "https://dns.alidns.com/dns-query"
60
- - "tls://223.5.5.5"
61
- direct-nameserver: []
62
- external-controller-cors:
63
- allow-private-network: true
64
- allow-origins:
65
- - "*"
66
- proxies: []
67
- proxy-providers: {}
68
- proxy-groups: []
69
- rule-providers: {}
70
- rules: []
1
+ mixed-port: 7897
2
+ allow-lan: true
3
+ mode: rule
4
+ log-level: warning
5
+ external-controller: "127.0.0.1:9097"
6
+ client-fingerprint: chrome
7
+ unified-delay: true
8
+ ipv6: true
9
+ profile:
10
+ store-selected: true
11
+ tun:
12
+ mtu: 1500
13
+ dns:
14
+ enable: true
15
+ listen: ":53"
16
+ enhanced-mode: "fake-ip"
17
+ fake-ip-range: "198.18.0.1/16"
18
+ fake-ip-filter-mode: "blacklist"
19
+ prefer-h3: false
20
+ respect-rules: false
21
+ use-hosts: false
22
+ use-system-hosts: false
23
+ ipv6: true
24
+ fake-ip-filter:
25
+ - "*.lan"
26
+ - "*.local"
27
+ - "*.arpa"
28
+ - "time.*.com"
29
+ - "ntp.*.com"
30
+ - "time.*.com"
31
+ - "+.market.xiaomi.com"
32
+ - "localhost.ptlogin2.qq.com"
33
+ - "*.msftncsi.com"
34
+ - "www.msftconnecttest.com"
35
+ default-nameserver:
36
+ - "system"
37
+ - "223.6.6.6"
38
+ - "8.8.8.8"
39
+ - "2400:3200::1"
40
+ - "2001:4860:4860::8888"
41
+ nameserver:
42
+ - "8.8.8.8"
43
+ - "https://doh.pub/dns-query"
44
+ - "https://dns.alidns.com/dns-query"
45
+ direct-nameserver-follow-policy: false
46
+ fallback-filter:
47
+ geoip: true
48
+ geoip-code: "CN"
49
+ ipcidr:
50
+ - "240.0.0.0/4"
51
+ - "0.0.0.0/32"
52
+ domain:
53
+ - "+.google.com"
54
+ - "+.facebook.com"
55
+ - "+.youtube.com"
56
+ fallback: []
57
+ proxy-server-nameserver:
58
+ - "https://doh.pub/dns-query"
59
+ - "https://dns.alidns.com/dns-query"
60
+ - "tls://223.5.5.5"
61
+ direct-nameserver: []
62
+ external-controller-cors:
63
+ allow-private-network: true
64
+ allow-origins:
65
+ - "*"
66
+ proxies: []
67
+ proxy-providers: {}
68
+ proxy-groups: []
69
+ rule-providers: {}
70
+ rules: []
@@ -27,20 +27,22 @@
27
27
  "uvicorn>=0.40.0",
28
28
  "webdriver-manager>=4.0.2",
29
29
  "pydantic-settings>=2.14.2",
30
+ "netifaces-plus>=0.12.5",
31
+ "ifaddr>=0.2.0",
30
32
  ]
31
33
  description = "My CLI"
32
34
  license = { text = "MIT" }
33
35
  name = "pymecli"
34
36
  readme = "README.md"
35
37
  requires-python = ">=3.10"
36
- version = "0.4.8"
38
+ version = "0.5.0"
37
39
 
38
40
  [project.urls]
39
41
  Homepage = "https://pypi.org/project/pymecli"
40
42
  Repository = "https://github.com/meme2046/pymecli"
41
43
 
42
44
  [project.scripts]
43
- # baidu = "cli.baidu:app" # 废弃
45
+ baidu = "cli.baidu:app"
44
46
  bitget = "cli.bitget:app"
45
47
  dst = "cli.dst:app"
46
48
  example = "cli.example:app"
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