pinger

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultPingOptions = PingOptions{
	StopOnGood:   false,
	StopOnBad:    false,
	StopOnChange: false,
	Timeout:      2 * time.Second,
}

Functions

This section is empty.

Types

type PingEvent

type PingEvent struct {
	Timestamp   time.Time         `json:"timestamp"`
	Destination string            `json:"destination"`
	ExtraInfo   string            `json:"extra_info,omitempty"`
	Error       *PingEventError   `json:"error,omitempty"`
	Good        *PingEventGood    `json:"good,omitempty"`
	Bad         *PingEventBad     `json:"bad,omitempty"`
	Destroy     *PingEventDestroy `json:"destroy,omitempty"`
}

type PingEventBad

type PingEventBad struct {
	LastGood time.Time `json:"last_good,omitempty"`
}

type PingEventDestroy

type PingEventDestroy struct{}

type PingEventError

type PingEventError struct {
	Message string `json:"message"`
}

type PingEventGood

type PingEventGood struct {
	LastBad time.Time     `json:"last_bad,omitempty"`
	RTT     time.Duration `json:"rtt"`
}

type PingOptions

type PingOptions struct {
	StopOnGood   bool
	StopOnBad    bool
	StopOnChange bool
	Timeout      time.Duration
}

type Pinger

type Pinger interface {
	Init(destination string, events chan PingEvent, options PingOptions)
	Start()
	Destroy()
}

type WindowsIcmpPinger

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

func (*WindowsIcmpPinger) Destroy

func (w *WindowsIcmpPinger) Destroy()

func (*WindowsIcmpPinger) Init

func (w *WindowsIcmpPinger) Init(destination string, events chan PingEvent, options PingOptions)

func (*WindowsIcmpPinger) Start

func (w *WindowsIcmpPinger) Start()

Jump to

Keyboard shortcuts

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