network

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2016 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultBridgeIface = "hyper0"
	DefaultBridgeIP    = "192.168.123.0/24"
)
View Source
const (
	IFNAMSIZ       = 16
	DEFAULT_CHANGE = 0xFFFFFFFF
	SIOC_BRADDBR   = 0x89a0
	SIOC_BRDELBR   = 0x89a1
	SIOC_BRADDIF   = 0x89a2
	CIFF_TAP       = 0x0002
	CIFF_NO_PI     = 0x1000
	CIFF_ONE_QUEUE = 0x2000
)

Variables

View Source
var (
	IpAllocator   = ipallocator.New()
	PortMapper    = portmapper.New()
	BridgeIPv4Net *net.IPNet
	BridgeIface   string
	BridgeIP      string
)

Functions

func AddToBridge

func AddToBridge(iface, master *net.Interface) error

AddToBridge attch interface to the bridge, we only support ovs bridge and linux bridge at present.

func AddToLinuxBridge added in v0.7.0

func AddToLinuxBridge(iface, master *net.Interface) error

func AddToOpenvswitchBridge added in v0.7.0

func AddToOpenvswitchBridge(iface, master *net.Interface) error

func CreateBridgeIface

func CreateBridgeIface(name string) error

Create the actual bridge device. This is more backward-compatible than netlink and works on RHEL 6.

func DeleteBridge

func DeleteBridge(name string) error

func GenRandomMac

func GenRandomMac() (string, error)

func GetIfaceAddr

func GetIfaceAddr(name string) (net.Addr, error)

Return the first IPv4 address for the specified network interface

func InitNetwork

func InitNetwork(bIface, bIP string, disable bool) error

func Modprobe

func Modprobe(module string) error

func NetworkLinkAddIp

func NetworkLinkAddIp(iface *net.Interface, ip net.IP, ipNet *net.IPNet) error

func NetworkLinkDelIp

func NetworkLinkDelIp(iface *net.Interface, ip net.IP, ipNet *net.IPNet) error

Delete an IP address from an interface. This is identical to: ip addr del $ip/$ipNet dev $iface

func NetworkLinkDown

func NetworkLinkDown(iface *net.Interface) error

Bring down a particular network interface. This is identical to running: ip link set $name down

func NetworkLinkUp

func NetworkLinkUp(iface *net.Interface) error

Bring up a particular network interface. This is identical to running: ip link set dev $name up

func Release

func Release(vmId, releasedIP string, maps []pod.UserContainerPort, file *os.File) error

Release an interface for a select ip

func ReleasePortMaps

func ReleasePortMaps(containerip string, maps []pod.UserContainerPort) error

func SetupPortMaps

func SetupPortMaps(containerip string, maps []pod.UserContainerPort) error

func UpAndAddToBridge

func UpAndAddToBridge(name string) error

Types

type IfAddr

type IfAddr struct {
	// contains filtered or unexported fields
}

type IfAddrmsg

type IfAddrmsg struct {
	syscall.IfAddrmsg
}

func (*IfAddrmsg) Len

func (msg *IfAddrmsg) Len() int

func (*IfAddrmsg) ToWireFormat

func (msg *IfAddrmsg) ToWireFormat() []byte

type IfInfomsg

type IfInfomsg struct {
	syscall.IfInfomsg
}

func (*IfInfomsg) Len

func (msg *IfInfomsg) Len() int

func (*IfInfomsg) ToWireFormat

func (msg *IfInfomsg) ToWireFormat() []byte

type NetlinkRequest

type NetlinkRequest struct {
	syscall.NlMsghdr
	Data []NetlinkRequestData
}

func (*NetlinkRequest) AddData

func (rr *NetlinkRequest) AddData(data NetlinkRequestData)

func (*NetlinkRequest) ToWireFormat

func (rr *NetlinkRequest) ToWireFormat() []byte

type NetlinkRequestData

type NetlinkRequestData interface {
	Len() int
	ToWireFormat() []byte
}

type NetlinkSocket

type NetlinkSocket struct {
	// contains filtered or unexported fields
}

func (*NetlinkSocket) CheckMessage

func (s *NetlinkSocket) CheckMessage(m syscall.NetlinkMessage, seq, pid uint32) error

func (*NetlinkSocket) Close

func (s *NetlinkSocket) Close()

func (*NetlinkSocket) GetPid

func (s *NetlinkSocket) GetPid() (uint32, error)

func (*NetlinkSocket) HandleAck

func (s *NetlinkSocket) HandleAck(seq uint32) error

func (*NetlinkSocket) Receive

func (s *NetlinkSocket) Receive() ([]syscall.NetlinkMessage, error)

func (*NetlinkSocket) Send

func (s *NetlinkSocket) Send(request *NetlinkRequest) error

type RtAttr

type RtAttr struct {
	syscall.RtAttr
	Data []byte
	// contains filtered or unexported fields
}

func (*RtAttr) Len

func (a *RtAttr) Len() int

func (*RtAttr) ToWireFormat

func (a *RtAttr) ToWireFormat() []byte

type Settings

type Settings struct {
	Mac         string
	IPAddress   string
	IPPrefixLen int
	Gateway     string
	Bridge      string
	Device      string
	File        *os.File
	Automatic   bool
}

func Allocate

func Allocate(vmId, requestedIP string, addrOnly bool, maps []pod.UserContainerPort) (*Settings, error)

func Configure

func Configure(vmId, requestedIP string, addrOnly bool,
	maps []pod.UserContainerPort, config pod.UserInterface) (*Settings, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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