Xray-core icon indicating copy to clipboard operation
Xray-core copied to clipboard

XTLS Vision not working with many inbounds

Open srvh opened this issue 2 years ago • 1 comments

Hello.

I have config file. Tha main idea : the first connnection "main-au" gets IP address of current VPS. All other connections like "2bg" get the second XTLS-Vision connection to another server in outbounds.

{
  "api": { "tag": "api", "services": ["StatsService"] },
  "dns": { "servers": [ "127.0.0.1" ], "tag": "dns" },
  "log": { "loglevel": "info" },
  "routing": {
    "domainStrategy": "IPIfNonMatch", "rules": [ { "type": "field", "inboundTag": [ "api" ], "outboundTag": "api" },
      { "type": "field", "inboundTag": [ "main-au" ], "outboundTag": "direct-main-au" },
      { "type": "field", "inboundTag": [ "2bg" ], "outboundTag": "direct-2bg" },
      { "type": "field", "inboundTag": [ "2ca" ], "outboundTag": "direct-2ca" }
	  
# and the same 10 rules for another locations

	   ] },
  "inbounds": [
    { "tag": "api", "listen": "127.0.0.1", "port": 10085, "protocol": "dokodemo-door", "settings": { "address": "127.0.0.1" } },
    { "tag": "main-au",
      "listen": "122.122.122.122", "port": 443, "protocol": "vless", "settings": {
        "clients": [{"id":"e2131d9f189a2fb7bca8f3001a35ce77","email":"user1","flow":"xtls-rprx-vision"}],
        "decryption": "none" },
      "streamSettings": { "network": "tcp", "security": "reality", "realitySettings": { "show": false, "dest": "www.cloudflare.com:443", "xver": 0, "serverNames": [ "www.cloudflare.com" ],
        "privateKey": "6MDnPRnlH_ush89pqWVkZcD8f5DbrI2y7xcRt1AkfFI", "minClientVer": "", "maxClientVer": "", "maxTimeDiff": 0, "shortIds": [ "6175" ] } },
      "sniffing": { "enabled": true, "destOverride": [ "http", "tls", "quic" ] }
    },
    { "tag": "2bg",
      "listen": "122.122.122.122", "port": 443, "protocol": "vless", "settings": {
        "clients": [{"id":"e2131d9f189a2fb7bca8f3001a35ce77","email":"user2","flow":"xtls-rprx-vision"}],
        "decryption": "none" },
      "streamSettings": { "network": "tcp", "security": "reality", "realitySettings": { "show": false, "dest": "www.cloudflare.com:443", "xver": 0, "serverNames": [ "www.cloudflare.com" ],
        "privateKey": "6MDnPRnlH_ush89pqWVkZcD8f5DbrI2y7xcRt1AkfFI", "minClientVer": "", "maxClientVer": "", "maxTimeDiff": 0, "shortIds": [ "326267" ] } },
      "sniffing": { "enabled": true, "destOverride": [ "http", "tls", "quic" ] }
    },
    { "tag": "2ca",
      "listen": "122.122.122.122", "port": 443, "protocol": "vless", "settings": {
        "clients": [{"id":"e2131d9f189a2fb7bca8f3001a35ce77","email":"user2","flow":"xtls-rprx-vision"}],
        "decryption": "none" },
      "streamSettings": { "network": "tcp", "security": "reality", "realitySettings": { "show": false, "dest": "www.cloudflare.com:443", "xver": 0, "serverNames": [ "www.cloudflare.com" ],
        "privateKey": "6MDnPRnlH_ush89pqWVkZcD8f5DbrI2y7xcRt1AkfFI", "minClientVer": "", "maxClientVer": "", "maxTimeDiff": 0, "shortIds": [ "326361" ] } },
      "sniffing": { "enabled": true, "destOverride": [ "http", "tls", "quic" ] }
    }
	
# and the same 10 inbounds for another locations

 ],
  "outbounds": [
    { "tag": "direct-main-au", "protocol": "freedom", "sendThrough": "122.122.122.122", "settings": { "domainStrategy": "UseIPv4" }
    },
    { "tag": "direct-2bg", "protocol": "vless", "settings": { "vnext": [ { "address": "240.240.240.240", "port": 443, "users": [ { "id": "e2131d9f189a2fb7bca8f3001a35ce71", "encryption": "none", "flow": "xtls-rprx-vision" } ] } ] },
      "streamSettings": { "network": "tcp", "security": "reality", "realitySettings": { "fingerprint": "chrome", "serverName": "www.cloudflare.com", "publicKey": "cvx8QuR_uE8sWKHY7RkIMIWI93bwllKSooUxgPH8Hmg", "spiderX": "", "shortId": "" } }
    },
    { "tag": "direct-2ca", "protocol": "vless", "settings": { "vnext": [ { "address": "250.250.250.250", "port": 443, "users": [ { "id": "e2131d9f189a2fb7bca8f3001a35ce71", "encryption": "none", "flow": "xtls-rprx-vision" } ] } ] },
      "streamSettings": { "network": "tcp", "security": "reality", "realitySettings": { "fingerprint": "chrome", "serverName": "www.cloudflare.com", "publicKey": "cvx8QuR_uE8sWKHY7RkIMIWI93bwllKSooUxgPH8Hmg", "spiderX": "", "shortId": "" } }
    },

# and the same 10 outbounds for another locations

    { "tag": "block", "protocol": "blackhole" } ],
  "policy": { "levels": { "0": { "statsUserDownlink": true, "statsUserUplink": true } }, "system": { "statsInboundDownlink": true, "statsInboundUplink": true } },
  "stats": {}
}

But it is not working correctly. I get the next error and connection is down in Foxray.

Dec 11 11:25:51 beroni.com xray[20017]: 2023/12/11 11:25:51 [Info] [1371026396] proxy/vless/inbound: firstLen = 61
Dec 11 11:25:51 beroni.com xray[20017]: 2023/12/11 11:25:51 [Info] [1371026396] proxy/vless/inbound: received request for udp:8.8.8.8:53
Dec 11 11:25:51 beroni.com xray[20017]: 2023/12/11 11:25:51 [Info] [1371026396] app/dispatcher: taking detour [direct-main-au] for [udp:8.8.8.8:53]
Dec 11 11:25:51 beroni.com xray[20017]: 2023/12/11 11:25:51 [Info] [1371026396] proxy/freedom: connection opened to udp:8.8.8.8:53, local endpoint 45.76.112.208:58286, remote endpoint 8.8.8.8:53
Dec 11 11:25:51 beroni.com xray[20017]: 2023/12/11 11:25:51 112.12.12.12:63889 accepted udp:8.8.8.8:53 [main-au -> direct-main-au] email: user1
Dec 11 11:25:51 beroni.com xray[20017]: 2023/12/11 11:25:51 [Info] [877684991] proxy/vless/inbound: firstLen = 112
Dec 11 11:25:51 beroni.com xray[20017]: 2023/12/11 11:25:51 [Info] [877684991] proxy/vless/inbound: received request for udp:8.8.8.8:53
Dec 11 11:25:51 beroni.com xray[20017]: 2023/12/11 11:25:51 [Info] [877684991] app/dispatcher: taking detour [direct-main-au] for [udp:8.8.8.8:53]
Dec 11 11:25:51 beroni.com xray[20017]: 2023/12/11 11:25:51 [Info] [877684991] proxy/freedom: connection opened to udp:8.8.8.8:53, local endpoint 45.76.112.208:52883, remote endpoint 8.8.8.8:53
Dec 11 11:25:51 beroni.com xray[20017]: 2023/12/11 11:25:51 112.12.12.12:63884 accepted udp:8.8.8.8:53 [main-au -> direct-main-au] email: user1
Dec 11 11:26:02 beroni.com xray[20017]: 2023/12/11 11:26:02 [Info] [4035287929] proxy/vless/inbound: firstLen = 64
Dec 11 11:26:02 beroni.com xray[20017]: 2023/12/11 11:26:02 [Info] [4035287929] proxy/vless/inbound: received request for udp:8.8.8.8:53
Dec 11 11:26:02 beroni.com xray[20017]: 2023/12/11 11:26:02 [Info] [4035287929] app/dispatcher: taking detour [direct-main-au] for [udp:8.8.8.8:53]
Dec 11 11:26:02 beroni.com xray[20017]: 2023/12/11 11:26:02 [Info] [4035287929] proxy/freedom: connection opened to udp:8.8.8.8:53, local endpoint 45.76.112.208:60209, remote endpoint 8.8.8.8:53
Dec 11 11:26:02 beroni.com xray[20017]: 2023/12/11 11:26:02 112.12.12.12:63912 accepted udp:8.8.8.8:53 [main-au -> direct-main-au] email: user1
Dec 11 11:26:54 beroni.com xray[20017]: 2023/12/11 11:26:54 [Info] [1671688400] proxy/vless/inbound: firstLen = 116
Dec 11 11:26:54 beroni.com xray[20017]: 2023/12/11 11:26:54 [Info] [1671688400] proxy/vless/inbound: received request for udp:8.8.8.8:53
Dec 11 11:26:54 beroni.com xray[20017]: 2023/12/11 11:26:54 [Info] [1671688400] app/dispatcher: taking detour [direct-main-au] for [udp:8.8.8.8:53]
Dec 11 11:26:54 beroni.com xray[20017]: 2023/12/11 11:26:54 [Info] [1671688400] proxy/freedom: connection opened to udp:8.8.8.8:53, local endpoint 45.76.112.208:39903, remote endpoint 8.8.8.8:53
Dec 11 11:26:54 beroni.com xray[20017]: 2023/12/11 11:26:54 112.12.12.12:63665 accepted udp:8.8.8.8:53 [main-au -> direct-main-au] email: user1
Dec 11 11:27:18 beroni.com xray[20017]: 2023/12/11 11:27:18 [Info] transport/internet/tcp: REALITY: processed invalid connection

