shadowsocks/qtun

作为插件配合 shadowsocks-rust 使用时监听端口不正确的问题

pexcn opened this issue · 4 comments

pexcn commented

以下是配置文件的关键部分:

        // 服务端
        {
            "server": "0.0.0.0",
            "server_port": 2047,
            "password": "${SHADOWSOCKS_PASSWORD}",
            "method": "chacha20-ietf-poly1305",
            "mode": "tcp_only",
            "plugin": "qtun-server",
            "plugin_opts": "acme_host=my.domain.com"
        },

        // 客户端
        {
            "server": "xxx.xxx.xxx.xxx",
            "server_port": 2047,
            "password": "${SHADOWSOCKS_PASSWORD}",
            "method": "chacha20-ietf-poly1305",
            "mode": "tcp_only",
            "plugin": "qtun-client",
            "plugin-opts": "host=my.domain.com"
        },

启动命令分别为:

ssservice server --config ./server.json -v
ssservice local --config ./local.json -v

日志里出现了:

2023-02-02T15:03:33.354735714+08:00 DEBUG [298:139989240718384] [shadowsocks::plugin] started plugin "qtun-client" on 127.0.0.1:34297 <-> xxx.xxx.xxx.xxx:2047 (302)
[2023-02-02T07:03:33Z INFO  qtun_client] listening on 127.0.0.1:8138

root@OpenWrt:~# netstat -nap | grep qtun-client
tcp        0      0 127.0.0.1:8138          0.0.0.0:*               LISTEN      5027/qtun-client
udp        0      0 :::50575                :::*                                5027/qtun-client
unix  3      [ ]         STREAM     CONNECTED     2072588 5027/qtun-client
unix  3      [ ]         STREAM     CONNECTED     2072589 5027/qtun-client

此时 qtun-client 监听的端口应该为 34297, 但实际监听了 8138.

相关问题:shadowsocks/shadowsocks-rust#1104

Can you try the command line options first?

Server

./ssserver -s 0.0.0.0:443 -k example -m aes-256-gcm --plugin ./qtun-server --plugin-opts "acme_host=example.com"

Client

./sslocal -s example.com:443 -k example -m aes-256-gcm --plugin ./qtun-client --plugin-opts "host=example.com"
pexcn commented

@madeye 可以的,正常使用。只是在配合 ss-rust 负载均衡测速时候有问题

If so, the SS_LOCAL_HOST and SS_LOCAL_PORT environment variables should be parsed correctly in qtun-client.

Guess there's something wrong in ss-rust while launching multiple SIP003 plugins. Can you try v2ray-plugin's quic mode as well?

pexcn commented

Guess there's something wrong in ss-rust while launching multiple SIP003 plugins. Can you try v2ray-plugin's quic mode as well?

我也用xray-plugin测试过了,netstat命令看到它监听的端口和预期是一样的,具体见这里
shadowsocks/shadowsocks-rust#1104 (comment)