metrics

package
v0.0.0-...-6992ff7 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const MessageDown = `🔴 Internet is offline in home %s`
View Source
const MessageUp = `🟢 Internet back online in home %s`
View Source
const (
	// ProtocolICMP see in https://godoc.org/golang.org/x/net/internal/iana,
	ProtocolICMP = 1
)

Variables

View Source
var ListenAddr = "0.0.0.0"

ListenAddr Default to listen on all IPv4 interfaces

Functions

func ICMPPing

func ICMPPing(addr string, timeout time.Duration) (*net.IPAddr, time.Duration, error)

func Listen

func Listen()

func Stop

func Stop()

Types

type InternetStatus

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

func NewInternetStatus

func NewInternetStatus(status bool, err error) InternetStatus

func (InternetStatus) Error

func (s InternetStatus) Error() error

func (InternetStatus) IsUp

func (s InternetStatus) IsUp() bool

func (InternetStatus) MetricValue

func (s InternetStatus) MetricValue() float64

func (InternetStatus) String

func (s InternetStatus) String() string

type InternetStatusMetric

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

func NewInternetStatusMetric

func NewInternetStatusMetric(config config.Home) *InternetStatusMetric

func (*InternetStatusMetric) Run

func (m *InternetStatusMetric) Run()

func (*InternetStatusMetric) Stop

func (m *InternetStatusMetric) Stop()

type Metric

type Metric interface {
	Run()
	Stop()
}

Jump to

Keyboard shortcuts

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