Documentation
¶
Index ¶
- Constants
- Variables
- func GetOutboundIP() (net.IP, error)
- type Gateway
- func (g *Gateway) Close()
- func (g *Gateway) CreateBackend(vsID, rsID string, options *RealOptions) error
- func (g *Gateway) CreateService(vsID string, options *ServiceOptions) error
- func (g *Gateway) GetMetrics(vsID string) (*Metrics, error)
- func (g *Gateway) RemoveBackend(vsID, rsID string) (*RealOptions, error)
- func (g *Gateway) RemoveService(vsID string) (*ServiceOptions, error)
- type Metrics
- type PortPool
- type RealOptions
- type Route
- type Router
- type ServiceOptions
- type VirtualService
Constants ¶
View Source
const ( DefaultProtocol = "tcp" DefaultSchedulingMethod = "wrr" )
View Source
const (
PlatformSupportIPVS = true
)
Variables ¶
View Source
var ( ErrMissingEndpoint = errors.New("endpoint information is missing") ErrUnknownProtocol = errors.New("specified protocol is unknown") )
Possible validation errors.
Functions ¶
func GetOutboundIP ¶
Types ¶
type Gateway ¶
type Gateway struct {
// contains filtered or unexported fields
}
func (*Gateway) CreateBackend ¶
func (g *Gateway) CreateBackend(vsID, rsID string, options *RealOptions) error
CreateBackend registers a new backend with the virtual service.
func (*Gateway) CreateService ¶
func (g *Gateway) CreateService(vsID string, options *ServiceOptions) error
CreateService registers a new virtual service with IPVS.
func (*Gateway) GetMetrics ¶
Metrics returns some metrics for a given virtual service.
func (*Gateway) RemoveBackend ¶
func (g *Gateway) RemoveBackend(vsID, rsID string) (*RealOptions, error)
RemoveBackend deregisters a backend from the virtual service.
func (*Gateway) RemoveService ¶
func (g *Gateway) RemoveService(vsID string) (*ServiceOptions, error)
RemoveService deregisters a virtual service.
type Metrics ¶
type Metrics struct { Connections uint64 InPackets uint64 OutPackets uint64 InBytes uint64 OutBytes uint64 ConnectionsPerSecond uint64 InPacketsPerSecond uint64 OutPacketsPerSecond uint64 InBytesPerSecond uint64 OutBytesPerSecond uint64 }
Metrics describes a virtual service metrics.
type PortPool ¶
type PortPool struct {
// contains filtered or unexported fields
}
func NewPortPool ¶
type RealOptions ¶
type RealOptions struct { Host string Port uint16 Weight int32 VsID string // contains filtered or unexported fields }
RealOptions describe a virtual service real.
func NewRealOptions ¶
NewRealOptions constructs new real service options.
type Router ¶ added in v0.4.1
type Router interface { // Register registers a new virtual service specified by the given ID. Register(ID string, protocol string) (VirtualService, error) // Deregister deregisters a virtual service specified by the given ID. Deregister(ID string) error // GetMetrics returns gateway-specific metrics. GetMetrics() (*Metrics, error) // Close closes the router, freeing all associated resources. Close() error }
type ServiceOptions ¶
type ServiceOptions struct { Host string Port uint16 Protocol string Method string Persistent bool // contains filtered or unexported fields }
ServiceOptions describe a virtual service.
func NewServiceOptions ¶
func NewServiceOptions(host string, port uint16, protocol string) (*ServiceOptions, error)
NewServiceOptions constructs new virtual service options.
type VirtualService ¶ added in v0.4.1
type VirtualService interface { // ID returns this virtual service's ID. ID() string // AddReal registers a new real service endpoint under the current virtual // service. // Host parameter may be both FQDN and IP address. AddReal(ID string, host string, port uint16) (*Route, error) // RemoveReal removes the real service specified by the ID from the // current virtual service. // Established connections won't be affected. RemoveReal(ID string) error }
VirtualService describes a virtual service.
Click to show internal directories.
Click to hide internal directories.