common

package
v0.0.0-...-676ac07 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendIfMissing

func AppendIfMissing(slice []string, i string) []string

AppendIfMissing Append only if the item does not exists in the current list

func CompareList

func CompareList(a, b []string) []string

CompareList Compare two lists and return a list with the difference

func DestAddrs

func DestAddrs(ctx context.Context, host string, resolver *net.Resolver, timeout time.Duration) ([]string, error)

DestAddrs resolve the hostname to all it'ss IP's

func HasListDuplicates

func HasListDuplicates(m []string) (string, error)

HasListDuplicates Find duplicates in a list

func HasMapDuplicates

func HasMapDuplicates(m map[string]string) bool

HasMapDuplicates Find duplicates in a map keys

func IsEqualIP

func IsEqualIP(ips1, ips2 string) bool

IsEqualIP IP Comparison

func SrvRecordCheck

func SrvRecordCheck(record string) bool

func SrvRecordHosts

func SrvRecordHosts(record string) ([]string, error)

func Time2Float

func Time2Float(t time.Duration) float32

Time2Float Convert time to float32

func TimeAverage

func TimeAverage(values []time.Duration) float64

TimeAverage Calculates the average of a slice of durations

func TimeCorrectedDeviation

func TimeCorrectedDeviation(values []time.Duration) float64

TimeCorrectedDeviation Calculates standard deviation using Bessel's correction which uses n-1 in the SD formula to correct bias of small sample size

func TimeRange

func TimeRange(values []time.Duration) time.Duration

TimeRange finds the range of a slice of durations

func TimeSquaredDeviation

func TimeSquaredDeviation(values []time.Duration) float64

TimeSquaredDeviation Calculates the squared deviation

func TimeUncorrectedDeviation

func TimeUncorrectedDeviation(values []time.Duration) float64

TimeUncorrectedDeviation Calculates standard deviation without correction

Types

type IcmpHop

type IcmpHop struct {
	Success              bool          `json:"success"`
	AddressFrom          string        `json:"address_from"`
	AddressTo            string        `json:"address_to"`
	N                    int           `json:"n"`
	TTL                  int           `json:"ttl"`
	Snt                  int           `json:"snt"`
	SntFail              int           `json:"snt_fail"`
	LastTime             time.Duration `json:"last"`
	SumTime              time.Duration `json:"sum"`
	AvgTime              time.Duration `json:"avg"`
	BestTime             time.Duration `json:"best"`
	WorstTime            time.Duration `json:"worst"`
	SquaredDeviationTime time.Duration `json:"sd"`
	UncorrectedSDTime    time.Duration `json:"usd"`
	CorrectedSDTime      time.Duration `json:"csd"`
	RangeTime            time.Duration `json:"range"`
	Loss                 float64       `json:"loss"`
}

IcmpHop ICMP HOP Response time details

type IcmpID

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

IcmpID ICMP Echo Unique ID for each coroutine

func (*IcmpID) Get

func (c *IcmpID) Get() int32

Get ICMP Echo Unique ID

type IcmpReturn

type IcmpReturn struct {
	Success bool
	Addr    string
	Elapsed time.Duration
}

IcmpReturn ICMP Response time details

type IcmpSummary

type IcmpSummary struct {
	AddressFrom string        `json:"address_from"`
	AddressTo   string        `json:"address_to"`
	Snt         int           `json:"snt"`
	SntFail     int           `json:"snt_fail"`
	SntTime     time.Duration `json:"snt_time"`
}

IcmpSummary ICMP HOP Summary

Jump to

Keyboard shortcuts

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