SagerNet / sing-box

The universal proxy platform
https://sing-box.sagernet.org/
Other
15.5k stars 1.9k forks source link

Is it able to write a outbound rule with a public proxy server that only supports socks5h. #1789

Closed Gemini-NX closed 4 weeks ago

Gemini-NX commented 1 month ago

操作系统

Linux

系统版本

Ubuntu 22.04

安装类型

sing-box 原始命令行程序

如果您使用图形客户端程序,请提供该程序版本。

No response

版本

No response

描述

Situation: In my case, I need send traffic to proxy server(public internet), but this proxy server only supports socks5h proxy. I checked configuration file and only find one related property named "domain_strategy". After I read its concept, I think everything should work well without setting domain_strategy, right? I tried normal config like below. If proxy server supports regular socks5 protocol, it works well. But if proxy server only supports socks5h protocol, then it doesn't work anymore.

{
  "log": {
    "disabled": false,
    "level": "info",
    "output": "/var/sing-box/1.log",
    "timestamp": true
  },
  "inbounds": [
    {
      "type": "tproxy",
      "tag": "tproxy-in",
      "listen" : "::",
      "listen_port": 10037
    }
  ],
  "outbounds": [
    {
      "type": "socks",
      "tag": "socks-out",
      "server": "abc.com",
      "server_port": 10001,
      "version": "5",
      "username": "uname",
      "password": "pwd"
    }
  ]
}

重现方式

Just use a proxy server which only supports socks5h in outbound section.

日志

And here is error log when I try to execute curl.

* Recv failure: Connection reset by peer
* Closing connection 0
curl: (56) Recv failure: Connection reset by peer

And here is sing-box trace log.

+0800 2024-05-25 17:54:04 INFO sing-box started (0.00s)
+0800 2024-05-25 17:54:19 INFO [987837199 0ms] inbound/tproxy[tproxy-in]: inbound connection from 172.16.108.142:55268
+0800 2024-05-25 17:54:19 INFO [987837199 0ms] inbound/tproxy[tproxy-in]: inbound connection to 34.117.186.192:80
+0800 2024-05-25 17:54:19 INFO [987837199 0ms] outbound/socks[socks-out]: outbound connection to 34.117.186.192:80
+0800 2024-05-25 17:54:19 DEBUG [987837199 0ms] dns: lookup domain abc.com
+0800 2024-05-25 17:54:19 DEBUG [987837199 25ms] dns: lookup succeed for abc.com: 127.0.0.1(fake)
+0800 2024-05-25 17:54:20 DEBUG [987837199 178ms] inbound/tproxy[tproxy-in]: connection closed: process connection from 172.16.108.142:55268: EOF

No response

支持我们

完整性要求