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 AddOrRemoveStaticArp(mode int, name string, ipaddr net.IP, mac net.HardwareAddr) 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 ( ADD = iota REMOVE )
const ( NDA_UNSPEC = iota NDA_DST NDA_LLADDR NDA_CACHEINFO NDA_PROBES NDA_VLAN NDA_PORT NDA_VNI NDA_IFINDEX NDA_MAX = NDA_IFINDEX )
const ( NUD_NONE = 0x00 NUD_INCOMPLETE = 0x01 NUD_REACHABLE = 0x02 NUD_STALE = 0x04 NUD_DELAY = 0x08 NUD_PROBE = 0x10 NUD_FAILED = 0x20 NUD_NOARP = 0x40 NUD_PERMANENT = 0x80 )
Neighbor Cache Entry States.
const ( NTF_USE = 0x01 NTF_SELF = 0x02 NTF_MASTER = 0x04 NTF_PROXY = 0x08 NTF_ROUTER = 0x80 )
Neighbor Flags
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 AddOrRemoveStaticArp ¶ added in v1.0.15
AddOrRemoveStaticArp sets/removes static arp entry based on mode
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.