shawn1m / overture

A customized DNS relay server
MIT License
1.79k stars 284 forks source link

请问最新版的domain_alternative正则是否与gfwlist的规则相同的 #167

Closed gitrootid closed 5 years ago

gitrootid commented 5 years ago

大佬您好! 我的意思是,假如配置文件中如下填写: "DomainFile": { "Primary": "/overture/config/domain_primary_sample", "Alternative": "/overture/config/domain_alternative_sample", "Matcher": "regex-list" }

最新版本中,domain_alternative_sample的这个文件,能不能直接使用https://raw.githubusercontent.com/gfwlist/gfwlist/master/gfwlist.txt经过base64解码后的内容

maddie commented 5 years ago

应该不可以,regex-list的matcher是用的正则表达式来解析domain_primary_sample的内容,gfwlist.txt解码后的内容看起来并不是正则表达式的格式

EDIT: gfwlist.txt解码后是AutoProxy的格式(也就是Adblock Plus的格式),可以参考 http://mydf.github.io/blog/autoproxy/ 或者 https://adblockplus.org/zh_CN/filters 了解详细

gitrootid commented 5 years ago

好的,感谢,另外再问下,有没有办法将这个格式改为正则的呢,或者有办法获取比较全面的正则列表吗,不然自己维护太难做了

gitrootid commented 5 years ago

经过搜索大法,终于找到一个git仓库:https://gist.github.com/sorz/5577181 python脚本: https://gist.githubusercontent.com/sorz/5577181/raw/d065899b319242b03eaee8e1215eeeeda1102306/gfwlist2regex.py 非常感谢

maddie commented 5 years ago

@gitrootid 根据你提供的链接我submit了一个PR,添加对decoded gfwlist的支持

因为Overture使用的格式跟你提供的Python脚本转换出来的格式有所出入,所以我另外再进行了一些处理,如果可以的麻烦你从我的branch里build一个版本来测试一下

谢谢

EDIT: https://github.com/maddie/overture/tree/matcher-gfwlist

gitrootid commented 5 years ago

@maddie 编译出来,从日志看找不到Matcher gfwlist does not exist, using regex-list matcher as default 日志输出: time="2019-07-26 15:41:41" level=info msg="Overture " time="2019-07-26 15:41:41" level=info msg="If you need any help, please visit the project repository: https://github.com/shawn1m/overture" time="2019-07-26 15:41:41" level=debug msg="Reading domain TTL file /overture/config/domain_ttl_sample reached EOF" time="2019-07-26 15:41:41" level=info msg="Domain TTL file /overture/config/domain_ttl_sample has been loaded with 2 records (0 failed)" time="2019-07-26 15:41:41" level=warning msg="Matcher gfwlist does not exist, using regex-list matcher as default" time="2019-07-26 15:41:41" level=debug msg="Reading domain file /overture/config/domain_primary_sample reached EOF" time="2019-07-26 15:41:41" level=warning msg="No element has been loaded from domain file: /overture/config/domain_primary_sample" time="2019-07-26 15:41:41" level=warning msg="Matcher gfwlist does not exist, using regex-list matcher as default" time="2019-07-26 15:41:41" level=debug msg="Reading domain file /overture/config/domain_alternative_sample reached EOF" time="2019-07-26 15:41:41" level=info msg="Domain file /overture/config/domain_alternative_sample has been loaded with 7853 records (regex-list)" time="2019-07-26 15:41:41" level=error msg="Error parsing IP network CIDR 1.0.1.0/24\n: invalid CIDR address: 1.0.1.0/24\n" time="2019-07-26 15:41:41" level=error msg="Error parsing IP network CIDR 1.0.2.0/23\n: invalid CIDR address: 1.0.2.0/23\n" time="2019-07-26 15:41:41" level=error msg="Error parsing IP network CIDR 1.0.8.0/21\n: invalid CIDR address: 1.0.8.0/21\n" ...... ......

git log: git log commit ea7181da654762d8c0f1b7f9ea70cc57e20eccce (HEAD) Author: Maddie Zhan maddie.zhan@cynovan.com Date: Thu Jul 25 16:10:01 2019 +0800

Add decoded gfwlist domain file matcher

Fixes #167

commit 4e2350e54ae66f94ab22676581c4661c0c10d3bc (origin/master, origin/HEAD, master) Author: ffftwo 1555426+ffftwo@users.noreply.github.com Date: Sat Jul 20 17:54:02 2019 +0800 ........ ........

编译命令 /go/src/overture # go build -ldflags "-s -w" -o overture-maddie-gfwlist main/main.go

配置文件:

"DomainFile": { "Primary": "/overture/config/domain_primary_sample", "Alternative": "/overture/config/domain_alternative_sample", "Matcher": "gfwlist" },

能否帮助看看问题出在哪里

blog2i2j commented 2 years ago

请问 @maddie ,现在的版本是否可以用这个python转出来的regex了?