mtu

package
v1.7.4 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2026 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrWinDivertUnavailable = errors.New("windivert capture unavailable")

Functions

This section is empty.

Types

type Config

type Config struct {
	Target         string
	DstIP          net.IP
	SrcIP          net.IP
	SourceDevice   string
	SrcPort        int
	DstPort        int
	BeginHop       int
	MaxHops        int
	Queries        int
	Timeout        time.Duration
	TTLInterval    time.Duration
	RDNS           bool
	AlwaysWaitRDNS bool
	IPGeoSource    ipgeo.Source
	Lang           string
	DN42           bool
}

type Event

type Event string
const (
	EventTimeExceeded Event = "time_exceeded"
	EventPacketTooBig Event = "packet_too_big"
	EventFragNeeded   Event = "frag_needed"
	EventDestination  Event = "destination"
	EventTimeout      Event = "timeout"
)

type Hop

type Hop struct {
	TTL      int              `json:"ttl"`
	Event    Event            `json:"event"`
	IP       string           `json:"ip,omitempty"`
	Hostname string           `json:"hostname,omitempty"`
	RTTMs    float64          `json:"rtt_ms,omitempty"`
	PMTU     int              `json:"pmtu,omitempty"`
	Geo      *ipgeo.IPGeoData `json:"geo,omitempty"`
}

type Result

type Result struct {
	Target     string `json:"target"`
	ResolvedIP string `json:"resolved_ip"`
	Protocol   string `json:"protocol"`
	IPVersion  int    `json:"ip_version"`
	StartMTU   int    `json:"start_mtu"`
	ProbeSize  int    `json:"probe_size"`
	PathMTU    int    `json:"path_mtu"`
	Hops       []Hop  `json:"hops"`
}

func Run

func Run(ctx context.Context, cfg Config) (*Result, error)

func RunStream

func RunStream(ctx context.Context, cfg Config, sink StreamSink) (*Result, error)

type StreamEvent

type StreamEvent struct {
	Kind       StreamEventKind `json:"kind"`
	TTL        int             `json:"ttl,omitempty"`
	Hop        Hop             `json:"hop,omitempty"`
	Target     string          `json:"target"`
	ResolvedIP string          `json:"resolved_ip"`
	Protocol   string          `json:"protocol"`
	IPVersion  int             `json:"ip_version"`
	StartMTU   int             `json:"start_mtu"`
	ProbeSize  int             `json:"probe_size"`
	PathMTU    int             `json:"path_mtu"`
}

type StreamEventKind

type StreamEventKind string
const (
	StreamEventTTLStart  StreamEventKind = "ttl_start"
	StreamEventTTLUpdate StreamEventKind = "ttl_update"
	StreamEventTTLFinal  StreamEventKind = "ttl_final"
	StreamEventDone      StreamEventKind = "done"
)

type StreamSink

type StreamSink func(StreamEvent)

Jump to

Keyboard shortcuts

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