Documentation ¶
Overview ¶
Package seesaw contains structures, interfaces and utility functions that are used by Seesaw v2 components.
Index ¶
- Constants
- Variables
- func InSubnets(ip net.IP, subnets map[string]*net.IPNet) bool
- func IsAnycast(ip net.IP) bool
- type AF
- type Backend
- type BackendMap
- type BackendOverride
- type ClusterStatus
- type Component
- type ConfigMetadata
- type ConfigStatus
- type Destination
- type DestinationOverride
- type DestinationStats
- type Destinations
- type HAConfig
- type HAState
- type HAStatus
- type HealthcheckMode
- type HealthcheckType
- type Host
- type IP
- type IPProto
- type LBMode
- type LBScheduler
- type Node
- type Nodes
- type NodesByIPv4
- type NodesByIPv6
- type Override
- type OverrideState
- type Service
- type ServiceKey
- type ServiceKeys
- type ServiceStats
- type VIP
- type VIPType
- type VLAN
- type VLANs
- type Vserver
- type VserverEntry
- type VserverMap
- type VserverOverride
Constants ¶
const ( SeesawVersion = 2 BinaryPath = "/usr/local/seesaw" ConfigPath = "/etc/seesaw" RunPath = "/var/run/seesaw" )
Variables ¶
var ( EngineSocket = socketPath("engine") NCCSocket = socketPath("ncc") )
Functions ¶
Types ¶
type Backend ¶
Backend represents a backend server that can be used as a load balancing destination.
type BackendMap ¶
BackendMap provides a map of backends keyed by backend hostname.
type BackendOverride ¶
type BackendOverride struct { Hostname string OverrideState }
func (*BackendOverride) State ¶
func (o *BackendOverride) State() OverrideState
func (*BackendOverride) Target ¶
func (o *BackendOverride) Target() string
type ClusterStatus ¶
ClusterStatus specifies the status of a Seesaw cluster.
type ConfigMetadata ¶
ConfigMetadata describes part of the state of the currently-loaded config.
type ConfigStatus ¶
type ConfigStatus struct { Attributes []ConfigMetadata LastUpdate time.Time Warnings []string }
ConfigStatus describes the status of the currently-loaded config.
type Destination ¶
type Destination struct { Name string VserverName string Weight int32 Stats *DestinationStats Backend *Backend Enabled bool Healthy bool Active bool }
Destination represents a load balancing destination.
type DestinationOverride ¶
type DestinationOverride struct { VserverName string DestinationName string OverrideState }
func (*DestinationOverride) State ¶
func (o *DestinationOverride) State() OverrideState
func (*DestinationOverride) Target ¶
func (o *DestinationOverride) Target() string
type DestinationStats ¶
type DestinationStats struct {
*ipvs.DestinationStats
}
DestinationStats contains statistics for a Destination.
type Destinations ¶
type Destinations []*Destination
Destinations represents a list of Destination.
func (Destinations) Len ¶
func (d Destinations) Len() int
func (Destinations) Less ¶
func (d Destinations) Less(i, j int) bool
func (Destinations) Swap ¶
func (d Destinations) Swap(i, j int)
type HAConfig ¶
HAConfig represents the high availability configuration for a node in a Seesaw cluster.
type HAStatus ¶
type HAStatus struct { LastUpdate time.Time State HAState Since time.Time Sent uint64 Received uint64 ReceivedQueued uint64 Transitions uint64 }
HAStatus indicates the High-Availability status for a Seesaw Node.
type HealthcheckMode ¶
type HealthcheckMode int
HealthcheckMode specifies the mode for a Healthcheck.
const ( HCModePlain HealthcheckMode = iota HCModeDSR )
func (HealthcheckMode) String ¶
func (h HealthcheckMode) String() string
String returns the name for a given HealthcheckMode.
type HealthcheckType ¶
type HealthcheckType int
HealthcheckType specifies the type for a Healthcheck.
const ( HCTypeNone HealthcheckType = iota HCTypeDNS HCTypeHTTP HCTypeHTTPS HCTypeICMP HCTypeRADIUS HCTypeTCP HCTypeTCPTLS HCTypeUDP )
func (HealthcheckType) String ¶
func (h HealthcheckType) String() string
String returns the name for the given HealthcheckType.
type Host ¶
type Host struct { Hostname string IPv4Addr net.IP IPv4Mask net.IPMask IPv6Addr net.IP IPv6Mask net.IPMask }
Host contains the hostname, IP addresses, and IP masks for a host.
func TestAnycastHost ¶
func TestAnycastHost() Host
TestAnycastHost returns a Host containing the details of the test anycast service.
func (*Host) IPv4Printable ¶
IPv4Printable returns a printable representation of the host's IPv4 address.
func (*Host) IPv6Printable ¶
IPv6Printable returns a printable representation of the host's IPv4 address.
type IP ¶
IP specifies an IP address.
func ParseIP ¶
ParseIP parses the given string and returns a seesaw IP initialised with the resulting IP address.
func (IP) Equal ¶
Equal returns true of the given seesaw.IP addresses are equal, as determined by net.IP.Equal().
type IPProto ¶
type IPProto uint16
IPProto specifies an IP protocol.
const ( IPProtoICMP IPProto = syscall.IPPROTO_ICMP IPProtoICMPv6 IPProto = syscall.IPPROTO_ICMPV6 IPProtoTCP IPProto = syscall.IPPROTO_TCP IPProtoUDP IPProto = syscall.IPPROTO_UDP )
type LBScheduler ¶
type LBScheduler int
LBScheduler specifies the load balancer scheduling algorithm for a Vserver.
const ( LBSchedulerNone LBScheduler = iota LBSchedulerRR LBSchedulerWRR LBSchedulerLC LBSchedulerWLC LBSchedulerSH )
func (LBScheduler) String ¶
func (lbs LBScheduler) String() string
String returns the string representation of a LBScheduler.
type Node ¶
type Node struct { Host Priority uint8 State HAState AnycastEnabled bool BGPEnabled bool VserversEnabled bool }
Node represents a node that is part of a Seesaw cluster.
type NodesByIPv4 ¶
type NodesByIPv4 struct{ Nodes }
NodesByIPv4 allows sorting Nodes by IPv4Addr.
func (NodesByIPv4) Less ¶
func (n NodesByIPv4) Less(i, j int) bool
type NodesByIPv6 ¶
type NodesByIPv6 struct{ Nodes }
NodesByIPv6 allows sorting Nodes by IPv6Addr.
func (NodesByIPv6) Less ¶
func (n NodesByIPv6) Less(i, j int) bool
type Override ¶
type Override interface { Target() string State() OverrideState }
type OverrideState ¶
type OverrideState int
OverrideState specifies an override state for a vserver, backend, or destination.
const ( OverrideDefault OverrideState = iota OverrideDisable OverrideEnable )
func (OverrideState) String ¶
func (o OverrideState) String() string
String returns the string representation of an OverrideState.
type Service ¶
type Service struct { ServiceKey IP net.IP Mode LBMode Scheduler LBScheduler OnePacket bool Persistence int Stats *ServiceStats Destinations map[string]*Destination // keyed by backend hostname Enabled bool Healthy bool Active bool HighWatermark float32 LowWatermark float32 CurrentWatermark float32 }
Service represents a load balancing service.
type ServiceKey ¶
ServiceKey provides a unique identifier for a load balancing service.
func (ServiceKey) String ¶
func (sk ServiceKey) String() string
String returns the string representation of a ServiceKey.
type ServiceKeys ¶
type ServiceKeys []*ServiceKey
ServiceKeys represents a list of ServiceKey.
func (ServiceKeys) Len ¶
func (sk ServiceKeys) Len() int
func (ServiceKeys) Less ¶
func (sk ServiceKeys) Less(i, j int) bool
func (ServiceKeys) Swap ¶
func (sk ServiceKeys) Swap(i, j int)
type ServiceStats ¶
type ServiceStats struct {
*ipvs.ServiceStats
}
ServiceStats contains statistics for a Service.
type VIPType ¶
type VIPType int
VIPType indicates whether a VIP is in a normal, dedicated, or anycast subnet.
type VLAN ¶
VLAN represents a VLAN interface configuration.
type Vserver ¶
type Vserver struct { Name string Entries []*VserverEntry FWM map[AF]uint32 Host Services map[ServiceKey]*Service OverrideState Enabled bool ConfigEnabled bool Warnings []string }
Vserver represents a virtual server configured for load balancing.
type VserverEntry ¶
type VserverEntry struct { Port uint16 Proto IPProto Scheduler LBScheduler Mode LBMode Persistence int OnePacket bool HighWatermark float32 LowWatermark float32 // TODO(angusc): Rename these: LThreshold int UThreshold int }
VserverEntry represents a port and protocol combination for a Vserver.
type VserverMap ¶
VserverMap provides a map of vservers keyed by vserver name.
type VserverOverride ¶
type VserverOverride struct { VserverName string OverrideState }
func (*VserverOverride) State ¶
func (o *VserverOverride) State() OverrideState
func (*VserverOverride) Target ¶
func (o *VserverOverride) Target() string