有可能的。根据SOCKS5 协议的维基百科描述,您必须在客户端连接请求的字段 2 中指定值 0x03。
The client's connection request is
field 1: SOCKS version number, 1 byte (must be 0x05 for this version)
field 2: command code, 1 byte:
0x01 = establish a TCP/IP stream connection
0x02 = establish a TCP/IP port binding
0x03 = associate a UDP port
field 3: reserved, must be 0x00
field 4: address type, 1 byte:
0x01 = IPv4 address
0x03 = Domain name
0x04 = IPv6 address
field 5: destination address of
4 bytes for IPv4 address
1 byte of name length followed by the name for Domain name
16 bytes for IPv6 address
field 6: port number in a network byte order, 2 bytes
Run Code Online (Sandbox Code Playgroud)
正如哈斯图尔昆指出的
您的代码不起作用,因为您根本没有发送连接请求。您必须发送 UDP ASSOCIATE 请求(在 TCP 连接上),并且需要使用响应中的端口和地址来中继数据报。
你真的应该看看Socks5 RFC