Repository navigation
Conversation
-s only silenced wireguard-go; the device defaulted to Verbose, which logs every keepalive and handshake, and wireproxy's own per-request lines could not be turned off. Every /readyz hit printed "Health metric request", so container healthchecks filled the log, and every SOCKS5 name lookup printed "Resolving address for". --log-level takes error, info (default) or debug: - error: wireguard logs errors only; wireproxy prints errors only. - info: wireguard logs errors only; wireproxy also prints startup and lifecycle lines. - debug: wireguard logs verbosely; wireproxy also prints per-request lines. -s/--silent stays and is an alias for --log-level error. It now maps to the wireguard error level instead of fully silent, so device errors still show. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Every argument parse error printed the usage to stdout and returned from main, so wireproxy exited 0. A missing option value (for example -i with no argument) or an unknown flag looked like a successful run to supervisors and scripts. Print the error and usage to stderr and exit with status 2. --help is handled by the argument parser and still prints to stdout and exits 0. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Only SIGINT and SIGQUIT were passed to signal.Notify. SIGTERM, which is what docker stop and systemd send, fell through to the Go runtime's default and killed the process by signal instead of leaving main through the normal shutdown path (as PID 1 in a container this shows up as exit status 2). Add syscall.SIGTERM to the notified signals. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…start Two more error paths in main returned normally and exited 0: no configuration path given (and none at a default location), and a failure to spawn the background process with -d. Both printed the message to stdout. A missing configuration path is an argument error: print it with the usage to stderr and exit 2. A daemon spawn failure is a runtime error: print it to stderr and exit 1. Config parse failures already exit 1 through log.Fatal and are now covered by a test. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
golangci-lint (errcheck) flagged the unchecked Close calls on the reserved listener and the health response body. Check the listener close and discard the response body close explicitly. The test reserved a port by listening and closing, then passed it to the child, so another process could take it in between. Start the child again with a fresh port (up to three attempts) when it exits before its health endpoint answers. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
If the -i address could not be bound (for example the port is already in use), the listener goroutine panicked, which dumps a stack trace and exits with status 2. This is a runtime error, not a usage error: log it and exit 1 like the other startup failures. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
A malformed -i value (for example "nohostport", or a non-numeric or out-of-range port) was only noticed in extractPort while applying the Landlock rules, which panics with a stack trace. Check it with the other arguments instead: it must be empty or host:port with a port in 0-65535. A bad value now prints the usage to stderr and exits 2. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
"closing inactive session" is printed once per client session, so it belongs with the other per-request lines at debug level. The "listening" line stays at info. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
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.
Summary
--log-level error|info|debug(defaultinfo).infokeeps the startup messages and sets the wireguard device log to errors only;debugadds per-request lines (Resolving address for ...,Health metric request, closed idle UDP sessions) and the verbose wireguard log.-s/--silentis now an alias forerror. Previously-sonly silenced wireguard-go, and every health-check hit logged a line (container healthchecks every few seconds).-iaddress, print the usage to stderr and exit 2 (previously usage went to stdout with exit 0, and a bad-ipanicked). A failed daemon start or an-ilistener that can't bind exits 1 with a log message.--helpstill exits 0.docker stopshuts down cleanly.README documents the flag, the level table and the exit statuses.
This PR touches
cmd/wireproxy/main.goand addscmd/wireproxy/main_test.go, which may conflict with the Landlock PR from the same set. Happy to rebase.Test plan
go test -race ./...,go vet ./...,gofmt -l ., golangci-lint (fork CI green).--help(exit 0), a busy-iport (exit 1, no stack trace), a malformed-i, and SIGTERM (exit 0).🤖 Generated with Claude Code