ipvs

package
v0.0.0-...-c5683e2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 21, 2016 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Author: jsing@google.com (Joel Sing)

Index

Constants

View Source
const (
	NatMode    = gipvs.DFForwardMasq
	TunnelMode = gipvs.DFForwardTunnel
	RouteMode  = gipvs.DFForwardRoute
)

Variables

This section is empty.

Functions

func Init

func Init(s *storm.DB) error

func InitStore

func InitStore(s *storm.DB) error

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 (s *IpvsStore) AddService(svc *Service) error

func (*IpvsStore) DeleteDestination

func (s *IpvsStore) DeleteDestination(dst *Destination) error

func (*IpvsStore) DeleteService

func (s *IpvsStore) DeleteService(svc *Service) error

func (*IpvsStore) GetDestination

func (s *IpvsStore) GetDestination(name string) (*Destination, error)

func (*IpvsStore) GetService

func (s *IpvsStore) GetService(name string) (*Service, error)

func (*IpvsStore) GetServices

func (s *IpvsStore) GetServices() (*[]Service, error)

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
}

func NewService

func NewService(s *gipvs.Service) Service

func (Service) GetId

func (svc Service) GetId() string

func (Service) ToIpvsService

func (s Service) ToIpvsService() *gipvs.Service

func (Service) ToJson

func (s Service) ToJson() ([]byte, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL