xiaorouji / openwrt-passwall2

1.39k stars 445 forks source link

[Bug]: Sing-box 与 Xray-core 规则匹配问题. #700

Closed xiaoshengshuohua closed 4 days ago

xiaoshengshuohua commented 6 days ago

Describe the Bug you encountered

image Direct存在:domain:push.apple.com Proxy存在:geosite:geolocation-!cn

使用Sing-box分流courier.push.apple.com域名会匹配domain:push.apple.com, 这很正常规则从上至下匹配.

使用Xray-core分流courier.push.apple.com域名会匹配geosite:geolocation-!cn, 为什么会优先匹配Proxy, 而不是Direct.

Xray使用Loyalsoldier规则, Sing-box使用lyc8503规则, lyc8503的规则是从Loyalsoldier移植的.


我在Direce添加了regexp:\.cn$, 在global.json配置文件内会多出一个转义符"\\.cn$", 在Direct中去掉转义符, global.json配置文件内便没有转义符, 只要正则表达式出现转义符便会在原有转义符上多出一个转义符, 不知道这算不算BUG.

Steps to reproduce this Bug

........

What you want to implement

使用Xray-core分流时也可以从上至下匹配.

正则表达式不知道算不算BUG.

Log information

......

Screenshot

No response

System related information

passwall2: 24.11.19-r1 OpenWrt: OpenWrt main分支.

Other Information

No response

Travel2Here commented 5 days ago

我也曾遇到一模一样的困惑,就是这些怪问题 让我从SB回退到XRAY了,再也不手贱。

xiaoshengshuohua commented 5 days ago

我也曾遇到一模一样的困惑,就是这些怪问题 让我从SB回退到XRAY了,再也不手贱。

是Xray分流有问题, 为什么你会从Sing-box退到Xray.

Travel2Here commented 5 days ago

我也曾遇到一模一样的困惑,就是这些怪问题 让我从SB回退到XRAY了,再也不手贱。

是Xray分流有问题, 为什么你会从Sing-box退到Xray.

我看反了,😆,反正之前有版本sb分流会漏我就退回去了,主要是漏openai相关的

xiaorouji commented 5 days ago

可能是 geosite 包含apple的域名。且用了 full: 匹配。 full 的優先級是最高的

xiaoshengshuohua commented 5 days ago

我看反了,😆,反正之前有版本sb分流会漏我就退回去了,主要是漏openai相关的

漏openai是什么表现.

Travel2Here commented 5 days ago

我看反了,😆,反正之前有版本sb分流会漏我就退回去了,主要是漏openai相关的

漏openai是什么表现.

…那不就是跟直连一个效果?😂拒绝服务啊

xiaoshengshuohua commented 5 days ago

可能是 geosite 包含apple的域名。且用了 full: 匹配。 full 的優先級是最高的

找到原因了, DNS服务器会同时查询A AAAA记录, 但是courier.push.apple.com只有A记录, 导致空响应回退到代理DNS服务器在查询一次, 我把*-courier.push.apple.com重定向到一个具有A AAAA记录的域名, 就不会发生代理DNS在查询一次的情况, 禁止回退似乎对这个域名无效.

2024/11/23 01:15:46 [Debug] app/dns: domain 44-courier.push.apple.com matches following rules: [domain:push.apple.com(DNS idx:3) geosite:geolocation-!cn(DNS idx:5) regexp:^(0|[1-4]?[0-9]|50)-courier\.push\.apple\.com$(DNS idx:3)]
2024/11/23 01:15:46 [Debug] app/dns: domain 44-courier.push.apple.com will use DNS in order: [UDP:127.0.0.1:15354 UDP:192.168.11.11:7053]
2024/11/23 01:15:46 [Debug] app/dns: DNS cache is disabled. Querying IP for 44-courier.push.apple.com at UDP:127.0.0.1:15354
2024/11/23 01:15:46 [Debug] app/dns: UDP:127.0.0.1:15354 querying DNS for: 44-courier.push.apple.com.
2024/11/23 01:15:46 [Debug] transport/internet/udp: dispatch request to: udp:127.0.0.1:15354
2024/11/23 01:15:46 [Info] transport/internet/udp: establishing new connection for udp:127.0.0.1:15354
2024/11/23 01:15:46 [Info] app/dispatcher: taking detour [direct] for [udp:127.0.0.1:15354]
2024/11/23 01:15:46 from DNS accepted udp:127.0.0.1:15354 [dns-in1 -> direct]
2024/11/23 01:15:46 [Debug] app/dns: domain 44-courier.push.apple.com matches following rules: [domain:push.apple.com(DNS idx:3) geosite:geolocation-!cn(DNS idx:5) regexp:^(0|[1-4]?[0-9]|50)-courier\.push\.apple\.com$(DNS idx:3)]
2024/11/23 01:15:46 [Debug] transport/internet: dialing to udp:127.0.0.1:15354
2024/11/23 01:15:46 [Debug] app/dns: domain 44-courier.push.apple.com will use DNS in order: [UDP:127.0.0.1:15354 UDP:192.168.11.11:7053]
2024/11/23 01:15:46 [Debug] app/dns: DNS cache is disabled. Querying IP for 44-courier.push.apple.com at UDP:127.0.0.1:15354
2024/11/23 01:15:46 [Debug] app/dns: UDP:127.0.0.1:15354 querying DNS for: 44-courier.push.apple.com.
2024/11/23 01:15:46 [Debug] transport/internet/udp: dispatch request to: udp:127.0.0.1:15354
2024/11/23 01:15:46 [Info] proxy/freedom: connection opened to udp:127.0.0.1:15354, local endpoint [::]:36838, remote endpoint 127.0.0.1:15354
2024/11/23 01:15:46 [Info] app/dns: UDP:127.0.0.1:15354 got answer: 44-courier.push.apple.com. TypeAAAA -> [] 34.650408ms
2024/11/23 01:15:46 [Debug] app/dns: UDP:127.0.0.1:15354 updating IP records for domain:44-courier.push.apple.com.
2024/11/23 01:15:46 [Info] app/dns: failed to lookup ip for domain 44-courier.push.apple.com at server UDP:127.0.0.1:15354 > features/dns: empty response
2024/11/23 01:15:46 [Debug] app/dns: DNS cache is disabled. Querying IP for 44-courier.push.apple.com at UDP:192.168.11.11:7053
2024/11/23 01:15:46 [Debug] app/dns: UDP:192.168.11.11:7053 querying DNS for: 44-courier.push.apple.com.
2024/11/23 01:15:46 [Debug] transport/internet/udp: dispatch request to: udp:192.168.11.11:7053
2024/11/23 01:15:46 [Info] app/dns: UDP:127.0.0.1:15354 got answer: 44-courier.push.apple.com. TypeA -> [17.57.145.138 17.57.145.137 17.57.145.133 17.57.145.132 17.57.145.135 17.57.145.134 17.57.145.136] 37.500593ms
xiaoshengshuohua commented 5 days ago

…那不就是跟直连一个效果?😂拒绝服务啊

貌似没有遇到过.

会不会是上面这种情况, 域名只有A或AAAA记录, 导致空响应回退到直连DNS服务器查询了.