Fix server crashes, add timeouts, graceful shutdown, and fix Dockerfile#20
Merged
pareshpawar merged 2 commits intomainfrom Apr 15, 2026
Merged
Conversation
Bug fixes: - Remove check() function that called log.Fatal() in request handlers, crashing the entire server on any error (e.g. missing template file) - Fix unsafe type assertion in GetMyOutboundIP() that could panic - Return errors from GetMyOutboundIP() instead of calling log.Fatal() Performance: - Cache outbound IP at startup instead of dialing UDP on every request - Parse HTML template once at startup instead of on every request Reliability: - Add read/write/idle timeouts to HTTP server to prevent slow-client attacks - Add graceful shutdown on SIGINT/SIGTERM with 15s drain timeout - Deduplicate color-coded request logging into logRequest() helper Dockerfile fixes: - Fix build command to compile entire module (was missing utils package) - Fix EXPOSE port from 8000 to 8081 to match actual listen port - Copy html/ directory into runtime image for /html/ endpoint - Set WORKDIR to / so relative paths resolve correctly Also bumps Go version from 1.20 to 1.21 in go.mod. https://claude.ai/code/session_01GkWCj6JKLSqEtnkBpPoFBL
The Go build produces an extensionless binary on Linux which wasn't covered by the existing *.exe/*.dll/*.so patterns. https://claude.ai/code/session_01GkWCj6JKLSqEtnkBpPoFBL
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.
Bug fixes:
crashing the entire server on any error (e.g. missing template file)
Performance:
Reliability:
Dockerfile fixes:
Also bumps Go version from 1.20 to 1.21 in go.mod.
https://claude.ai/code/session_01GkWCj6JKLSqEtnkBpPoFBL