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

socks5 udp连接 复用同一个连接时连接失败 #1757

Closed
4 of 5 tasks
fanyiguang opened this issue May 10, 2024 · 2 comments
Closed
4 of 5 tasks

socks5 udp连接 复用同一个连接时连接失败 #1757

fanyiguang opened this issue May 10, 2024 · 2 comments
Labels
from end user An end user is asking a developer to fix their problem for free invalid This doesn't seem right

Comments

@fanyiguang
Copy link

Operating system

Windows

System version

Windows 10 家庭中文版

Installation type

Original sing-box Command Line

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

Version

sing-box version 1.8.2

Environment: go1.21.5 windows/amd64
Tags: with_gvisor,with_dhcp,with_reality_server,with_clash_api,with_quic,with_ech,with_utls
Revision: 7fd0726ab8c5a4588f3710590b3bbb9cfca653f4
CGO: enabled

Description

配置udp dns detour为socks5 outbound并且设置disable_cache=true时,第一次dns解析成功后,第二次解析必定失败。

Reproduction

{
"log": {
"disabled": false,
"level": "debug",
"output": "",
"timestamp": true
},
"dns": {
"servers": [
{
"tag": "remote",
"address": "udp://114.114.114.114",
"detour": "socks-out"
}
],
"final": "remote",
"strategy": "ipv4_only",
"disable_cache": true
},
"inbounds": [
{
"type": "socks",
"tag": "socks-in",
"listen": "127.0.0.1",
"listen_port": 8989,
"domain_strategy": "ipv4_only",
"users": [
{
"username": "admin",
"password": "123"
}
]
}
],
"outbounds": [
{
"type": "direct",
"tag": "direct-out"
},
{
"type": "socks",
"tag": "socks-out",
"server": "127.0.0.1",
"server_port": 18882,
"username": "admin",
"password": "123",
"version": "5"
},
{
"type": "dns",
"tag": "dns-out"
},
{
"type": "block",
"tag": "block"
}
],
"route": {
"rules": [
{
"inbound": [
"socks-in"
],
"outbound": "direct-out"
}
]
}
}

Logs

+0800 2024-05-10 20:02:07 INFO router: updated default interface WLAN, index 4
+0800 2024-05-10 20:02:07 INFO inbound/socks[socks-in]: tcp server started at 127.0.0.1:8989
+0800 2024-05-10 20:02:07 INFO sing-box started (0.22s)
+0800 2024-05-10 20:02:51 INFO [2281251229 0ms] inbound/socks[socks-in]: inbound connection from 127.0.0.1:17467
+0800 2024-05-10 20:02:51 INFO [2281251229 0ms] inbound/socks[socks-in]: [admin] inbound connection to ipinfo.io:80
+0800 2024-05-10 20:02:51 DEBUG [2281251229 1ms] dns: lookup domain ipinfo.io
+0800 2024-05-10 20:02:55 INFO outbound/socks[socks-out]: outbound packet connection to 114.114.114.114:53
+0800 2024-05-10 20:03:00 DEBUG [2281251229 8.42s] dns: exchanged ipinfo.io NOERROR 34
+0800 2024-05-10 20:03:00 INFO [2281251229 8.42s] dns: exchanged ipinfo.io A ipinfo.io. 34 IN A 34.117.186.192
+0800 2024-05-10 20:03:00 INFO [2281251229 8.42s] dns: lookup succeed for ipinfo.io: 34.117.186.192
+0800 2024-05-10 20:03:00 DEBUG [2281251229 8.42s] dns: resolved [34.117.186.192]
+0800 2024-05-10 20:03:00 DEBUG [2281251229 8.42s] router: match[0] inbound=socks-in => direct-out
+0800 2024-05-10 20:03:00 INFO [2281251229 8.42s] outbound/direct[direct-out]: outbound connection to ipinfo.io:80
+0800 2024-05-10 20:03:07 INFO [1160678508 0ms] inbound/socks[socks-in]: inbound connection from 127.0.0.1:17473
+0800 2024-05-10 20:03:07 INFO [1160678508 0ms] inbound/socks[socks-in]: [admin] inbound connection to ipinfo.io:80
+0800 2024-05-10 20:03:07 DEBUG [1160678508 0ms] dns: lookup domain ipinfo.io
+0800 2024-05-10 20:03:17 ERROR [1160678508 10.1s] dns: lookup failed for ipinfo.io: context deadline exceeded

Supporter

Integrity 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 confirm that I have provided the server and client configuration files and process that can be reproduced locally, instead of a complicated client configuration file that has been stripped of sensitive data.
  • I confirm that I have provided the simplest configuration that can be used to reproduce the error I reported, instead of depending on remote servers, TUN, graphical interface clients, or other closed-source software.
  • I confirm that I have provided the complete configuration files and logs, rather than just providing parts I think are useful out of confidence in my own intelligence.
@nekohasekai
Copy link
Member

SOCKS5 UDP ports are not designed to be reused by multiple clients

@nekohasekai nekohasekai closed this as not planned Won't fix, can't repro, duplicate, stale May 16, 2024
@nekohasekai nekohasekai added the from end user An end user is asking a developer to fix their problem for free label May 16, 2024
@dyhkwong
Copy link
Contributor

I think this ia a valid issue. In the case of this issue, SOCKS5 UDP port is reused by sing-box itself . And it is okay to reuse UDP bind address (like STUN).
See SagerNet/sing#66 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
from end user An end user is asking a developer to fix their problem for free invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

3 participants