prober

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 1, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultTestSize = 5 * 1024 * 1024

DefaultTestSize is the default amount of data to transfer (5MB)

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPSpeedTester

type HTTPSpeedTester struct {
	URL string
}

func NewHTTPSpeedTester

func NewHTTPSpeedTester(url string) *HTTPSpeedTester

func (*HTTPSpeedTester) Run

func (h *HTTPSpeedTester) Run() (*SpeedResult, error)

type HopInfo

type HopInfo struct {
	Hop     int
	IP      string
	Latency time.Duration
	City    string
	Country string
	ISP     string
	Loss    float64
}

HopInfo represents a single hop in a traceroute

type ICMPPinger

type ICMPPinger struct {
	Target     string
	Count      int
	Interval   time.Duration
	Timeout    time.Duration
	Privileged bool // Set to true if running as root/sudo
}

func NewICMPPinger

func NewICMPPinger(target string, count int) *ICMPPinger

func (*ICMPPinger) Run

func (p *ICMPPinger) Run() (*PingResult, error)

type IperfProber

type IperfProber struct {
	Target string
	Port   int
}

func NewIperfProber

func NewIperfProber(target string, port int) *IperfProber

func (*IperfProber) Run

func (p *IperfProber) Run() (*SpeedResult, error)

type MTRHop

type MTRHop struct {
	Hop   int
	Host  string
	Loss  float64
	Last  float64
	Avg   float64
	Best  float64
	Worst float64
	ASN   string
}

type MTRResult

type MTRResult struct {
	Target    string
	Hops      []MTRHop
	Timestamp time.Time
}

type MTRRunner

type MTRRunner struct {
	Target string
	Count  int
}

func NewMTRRunner

func NewMTRRunner(target string) *MTRRunner

func (*MTRRunner) Run

func (r *MTRRunner) Run() (*MTRResult, error)

type MetricType

type MetricType string

MetricType defines the type of network metric

const (
	MetricLatency    MetricType = "latency"
	MetricPacketLoss MetricType = "packet_loss"
	MetricBandwidth  MetricType = "bandwidth"
	MetricTraceroute MetricType = "traceroute"
)

type PingResult

type PingResult struct {
	PacketsSent int
	PacketsRecv int
	MinRtt      time.Duration
	MaxRtt      time.Duration
	AvgRtt      time.Duration
	LossRate    float64 // Percentage 0.0 - 100.0
	Timestamp   time.Time
}

PingResult holds the result of an ICMP ping series

type SSHConfig

type SSHConfig struct {
	Host      string
	Port      int
	User      string
	Password  string
	KeyPath   string
	KeyText   string
	Timeout   time.Duration
	TestBytes int64 // How many bytes to test. If 0, uses DefaultTestSize
}

type SSHSpeedTester

type SSHSpeedTester struct {
	// contains filtered or unexported fields
}

SSHSpeedTester handles the SSH connection and speed measurement

func NewSSHSpeedTester

func NewSSHSpeedTester(cfg SSHConfig) *SSHSpeedTester

func (*SSHSpeedTester) Run

func (s *SSHSpeedTester) Run() (*SpeedResult, error)

type SpeedResult

type SpeedResult struct {
	UploadSpeed   float64 // Mbps
	DownloadSpeed float64 // Mbps
	Latency       time.Duration
	Timestamp     time.Time
}

SpeedResult holds the result of a bandwidth test

type TraceResult

type TraceResult struct {
	Target    string
	Hops      []HopInfo
	Timestamp time.Time
}

TraceResult holds the result of a traceroute

type TracerouteRunner

type TracerouteRunner struct {
	Target      string
	MaxHops     int
	CountPerHop int // Number of probes per hop (typically 3)
	Timeout     time.Duration
}

func NewTracerouteRunner

func NewTracerouteRunner(target string) *TracerouteRunner

func (*TracerouteRunner) Run

func (t *TracerouteRunner) Run() (*TraceResult, error)

Run executes a traceroute

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL