...

Package probing

import "github.com/xiang90/probing"
Overview
Index

Overview ▾

Variables

var (
    ErrNotFound = errors.New("probing: id not found")
    ErrExist    = errors.New("probing: id exists")
)

func NewHandler

func NewHandler() http.Handler

type Health

type Health struct {
    OK  bool
    Now time.Time
}

type Prober

type Prober interface {
    AddHTTP(id string, probingInterval time.Duration, endpoints []string) error
    Remove(id string) error
    RemoveAll()
    Reset(id string) error
    Status(id string) (Status, error)
}

func NewProber

func NewProber(tr http.RoundTripper) Prober

type Status

type Status interface {
    Total() int64
    Loss() int64
    Health() bool
    Err() error
    // Estimated smoothed round trip time
    SRTT() time.Duration
    // Estimated clock difference
    ClockDiff() time.Duration
    StopNotify() <-chan struct{}
}