Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

domain_suffix不完整匹配二级域名 #1189

Closed
AoEiuV020 opened this issue Dec 5, 2023 · 10 comments
Closed

domain_suffix不完整匹配二级域名 #1189

AoEiuV020 opened this issue Dec 5, 2023 · 10 comments

Comments

@AoEiuV020
Copy link

Operating system

Android

System version

13

Installation type

sing-box for Android Graphical Client

If you are using a graphical client, please provide the version of the client.

1.7.2

Version

No response

Description

clash难民刚研究换用singbox,google.com死活走了直连,研究一晚上发现,我用的规则ChinaDomain.list 里有一个domain_suffix le.com走直连,就是这个规则把google.com也拐到直连去了,
按理说这种domain_suffix应该要和clash一样完整匹配到某一级域名,而不是简单的字符串endsWith的逻辑,
比如 le.com 应该匹配 *.le.com 和 le.com , 不应该匹配到google.com,

Reproduction

添加优先规则 domain_suffix le.com 走直连,
请求 google.com, 匹配到规则, 走了直连,
实际不应该被匹配,

Logs

No response

@PuerNya
Copy link
Contributor

PuerNya commented Dec 7, 2023

请变更你的写法到

{
  "domain": "le.com",
  "domain_suffix": ".le.com"
}

@AoEiuV020
Copy link
Author

@PuerNya 确定这样的话,那只能建议subconverter那边改了,
但是真的是这样设计的吗,有点理解不能,为什么suffix不和别家做成一样的含义,

@AoEiuV020
Copy link
Author

@nekohasekai 还请来个有权限的给个定论,如果确实设计如此的话请直接关闭issue我好尽快推动其他项目适配这点,

@nekohasekai
Copy link
Member

这是一个历史遗留问题,且一直无人指出。暂时没有更改语义的计划。

@AoEiuV020
Copy link
Author

了解了,那这边先close了,未来如果有打算调整再说,
我到subconverter去提一个issue,我还是希望clash+subconverter的难民能简单迁移到singbox,

@xqXQzzz1
Copy link

xqXQzzz1 commented Dec 8, 2023

这是一个历史遗留问题,且一直无人指出。暂时没有更改语义的计划。

ShadowRocket/Surge/leaf/Clash等代理软件DOMAIN-SUFFIX中均将le.com识别为*.\.le.com,而sing-box则识别为*.le.com。
后续sing-box1.8.0版本将使用rule-set,而上述软件积攒了大量的规则集,如果DOMAIN-SUFFIX语义相同,则两者规则集的转换是否更加方便?

@nekohasekai
Copy link
Member

对于二进制规则集而言,即使修改了意义,大小也没有变化。规则转换只需要一次性编写,我相信这些网红开发者这个能力简单地兼容这样的规则,而不是要求 sing-box 符合其它闭源或无文档的项目。

@alanwang776

This comment was marked as abuse.

@muink
Copy link

muink commented Dec 15, 2023

确实, clash 那边用 +.google.com 解决 主域和子域, sing-box 需要 domaindomain_suffix, 仅仅只差一个 ., 就要两倍的儲存空间和网络传输开销.
还有想请问一下 @nekohasekai 同样的规则如果转换为 domain_regex 比如 ^([a-zA-Z0-9_-]+\\.)*google\\.com$
会导致性能开销大幅提升吗

@nekohasekai
Copy link
Member

nekohasekai commented Dec 15, 2023

只有 JSON 会有存储空间和流量开销,使用二进制格式没有开销。正则表达式规则在所有项目都是一样的开销大。

@SagerNet SagerNet locked as resolved and limited conversation to collaborators Dec 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants