Documentation
¶
Overview ¶
Package netinfo wraps OS-specific network introspection (default gateway, Wi-Fi state) behind a small cross-platform interface.
Gateway detection is uniform across OSes via jackpal/gateway (which uses netlink on Linux and PF_ROUTE on macOS/BSD/Windows internally), so it lives in this single file with no build tags.
Wi-Fi state varies wildly per platform — see wifi_*.go for the build-tagged implementations.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DetectDefaultGateway ¶
DetectDefaultGateway returns the IP address of the system's default route, or ("", false) if it can't be determined.
Used by the monitor to dynamically add a `router_icmp` probe at startup — the legacy Python tool inserted this probe so users always have direct "is my router reachable?" data alongside the public-internet probes.
Types ¶
type WifiSample ¶
type WifiSample struct {
Timestamp time.Time
SSID *string
BSSID *string
SignalPercent *int // Windows-only
RSSIDbm *int // best-effort cross-platform
RxRateMbps *float64 // Windows-only
TxRateMbps *float64 // Windows-only
Channel *string
}
WifiSample captures network attachment state at a point in time. Most fields are platform-dependent and may be nil; SignalPercent and Rx/Tx rates are Windows-only.
func SampleWifi ¶
func SampleWifi(_ context.Context) WifiSample
SampleWifi reads Wi-Fi state from netlink via mdlayher/wifi. Pure Go, no shell-out. Returns a near-empty sample on failure rather than erroring.