Documentation ¶
Overview ¶
Package ipvs provides a Go interface to Linux IPVS.
Index ¶
- func AddDestination(svc Service, dst Destination) error
- func AddService(svc Service) error
- func DeleteDestination(svc Service, dst Destination) error
- func DeleteService(svc Service) error
- func Flush() error
- func Init() error
- func UpdateDestination(svc Service, dst Destination) error
- func UpdateService(svc Service) error
- type Destination
- type DestinationFlags
- type DestinationStats
- type IPProto
- type IPVSVersion
- type Service
- type ServiceFlags
- type ServiceStats
- type Stats
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddDestination ¶
func AddDestination(svc Service, dst Destination) error
AddDestination adds the specified destination to the IPVS table.
func AddService ¶
AddService adds the specified service to the IPVS table. Any destinations associated with the given service will also be added.
func DeleteDestination ¶
func DeleteDestination(svc Service, dst Destination) error
DeleteDestination deletes the specified destination from the IPVS table.
func DeleteService ¶
DeleteService deletes the specified service from the IPVS table.
func UpdateDestination ¶
func UpdateDestination(svc Service, dst Destination) error
UpdateDestination updates the specified destination in the IPVS table.
func UpdateService ¶
UpdateService updates the specified service in the IPVS table.
Types ¶
type Destination ¶
type Destination struct { Address net.IP Port uint16 Weight int32 Flags DestinationFlags LowerThreshold uint32 UpperThreshold uint32 Statistics *DestinationStats }
Destination represents an IPVS destination.
func (Destination) Equal ¶
func (dest Destination) Equal(other Destination) bool
Equal returns true if two Destinations are the same.
func (Destination) String ¶
func (dest Destination) String() string
String returns a string representation of a Destination.
type DestinationFlags ¶
type DestinationFlags uint32
DestinationFlags specifies the flags for a connection to an IPVS destination.
const ( DFForwardMask DestinationFlags = ipvsDstFlagFwdMask DFForwardMasq DestinationFlags = ipvsDstFlagFwdMasq DFForwardLocal DestinationFlags = ipvsDstFlagFwdLocal DFForwardRoute DestinationFlags = ipvsDstFlagFwdRoute DFForwardTunnel DestinationFlags = ipvsDstFlagFwdTunnel DFForwardBypass DestinationFlags = ipvsDstFlagFwdBypass )
type DestinationStats ¶
DestinationStats encapsulates statistics for an IPVS destination.
type IPProto ¶
type IPProto uint16
IPProto specifies the protocol encapsulated within an IP datagram.
type IPVSVersion ¶
IPVSVersion represents a IPVS version as major, minor and patch values.
func (IPVSVersion) String ¶
func (v IPVSVersion) String() string
String returns a string representation of the IPVS version number.
type Service ¶
type Service struct { Address net.IP Protocol IPProto Port uint16 FirewallMark uint32 Scheduler string Flags ServiceFlags Timeout uint32 PersistenceEngine string Statistics *ServiceStats Destinations []*Destination }
Service represents an IPVS service.
func GetService ¶
GetService returns the service entry that is currently configured in the kernel IPVS table, which matches the specified service.
func GetServices ¶
GetServices returns a list of service entries that are currently configured in the kernel IPVS table.
type ServiceFlags ¶
type ServiceFlags uint32
ServiceFlags specifies the flags for a IPVS service.
const ( SFPersistent ServiceFlags = ipvsSvcFlagPersist SFHashed ServiceFlags = ipvsSvcFlagHashed SFOnePacket ServiceFlags = ipvsSvcFlagOnePacket )
func (ServiceFlags) Bytes ¶
func (f ServiceFlags) Bytes() []byte
Bytes returns the netlink representation of the service flags.
func (*ServiceFlags) SetBytes ¶
func (f *ServiceFlags) SetBytes(x []byte)
SetBytes sets the service flags from its netlink representation.
type ServiceStats ¶
type ServiceStats struct {
Stats
}
ServiceStats encapsulates statistics for an IPVS service.
type Stats ¶
type Stats struct { Connections uint32 `netlink:"attr:1"` PacketsIn uint32 `netlink:"attr:2"` PacketsOut uint32 `netlink:"attr:3"` BytesIn uint64 `netlink:"attr:4"` BytesOut uint64 `netlink:"attr:5"` CPS uint32 `netlink:"attr:6"` PPSIn uint32 `netlink:"attr:7"` PPSOut uint32 `netlink:"attr:8"` BPSIn uint32 `netlink:"attr:9"` BPSOut uint32 `netlink:"attr:10"` }