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

在最新版本V1.8.11内使用wireguard出口导致xray崩溃 #3375

Closed
2 tasks done
crmmc opened this issue May 20, 2024 · 1 comment
Closed
2 tasks done

在最新版本V1.8.11内使用wireguard出口导致xray崩溃 #3375

crmmc opened this issue May 20, 2024 · 1 comment

Comments

@crmmc
Copy link

crmmc commented May 20, 2024

完整性要求

  • 我保证阅读了文档,了解所有我编写的配置文件项的含义,而不是大量堆砌看似有用的选项或默认值。
  • 我搜索了issues,没有发现已提出的类似问题。

版本

v.8.11

描述

使用wireguard出口会导致xray-core直接崩溃,我尝试;了正常的windows wiregaurd客户端设置一样的配置文件,测试可以使用的一个wireguard节点,甚至测试了在sing-box中使用相同的节点配置,均可正常使用. 但是使用xray切相同节点和配置的时候,一旦流量尝试走wireguard出口,就会出发软件崩溃
崩溃原因: [Error] IPC error -22: failed to set private_key: hex string does not fit the slice
但是我反复测试,我是用的key应该是没问题的
image

重现方式

测试使用curl
curl https://www.baidu.com --socks5 127.0.0.1:8888

客户端配置


{
    "log": {
        "loglevel": "warning"
    },
    "routing": {
        "domainStrategy": "AsIs",
        "rules": [
            {
                "type": "field",
                "network": "tcp,udp",
                "balancerTag": "B1"
            }
        ],
        "balancers": [
            {
                "tag": "B1",
                "type": "roundRobin", //顺序选取出口
                "selector": [
                    "proxy1"
                ]
            }
        ]
    },
    "inbounds": [
        {
            "tag": "in1",
            "listen": "127.0.0.1",
            "port": "8888",
            "protocol": "socks",
            "settings": {
                "auth": "noauth",
                "udp": true
            }
        }
    ],
    "outbounds": [
        {
            "tag": "proxy1",
            "protocol": "wireguard",
            "secretKey": "8GK9bioGPYkdL0ObYmQqe2iMsffKV9D9C7t9tP2heEU=",
            "address": [
                "10.9.9.7/32"
            ],
            "peers": [
                {
                    "endpoint": "10.25.25.1:11451",
                    "publicKey": "USRGaQ8uORcj4W42CAiQhiVFMFM4wgHw37wAcmzV2jo=",
                    "preSharedKey": "",
                    "keepAlive": 3,
                    "allowedIPs": [
                        "0.0.0.0/0"
                    ]
                }
            ],
            "reserved": [
                0,
                0,
                0
            ],
            "mtu": 1420, // optional, default 1420
            "workers": 1, // optional, default runtime.NumCPU()
            "domainStrategy": "ForceIP"
        },
        {
            "protocol": "freedom",
            "tag": "direct"
        },
        {
            "tag": "block",
            "protocol": "blackhole"
        }
    ]
}

服务端配置


使用的Linux内核wireguard实现,平台为ubuntu 18.04 LTS, arm64

客户端日志


2024/05/21 00:52:20 [Warning] core: Xray 1.8.11 started
2024/05/21 00:52:42 tcp:127.0.0.1:50628 accepted tcp:157.148.69.74:443 [in1 -> proxy1]
2024/05/21 00:52:42 [Error] IPC error -22: failed to set private_key: hex string does not fit the slice
panic: close of closed channel

goroutine 48 [running]:
github.com/xtls/xray-core/proxy/wireguard/gvisortun.(*netTun).Close(0xc0001ff350)
github.com/xtls/xray-core/proxy/wireguard/gvisortun/tun.go:180 +0x38
github.com/xtls/xray-core/proxy/wireguard.(*tunnel).Close(0xc0001fe7e0)
github.com/xtls/xray-core/proxy/wireguard/tun.go:89 +0xc9
github.com/xtls/xray-core/proxy/wireguard.(*gvisorNet).Close(0xc000321b20?)
github.com/xtls/xray-core/proxy/wireguard/tun.go:127 +0x15
github.com/xtls/xray-core/proxy/wireguard.(*Handler).makeVirtualTun(0xc000321b20, 0xc000184690)
github.com/xtls/xray-core/proxy/wireguard/client.go:251 +0xd8
github.com/xtls/xray-core/proxy/wireguard.(*Handler).processWireGuard(0xc000321b20, {0x1f890f0, 0xc0003ea380})
github.com/xtls/xray-core/proxy/wireguard/client.go:120 +0x2d8
github.com/xtls/xray-core/proxy/wireguard.(*Handler).Process(0xc000321b20, {0x1f8bbe0, 0xc0000443f0}, 0xc00012e6a0, {0x1f890f0, 0xc0003ea380})
github.com/xtls/xray-core/proxy/wireguard/client.go:140 +0x128
github.com/xtls/xray-core/app/proxyman/outbound.(*Handler).Dispatch(0xc0003ea380, {0x1f8bbe0, 0xc0000443f0}, 0xc00012e6a0)
github.com/xtls/xray-core/app/proxyman/outbound/handler.go:208 +0x3d8
github.com/xtls/xray-core/app/dispatcher.(*DefaultDispatcher).routedDispatch(0xc0003ad7a0, {0x1f8bbe0, 0xc0000443f0}, 0xc00012e6a0, {{0x1f8bd68, 0xc000126090}, 0x1bb, 0x2})
github.com/xtls/xray-core/app/dispatcher/default.go:443 +0xca6
created by github.com/xtls/xray-core/app/dispatcher.(*DefaultDispatcher).Dispatch in goroutine 47
github.com/xtls/xray-core/app/dispatcher/default.go:237 +0x4f9

服务端日志


暂时无法获得,但是服务端99%无问题
@Fangliding
Copy link
Member

Fangliding commented May 20, 2024

协议内部有关的字段要放在 "settings" 里 而不是直接放在单个入站里

        {
            "tag": "proxy1",
            "protocol": "wireguard",
            "settings": {          // 以下均为wireguard出站的设置
                "secretKey": "8GK9bioGPYkdL0ObYmQqe2iMsffKV9D9C7t9tP2heEU=",
                "address": [
                    "10.9.9.7/32"
                ],
                "peers": [
                    {
                        "endpoint": "10.25.25.1:11451",
                        "publicKey": "USRGaQ8uORcj4W42CAiQhiVFMFM4wgHw37wAcmzV2jo=",
                        "preSharedKey": "",
                        "keepAlive": 3,
                        "allowedIPs": [
                            "0.0.0.0/0"
                        ]
                    }
                ],
                "reserved": [
                    0,
                    0,
                    0
                ],
                "mtu": 1420, // optional, default 1420
                "workers": 1, // optional, default runtime.NumCPU()
                "domainStrategy": "ForceIP"
              }
        }

这里有一个有效的范例出站(使用cloudflare warp) 以供参考

    {
        "protocol": "wireguard",
        "settings": {
          "secretKey": "QC7ExHptW1GIS7AD8pZY5Z3O31nA4c1VNvyHXsnCXFI=",
          "address": [
            "172.16.0.2/32"
          ],
          "peers": [
            {
              "publicKey": "bmXOC+F1FxEMF9dyiK2H5/1SUtzH0JuVo51h2wPfgyo=",
              "allowedIPs": [
                "0.0.0.0/0"
              ],
              "endpoint": "engage.cloudflareclient.com:2408"
            }
          ],
          "reserved": [43, 77, 229],
          "mtu": 1280
        },
        "tag": "proxy1"
      }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants