SagerNet / sing-box

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

配置socks出口时,入站出现EOF #2244

Closed bcseputetto closed 3 weeks ago

bcseputetto commented 3 weeks ago

Operating system

Linux

System version

Debian 12

Installation type

Original sing-box Command Line

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

No response

Version

sing-box version 1.10.1

Environment: go1.23.2 linux/amd64
Tags: with_gvisor,with_quic,with_dhcp,with_wireguard,with_ech,with_utls,with_reality_server,with_acme,with_clash_api
Revision: b80ec55ba0aafc60774e19c409e55ced50ddaab3
CGO: disabled

Description

使用cloudflare warp,socks5 监听18743

root@debian:~# curl https://4.ipw.cn
160.xx.xxx.100
root@debian:~# curl -x socks5://localhost:18743  https://4.ipw.cn
104.28.157.203

使用curl已经确定该socks是可用的。 然而配置文件中使用 route 将部分域名指向该socks无法使用,日志出现入站EOF

Reproduction

{
    "inbounds": [
        {
            "type": "vmess",
            "sniff": true,
            "sniff_override_destination": true,
            "listen": "127.0.0.1",
            "listen_port": 8001,
            "users": [
                {
                    "uuid": "xxxxxxx-xxxxx-xxxx-xxxx-xxxxxxxxxx",
                    "alterId": 0
                }
            ],
            "transport": {
                "type": "ws",
                "path": "xxxx",
                "max_early_data": 2048,
                "early_data_header_name": "Sec-WebSocket-Protocol"
            },
            "multiplex": {
                "enabled": true,
                "padding": false,
                "brutal": {
                    "enabled": true,
                    "up_mbps": 100,
                    "down_mbps": 100
                 }
            }
        }
    ],
    "route": {
        "final": "freedom",
        "rules": [
        {
                "domain_suffix": [
                ".netflix.com"
        ],
        "outbound": "cloudflare"
        }
        ]
    },
    "outbounds": [
        {
            "type": "direct",
            "tag": "freedom"
        },
        {
            "type": "socks",
            "tag": "cloudflare",
            "server": "127.0.0.1",
            "server_port": 18743,
            "version": "5"
        }
    ]
}

Logs

DEBUG[1163] [2245934595 136ms] inbound/vmess[0]: connection closed: process connection from 23.xxx.xx.191:33216: EOF
INFO[1164] [1144770945 0ms] inbound/vmess[0]: inbound connection from 23.xxx.xx.186:33218
INFO[1164] [1894688231 0ms] inbound/vmess[0]: [0] inbound connection to www.netflix.com:443
DEBUG[1164] [1894688231 0ms] router: sniffed protocol: tls, domain: www.netflix.com
DEBUG[1164] [1894688231 0ms] router: match[0] domain_suffix=.netflix.com => cloudflare
INFO[1164] [1894688231 0ms] outbound/socks[cloudflare]: outbound connection to www.netflix.com:443
DEBUG[1164] [1144770945 192ms] inbound/vmess[0]: connection closed: process connection from 23.xxx.xx.186:33218: EOF
INFO[1164] [1730326480 0ms] inbound/vmess[0]: inbound connection from 23.xxx.xx.190:33224
INFO[1164] [824520902 0ms] inbound/vmess[0]: [0] inbound connection to www.netflix.com:443
DEBUG[1164] [824520902 0ms] router: sniffed protocol: tls, domain: www.netflix.com
DEBUG[1164] [824520902 0ms] router: match[0] domain_suffix=.netflix.com => cloudflare
INFO[1164] [824520902 0ms] outbound/socks[cloudflare]: outbound connection to www.netflix.com:443
DEBUG[1164] [1730326480 165ms] inbound/vmess[0]: connection closed: process connection from 23.xxx.xx.190:33224: EOF
INFO[1164] [1661629808 0ms] inbound/vmess[0]: inbound connection from 23.xxx.xx.187:33228
INFO[1164] [1340319645 0ms] inbound/vmess[0]: [0] inbound connection to www.netflix.com:443
DEBUG[1164] [1340319645 1ms] router: sniffed protocol: tls, domain: www.netflix.com
DEBUG[1164] [1340319645 2ms] router: match[0] domain_suffix=.netflix.com => cloudflare
INFO[1164] [1340319645 2ms] outbound/socks[cloudflare]: outbound connection to www.netflix.com:443
DEBUG[1164] [1661629808 184ms] inbound/vmess[0]: connection closed: process connection from 23.xxx.xx.187:33228: EOF
INFO[1165] [2907163410 0ms] inbound/vmess[0]: inbound connection from 23.xxx.xx.191:33236

Supporter

Integrity requirements

bcseputetto commented 3 weeks ago

只有走socks出口的会报类似错误,走direct出口,没有任何问题

bcseputetto commented 3 weeks ago

目前在服务器上额外套了一个 xray vless来解决这个问题 sing-box 出站vless➡️ xray 入站vless➡️xray 出站socks➡️cloudflare warp socks

dyhkwong commented 3 weeks ago

WARP 不支持域名作为目标地址

bcseputetto commented 3 weeks ago

WARP 不支持域名作为目标地址

那有什么办法走socks出站时解析为IP再连接,我加了 "domain_strategy": "prefer_ipv4" 似乎不对,可能是我配置的不正确