probe

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package probe runs STUN Binding requests against one or more servers and captures mapping behavior (mapped endpoint, RTT, errors).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Prober

type Prober interface {
	Probe(ctx context.Context, s Server) Result
}

Prober performs one STUN Binding probe per call. Implementations must not panic on bad input and must respect context cancellation.

func NewSTUN

func NewSTUN() Prober

NewSTUN returns a Prober backed by pion/stun over UDP. A fresh UDP socket is opened per probe.

type Result

type Result struct {
	Server Server
	Mapped netip.AddrPort
	RTT    time.Duration
	Err    error
}

Result captures the outcome of a single probe. On success, Mapped and RTT are set and Err is nil. On failure, Err is non-nil and Mapped/RTT are zero.

type Server

type Server struct {
	Host string
	Port int
}

Server identifies a STUN server to probe.

Jump to

Keyboard shortcuts

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