Closed lizhaode closed 7 years ago
你有reload config么
在 2017年7月20日,14:28,lizhaode notifications@github.com 写道:
我配置的规则如下:
rule:
- type: list file: ~/.SpechtLite/domainReject.txt adapter: reject
- type: iplist file: ~/.SpechtLite/ipReject.txt adapter: reject
- type: list file: ~/.SpechtLite/domainWhite.txt adapter: direct
- type: country country: CN match: true adapter: direct
- type: all adapter: ss 在 domainReject.txt 文件中有这么一条 gdt.qq.com$ 在 domainWhite.txt 文件中有这么一条 qq.com$
按照我的理解,当我访问 gdt.qq.com 这个域名的时候,SpechtLite应该是先从 domainReject.txt 中匹配规则,因为我这个规则的配置在最前边
然而,通过查询log,我发现是这样的
2017/07/20 14:14:54:897 Request: gtd.qq.com Type: DirectAdapter Rule:
2017/07/20 14:14:56:534 Request: gtd.qq.com Type: DirectAdapter Rule: 2017/07/20 14:14:58:647 Request: mtalk.google.com Type: ShadowsocksAdapter Rule: 2017/07/20 14:15:02:553 Request: gtd.qq.com Type: DirectAdapter Rule: 2017/07/20 14:15:33:574 Request: gtd.qq.com Type: DirectAdapter Rule: 2017/07/20 14:16:34:597 Request: gtd.qq.com Type: DirectAdapter Rule: 这样看来,我配置在最开始的 reject规则 并没有首先生效 — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.
有,我重启了电脑也是这样
另外,我还想问一个问题
l\.qq\.com$
这条规则会匹配 mail.qq.com吗?
会
在 2017年7月20日,14:42,lizhaode notifications@github.com 写道:
另外,我还想问一个问题 l.qq.com$
这条规则会匹配 mail.qq.com吗?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.
那shadowRocket这类软件的配置中 DOMAIN-SUFFIX,l.qq.com,Reject
这个规则应该怎么写呢?
用^
在 2017年7月20日,14:45,lizhaode notifications@github.com 写道:
那shadowRocket这类软件的配置中 DOMAIN-SUFFIX,l.qq.com,Reject 这个规则应该怎么写呢?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.
^l.qq.com$ 就是只匹配 l.qq.com 这个域名吧
.要转义
在 2017年7月20日,15:07,lizhaode notifications@github.com 写道:
^l.qq.com$ 就是只匹配 l.qq.com 这个域名吧
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.
我还是没搞懂 $ 在里边起的作用 能不能写个关于这些的详细说明?像我这种小白应该还不少
就是普通正则表达式
在 2017年7月20日,15:13,lizhaode notifications@github.com 写道:
我还是没搞懂 $ 在里边起的作用 能不能写个关于这些的详细说明?像我这种小白应该还不少
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.
我的意思是
在你的说明文档中,只有
每一个表达式都由 NSRegularExpression(pattern: pattern, options: .CaseInsensitive)进行初始化,然后通过firstMatchInString(host, options: [], range: NSRange(location: 0, length: host.utf16.count))进行匹配。
这些,如果不了解iOS开发的话,这两个方法看不明白
我觉得是不是解释一下这两个方法都做了什么。也就是说,讲一下规则匹配的过程
前面不是写了每一行是一个正则表达式了么。并没有任何地方很特殊。
在 2017年7月20日,15:24,lizhaode notifications@github.com 写道:
我的意思是
在你的说明文档中,只有 每一个表达式都由 NSRegularExpression(pattern: pattern, options: .CaseInsensitive)进行初始化,然后通过firstMatchInString(host, options: [], range: NSRange(location: 0, length: host.utf16.count))进行匹配。
这些,如果不了解iOS开发的话,这两个方法看不明白
我觉得是不是解释一下这两个方法都做了什么。也就是说,讲一下规则匹配的过程
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.
经过测试 ^l\.qq\.com$
和 DOMAIN-SUFFIX,l.qq.com,Reject
这条规则匹配出来的域名不一样
根据规则 DOMAIN-SUFFIX,l.qq.com,Reject
a.l.qq.com 应该是reject的
如果用了 ^l\.qq\.com$
,a.l.qq.com就是放行的了
那就写两条啊 .l.qq.com$
在 2017年7月20日,16:59,lizhaode notifications@github.com 写道:
经过测试 ^l.qq.com$ 和 DOMAIN-SUFFIX,l.qq.com,Reject 这条规则匹配出来的域名不一样
根据规则 DOMAIN-SUFFIX,l.qq.com,Reject a.l.qq.com 应该是reject的 如果用了 ^l.qq.com$ ,a.l.qq.com就是放行的了
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.
^表示字符串开头, $表示字符串结尾, 我猜这位是想 屏蔽 l.qq.com, 又想 屏蔽 a.l.qq.com, 但是不想误伤 mail.qq.com, 如果非要用正则来匹配的话, 只能写成两条 ^l.qq.com$ 对应严格匹配 l.qq.com .l.qq.com$ 对应 以 .l.qq.com 结尾
嗯 .也要转义
在 2017年7月21日,10:33,xlighting2017 notifications@github.com 写道:
^表示字符串开头, $表示字符串结尾, 我猜这位是想 屏蔽 l.qq.com, 又想 屏蔽 a.l.qq.com, 但是不想误伤 mail.qq.com, 如果非要用正则来匹配的话, 只能写成两条 ^l.qq.com$ 对应严格匹配 l.qq.com .l.qq.com$ 对应 以 .l.qq.com 结尾
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.
@xlighting2017 多谢,一直对正则比较晕
@xlighting2017 其实一行是可以的,(^|\.)l\.qq\.com$
,我觉得还是分两行好理解了。
我配置的规则如下:
在
domainReject.txt
文件中有这么一条gdt\.qq\.com$
在domainWhite.txt
文件中有这么一条qq\.com$
按照我的理解,当我访问 gdt.qq.com 这个域名的时候,SpechtLite应该是先从
domainReject.txt
中匹配规则,因为我这个规则的配置在最前边然而,通过查询log,我发现是这样的
这样看来,我配置在最开始的 reject规则 并没有首先生效