tracert

package module
v0.0.0-...-5039b1b Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

README

tracert

一个特别定制的traceroute库,通过UDP协议实现路径探测.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = Config{
	MaxTTL:   30,
	Timeout:  3 * time.Second,
	Parallel: 1,
	Delay:    time.Second,
}

Functions

This section is empty.

Types

type Config

type Config struct {
	MaxTTL   int
	TOS      int
	Timeout  time.Duration
	Parallel int
	Delay    time.Duration
}

type TraceRoute

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

func New

func New(localIP, remoteIP string, localPort, remotePort int, data []byte, config *Config) *TraceRoute

func (*TraceRoute) Trace

func (tr *TraceRoute) Trace(ctx context.Context) ([]*TracertHop, error)

type TraceRouteResult

type TraceRouteResult struct {
	LastSuccessRouters map[string]int      `json:"last_success_routers,omitempty"` // last success router ip => count of failed ip pairs
	FailedPair         map[string][]string `json:"failed_pair,omitempty"`          // last success router ip => failed ip pairs
	Failed             int                 `json:"failed,omitempty"`
	Success            int                 `json:"success,omitempty"`
}

func MTrace

func MTrace(localIP, remoteIP string, localPorts, remotePorts []int) *TraceRouteResult

type TracertHop

type TracertHop struct {
	Success bool
	Address string
	TTL     int
	RTT     time.Duration
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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