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

DNS: Add tag for DnsServerObject #4515

Merged
merged 2 commits into from
Mar 21, 2025
Merged

DNS: Add tag for DnsServerObject #4515

merged 2 commits into from
Mar 21, 2025

Conversation

Fangliding
Copy link
Member

@Fangliding Fangliding commented Mar 20, 2025

close #4505
字面意思 每个服务器新加了一个tagOverride参数 允许为每个dnserver指定inbound tag
为什么叫 tagOverride 不就叫tag?
因为我怕被误解成这个规则本身的tag 但是ray里并没有标识不同dnsserver的tag并按其处理的机制 这样会造成误解

不是说我赞成那个issue里谁的想法 只是全局的dns inbound tag确实是劣质的

@Meo597
Copy link
Contributor

Meo597 commented Mar 20, 2025

个人感觉把原来的改叫defaultTag,每个dnsServerObj就叫tag似乎更直观

不过其实都叫tag也无所谓
毕竟这个粒度更细,因此优先级更高,所以覆盖全局,个人感觉没啥歧义

@Fangliding
Copy link
Member Author

原字段就留着吧 querystrategy也没见改名

@Meo597
Copy link
Contributor

Meo597 commented Mar 20, 2025

然后有可能本来没设全局的tag,现在给某个server打了,这时override谁了

叫啥都行,功能有了就行,我没代码洁癖无所谓

反正都得看文档

@Fangliding
Copy link
Member Author

默认是个空tag

@patterniha
Copy link
Contributor

patterniha commented Mar 20, 2025

The default is an empty tag.

Please add "tagOverride" and "allowUnexpectedIPs" to the documentation: https://xtls.github.io/config/dns.html#dnsserverobject

Also, "queryStrategy" (for DnsServerObject) has not been added to the documentation yet !!!

@patterniha
Copy link
Contributor

patterniha commented Mar 20, 2025

@Fangliding

I also saw dotless: for domain-rule in the code.

case strings.HasPrefix(domain, "dotless:"):

case strings.HasPrefix(domain, "dotless:"):

But there is no such thing in the documentation.

Why?

@Fangliding
Copy link
Member Author

很多代码都是v2fly继承来的 文档也是 有的v2fly未在文档列出的功能就一直没人管 这种东西已经清理了一些了不知道还有多少 不用每个都打个小报告 你要是觉得很有用可以提PR加上去

@Meo597
Copy link
Contributor

Meo597 commented Mar 20, 2025

有了最近的俩DNS相关的Pull
我可以单方面宣布:xray拿来当网关,且多节点间策略分流,同时避免二次DNS解析的配置组合
在功能上没啥大问题了

下面还有俩问题:

  1. DNS Client整个链路keepAlive有极限时间,冷门节点再叠上高延迟debuff,首次打开网页可能需要四秒,至少一半时间花在DNS上了
    不过这个可以靠脚本定时触发解析来实现,个人感觉也不应该放在core中。只是提一嘴供以后有需要的玩家自己折腾

  2. 之前提到过,本地和节点都是sniff+routeOnly=true时,Android或PC版Chrome如果配了DoH会导致分流失败或者DNS被污染
    sniff+routeOnly=true是为了使 多节点分流 + 透明代理 场景下 避免二次DNS解析

  • PC的DNS如果被chrome检测到支持DOH,会默认开启
  • 一些Android系统会自动开DoH
  • 国内App内嵌天朝特色的httpdns sdk

我能想到的就是加一个开关,允许直接把目标ip强行改写,当目标本来就是个ip时
但这事儿显然在routing和出站做都不行,只能在入站做

关于这个需求,目前我的补丁用着没发现什么问题
或者想办法穷尽所有大厂的httpdns sdk + 知名doh也行
Meo597@d5b80c7

干Java的,Go写起来蹩脚
可能没啥人把Xray这种爬墙的东西当Mini SD-WAN用,不过用起来的确挺爽

@Fangliding

@RPRX
Copy link
Member

RPRX commented Mar 20, 2025

应当就叫 tag,它就是这个 DnsServerObject 本身的 tag,没有歧义

但是ray里并没有标识不同dnsserver的tag并按其处理的机制

路由拿它当 inbound tag 来匹配就算是

@Fangliding
Copy link
Member Author

应当就叫 tag,它就是这个 DnsServerObject 本身的 tag,没有歧义

但是ray里并没有标识不同dnsserver的tag并按其处理的机制

路由拿它当 inbound tag 来匹配就算是

好吧 done

@patterniha
Copy link
Contributor

patterniha commented Mar 20, 2025

@Fangliding

The timeout for each dns is fixed and is 4 seconds.

ctx, cancel := context.WithTimeout(ctx, 4*time.Second)

For some types of dns like doh+fragment, this value may not be enough, but for some other types of dns like local-udp, it is too much!

Also, if we want to use fallback, this value is too much. suppose, for example, we have two fallbacks other than the main dns, so it takes 8 seconds to use the second fallback !!!

So the user should be able to decrease or increase this timeout.

So if you agree, add the "timeout" option to this PR as well.

@RPRX RPRX changed the title DNS: Add tagOverride DNS: Add tag for DnsServerObject Mar 21, 2025
@RPRX RPRX merged commit 96381e8 into main Mar 21, 2025
70 checks passed
@patterniha
Copy link
Contributor

@Fangliding

The timeout for each dns is fixed and is 4 seconds.

ctx, cancel := context.WithTimeout(ctx, 4*time.Second)

For some types of dns like doh+fragment, this value may not be enough, but for some other types of dns like local-udp, it is too much!

Also, if we want to use fallback, this value is too much. suppose, for example, we have two fallbacks other than the main dns, so it takes 8 seconds to use the second fallback !!!

So the user should be able to decrease or increase this timeout.

So if you agree, add the "timeout" option to this PR as well.

@RPRX

And what about this?
Can I PR for this?

RPRX pushed a commit that referenced this pull request Mar 21, 2025
@RPRX RPRX deleted the DNS-tagOverride branch March 21, 2025 20:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

功能请求:更专业的DNS分流
4 participants