-
Notifications
You must be signed in to change notification settings - Fork 616
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(2022/07/07) 0.3.9 [强烈建议更新server和client]: 1. 支持导出一个clash.meta 配置文件,clash.meta作为客户端核心比起hysteria有着非常多的优势,详情查看介绍。[推荐/beta ing...] 2. 修改acl规则生成来源,转化长期维护更新clash分流规则成hysteria acl规则,修复0.3.8.1 acl屏蔽规则 3. hysteria里程碑更新至1.1.0, cpu开销减少,至少提升130%-500%速度,船烈建议更新两端 4. 修改结果打印样式,更加清晰可见
- Loading branch information
emptysuns
committed
Jul 7, 2022
1 parent
1f75718
commit df844a8
Showing
14 changed files
with
99,295 additions
and
32,073 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,66 @@ | ||
#! /usr/bin/env python3 | ||
import re | ||
import urllib.request | ||
from datetime import date | ||
from datetime import date,datetime | ||
|
||
start = datetime.now() | ||
print(f'{date.today().strftime("%B %d, %Y")},Loading...\n') | ||
urllib.request.urlretrieve( | ||
'https://cdn.jsdelivr.net/gh/Loyalsoldier/geoip@release/Country.mmdb', './Country.mmdb' | ||
) | ||
|
||
domain_direct = urllib.request.urlopen( | ||
'https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/direct.txt' | ||
) | ||
|
||
domain_ad = urllib.request.urlopen( | ||
'https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/reject.txt' | ||
) | ||
domain_proxy = urllib.request.urlopen( | ||
'https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/proxy.txt' | ||
) | ||
|
||
a = re.compile(r'([a-z]|[0-9])(.*[a-z])') | ||
a = re.compile(r'([a-z]|[0-9]|[A-Z])(.*[a-z]|[A-Z])') | ||
|
||
with open('routes.acl', 'w') as f: | ||
f.write('# Author:github.com/A1-hub\n#hysteria acl routes\n# Generated on %s\n\n' % | ||
f.write('# Author:github.com/A1-hub\n# hysteria acl routes\n# Generated on %s\n\n' % | ||
date.today().strftime("%B %d, %Y")) | ||
sumc = 0 | ||
|
||
count = 0 | ||
for ad in domain_ad: | ||
rad = str(ad, 'UTF8').strip() | ||
m = re.search(a, rad).group() | ||
if m != 'payload': | ||
count += 1 | ||
f.write('block domain-suffix %s\n' % m) | ||
print(f'Block rules: {count} done.') | ||
sumc += count | ||
|
||
count = 0 | ||
for direct in domain_direct: | ||
rdirect = str(direct, 'UTF8').strip() | ||
m = re.search(a, rdirect).group() | ||
if m != 'payload': | ||
count += 1 | ||
f.write('direct domain-suffix %s\n' % m) | ||
print(f'Direct rules: {count} done.') | ||
sumc += count | ||
|
||
count = 0 | ||
for proxy in domain_proxy: | ||
rproxy = str(proxy, 'UTF8').strip() | ||
m = re.search(a,rproxy).group() | ||
if m !='payload' : | ||
count += 1 | ||
f.write('proxy domain-suffix %s\n' % m) | ||
print(f'Proxy rules: {count} done.') | ||
sumc += count | ||
|
||
for ad in domain_ad: | ||
rad = str(ad, 'UTF8').strip() | ||
m = re.search(a,rad).group() | ||
if m != 'payload': | ||
f.write('block domain-suffix %s\n' % m) | ||
print('\nAll rules:', str(sumc)) | ||
|
||
f.write('direct country cn\n') | ||
f.write('proxy all') | ||
f.close() | ||
|
||
print('Generate completed!') | ||
end = datetime.now() | ||
print(f'\nUse: {(end-start).seconds}s\nGenerate completed!') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.