I tried to delete DNS line in config files, changed routing rules, delete outbounds. But I found if I delete all lines in inbounds except 2 first, then connection is work well.

Can you help me why many inbounds does not work correctly ?

srvh avatar Dec 11 '23 08:12 srvh

try listen different port and uuid, servername, public / private key

geneyuriy avatar Dec 14 '23 07:12 geneyuriy

{
    "inbounds": [
        {
            "settings": {
                "clients": [
                    {
                        "id": "au-uuid",
                        "email": "[email protected]",
                        "flow": "xtls-rprx-vision"
                    },
                    {
                        "id": "bg-uuid",
                        "email": "[email protected]",
                        "flow": "xtls-rprx-vision"
                    },
                    {
                        "id": "ca-uuid",
                        "email": "[email protected]",
                        "flow": "xtls-rprx-vision"
                    }
                ]
            },
            "streamSettings": {
                "realitySettings": {
                    "shortIds": [
                        "6175",
                        "326267",
                        "326361"
                    ]
                }
            }
        }
    ],
    "routing": {
        "rules": [
            {
                "type": "field",
                "user": [
                    "[email protected]"
                ],
                "outboundTag": "direct-main-au"
            },
            {
                "type": "field",
                "user": [
                    "[email protected]"
                ],
                "outboundTag": "direct-2bg"
            },
            {
                "type": "field",
                "user": [
                    "[email protected]"
                ],
                "outboundTag": "direct-2ca"
            }
        ]
    }
}

enterusernamecontinue avatar Mar 12 '24 08:03 enterusernamecontinue