SagerNet / SagerNet/sing-box

L4 代理入站转发至 Wireguard 出站时,UDP 目的的域名解析貌似会失效

Open
#4,389 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Go
Stars
38.2k
Forks
4.6k
Avg merge
19d 15h
Merged PRs (30d)
1

Description

复现步骤:

sing-box 配置:

{
  "log": {
    "level": "warning"
  },
  "dns": {
    "servers": [
      {
        "type": "udp",
        "tag": "cloudflare",
        "server": "1.1.1.1",
        "detour": "wgcf"
      }
    ],
    "strategy": "prefer_ipv6"
  },
  "endpoints": [
    {
      "type": "wireguard",
      "tag": "wgcf",
      "mtu": 1280,
      "address": [
        "172.16.0.2/32",
        "2606:4700:110:********/128"
      ],
      // …… 省略以下配置
    }
  ],
  "inbounds": [
    {
      "type": "snell",
      "tag": "snell-in",
      "version": 6,
      "listen": "::",
      "listen_port": 8888,
      "psk": <hidden>
    }
  ],
  "route": {
    "final": "wgcf"
  }
}

在代理客户端上用 Speedtest 测速,会向一个 UDP 远端发送流量(如:UDP:speed.udx.icscoe.jp:8080),在 Surge 内查看这个请求是处于失败的状态。并且 Sing-box 日志也会出现报错:ERROR[0040] [4100859304 0ms] connection: listen packet connection using using outbound/wireguard[wgcf]: invalid non-IP destination: invalid argument

我能想到的原因也就是这个目的是域名的代理请求还没经过域名解析就被转发到了 Wireguard 出站。但是如果我把 route.final 改成一个 direct 类型的出站,报错就会消失。于是前来发 issue。

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the route.final setting, DNS server detour, and the outbound/wireguard[wgcf] packet-connection path described in the report. Reproduce the Snell inbound request to UDP:speed.udx.icscoe.jp:8080 with the provided configuration, then compare it with route.final set to a direct outbound. Done means the domain-based UDP destination is handled without the reported invalid non-IP destination error.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.