Documentation
¶
Overview ¶
Package check owns what a check is: its protocols, its settings, the rules a valid check follows and its options. The central validates with it before storing, the edge before running, so both always agree.
Index ¶
- Constants
- Variables
- func Matches(selector, labels map[string]string) bool
- func ToProto(versionID int64, host string, s Spec) *netprobev1.Check
- func ValidLabels(labels map[string]string) error
- func ValidName(name string) error
- type Bounds
- type DNSOptions
- type Family
- type HTTPOptions
- type MTUOptions
- type Protocol
- type Spec
Constants ¶
const ( // TraceMaxHops is how far a traceroute goes. TraceMaxHops = 30 // MTUProbes bounds a path MTU search: binary search from 576 to 9000 bytes. MTUProbes = 15 // InterSample spaces the samples of one cycle. InterSample = 100 * time.Millisecond )
Variables ¶
var ( ProbeBounds = Bounds{MinInterval: 5 * time.Second, MaxInterval: time.Hour, MinTimeout: 100 * time.Millisecond, MaxTimeout: 30 * time.Second, MaxCount: 20} TraceBounds = Bounds{MinInterval: time.Minute, MaxInterval: 24 * time.Hour, MinTimeout: 100 * time.Millisecond, MaxTimeout: 5 * time.Second, MaxCount: 5} )
Central bounds, for probes and for traceroutes.
var DNSTypes = []string{"A", "AAAA", "CNAME", "MX", "NS", "SOA", "TXT", "PTR", "SRV"}
DNSTypes are the question types a DNS check may ask.
Protocols lists every protocol, in display order.
Functions ¶
func ToProto ¶
func ToProto(versionID int64, host string, s Spec) *netprobev1.Check
ToProto is a check version as sent to edges.
func ValidLabels ¶
ValidLabels checks edge labels and the selectors that match them.
Types ¶
type Bounds ¶
type Bounds struct {
MinInterval, MaxInterval time.Duration
MinTimeout, MaxTimeout time.Duration
MaxCount int
}
Bounds are limits a spec must also respect: the central sets them for the checks it accepts, an edge for the checks it runs.
func CentralBounds ¶
CentralBounds are the bounds the central applies to s.
type DNSOptions ¶
type DNSOptions struct {
Name string // fully qualified, with the final dot
Type string // one of DNSTypes
TCP bool
}
DNSOptions: one question to the target, a resolver.
type Family ¶
type Family string
Family restricts the address family; Auto lets the resolver choose.
func FamilyOf ¶
func FamilyOf(f netprobev1.Family) (Family, bool)
FamilyOf returns the family of an API value; false if unknown.
type HTTPOptions ¶
type HTTPOptions struct {
TLS bool
Path string
Expect int // status wanted; 0: any below 400
Insecure bool
}
HTTPOptions: GET of Path on the target, HTTPS unless port 80 or scheme=http.
type MTUOptions ¶
type MTUOptions struct {
Max int
}
MTUOptions: search between the minimum MTU of the family and Max.
type Protocol ¶
type Protocol string
func ProtocolOf ¶
func ProtocolOf(p netprobev1.Protocol) (Protocol, bool)
ProtocolOf returns the protocol of an API value; false if unknown.
type Spec ¶
type Spec struct {
Protocol Protocol
Port int
LocalPort int // source port, 0 for any
Family Family
Interval time.Duration
Timeout time.Duration
Count int // samples per cycle; per hop for a traceroute
Payload []byte
Options map[string]string
}
Spec is what a check measures. Any change of it is a new version.
func FromProto ¶
func FromProto(c *netprobev1.Check) Spec
FromProto is the spec of a check received by an edge. Unknown protocols or families come out invalid, and Validate says so.
func (Spec) DNS ¶
func (s Spec) DNS() (DNSOptions, error)
func (Spec) HTTP ¶
func (s Spec) HTTP() (HTTPOptions, error)
func (Spec) MTU ¶
func (s Spec) MTU() (MTUOptions, error)