utils

package
v0.0.0-...-d2980c9 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2018 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const ETCDPrefix string = "/ovs-cni/networks/"

Variables

This section is empty.

Functions

func ConnectETCD

func ConnectETCD(config *IPMConfig) (*clientv3.Client, error)

func DeleteKey

func DeleteKey(cli *clientv3.Client, prefix string) error

func GetIPByInt

func GetIPByInt(ip net.IP, n uint32) net.IP

func GetKeyValuesWithPrefix

func GetKeyValuesWithPrefix(cli *clientv3.Client, key string) (map[string]string, error)

func GetNextIP

func GetNextIP(ipn *net.IPNet) net.IP

We use the first IP as gateway address

func IntToIP

func IntToIP(nn uint32) net.IP

func IpToInt

func IpToInt(ip net.IP) (uint32, error)

func PowTwo

func PowTwo(times int) uint32

func PutValue

func PutValue(cli *clientv3.Client, prefix, value string) error

Types

type CentralIPM

type CentralIPM interface {
	GetGateway() (string, error)
	GetAvailableIP() (string, *net.IPNet, error)
	Delete() error
}

type IPMConfig

type IPMConfig struct {
	Type                  string `json:"type"`
	IPType                string `json:"ipType"`
	Network               string `json:"network"`
	SubnetLen             int    `json:"subnetLen"`
	SubnetMin             string `json:"subnetMin"`
	SubnetMax             string `json:"subnetMax"`
	ETCDURL               string `json:"etcdURL"`
	ETCDCertFile          string `json:"etcdCertFile"`
	ETCDKeyFile           string `json:"etcdKeyFile"`
	ETCDTrustedCAFileFile string `json:"etcdTrustedCAFileFile"`
}

Jump to

Keyboard shortcuts

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