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.

Port Check: Concurrent Go performance

Project Gallery

Scan Ports: Concurrent scan of multiple hosts with custom port ranges.

Detailed pcheck CLI terminal output

Scan Ports (CSV): Structured CSV output for spreadsheet integration or shell piping.

Detailed pcheck CLI terminal output (CSV format)

Scan Ports (JSON): JSON-formatted telemetry for consumption by external APIs or dashboards.

Detailed pcheck CLI terminal output (JSON format)

Reliability: 90%+ test coverage of internal packages, and race detection verified to ensure production-grade stability.

Go test coverage and race detector results

About: Output of the pcheck help command showing Cobra/Viper commands and flags.

pcheck help command output