Documentation ¶
Overview ¶
Package config contains the Iaido configuration format.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Resolver = net.Resolver{PreferGo: true}
Resolver can be overridden for testing.
Functions ¶
Types ¶
type BackendPool ¶
type BackendPool struct { // LatencyBucket allows backends to be assigned to tiers // automatically. Backends are grouped such that the latencies of // the fastest and slowest entries in a tier are no greater than the // given value. // // Automatic latency detection can be disabled by setting this to a // negative value. LatencyBucket time.Duration `yaml:"latencyBucket"` // How often connections within the pool should be evaluated for // over-load conditions, promotion to a higher tier, etc. // Longer values provide better damping of behavior, at the cost // of simply taking more time to effect configuration changes. MaintenanceTime time.Duration `yaml:"maintenanceTime"` // Backends are arranged in tiers with a "fill and spill" behavior. Tiers []Tier `yaml:"tiers"` }
BackendPool represents the actual machines to connect to.
type Config ¶
type Config struct { // A local address to bind a diagnostic HTTP endpoint to. DiagAddr string `yaml:"diagAddr"` Frontends []Frontend `yaml:"frontends"` GracePeriod time.Duration `yaml:"gracePeriod"` }
Config is the top-level YAML-compatible configuration.
type Frontend ¶
type Frontend struct { BackendPool BackendPool `yaml:"backendPool"` // The local address to listen for incoming connections on. BindAddress string `yaml:"bindAddress"` // The time after which an idle connection should be pruned. IdleDuration time.Duration `yaml:"idleDuration"` // How often to rebalance backends across tiers. RebalanceDuration time.Duration `yaml:"rebalanceDuration"` }
Frontend represents an active proxy frontend.
type Proto ¶
type Proto int
Proto defines an enumeration of network protocols.
TODO(bob): Expand this to include HTTP and PSQL options.
func (Proto) MarshalText ¶
MarshalText implements encoding.TextMarshaler and returns the enum name.
func (*Proto) UnmarshalText ¶
UnmarshalText implements encoding.TextMarshaler.
type Target ¶
A Target is a string value that can be resolved to one or more network addresses.
Targets are generally assumed to represent TCP/IP endpoints.
func ParseTarget ¶
ParseTarget parses a human-provided description of a target. It should be of the form "host:port" with an optional protocol.
type Tier ¶
type Tier struct { // How long to disable a backend if a connection cannot be established. DialFailureTimeout time.Duration `yaml:"dialFailureTimeout"` // If non-zero, connections to this tier will be forcefully // disconnected if a backend in a closer tier becomes available. ForcePromotionAfter time.Duration `yaml:"forcePromotionAfter"` // The maximum number of connections to make to any given backend. MaxBackendConnections int `yaml:"maxBackendConnections"` Targets []Target `yaml:"targets"` }
Tier contains the targets that the frontend will forward connections to.