SagerNet / sing-box

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

指定自定义alpn时无法正常连接 #613

Closed LinaChong closed 1 year ago

LinaChong commented 1 year ago

Welcome

Description of the problem

服务器xray版本1.7.5

sing-box安装自release的deb包

vless+http2, 不指定alpn可以正常连接,但是指定alpn后连接失败,curl -x socks5://[::1]:61080 ipinfo.io提示”Empty reply from server“ 我用于测试的alpn为"love",使用openssl可以正确协商。

$ echo "" | openssl s_client -connect $ip:443 -servername $sni -alpn love
...
---
New, TLSv1.3, Cipher is TLS_AES_128_GCM_SHA256
Server public key is 384 bit
Secure Renegotiation IS NOT supported
Compression: NONE
Expansion: NONE
ALPN protocol: love
Early data was not sent
Verify return code: 0 (ok)
---
DONE

Version of sing-box

```console $ sing-box version sing-box version 1.3-beta11 Environment: go1.20.3 linux/arm64 Tags: with_gvisor,with_quic,with_wireguard,with_utls,with_reality_server,with_clash_api Revision: e02317a34851617c0eb2cb6634b4b62901aa04dc CGO: disabled ```

Server and client configuration file

客户端配置:

```console { "log": { "level": "trace" }, "inbounds": [ { "type": "mixed", "tag": "socks_in", "listen": "::1", "listen_port": 61080 } ], "outbounds": [ { "type": "vless", "tag": "vps_HTTP2", "server": "100...1", "server_port": 443, "uuid": "uuid", "tls": { "enabled": true, "alpn": ["love"], "server_name": "servername" }, "transport": { "type": "http" } } ] } ```

服务端配置:

```console { "log": { "loglevel": "debug" }, "inbounds": [ { "port": 443, "protocol": "vless", "settings": { "clients": [ { "id": "uuid" } ], "decryption": "none" }, "streamSettings": { "network": "http", "security": "tls", "tlsSettings": { "rejectUnknownSni": true, "minVersion": "1.3", "alpn": ["love"], "certificates": [ { "certificateFile": "/etc/nginx/certs/crt", "keyFile": "/etc/nginx/key" } ] } } } ], "outbounds": [ { "protocol": "freedom", "tag": "direct" } ] } ```

Server and client log file

两次请求,第一次客户端设置了“ "alpn": ["love"], ” 第二次没有设置。两次请求服务端配置不变。使用自定义alpn时,xray服务端看起来没有收到信息

```console $ sing-box run TRACE[0000] initializing inbound/mixed[socks_in] INFO[0000] inbound/mixed[socks_in]: tcp server started at [::1]:61080 INFO[0000] sing-box started (0.00s) INFO[0004] [814796640 0ms] inbound/mixed[socks_in]: inbound connection from [::1]:44343 INFO[0004] [814796640 343ms] inbound/mixed[socks_in]: inbound connection to 34.117.59.81:80 INFO[0004] [814796640 343ms] outbound/vless[vps_HTTP2]: outbound connection to 34.117.59.81:80 INFO[0004] [814796640 344ms] outbound/vless[vps_HTTP2]: outbound connection to 34.117.59.81:80 DEBUG[0005] [814796640 1.9s] inbound/mixed[socks_in]: connection closed: process connection from [::1]:44343: download: unexpected EOF | upload: read tcp [::1]:61080->[::1]:44343: use of closed network connection TRACE[0026] closing inbound/mixed[0] TRACE[0026] closing outbound/vless[0] TRACE[0026] closing router TRACE[0026] router: closing transport[0] TRACE[0026] closing log factory $ sing-box run TRACE[0000] initializing inbound/mixed[socks_in] INFO[0000] inbound/mixed[socks_in]: tcp server started at [::1]:61080 INFO[0000] sing-box started (0.00s) INFO[0003] [3755889304 0ms] inbound/mixed[socks_in]: inbound connection from [::1]:44390 INFO[0003] [3755889304 34ms] inbound/mixed[socks_in]: inbound connection to 34.117.59.81:80 INFO[0003] [3755889304 34ms] outbound/vless[vps_HTTP2]: outbound connection to 34.117.59.81:80 INFO[0003] [3755889304 35ms] outbound/vless[vps_HTTP2]: outbound connection to 34.117.59.81:80 DEBUG[0003] [3755889304 863ms] inbound/mixed[socks_in]: connection closed: process connection from [::1]:44390: download: use of closed network connection TRACE[0009] closing inbound/mixed[0] TRACE[0009] closing outbound/vless[0] TRACE[0009] closing router TRACE[0009] router: closing transport[0] TRACE[0009] closing log factory Xray 1.7.5 (Xray, Penetrates Everything.) Custom (go1.20 linux/arm64) A unified platform for anti-censorship. 2023/05/20 13:22:27 Using default config: /media/nas/sharing/Xray-linux-arm64-v8a/config.json 2023/05/20 13:22:27 [Info] infra/conf/serial: Reading config: /media/nas/sharing/Xray-linux-arm64-v8a/config.json 2023/05/20 13:22:27 [Debug] app/log: Logger started 2023/05/20 13:22:27 [Debug] app/proxyman/inbound: creating stream worker on 0.0.0.0:443 2023/05/20 13:22:27 [Warning] core: Xray 1.7.5 started 2023/05/20 13:23:01 [Info] [3443080308] proxy/vless/inbound: firstLen = 98 2023/05/20 13:23:01 [Info] [3443080308] proxy/vless/inbound: received request for tcp:34.117.59.81:80 2023/05/20 13:23:01 [Info] [3443080308] app/dispatcher: default route for tcp:34.117.59.81:80 2023/05/20 13:23:01 xxxxxx accepted tcp:34.117.59.81:80 [direct] 2023/05/20 13:23:01 [Info] [3443080308] proxy/freedom: opening connection to tcp:34.117.59.81:80 2023/05/20 13:23:01 [Info] [3443080308] transport/internet/tcp: dialing TCP to tcp:34.117.59.81:80 2023/05/20 13:23:01 [Debug] transport/internet: dialing to tcp:34.117.59.81:80 2023/05/20 13:23:02 [Info] [3443080308] app/proxyman/inbound: connection ends > proxy/vless/inbound: connection ends > proxy/vless/inbound: failed to transfer request payload > stream error: stream ID 1; CANCEL ```
nekohasekai commented 1 year ago

请提供可以在本地重现的配置对,并确认请求没有发出。

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 5 days