pro-bing
A Go library for ICMP echo (ping) and HTTP probing with concurrent-safe callbacks and cross-platform privilege handling.
Repository Health
Technical Analysis
pro-bing is a Go library that sends ICMP echo requests and reads replies, giving Go programs a native ping implementation instead of shelling out to the system ping binary. It exposes a Pinger type with OnRecv, OnDuplicateRecv, and OnFinish callbacks, tracks round-trip statistics (min/avg/max/stddev RTT, packet loss, duplicates), and works across Linux, Windows, and macOS with both privileged (raw socket) and unprivileged (UDP-based) modes.
Beyond ICMP, the library also ships an HTTPCaller built on net/http/httptrace that wraps DNS lookup, connection, TLS handshake, and time-to-first-byte events into a concurrency-safe TraceSuite, letting callers run repeated HTTP probes at a configurable request rate and concurrency without hand-rolling httptrace synchronization themselves.
Originally created by sparrc as go-ping/go-fastping successors, the project now lives under the Prometheus Community organization and backs Prometheus’s own probing and blackbox-style tooling, giving it active maintenance and real production usage as its primary validation.
What You Get
- A
Pingertype withNewPinger/Run/RunWithContextthat sends and receives ICMP echo packets and reports RTT, packet loss, and duplicate detection through callbacks - Automatic privileged-vs-unprivileged socket selection per OS, with
SetPrivileged,SetMark, andSetDoNotFragmentfor fine-grained control on Linux - An
HTTPCallertype that runs repeated HTTP calls at a configured frequency and concurrency, exposing DNS/connect/TLS/first-byte timing via a concurrency-safeTraceSuite - Per-packet UUID tagging (via
google/uuid) so multiplePingerinstances can share a single raw socket without cross-matching each other’s replies - A small
cmd/pingreference binary showing a full traditional-ping-style implementation built on the library
Common Use Cases
- Building custom network-monitoring or uptime-checking tools that need programmatic ping results rather than parsing shell output
- Adding a lightweight ICMP or HTTP health-check probe inside a larger Go service (e.g. a Prometheus exporter or internal monitoring agent)
- Measuring per-phase HTTP latency (DNS, connect, TLS, TTFB) for API endpoints under repeated load without writing raw httptrace glue code
- Cross-platform CLI ping utilities that need to run without root/administrator privileges on Linux via the unprivileged UDP-ICMP mode
Under The Hood
Architecture
pro-bing is a single flat Go package (probing) built around two independent probing types — Pinger (ping.go) and HTTPCaller (http.go) — sharing a Logger interface (logger.go) for pluggable output. The Pinger delegates the actual socket work to a packetConn abstraction (packetconn.go), implemented separately per OS in utils_linux.go, utils_windows.go, and utils_other.go, so listen() can transparently choose a privileged raw ICMP socket or an unprivileged UDP-based one depending on platform and configuration. Packets sent by sendICMP are tagged with a UUID (via getPacketUUID/getCurrentTrackerUUID) so recvICMP and processPacket can correctly attribute replies even when multiple Pinger instances share one socket, then feed updateStatistics and the OnRecv/OnDuplicateRecv/OnFinish callbacks. HTTPCaller follows a parallel but separate design: runWorkScheduler and runCallers drive goroutines at a configured call frequency and concurrency, each wrapping net/http/httptrace events into a TraceSuite object that is safe to read from concurrent callbacks. Because the two probing types don’t share code beyond the Logger interface, changing the packet-tracking or socket-selection logic in Pinger has no effect on HTTPCaller’s httptrace wrapping, and vice versa.
Tech Stack
The module targets Go 1.25 and takes on three real dependencies: google/uuid for packet tracking, golang.org/x/net for ICMP/IPv4/IPv6 packet marshaling, and golang.org/x/sync for goroutine coordination, with golang.org/x/sys pulled in indirectly for raw syscalls. There’s no database, web framework, or ORM involved — it’s a low-level networking library. Build tooling follows the wider Prometheus Community convention: a Makefile plus the shared Makefile.common, .promu.yml for cross-compiling the bundled cmd/ping binary with promu, golangci-lint v2 with a curated set of enabled linters (misspell, modernize, revive), and GitHub Actions workflows for CI, lint, and govulncheck vulnerability scanning, with Dependabot keeping dependencies current.
Code Quality
The project has substantial test coverage using Go’s standard testing package (no third-party assertion library) — 23 test functions in ping_test.go alone, plus 10 in http_test.go and platform-specific tests in utils_windows_test.go — covering statistics calculation, packet parsing, and HTTP tracing behavior. Error handling is explicit and idiomatic Go (errors.New/fmt.Errorf wrapping rather than swallowed errors), and golangci-lint enforcement plus GitHub Actions CI gates every change. Naming is consistent with Go conventions throughout (exported Pinger/HTTPCaller types, functional-options pattern for HTTPCaller configuration).
What Makes It Unique
The library’s distinguishing engineering choice is its concurrent-safe packet attribution model: rather than assuming one socket per pinger, it tags outgoing ICMP packets with a UUID so several Pinger instances can share a single raw socket and still correctly separate their own replies from another instance’s — a real problem the simpler predecessor libraries (go-ping, go-fastping) it was inspired by don’t solve. Its unprivileged-ICMP-via-UDP support (gated by a Linux sysctl) and equivalent Windows handling let it run useful ping functionality without root/administrator rights, and the HTTPCaller’s wrapping of net/http/httptrace into a safe, callback-driven TraceSuite addresses httptrace’s well-known concurrency hazards directly rather than leaving that to each caller.
Used by 3 apps in this directory
Coder
Devops · Developer Tools · Code Editors
Self-hosted cloud development environments and AI coding agents — defined in Terraform, connected via WireGuard, automatically shut down when idle.
Gatus
Monitoring · Devops
Developer-oriented health dashboard with active endpoint probing, multi-protocol checks, and 40+ alerting integrations so you know about failures before your users do.
Netdata
Monitoring · Devops
Real-time per-second metrics, ML-powered anomaly detection, and zero-config observability for any infrastructure.