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

fix(socks5): should not dial returned bind addr directly #212

Merged

Conversation

mzz2017
Copy link
Contributor

@mzz2017 mzz2017 commented Dec 16, 2020

When server returns an any ip (0.0.0.0 or [::]), we should use conventional ip to replace the any ip given (0.0.0.0 or [::]). This behaviour adapts to most situations.

See v2fly/v2ray-core#523


Problem happens when socks5 proxy works on remote servers and different implementation will given different bind addr.

For most situations it is issues of servers. However, clients should behave normally in one case that returned bind addr is an ANYIP (0.0.0.0 or [::]), which indicate that we should use a conventional remote address to connect.

RFC does not illustrate the mechanism of bind addr; it is based on experience.

When server returns an any ip (0.0.0.0 or [::0]), we should use conventional ip to replace the any ip given (0.0.0.0 or [::0]).
This behaviour adapts to most situations.

See v2fly/v2ray-core#523
@mzz2017
Copy link
Contributor Author

mzz2017 commented Dec 16, 2020

My remote server is 10.xxx.xxx.xxx with refined v2ray-core by PR#523 mentioned above and socks5 port 20170 on.

Current version(0.13.0):

2020/12/16 16:03:43 group.go:182: [group] only 1 forwarder found, disable health checking
2020/12/16 16:03:43 server.go:105: [socks5] listening UDP on :1080
2020/12/16 16:03:43 mixed.go:68: [mixed] listening TCP on :1080
2020/12/16 16:03:45 server.go:142: [socks5u] 127.0.0.1:41632 <-> 223.5.5.5:53 via 10.xxx.xxx.xxx:20170
2020/12/16 16:03:45 server.go:150: [socks5u] remote write error: write udp [::]:57461->0.0.0.0:20170: sendto: cannot assign requested address

After the fix by #212:

2020/12/16 16:04:56 group.go:182: [group] only 1 forwarder found, disable health checking
2020/12/16 16:04:56 mixed.go:68: [mixed] listening TCP on :1080
2020/12/16 16:04:56 server.go:105: [socks5] listening UDP on :1080
2020/12/16 16:04:58 server.go:142: [socks5u] 127.0.0.1:41778 <-> 223.5.5.5:53 via 10.xxx.xxx.xxx:20170

The server side socks5 implementation of glider is not perfect but just ok (behave like clash). So it is not included in this fix.

@nadoo nadoo merged commit d2268b6 into nadoo:dev Feb 7, 2021
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.

2 participants