pinger4

package module
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2023 License: MIT Imports: 15 Imported by: 2

README

README

Documentation

Index

Constants

View Source
const (
	IcmpResultUnknown = IcmpResultType(iota)
	IcmpResultTypeReceive
	IcmpResultTypeReceiveAfterTimeout
	IcmpResultTypeTTLExceeded
	IcmpResultTypeTimeout
)

IcmpResultType a

Variables

This section is empty.

Functions

func BinIPv4Address2String

func BinIPv4Address2String(ipBin BinIPv4Address) string

BinIPv4Address2String a

Types

type BinIPv4Address

type BinIPv4Address uint32

BinIPv4Address a

func NetIP2BinIPv4Address

func NetIP2BinIPv4Address(ip net.IP) BinIPv4Address

NetIP2BinIPv4Address a

type Config

type Config struct {
	DebugEnable            bool   `json:"DebugEnable"`
	DebugPrintIntervalSec  int64  `json:"DebugPrintInterval"`
	SourceIPAddress        string `json:"SourceIPAddress"`
	StartSendIcmpSmoothing bool   `json:"StartSendIcmpSmoothing"`
	IntervalMillisec       int64  `json:"IntervalMillisec"`
	TimeoutMillisec        int64  `json:"TimeoutMillisec"`
	MaxWorkers             int64  `json:"MaxWorkers"`
	StatisticsCountsNum    int64  `json:"StatisticsCountsNum"`
}

Config a

func DefaultConfig

func DefaultConfig() Config

DefaultConfig a

type IcmpResult

type IcmpResult struct {
	ResultType             IcmpResultType
	IcmpTargetID           BinIPv4Address
	BinPeerIP              BinIPv4Address
	Seq                    int
	SendTimeUnixNanosec    int64
	ReceiveTimeUnixNanosec int64
}

IcmpResult a

type IcmpResultType

type IcmpResultType uint8

IcmpResultType a

type Info

type Info struct {
	IcmpID  int
	Targets map[BinIPv4Address]struct {
		IPAddress string
		Comment   string
	}
	TargetsOrder        []BinIPv4Address
	StatisticsCountsNum int64
	IntervalMillisec    int64
	TimeoutMillisec     int64
	TimeouterCounter    int64
	ResultDropCounter   int64
}

Info a

type Pinger

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

Pinger is Pinger

func New

func New(icmpID int, pingerConfig Config) Pinger

New is create Pinger

func (*Pinger) AddTarget

func (thisPinger *Pinger) AddTarget(ipAddress string, comment string) error

AddTarget is AddTarget

func (*Pinger) GetChIcmpResult

func (thisPinger *Pinger) GetChIcmpResult(cap int) <-chan IcmpResult

GetChIcmpResult a

func (*Pinger) GetIcmpID

func (thisPinger *Pinger) GetIcmpID() int

GetIcmpID is

func (*Pinger) GetInfo

func (thisPinger *Pinger) GetInfo() Info

GetInfo is

func (*Pinger) GetSuccessCounts

func (thisPinger *Pinger) GetSuccessCounts() SuccessCounts

GetSuccessCounts a

func (*Pinger) Run

func (thisPinger *Pinger) Run(ctx context.Context) error

Run is Pinger start

func (*Pinger) SetLogEnableLevel

func (thisPinger *Pinger) SetLogEnableLevel(targetLevelFlgs labelinglog.LogLevel) error

SetLogEnableLevel a

func (*Pinger) SetLogWriter

func (thisPinger *Pinger) SetLogWriter(targetLevelFlgs labelinglog.LogLevel, writer io.Writer) error

SetLogWriter a

type SuccessCounts

type SuccessCounts map[BinIPv4Address]struct {
	Count int64
}

SuccessCounts a

Jump to

Keyboard shortcuts

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