pingutil

package
v1.3.0-sp4 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2024 License: AGPL-3.0 Imports: 15 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Traceroute added in v1.3.1

func Traceroute(host string, opts ...TracerouteConfigOption) (chan *TracerouteResponse, error)

Types

type PingConfig added in v1.2.5

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

type PingResult

type PingResult struct {
	IP     string
	Ok     bool
	RTT    int64
	Reason string
}

func PingAuto

func PingAuto(ip string, defaultTcpPort string, timeout time.Duration, proxies ...string) *PingResult

func PingAutoConfig added in v1.2.5

func PingAutoConfig(ip string, config *PingConfig) *PingResult

func PingNative

func PingNative(ip string, timeout time.Duration) *PingResult

func PingNativeBase added in v1.2.5

func PingNativeBase(ip string, cxt context.Context, timeout time.Duration) *PingResult

type TracerouteConfig added in v1.3.1

type TracerouteConfig struct {
	Ctx          context.Context
	MaxHops      int
	Protocol     string
	WriteTimeOut time.Duration
	ReadTimeOut  time.Duration
	LocalAddr    string
	RetryTimes   int
	UdpPort      int
	FirstTTL     int
	Sender       func(host string, hop int) (*TracerouteResponse, error)
}

func NewTracerouteConfig added in v1.3.1

func NewTracerouteConfig(opts ...TracerouteConfigOption) *TracerouteConfig

type TracerouteConfigOption added in v1.3.1

type TracerouteConfigOption func(*TracerouteConfig)

func WithCtx added in v1.3.1

func WithFirstTTL added in v1.3.1

func WithFirstTTL(ttl int) TracerouteConfigOption

func WithLocalAddr added in v1.3.1

func WithLocalAddr(addr string) TracerouteConfigOption

func WithMaxHops added in v1.3.1

func WithMaxHops(hops int) TracerouteConfigOption

func WithProtocol added in v1.3.1

func WithProtocol(protocol string) TracerouteConfigOption

func WithReadTimeout added in v1.3.1

func WithReadTimeout(timeout float64) TracerouteConfigOption

func WithRetryTimes added in v1.3.1

func WithRetryTimes(times int) TracerouteConfigOption

func WithSender added in v1.3.1

func WithSender(f func(config *TracerouteConfig, host string, hop int) (*TracerouteResponse, error)) TracerouteConfigOption

func WithUdpPort added in v1.3.1

func WithUdpPort(port int) TracerouteConfigOption

func WithWriteTimeout added in v1.3.1

func WithWriteTimeout(timeout float64) TracerouteConfigOption

type TracerouteResponse added in v1.3.1

type TracerouteResponse struct {
	IP     string
	RTT    int64
	Reason string
	Hop    int
}

Jump to

Keyboard shortcuts

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