Documentation ¶
Index ¶
- Constants
- func AddIpAddress(ifName string, ipAddress net.IP, ipNet *net.IPNet) error
- func AddIpRoute(route *Route) error
- func AddLink(link Link) error
- func DeleteIpAddress(ifName string, ipAddress net.IP, ipNet *net.IPNet) error
- func DeleteIpRoute(route *Route) error
- func DeleteLink(name string) error
- func Echo(text string) error
- func GetIpAddressFamily(ip net.IP) int
- func ResetSocket()
- func SetLinkAddress(ifName string, hwAddress net.HardwareAddr) error
- func SetLinkHairpin(bridgeName string, on bool) error
- func SetLinkMaster(name string, master string) error
- func SetLinkName(name string, newName string) error
- func SetLinkNetNs(name string, fd uintptr) error
- func SetLinkPromisc(ifName string, on bool) error
- func SetLinkState(name string, up bool) error
- type BridgeLink
- type DummyLink
- type IPVlanLink
- type IPVlanMode
- type Link
- type LinkInfo
- type Route
- type VEthLink
Constants ¶
const ( LINK_TYPE_BRIDGE = "bridge" LINK_TYPE_VETH = "veth" LINK_TYPE_IPVLAN = "ipvlan" LINK_TYPE_DUMMY = "dummy" )
Link types.
const ( IFLA_INFO_KIND = 1 IFLA_INFO_DATA = 2 IFLA_NET_NS_FD = 28 IFLA_IPVLAN_MODE = 1 IFLA_BRPORT_MODE = 4 VETH_INFO_PEER = 1 DEFAULT_CHANGE = 0xFFFFFFFF )
Netlink protocol constants that are not already defined in unix package.
Variables ¶
This section is empty.
Functions ¶
func AddIpAddress ¶
AddIpAddress adds an IP address to a network interface.
func AddIpRoute ¶
AddIpRoute adds an IP route to the route table.
func DeleteIpAddress ¶
DeleteIpAddress deletes an IP address from a network interface.
func DeleteIpRoute ¶
DeleteIpRoute deletes an IP route from the route table.
func GetIpAddressFamily ¶
GetIpAddressFamily returns the address family of an IP address.
func SetLinkAddress ¶
func SetLinkAddress(ifName string, hwAddress net.HardwareAddr) error
SetLinkAddress sets the link layer hardware address of a network interface.
func SetLinkHairpin ¶
SetLinkHairpin sets the hairpin (reflective relay) mode of a bridged interface.
func SetLinkMaster ¶
SetLinkMaster sets the master (upper) device of a network interface.
func SetLinkName ¶
SetLinkName sets the name of a network interface.
func SetLinkNetNs ¶
SetLinkNetNs sets the network namespace of a network interface.
func SetLinkPromisc ¶
SetLinkPromisc sets the promiscuous mode of a network interface.
func SetLinkState ¶
SetLinkState sets the operational state of a network interface.
Types ¶
type IPVlanLink ¶
type IPVlanLink struct { LinkInfo Mode IPVlanMode }
IPVlanLink represents an IPVlan network interface.
type IPVlanMode ¶
type IPVlanMode uint16
IPVLAN link attributes.
const ( IPVLAN_MODE_L2 IPVlanMode = iota IPVLAN_MODE_L3 IPVLAN_MODE_L3S IPVLAN_MODE_MAX )
type LinkInfo ¶
type LinkInfo struct { Type string Name string Flags net.Flags MTU uint TxQLen uint ParentIndex int }
LinkInfo respresents the common properties of all network interfaces.
type Route ¶
type Route struct { Family int Dst *net.IPNet Src net.IP Gw net.IP Tos int Table int Protocol int Scope int Type int Flags int Priority int LinkIndex int ILinkIndex int }
Route represents a netlink route.
func GetIpRoute ¶
GetIpRoute returns a list of IP routes matching the given filter.