Documentation ¶
Index ¶
- Constants
- Variables
- func GRPCWaiter(name string, target *TargetConfig) error
- func HTTPWaiter(name string, target *TargetConfig) error
- func TCPWaiter(name string, target *TargetConfig) error
- func WaitOn(config *Config, logger Logger, targets []string, waiters map[string]Waiter) error
- type Config
- type DNSLookup
- type DNSWaiter
- type IPList
- type Logger
- type TargetConfig
- type Waiter
- type WaiterFunc
Constants ¶
const DefaultHTTPClientTimeout = time.Second
DefaultHTTPClientTimeout a default value for a time limit for requests made by http client
const DefaultTimeout = time.Second * 5
DefaultTimeout is the amount of time to wait for target before failing
Variables ¶
var NullLogger = func(f string, a ...interface{}) {}
NullLogger can be used in place of a real logging function
var SupportedWaiters map[string]Waiter
SupportedWaiters is a mapping of known protocol names to waiter implementations
Functions ¶
func GRPCWaiter ¶ added in v0.0.4
func GRPCWaiter(name string, target *TargetConfig) error
func HTTPWaiter ¶
func HTTPWaiter(name string, target *TargetConfig) error
func TCPWaiter ¶
func TCPWaiter(name string, target *TargetConfig) error
Types ¶
type Config ¶
type Config struct { DefaultTimeout time.Duration `yaml:"default-timeout"` Targets map[string]TargetConfig DefaultHTTPClientTimeout time.Duration `yaml:"default-http-client-timeout"` }
Config represents all of the config that can be defined in a config file
func NewConfigFromFile ¶
NewConfigFromFile reads configuration from the file provided
func OpenConfig ¶
func (*Config) AddFromString ¶
AddFromString adds a new target from a string using the format <type>:<target location>
type DNSWaiter ¶ added in v0.0.5
type DNSWaiter struct {
// contains filtered or unexported fields
}
func NewDNSWaiter ¶ added in v0.0.5
type TargetConfig ¶
type TargetConfig struct { // Type is the kind of target being described Type string // Target is the location of the target to be tested Target string // Timeout is the timeout to use for this specific target if it is different to DefaultTimeout Timeout time.Duration // HTTPClientTimeout is the timeout for requests made by a http client HTTPClientTimeout time.Duration `yaml:"http-client-timeout"` }
TargetConfig is the configuration of a single target
type Waiter ¶ added in v0.0.5
type Waiter interface {
Wait(name string, target *TargetConfig) error
}
type WaiterFunc ¶
type WaiterFunc func(name string, target *TargetConfig) error
WaiterFunc is used to implement waiting for a specific type of target. The name is used in the error and target is the actual destination being tested.
func (WaiterFunc) Wait ¶ added in v0.0.5
func (w WaiterFunc) Wait(name string, target *TargetConfig) error