things-go / go-socks5

socks5 server in pure Golang with much custom optional. Full TCP/UDP and IPv4/IPv6 support.
MIT License
368 stars 59 forks source link

use LocalAddr for UDP associate bind address #65

Open ge9 opened 1 month ago

ge9 commented 1 month ago

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.

ge9 commented 1 month ago

Oh sorry I found there is another pull request of much the same purpose (https://github.com/things-go/go-socks5/pull/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[bot] commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 65.71%. Comparing base (8de715f) to head (40c50a9). Report is 18 commits behind head on master.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #65 +/- ## ========================================== + Coverage 63.13% 65.71% +2.57% ========================================== Files 14 14 Lines 784 697 -87 ========================================== - Hits 495 458 -37 + Misses 230 179 -51 - Partials 59 60 +1 ``` | [Flag](https://app.codecov.io/gh/things-go/go-socks5/pull/65/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=things-go) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/things-go/go-socks5/pull/65/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=things-go) | `65.71% <100.00%> (+2.57%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=things-go#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.