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

use outgoing interface's IP for UDP relay port #1030

Merged
merged 1 commit into from
Jun 13, 2024
Merged

Conversation

ge9
Copy link
Contributor

@ge9 ge9 commented Jun 13, 2024

(resending without an unnecessary file; cf. #1029)
Currently relay ports for SOCKS UDP associate are obtained with nil ([::]:0), and then replied to clients with the IP replaced by TCP local address.
My implementation uses the TCP local address instead of nil when getting UDP relay ports.
This solves possible problems in situations where the SOCKS server can be seen through more than one IP addresses.
For example, if we use some external interface address (like 10.0.0.1) to access gost SOCKS5 proxy running on the same machine as client, only my implementation will work, because current implementation will send back UDP packets using localhost (127.0.0.1), which is different from the replied relay port.
Also, the current implementation typically replies IPv4-mapped IPv6 address to IPv4 clients (like ::ffff:10.0.0.1), which is incompatible with redsocks (https://github.com/semigodking/redsocks) which is one of the most widely-used transparent SOCKS5 proxy clients. My implementation will also fix this.

@ginuerzh ginuerzh merged commit ac1e896 into ginuerzh:master Jun 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants