Skip to content

WireGuard Outbound DNS Regression #6567

Closed

Description

@LagPixelLOL

Integrity requirements

  • I have read all the comments in the issue template and ensured that this issue meet the requirements.
  • I confirm that I have read the documentation, understand the meaning of all the configuration items I wrote, and did not pile up seemingly useful options or default values.
  • I provided the complete config and logs, rather than just providing the truncated parts based on my own judgment.
  • I searched issues and did not find any similar issues.
  • The problem can be successfully reproduced in the latest Release

Description

proxy/wireguard/client.go:353

After PR #6287, WG outbound now ignores built-in DNS server completely, and uses hard coded Cloudflare DNS for ALL domain based outbounds through WG, which is a contradiction to the documentation and a regression, because the code path right now does not respect DNS caching at all (it now uses a copied DNS resolver from upstream wireguard-go library which is very basic and feature poor) and requries for every new connection for TCP and every packet for UDP!

Reproduction Method

x

Client config

x

Server config

x

Client log

x

Server log

x

Activity

  1. LagPixelLOL commented on Aug 1, 2026

    @LagPixelLOL
    ContributorAuthor
  2. bytecategory commented on Aug 1, 2026

    @bytecategory
    Contributor

    确实,硬编码1.1.1.1等cf dns地址,无视内置dns,没有缓存,每个请求都建新连接
    问题存在,找他解决吧.

  3. bytecategory commented on Aug 1, 2026

    @bytecategory
    Contributor

    #6287 (comment)
    以及一个很有意思的评论 也就是说你的问题在他看来是预期行为

  4. LjhAUMEM commented on Aug 1, 2026

    @LjhAUMEM
    Contributor

    我很少使用到 core 里的 dns 模块,我自己私有项目也都是这么用,如果你们认为需要恢复到用内置 dns 解析可以讨论一下

    因为如果不显示写 dns 模块,core 的行为应该是本地解析完成才会进行连接,则不会触发 remote 解析

  5. Fangliding commented on Aug 1, 2026

    @Fangliding
    Member

    怎么能硬编码一个dns 不会是ai写的时候没看到吧

  6. LagPixelLOL commented on Aug 1, 2026

    @LagPixelLOL
    ContributorAuthor

    问题是现在DNS非常有问题, 第一无法配置DNS服务器, 第二完全没有缓存, 注意每个UDP包都会来一遍DNS...

    Xray内置的DNS模块本身就可以走WireGuard, 完全没必要从wireguard-go里复制一个简易的DNS模块扔到Xray里, 现在Xray里相当于有两个DNS模块...

  7. bytecategory commented on Aug 1, 2026

    @bytecategory
    Contributor

    我很少使用到 core 里的 dns 模块,我自己私有项目也都是这么用,如果你们认为需要恢复到用内置 dns 解析可以讨论一下

    因为如果不显示写 dns 模块,core 的行为应该是本地解析完成才会进行连接,则不会触发 remote 解析

    不必讨论了,评论区现在四个人有三个认为需要

  8. LjhAUMEM commented on Aug 1, 2026

    @LjhAUMEM
    Contributor

    怎么能硬编码一个dns 不会是ai写的时候没看到吧

    source https://github.com/ViRb3/wgcf/blob/b0ffa9659a06f5ddefc4660f61f7d2d6f4db3348/wireguard/profile.go#L14

    而且之前 wg 完全是一锅粥,懒得写 infra 配置了暂时硬编码我觉得没有什么问题

  9. LagPixelLOL commented on Aug 1, 2026

    @LagPixelLOL
    ContributorAuthor

    暂时硬编码我觉得没有什么问题

    ???
    那为啥不用Xray内置DNS???

  10. LjhAUMEM commented on Aug 1, 2026

    @LjhAUMEM
    Contributor

    Xray内置的DNS模块本身就可以走WireGuard, 完全没必要从wireguard-go里复制一个简易的DNS模块扔到Xray里, 现在Xray里相当于有两个DNS模块...

    那为啥不用Xray内置DNS???

    因为需要 json 写 "dns": {}?上面说过了

    按照现在的架构改回内置 dns 很容易,重构就是推翻重来,而且之前的 dns 写法真的有点 shit

  11. LjhAUMEM commented on Aug 1, 2026

    @LjhAUMEM
    Contributor

    我还是倾向改成可配置的

    当然你要改回内置的我也没什么意见,把 resolveRemote 删了其他改成 resolveLocal 就可以了 @LagPixelLOL 你有空自己开个 pr 吧

  12. LagPixelLOL commented on Aug 1, 2026

    @LagPixelLOL
    ContributorAuthor

    因为需要 json 写 "dns": {}?上面说过了

    现在不管写不写都不会经过Xray处理, 完全不会本地解析, 都是走你硬编码的 1.1.1.1
    Xray如果没看到 "dns" 会插入一个类似于 "dns": {"servers": ["localhost"]} 的代码

    我还是倾向改成可配置的

    你在Xray DNS里配置是完全一样的

    你有空自己开个 pr 吧

    给你点个赞
    我开就我开吧, 反正丢给AI我也不考虑写对了没

  13. LjhAUMEM commented on Aug 1, 2026

    @LjhAUMEM
    Contributor

    现在不管写不写都不会经过Xray处理, 完全不会本地解析

    除了出站就没法配置了?路由里没法解析后走出站?

  14. LagPixelLOL commented on Aug 1, 2026

    @LagPixelLOL
    ContributorAuthor

    路由里没法解析后走出站?

    路由还会把域名目标替换成IP???

  15. LjhAUMEM commented on Aug 1, 2026

    @LjhAUMEM
    Contributor

    怎么能硬编码一个dns 不会是ai写的时候没看到吧

    我也希望,这样当时工作量就可以少点,实际情况是20$都充不起

    路由还会把域名目标替换成IP???

    我记得风扇说过可以,我很少用到内置解析,入站,路由,出站,三个阶段,如果只有出站才能走内置解析会很糟糕

  16. 11 remaining items

  17. bytecategory commented on Aug 4, 2026

    @bytecategory
    Contributor

    讨论看起来很正常

    实际并无讨论,一直是我在回复

    没有人攻击你吧

    每一句话的目的就是为了 revert 你写的代码在我看来是的

    都已经是协作者了, 何必感到被胁迫呢?

  18. Raymond520888 commented on Aug 4, 2026

    @Raymond520888

    @bytecategory 这个冷笑话不错👍

  19. bytecategory commented on Aug 4, 2026

    @bytecategory
    Contributor

    @bytecategory 这个冷笑话不错👍

    肌肉被冻伤笑不出来了.

  20. Meo597 commented on Sep 13, 2026

    @Meo597
    Collaborator

    更新 domainStrategy/targetStrategy 文档的时候被 WG 给干宕机了

    domainStrategy: "ForceIPv6v4" | "ForceIPv6" | "ForceIPv4v6" | "ForceIPv4" | "ForceIP"
    当 Wireguard 服务器地址为域名、被代理流量目标地址是域名时,控制它们的域名解析策略。

    耦合在一起了
    个人感觉 wg.ds 删了好,还干净点,内层用 ts 控制,服务器用 sockopt.ds 控制各干各的
    wg 里的 dns 作为兜底,根据 wg.settings.address 来决定偏好,用户不可配置
    如果想要偏好就自己配置 targetStrategy

  21. LjhAUMEM commented on Sep 13, 2026

    @LjhAUMEM
    Contributor

    等等,targetStrategy?所以是有办法控制内层解析的,那当初我加个 der local 啊

    内层用 ts 控制,服务器用 sockopt.ds 控制各干各的

    这样看来确实是可以删了,内外都有自己的 ds,当初我辩论的时候怎么没人提醒我有 targetStrategy...

  22. LjhAUMEM commented on Sep 13, 2026

    @LjhAUMEM
    Contributor

    真正该删的 resolveLocal,这两天会开 pr,有人替我开了也行

    哦不对,如果是 multi peer 只有第一个 peer 会走 sockopt.ds,resolveLocal 还是需要

  23. Meo597 commented on Sep 13, 2026

    @Meo597
    Collaborator

    偷看 sockopt.ds?反正 freedom 也这么干了

  24. LjhAUMEM commented on Sep 13, 2026

    @LjhAUMEM
    Contributor

    也行,这样倒是可以把 ds 清了,两种 resolve 只能都先保留,remote 的 ds 改用 wg-go 的默认行为,如果要控制就配置 targetStrategy

    当初就应该这样回复,damn

  25. Meo597 commented on Sep 14, 2026

    @Meo597
    Collaborator

    wg 文档重构了下,这样 ok 不
    有亿点点复杂

  26. RPRX commented on Sep 14, 2026

    @RPRX
    Member

    @Meo597 文档还是得写一下那个新参数吧,至少能控制远程解析的 DNS IP,远程解析也是这种出站的默认选择

  27. LjhAUMEM commented on Sep 14, 2026

    @LjhAUMEM
    Contributor

    @Meo597 文档还是得写一下那个新参数吧,至少能控制远程解析的 DNS IP,远程解析也是这种出站的默认选择

    要控制有更上层的选择,#6620 我会加 local 是因为之前不知道有 targetStrategy,local 将会被删掉

  28. Meo597 commented on Sep 14, 2026

    @Meo597
    Collaborator

    @Meo597 文档还是得写一下那个新参数吧

    计划等 @LjhAUMEM 解耦内外层解析策略之后加
    不然文档还得改

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions