Port Check: Production-Ready Port Scanner in Go
Problem: Networking tools often struggle to balance reliability with speed. Port scanners that run sequentially are too slow for modern infrastructure, while unconstrained concurrent scanners can crash a system by opening thousands of simultaneous network sockets, triggering "too many open files" errors or OS resource exhaustion.
Action: Developed a high-performance CLI tool using a Buffered Worker Pool architecture. Instead of unconstrained concurrency, I implemented a fixed set of workers (capped at 1,000) that pull from a job queue, providing natural backpressure and system stability.
Result: Port Check - a performant, 12-factor compliant network utility featuring:
- High-Throughput Concurrency: Capable of scanning hundreds of ports across multiple hosts in seconds without hitting OS file descriptor limits.
- Intelligent Port Parsing: Developed a custom engine supporting individual ports and ranges (e.g. 80,443,8000-8080) with a sort-and-deduplicate algorithm to minimize redundant network calls.
- 12-Factor Configuration: Integrated Cobra and Viper for a robust CLI hierarchy (Flags > Env > Config File).
- Production Safety: Achieved 90%+ test coverage in core logic, and verified 100% thread-safety via the Race Detector.
- Structured Data Output: Optimized for post-processing with support for JSON and CSV output formats, enabling integration with security dashboarding tools.
Project Gallery
Scan Ports: Concurrent scan of multiple hosts with custom port ranges.
Scan Ports (CSV): Structured CSV output for spreadsheet integration or shell piping.
Scan Ports (JSON): JSON-formatted telemetry for consumption by external APIs or dashboards.
Reliability: 90%+ test coverage of internal packages, and race detection verified to ensure production-grade stability.
About: Output of the pcheck help command showing Cobra/Viper commands and flags.