Documentation ¶
Index ¶
- Constants
- type Config
- type Destination
- type DstStats
- type Handle
- func (i *Handle) Close()
- func (i *Handle) DelDestination(s *Service, d *Destination) error
- func (i *Handle) DelService(s *Service) error
- func (i *Handle) Flush() error
- func (i *Handle) GetConfig() (*Config, error)
- func (i *Handle) GetDestinations(s *Service) ([]*Destination, error)
- func (i *Handle) GetService(s *Service) (*Service, error)
- func (i *Handle) GetServices() ([]*Service, error)
- func (i *Handle) IsServicePresent(s *Service) bool
- func (i *Handle) NewDestination(s *Service, d *Destination) error
- func (i *Handle) NewService(s *Service) error
- func (i *Handle) SetConfig(c *Config) error
- func (i *Handle) UpdateDestination(s *Service, d *Destination) error
- func (i *Handle) UpdateService(s *Service) error
- type Service
- type SvcStats
Constants ¶
const ( // ConnectionFlagFwdmask indicates the mask in the connection // flags which is used by forwarding method bits. ConnectionFlagFwdMask = 0x0007 // ConnectionFlagMasq is used for masquerade forwarding method. ConnectionFlagMasq = 0x0000 // ConnectionFlagLocalNode is used for local node forwarding // method. ConnectionFlagLocalNode = 0x0001 // ConnectionFlagTunnel is used for tunnel mode forwarding // method. ConnectionFlagTunnel = 0x0002 // ConnectionFlagDirectRoute is used for direct routing // forwarding method. ConnectionFlagDirectRoute = 0x0003 )
Destination forwarding methods
const ( // RoundRobin distributes jobs equally amongst the available // real servers. RoundRobin = "rr" // LeastConnection assigns more jobs to real servers with // fewer active jobs. LeastConnection = "lc" // DestinationHashing assigns jobs to servers through looking // up a statically assigned hash table by their destination IP // addresses. DestinationHashing = "dh" // SourceHashing assigns jobs to servers through looking up // a statically assigned hash table by their source IP // addresses. SourceHashing = "sh" )
const ( // ConnFwdMask is a mask for the fwd methods ConnFwdMask = 0x0007 // ConnFwdMasq denotes forwarding via masquerading/NAT ConnFwdMasq = 0x0000 // ConnFwdLocalNode denotes forwarding to a local node ConnFwdLocalNode = 0x0001 // ConnFwdTunnel denotes forwarding via a tunnel ConnFwdTunnel = 0x0002 // ConnFwdDirectRoute denotes forwarding via direct routing ConnFwdDirectRoute = 0x0003 // ConnFwdBypass denotes forwarding while bypassing the cache ConnFwdBypass = 0x0004 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { TimeoutTCP time.Duration TimeoutTCPFin time.Duration TimeoutUDP time.Duration }
Config defines IPVS timeout configuration
type Destination ¶
type Destination struct { Address net.IP Port uint16 Weight int ConnectionFlags uint32 AddressFamily uint16 UpperThreshold uint32 LowerThreshold uint32 ActiveConnections int InactiveConnections int Stats DstStats }
Destination defines an IPVS destination (real server) in its entirety.
type Handle ¶
type Handle struct {
// contains filtered or unexported fields
}
Handle provides a namespace specific ipvs handle to program ipvs rules.
func New ¶
New provides a new ipvs handle in the namespace pointed to by the passed path. It will return a valid handle or an error in case an error occurred while creating the handle.
func (*Handle) Close ¶
func (i *Handle) Close()
Close closes the ipvs handle. The handle is invalid after Close returns.
func (*Handle) DelDestination ¶
func (i *Handle) DelDestination(s *Service, d *Destination) error
DelDestination deletes an already existing real server in the passed ipvs service in the passed handle.
func (*Handle) DelService ¶
DelService deletes an already existing service in the passed handle.
func (*Handle) GetDestinations ¶
func (i *Handle) GetDestinations(s *Service) ([]*Destination, error)
GetDestinations returns an array of Destinations configured for this Service
func (*Handle) GetService ¶
GetService gets details of a specific IPVS services, useful in updating statisics etc.,
func (*Handle) GetServices ¶
GetServices returns an array of services configured on the Node
func (*Handle) IsServicePresent ¶
IsServicePresent queries for the ipvs service in the passed handle.
func (*Handle) NewDestination ¶
func (i *Handle) NewDestination(s *Service, d *Destination) error
NewDestination creates a new real server in the passed ipvs service which should already be existing in the passed handle.
func (*Handle) NewService ¶
NewService creates a new ipvs service in the passed handle.
func (*Handle) UpdateDestination ¶
func (i *Handle) UpdateDestination(s *Service, d *Destination) error
UpdateDestination updates an already existing real server in the passed ipvs service in the passed handle.
func (*Handle) UpdateService ¶
UpdateService updates an already existing service in the passed handle.
type Service ¶
type Service struct { // Virtual service address. Address net.IP Protocol uint16 Port uint16 FWMark uint32 // Firewall mark of the service. // Virtual service options. SchedName string Flags uint32 Timeout uint32 Netmask uint32 AddressFamily uint16 PEName string Stats SvcStats }
Service defines an IPVS service in its entirety.