Documentation ¶
Index ¶
- Variables
- func HealthQueryHandlerHTML(phs map[string]*HealthService, provider string) httpHandler
- func HealthQueryHandlerJSON(phs map[string]*HealthService, provider string) httpHandler
- func HealthSummaryHandlerText(phs map[string]*HealthService, provider string) httpHandler
- type Checker
- type HealthService
- type Measurement
- type MeasurementBatch
- type VPNChecker
Constants ¶
This section is empty.
Variables ¶
var ( ErrNotReady = errors.New("not ready") ErrBadBase64Blob = errors.New("wrong base64 encoding") )
var (
ErrUnknownEntity = errors.New("unknown entity")
)
Functions ¶
func HealthQueryHandlerHTML ¶
func HealthQueryHandlerHTML(phs map[string]*HealthService, provider string) httpHandler
User facing status (html) (TODO)
func HealthQueryHandlerJSON ¶
func HealthQueryHandlerJSON(phs map[string]*HealthService, provider string) httpHandler
func HealthSummaryHandlerText ¶
func HealthSummaryHandlerText(phs map[string]*HealthService, provider string) httpHandler
PoC for a general view of status (text/plain)
Types ¶
type Checker ¶
type Checker interface { Kind() string Proto() string ProviderName() string Run(chan *Measurement) error }
Checker is a VPN checker with aspirations of universality.
type HealthService ¶
type HealthService struct { // Name contains the provider/entity this service is associated with. Name string // Checker is the service checker implementation associated with this service. Checker Checker // The idea behind storing current/previous measurement batches is that // we can detect (and store) deltas. Current *MeasurementBatch Previous *MeasurementBatch }
Health schedules service checks, and exposes a method to query for the health status of a particular endpoint.
func (*HealthService) Healthy ¶
Healthy returns true if the passed address/proto is known to be healthy. It will return an error if we don't have that measurement.
func (*HealthService) RunBatch ¶
func (hs *HealthService) RunBatch(ctx context.Context)
type Measurement ¶
type Measurement struct { // Healthy is true if the service is up. Healthy bool // Addr is the address we measured. Addr net.Addr // Transport is tcp | udp Transport string // For metrics purposes. Timestamp time.Time // Recovered is intended to be set by the monitoring service, by // comparing with the previous run. // TODO remove if I don't end up using it (for instance, to make // any service using this one aware that this is a resource tha can be // added back into the pool). Recovered bool }
Measurement is a single measurement. For what we really care about, it can only be healthy or unhealthy. For the time being, our criteria for "healthy" is having a gateway that can route us to the internet has a ICMP packet loss less than a certain threshold. There's more info we could share: did we get a handshake but we could not route? Can we resolve DNS through the GW? (gateway could have routing problems etc).
func (*Measurement) String ¶
func (m *Measurement) String() string
type MeasurementBatch ¶
type MeasurementBatch struct { TimeInRound time.Duration // contains filtered or unexported fields }
A MeasuremenMeasurementBatch is a round of measurements.
func NewMeasurementBatch ¶
func NewMeasurementBatch() *MeasurementBatch
NewNewMeasurementBatch returns a pointer to a MeasurementBatch ready to be used.
func (*MeasurementBatch) Healthy ¶
Healthy returns true if the passed address is known to be healthy. It will return an error if we don't have that measurement.
func (*MeasurementBatch) Measurements ¶
func (mb *MeasurementBatch) Measurements() []*Measurement
type VPNChecker ¶
VPNChecker is the real thing.
func (*VPNChecker) Kind ¶
func (v *VPNChecker) Kind() string
func (*VPNChecker) Proto ¶
func (v *VPNChecker) Proto() string
func (*VPNChecker) ProviderName ¶
func (v *VPNChecker) ProviderName() string
func (*VPNChecker) Run ¶
func (v *VPNChecker) Run(mCh chan *Measurement) error