network

package
v0.0.0-...-250839a Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2020 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const TIME_LAYOUT = "2006-01-02 15:04:05.999999999 -0700 MST"

Variables

This section is empty.

Functions

func AllocateIP

func AllocateIP(netname string, VMName string, mac string) (net.IP, error)

func CreateNetwork

func CreateNetwork(name, subnet, gateway string, isIsolated bool) error

func DeleteNetwork

func DeleteNetwork(networkName string, force bool) error

func GetGateWay

func GetGateWay(netname string) (string, error)

func GetHosts

func GetHosts(netname string) ([]string, error)

func GetPrefix

func GetPrefix(netname string) (int, error)

func Init

func Init() error

func InspectNetwork

func InspectNetwork(networkName string) (string, error)

func ListNetwork

func ListNetwork() []*pb.NetworkInfo

func RegisterIP

func RegisterIP(netname string, VMName string, ipaddr net.IP, mac string) error

func ReleaseIP

func ReleaseIP(netname string, VMName string, ipaddr net.IP) error

Types

type BridgeNetworkDriver

type BridgeNetworkDriver struct {
	BridgeName string
	IP         net.IP
	Mask       net.IPMask
	IsIsolated bool
}

func (*BridgeNetworkDriver) Create

func (d *BridgeNetworkDriver) Create(IpRange *net.IPNet) error

func (*BridgeNetworkDriver) Name

func (d *BridgeNetworkDriver) Name() string

type IPAM

type IPAM struct {
	SubnetAllocatorPath string
	Subnets             map[string]string
}

func (*IPAM) Init

func (ipam *IPAM) Init() error

type Network

type Network struct {
	Name       string
	Subnet     *net.IPNet
	Driver     string
	CreateTime time.Time
	GateWay    net.IP
	IsIsolated bool
}

type NetworkConf

type NetworkConf struct {
	Gateway string
	Subnet  string
}

type NetworkDriver

type NetworkDriver interface {
	Name() string
	Create(IpRange *net.IPNet) error
}

type NetworkInfo

type NetworkInfo struct {
	Name       string
	Driver     string
	CreateTime string
	Config     NetworkConf
}

func GetNetworkInfo

func GetNetworkInfo(netname string) *NetworkInfo

返回一个network的信息,如果没有则返回nil

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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