diagnostic

package
v0.0.0-...-2714d10 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const MicrosecondsFactor = 1000.0

Variables

View Source
var ErrEmptyDomain = errors.New("domain must not be empty")

Functions

This section is empty.

Types

type DecodeLineFunc

type DecodeLineFunc func(text string) (*Hop, error)

type Hop

type Hop struct {
	Hop    uint8           `json:"hop,omitempty"`    // hop number along the route
	Domain string          `json:"domain,omitempty"` // domain and/or ip of the hop, this field will be '*' if the hop is a timeout
	Rtts   []time.Duration `json:"rtts,omitempty"`   // RTT measurements in microseconds
}

func Decode

func Decode(reader io.Reader, decodeLine DecodeLineFunc) ([]*Hop, error)

func DecodeLine

func DecodeLine(text string) (*Hop, error)

func NewHop

func NewHop(hop uint8, domain string, rtts []time.Duration) *Hop

func NewTimeoutHop

func NewTimeoutHop(
	hop uint8,
) *Hop

type IPVersion

type IPVersion int

For now only support ICMP is provided.

const (
	V4 IPVersion = iota
	V6 IPVersion = iota
)

type NetworkCollector

type NetworkCollector interface {
	// Performs a trace route operation with the specified options.
	// In case the trace fails, it will return a non-nil error and
	// it may return a string which represents the raw information
	// obtained.
	// In case it is successful it will only return an array of Hops
	// an empty string and a nil error.
	Collect(ctx context.Context, options TraceOptions) ([]*Hop, string, error)
}

type NetworkCollectorImpl

type NetworkCollectorImpl struct{}

func (*NetworkCollectorImpl) Collect

func (tracer *NetworkCollectorImpl) Collect(ctx context.Context, options TraceOptions) ([]*Hop, string, error)

type TraceOptions

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

func NewTraceOptions

func NewTraceOptions(
	ttl uint64,
	timeout time.Duration,
	address string,
	useV4 bool,
) TraceOptions

Jump to

Keyboard shortcuts

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