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

V2Ray v5.4.0 Trojan NAT type为UdpBlocked #2377

Closed
xanadus0 opened this issue Mar 4, 2023 · 5 comments
Closed

V2Ray v5.4.0 Trojan NAT type为UdpBlocked #2377

xanadus0 opened this issue Mar 4, 2023 · 5 comments
Labels
bug Something isn't working

Comments

@xanadus0
Copy link

xanadus0 commented Mar 4, 2023

你正在使用哪个版本的 V2Ray?

v5.4.0

你的使用场景是什么?

Windows客户端 Socks5入站 NAT type FullCone
Linux服务端

你看到的异常现象是什么?

v5.4.0版本,NatTypeTester测试NAT type为UdpBlocked
相同配置v5.3.0版本,NAT type为FullCone

你期待看到的正常表现是怎样的?

NatTypeTester测试NAT type为FullCone

请附上你的配置

服务端配置:

// 在这里附上服务器端配置文件
{
    "log": {
	"access": {
	    "type": "Console",
	    "level": "Debug"
	},
        "error": {
	    "type": "Console",
	    "level": "Debug"
	}
    },
    "inbounds": [
        {
            "protocol": "trojan",
            "settings": {
                "users": [
                    "89319cbd-48h8-480d-2c32-b15c34037936"
                ],
		"packetEncoding": "Packet"   //v5.4.0版本,服务端入站无论是否有此行,都是UdpBlocked
            },
            "port": "12321",
            "listen": "127.0.0.1",
            "streamSettings": {
                "transport": "grpc",
                "transportSettings": {
                    "serviceName": "Tnc845wXN"
                },
                "security": "none"
            }
        }
    ],
    "outbounds": [
        {
            "protocol": "freedom"
        }
    ]
}

客户端配置:

// 在这里附上客户端配置
{
    "log": {
        "access": {
            "type": "Console",
            "level": "Debug"
        },
        "error": {
            "type": "Console",
            "level": "Debug"
        }
    },
    "inbounds": [
        {
            "protocol": "socks",
            "settings": {
                "udpEnabled": true,
                "packetEncoding": "Packet"
            },
            "port": "2333"
        }
    ],
    "outbounds": [
        {
            "protocol": "trojan",
            "settings": {
                "address": "*.*.*.*",
                "port": 443,
                "password": "89319cbd-48h8-480d-2c32-b15c34037936"
            },
            "tag": "proxy",
            "streamSettings": {
                "transport": "grpc",
                "transportSettings": {
                    "serviceName": "Tnc845wXN"
                },
                "security": "tls",
                "securitySettings": {
                    "serverName": "******"
                }
            }
        }
    ]
}

请附上出错时软件输出的错误日志

服务器端错误日志:

// 在这里附上服务器端日志
V2Ray 5.4.0 (V2Fly, a community-driven edition of V2Ray.) Custom (go1.20.1 linux/amd64)
A unified platform for anti-censorship.
2023/03/04 23:29:08 [Debug] app/log: Logger started
2023/03/04 23:29:08 [Debug] app/proxyman/inbound: creating stream worker on 127.0.0.1:12321
2023/03/04 23:29:08 [Warning] V2Ray 5.4.0 started
2023/03/04 23:29:22 [Info] [1695992416] proxy/trojan: firstLen = 2048
//v5.4.0版本,服务端入站若没有"packetEncoding": "Packet" ,则没有以下两行
2023/03/04 23:29:22 [Warning] [1695992416] app/dispatcher: default route for udp:sp.packet-addr.v2fly.arpa:0 
2023/03/04 23:29:22 [Info] [1695992416] proxy/freedom: opening connection to udp:sp.packet-addr.v2fly.arpa:0

客户端错误日志:

// 在这里附上客户端日志
V2Ray 5.4.0 (V2Fly, a community-driven edition of V2Ray.) Custom (go1.20.1 windows/amd64)
A unified platform for anti-censorship.
2023/03/04 23:29:17 [Debug] app/log: Logger started
2023/03/04 23:29:17 [Debug] app/proxyman/inbound: creating stream worker on 0.0.0.0:2333
2023/03/04 23:29:17 [Info] transport/internet/tcp: listening TCP on 0.0.0.0:2333
2023/03/04 23:29:17 [Info] transport/internet/udp: listening UDP on 0.0.0.0:2333
2023/03/04 23:29:17 [Warning] V2Ray 5.4.0 started
2023/03/04 23:29:21 [Info] [1209004528] proxy/socks: client UDP connection from udp:127.0.0.1:49711
2023/03/04 23:29:21 [Debug] [1209004528] proxy/socks: send packet to udp:198.211.120.59:3478 with 20 bytes
2023/03/04 23:29:21 [Warning] [1209004528] app/dispatcher: default route for udp:sp.packet-addr.v2fly.arpa:0
2023/03/04 23:29:21 [Info] [1209004528] transport/internet/grpc: creating connection to tcp:*.*.*.*:443
2023/03/04 23:29:21 [Info] [1209004528] proxy/trojan: tunneling request to udp:sp.packet-addr.v2fly.arpa:0 via *.*.*.*:443
2023/03/04 23:29:37 [Info] [1209004528] app/proxyman/inbound: connection ends > EOF

其它相关的配置文件(如 Nginx)和相关日志

server {
        location /Tnc845wXN {
            if ($request_method != "POST") {
                return 404;
            }
            client_body_buffer_size 1m;
            client_body_timeout 1h;
            client_max_body_size 0;
            grpc_pass grpc://127.0.0.1:12321
            grpc_read_timeout 1h;
            grpc_send_timeout 1h;
            grpc_set_header X-Real-IP $remote_addr;
        }
}
@rurirei
Copy link
Contributor

rurirei commented Mar 5, 2023

it's mostly problematic to test nat-level on windows as you get a wrong result: full-cone. packet-addr support for trojan has started from version 5.4.0 01a2686

@cross-hello
Copy link

Maybe caused via #2336

@AkinoKaede AkinoKaede added question Further information is requested bug Something isn't working and removed question Further information is requested labels Mar 7, 2023
@AkinoKaede
Copy link
Contributor

This seems to be caused by the packet addr client implementation in Trojan, but I haven't been able to find the bug in the code yet.

@AkinoKaede
Copy link
Contributor

cc @xiaokangwang

@xiaokangwang
Copy link
Contributor

xiaokangwang commented Mar 20, 2023

cc @xiaokangwang

A release with a bug fix for this issue have been released. https://github.com/v2fly/v2ray-core/releases/tag/v5.4.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants