Documentation ¶
Overview ¶
Author: jsing@google.com (Joel Sing)
Index ¶
- Constants
- func Init(s *storm.DB) error
- func InitStore(s *storm.DB) error
- type Destination
- type IpvsKernel
- func (k *IpvsKernel) AddDestination(svc gipvs.Service, dst gipvs.Destination) error
- func (k *IpvsKernel) AddService(svc *gipvs.Service) error
- func (k *IpvsKernel) DeleteDestination(svc gipvs.Service, dst gipvs.Destination) error
- func (k *IpvsKernel) DeleteService(svc *gipvs.Service) error
- func (k *IpvsKernel) Flush() error
- func (k *IpvsKernel) GetServices() ([]*gipvs.Service, error)
- type IpvsStore
- func (s *IpvsStore) AddDestination(dst *Destination) error
- func (s *IpvsStore) AddService(svc *Service) error
- func (s *IpvsStore) DeleteDestination(dst *Destination) error
- func (s *IpvsStore) DeleteService(svc *Service) error
- func (s *IpvsStore) GetDestination(name string) (*Destination, error)
- func (s *IpvsStore) GetService(name string) (*Service, error)
- func (s *IpvsStore) GetServices() (*[]Service, error)
- type Service
Constants ¶
const ( NatMode = gipvs.DFForwardMasq TunnelMode = gipvs.DFForwardTunnel RouteMode = gipvs.DFForwardRoute )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Destination ¶
type Destination struct { Id string `storm:"id"` Name string `storm:"unique"` Host string `valid:"required"` Port uint16 `valid:"required"` Weight int32 Mode string `valid:"required"` ServiceId string `storm:"index" valid:"required"` }
func (Destination) GetId ¶
func (dst Destination) GetId() string
func (Destination) ToIpvsDestination ¶
func (d Destination) ToIpvsDestination() *gipvs.Destination
func (Destination) ToJson ¶
func (d Destination) ToJson() ([]byte, error)
type IpvsKernel ¶
type IpvsKernel struct{}
var Kernel *IpvsKernel
func (*IpvsKernel) AddDestination ¶
func (k *IpvsKernel) AddDestination(svc gipvs.Service, dst gipvs.Destination) error
IPVSAddDestination adds the specified destination to the IPVS table.
func (*IpvsKernel) AddService ¶
func (k *IpvsKernel) AddService(svc *gipvs.Service) error
IPVSGetService gets the currently configured service from the IPVS table, which matches the specified service.
func (k *IpvsKernel) IPVSGetService(svc gipvs.Service) (error) { mt.Lock() defer mt.Unlock() so, err := gipvs.GetService(svc) if err != nil { return err } s.Services = []*gipvs.Service{so} return nil }
// IPVSAddService adds the specified service to the IPVS table.
func (*IpvsKernel) DeleteDestination ¶
func (k *IpvsKernel) DeleteDestination(svc gipvs.Service, dst gipvs.Destination) error
// IPVSUpdateDestination updates the specified destination in the IPVS table.
func (k *IpvsKernel) IPVSUpdateDestination(dst *ncctypes.IPVSDestination, out *int) error { mt.Lock() defer mt.Unlock() return gipvs.UpdateDestination(*dst.Service, *dst.Destination) }
// IPVSDeleteDestination deletes the specified destination from the IPVS table.
func (*IpvsKernel) DeleteService ¶
func (k *IpvsKernel) DeleteService(svc *gipvs.Service) error
// IPVSUpdateService updates the specified service in the IPVS table.
func (k *IpvsKernel) IPVSUpdateService(svc *gipvs.Service, out *int) error { mt.Lock() defer mt.Unlock() return gipvs.UpdateService(*svc) }
IPVSDeleteService deletes the specified service from the IPVS table.
func (*IpvsKernel) Flush ¶
func (k *IpvsKernel) Flush() error
IPVSFlush flushes all services and destinations from the IPVS table.
func (*IpvsKernel) GetServices ¶
func (k *IpvsKernel) GetServices() ([]*gipvs.Service, error)
IPVSGetServices gets the currently configured services from the IPVS table.
type IpvsStore ¶
type IpvsStore struct {
// contains filtered or unexported fields
}
var Store *IpvsStore
func (*IpvsStore) AddDestination ¶
func (s *IpvsStore) AddDestination(dst *Destination) error
func (*IpvsStore) AddService ¶
func (*IpvsStore) DeleteDestination ¶
func (s *IpvsStore) DeleteDestination(dst *Destination) error
func (*IpvsStore) DeleteService ¶
func (*IpvsStore) GetDestination ¶
func (s *IpvsStore) GetDestination(name string) (*Destination, error)
func (*IpvsStore) GetServices ¶
type Service ¶
type Service struct { Id string `storm:"id"` Name string `storm:"unique"` Host string Port uint16 `valid:"required"` Protocol string `valid:"required"` Scheduler string `valid:"required"` Destinations []Destination }