Documentation ¶
Index ¶
- Constants
- Variables
- func AddToBridge(iface, master *net.Interface) error
- func AddToLinuxBridge(iface, master *net.Interface) error
- func AddToOpenvswitchBridge(iface, master *net.Interface) error
- func CreateBridgeIface(name string) error
- func DeleteBridge(name string) error
- func GenRandomMac() (string, error)
- func GetIfaceAddr(name string) (net.Addr, error)
- func InitNetwork(bIface, bIP string, disable bool) error
- func Modprobe(module string) error
- func NetworkLinkAddIp(iface *net.Interface, ip net.IP, ipNet *net.IPNet) error
- func NetworkLinkDelIp(iface *net.Interface, ip net.IP, ipNet *net.IPNet) error
- func NetworkLinkDown(iface *net.Interface) error
- func NetworkLinkUp(iface *net.Interface) error
- func Release(vmId, releasedIP string, maps []pod.UserContainerPort, file *os.File) error
- func ReleasePortMaps(containerip string, maps []pod.UserContainerPort) error
- func SetupPortMaps(containerip string, maps []pod.UserContainerPort) error
- func UpAndAddToBridge(name string) error
- type IfAddr
- type IfAddrmsg
- type IfInfomsg
- type NetlinkRequest
- type NetlinkRequestData
- type NetlinkSocket
- func (s *NetlinkSocket) CheckMessage(m syscall.NetlinkMessage, seq, pid uint32) error
- func (s *NetlinkSocket) Close()
- func (s *NetlinkSocket) GetPid() (uint32, error)
- func (s *NetlinkSocket) HandleAck(seq uint32) error
- func (s *NetlinkSocket) Receive() ([]syscall.NetlinkMessage, error)
- func (s *NetlinkSocket) Send(request *NetlinkRequest) error
- type RtAttr
- type Settings
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 ¶
AddToBridge attch interface to the bridge, we only support ovs bridge and linux bridge at present.
func AddToLinuxBridge ¶ added in v0.7.0
func AddToOpenvswitchBridge ¶ added in v0.7.0
func CreateBridgeIface ¶
Create the actual bridge device. This is more backward-compatible than netlink and works on RHEL 6.
func DeleteBridge ¶
func GenRandomMac ¶
func GetIfaceAddr ¶
Return the first IPv4 address for the specified network interface
func InitNetwork ¶
func NetworkLinkAddIp ¶
func NetworkLinkDelIp ¶
Delete an IP address from an interface. This is identical to: ip addr del $ip/$ipNet dev $iface
func NetworkLinkDown ¶
Bring down a particular network interface. This is identical to running: ip link set $name down
func NetworkLinkUp ¶
Bring up a particular network interface. This is identical to running: ip link set dev $name up
func ReleasePortMaps ¶
func ReleasePortMaps(containerip string, maps []pod.UserContainerPort) error
func SetupPortMaps ¶
func SetupPortMaps(containerip string, maps []pod.UserContainerPort) error
func UpAndAddToBridge ¶
Types ¶
type IfAddrmsg ¶
func (*IfAddrmsg) ToWireFormat ¶
type IfInfomsg ¶
func (*IfInfomsg) ToWireFormat ¶
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 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 ¶
func (*RtAttr) ToWireFormat ¶
type Settings ¶
type Settings struct { Mac string IPAddress string IPPrefixLen int Gateway string Bridge string Device string File *os.File Automatic bool }
func Configure ¶
func Configure(vmId, requestedIP string, addrOnly bool, maps []pod.UserContainerPort, config pod.UserInterface) (*Settings, error)
Click to show internal directories.
Click to hide internal directories.