-
Notifications
You must be signed in to change notification settings - Fork 76
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 LocalAddr for UDP associate bind address #65
base: master
Are you sure you want to change the base?
Conversation
Oh sorry I found there is another pull request of much the same purpose (#63) but I think my implementation is more appropriate because clients on other hosts require external IP address to use UDP associate bind address. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #65 +/- ##
==========================================
- Coverage 66.66% 62.55% -4.11%
==========================================
Files 14 14
Lines 726 836 +110
==========================================
+ Hits 484 523 +39
- Misses 184 253 +69
- Partials 58 60 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
(Sorry I mistakenly generated merge commit so I discarded that and did rebase instead. The code is unchanged.) |
But then it will be difficult to make go-socks5 listen to the wildcard address (0.0.0.0:XXXXX)? |
here: ResolveUdpAddr(bindIp net.IP, request *Request) (*net.UDPAddr, error) @ge9 impl: ResolveUdpAddr(bindIp net.IP, request *Request) (*net.UDPAddr, error) {
return &net.UDPAddr{IP: request.LocalAddr.(*net.TCPAddr).IP, Port: 0}, nil
} @fregie impl: ResolveUdpAddr(bindIp net.IP, request *Request) (*net.UDPAddr, error) {
if bindIp == nil {
return nil, errors.New("not support")
}
return net.ResolveUDPAddr("udp", bindIp.String()+":0")
} any other impl: ResolveUdpAddr(bindIp net.IP, request *Request) (*net.UDPAddr, error) {
panic("implment me")
} maybe we can direct get
|
Ah, I see, that's great! Thank you for your idea. |
@ge9 |
Oh, sorry, I've forgot to create a branch... |
In UDP associate, the IP address used for connection from the client should be notified to client (at least, https://github.com/3proxy/3proxy is implemented in this way).
This also fixes IPv6 address ([::]) replied for IPv4 UDP associate request (in bytes, [5, 3, 0, 1, 0, 0, 0, 0, 0, 0]).Sorry this is wrong.