Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces a new internal SOCKS5 proxy server (with optional username/password auth), wires it into Gluetun startup/shutdown, and adds configuration/env var plumbing plus unit/integration-style tests to support the feature request in #2409.
Changes:
- Add
internal/socks5package implementing a SOCKS5 CONNECT proxy with RFC1929 username/password auth. - Add configuration settings/env vars for SOCKS5 and surface them in the global settings output.
- Start the SOCKS5 server loop from
cmd/gluetun/main.goand add tests for the new package.
Reviewed changes
Copilot reviewed 15 out of 16 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
internal/socks5/socks5.go |
Core SOCKS5 handshake + CONNECT handling and TCP relay. |
internal/socks5/server.go |
TCP listener accept loop and per-connection handling. |
internal/socks5/loop.go |
Restarting loop wrapper around the SOCKS5 server. |
internal/socks5/usernamepassword.go |
RFC1929 username/password subnegotiation. |
internal/socks5/response.go |
SOCKS5 response encoding helpers. |
internal/socks5/constants.go |
SOCKS5 protocol constants and stringers. |
internal/socks5/settings.go |
Internal settings struct for the SOCKS5 package. |
internal/socks5/interfaces.go |
Logger interface for the SOCKS5 package. |
internal/socks5/socks5_test.go |
Unit + end-to-end proxy tests for the SOCKS5 package. |
internal/socks5/mocks_generate_test.go / internal/socks5/mocks_test.go |
Generated GoMock logger for tests. |
internal/configuration/settings/socks5.go |
New config/env parsing + defaults + validation for SOCKS5. |
internal/configuration/settings/settings.go |
Add SOCKS5 settings to the global settings lifecycle (read/validate/defaults/string). |
internal/configuration/settings/settings_test.go |
Update settings string snapshot for SOCKS5 section. |
Dockerfile |
Add default SOCKS5 env vars. |
cmd/gluetun/main.go |
Start/stop SOCKS5 loop and include it in crash monitoring. |
Files not reviewed (1)
- internal/socks5/mocks_test.go: Language not supported
Comments suppressed due to low confidence (1)
internal/socks5/loop.go:41
runErrorChis returned to the caller but nothing ever writes to it (and it is never closed). Incmd/gluetun/main.gothe main select waits on this channel, so SOCKS5 loop failures will never be reported and the goroutine can leak. Consider returningrunDonedirectly, or forwarding errors fromrun/server.StartintorunErrorChand closing it on exit.
runDone := make(chan error)
l.runDone = runDone
runErrorCh := make(chan error)
go run(runCtx, runDone, l.settings)
return runErrorCh, nil
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This was referenced May 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
New options:
SOCKS5_ENABLED=offSOCKS5_LISTENING_ADDRESS=":1080"SOCKS5_USER=SOCKS5_PASSWORD=Issue
Fixes #234
Assertions