XTLS / Xray-core

Xray, Penetrates Everything. Also the best v2ray-core, with XTLS support. Fully compatible configuration.
https://t.me/projectXray
Mozilla Public License 2.0
24.19k stars 3.81k forks source link

[bug] grpc connection fail with proxySettings #880

Closed iosmanthus closed 4 months ago

iosmanthus commented 2 years ago

with V2Ray 4.44.0, the following outbound configuration should work just fine:

 {
            "tag": "trojan",
            "protocol": "trojan",
            "settings": {
                "servers": [
                    {
                        "address": "172.18.0.2",
                        "port": 8080,
                        "password": "password"
                    }
                ]
            },
            "proxySettings": {
                "tag": "transit", // a socks5 exit outbound.
                "transportLayer": true
            },
            "streamSettings": {
                "network": "grpc",
                "security": "tls",
                "grpcSettings": {
                    "serviceName": "proxy"
                },
                "tlsSettings": {
                    "serverName": "example.com",
                    "alpn": [
                        "h2"
                    ],
                    "allowInsecure": true
                }
            }
}

However, with Xray v1.5.2, errors are reported.

2021/12/30 18:19:10 [Info] [519392493] app/proxyman/outbound: failed to process outbound traffic > proxy/trojan: connection ends > transport/internet/grpc/encoding: failed to fetch hunk from gRPC tunnel > rpc error: code = Unavailable desc = transport is closing
2021/12/30 18:19:10 [Info] [1866590884] app/proxyman/outbound: failed to process outbound traffic > proxy/trojan: connection ends > transport/internet/grpc/encoding: failed to fetch hunk from gRPC tunnel > rpc error: code = Unavailable desc = transport is closing
2021/12/30 18:19:10 [Info] [519392493] app/proxyman/inbound: connection ends > proxy/socks: connection ends > proxy/socks: failed to transport all TCP response > io: read/write on closed pipe
2021/12/30 18:19:10 [Warning] [1639575845] app/proxyman/outbound: failed to process outbound traffic > proxy/trojan: connection ends > proxy/trojan: failed to flush payload > transport/internet/grpc/encoding: failed to send data over gRPC tunnel > EOF
2021/12/30 18:19:10 [Info] [1639575845] app/proxyman/inbound: connection ends > proxy/socks: connection ends > proxy/socks: failed to transport all TCP response > io: read/write on closed pipe
yuhan6665 commented 2 years ago

https://xtls.github.io/config/transport.html#sockoptobject try dialerProxy

iosmanthus commented 2 years ago

xtls.github.io/config/transport.html#sockoptobject try dialerProxy

Same error reported:

2021/12/30 18:19:10 [Warning] [1639575845] app/proxyman/outbound: failed to process outbound traffic > proxy/trojan: connection ends > proxy/trojan: failed to flush payload > transport/internet/grpc/encoding: failed to send data over gRPC tunnel > EOF
iosmanthus commented 2 years ago

There is a workaround for this bug, I am trying to use inboundDetour to mock dialerProxy or proxySettings:

{
"routing": {
        "domainStrategy": "IPIfNonMatch",
        "domainMatcher": "mph",
        "rules": [
            {
                "type": "field",
                "inboundTag": [
                    "bridge"
                ],
                "outboundTag": "transit"
            },
            {
                "type": "field",
                "inboundTag": [
                    "socks"
                ],
                "outboundTag": "trojan"
            }
        ]
    },
   "inboundDetour": [
        {
            "tag": "bridge",
            "listen": "172.18.0.4",
            "port": 9090,
            "protocol": "dokodemo-door",
            "settings": {
                "network": "tcp",
                "address": "172.16.5.32",
                "port": 9090
            }
        }
    ]
}
elvisw commented 1 year ago

我也遇到了同样的情况,我是使用grpc传输vless,加上前置代理就不行了

Fangliding commented 4 months ago

这个proxysettings不经过底层传输

Fangliding commented 4 months ago

这个proxysettings不经过底层传输