txthinking/socks5

When using udp connection, some VPS servers can fail due to IP conversion.

grasstractor opened this issue · 1 comments

I know that UDP connections should use the DST.ADDR and DST.PORT returned by the server to establish a new UDP connection to send data, but building a socks5 server using the servers of some cloud server providers creates a problem:
The VPS provided by these cloud servers use an internal IP(like 10.0.2.*) and an external IP, and they are bound together through the firewall of the cloud provider. In the VPS, only the internal IP can be accessed, so when building the socks5 server, it cannot listen to the external IP and can only return the internal IP to the client. The client then cannot establish a connection properly. This problem does not exist when using TCP.
So I think the best solution to this problem is to set a parameter on the server side to allow custom return of UDP address.

NewClassicServer(internal IP and port, external IP, username, password, tcpTimeout, udpTimeout)