Movatterモバイル変換


[0]ホーム

URL:


netlink

packagemodule
v1.3.1Latest Latest
Warning

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

Go to latest
Published: May 9, 2025 License:Apache-2.0Imports:21Imported by:7,297

Details

Repository

github.com/vishvananda/netlink

Links

README

netlink - netlink library for go

Build StatusGoDoc

The netlink package provides a simple netlink library for go. Netlinkis the interface a user-space program in linux uses to communicate withthe kernel. It can be used to add and remove interfaces, set ip addressesand routes, and configure ipsec. Netlink communication requires elevatedprivileges, so in most cases this code needs to be run as root. Sincelow-level netlink messages are inscrutable at best, the library attemptsto provide an api that is loosely modeled on the CLI provided by iproute2.Actions likeip link add will be accomplished via a similarly namedfunction like AddLink(). This library began its life as a fork of thenetlink functionality indocker/libcontainer but washeavily rewritten to improve testability, performance, and to add newfunctionality like ipsec xfrm handling.

Local Build and Test

You can use go get command:

go get github.com/vishvananda/netlink

Testing dependencies:

go get github.com/vishvananda/netns

Testing (requires root):

sudo -E go test github.com/vishvananda/netlink

Examples

Add a new bridge and add eth1 into it:

package mainimport (    "fmt"    "github.com/vishvananda/netlink")func main() {    la := netlink.NewLinkAttrs()    la.Name = "foo"    mybridge := &netlink.Bridge{LinkAttrs: la}    err := netlink.LinkAdd(mybridge)    if err != nil  {        fmt.Printf("could not add %s: %v\n", la.Name, err)    }    eth1, _ := netlink.LinkByName("eth1")    netlink.LinkSetMaster(eth1, mybridge)}

NoteNewLinkAttrs constructor, it sets default values in structure. For nowit sets onlyTxQLen to-1, so kernel will set default by itself. If you'reusing simple initialization(LinkAttrs{Name: "foo"})TxQLen will be set to0 unless you specify it likeLinkAttrs{Name: "foo", TxQLen: 1000}.

Add a new ip address to loopback:

package mainimport (    "github.com/vishvananda/netlink")func main() {    lo, _ := netlink.LinkByName("lo")    addr, _ := netlink.ParseAddr("169.254.169.254/32")    netlink.AddrAdd(lo, addr)}

Future Work

Many pieces of netlink are not yet fully supported in the high-levelinterface. Aspects of virtually all of the high-level objects don't exist.Many of the underlying primitives are there, so its a matter of puttingthe right fields into the high-level objects and making sure that theyare serialized and deserialized correctly in the Add and List methods.

There are also a few pieces of low level netlink functionality that stillneed to be implemented. Routing rules are not in place and some of themore advanced link types. Hopefully there is decent structure and testingin place to make these fairly straightforward to add.

Documentation

Overview

Package netlink provides a simple library for netlink. Netlink isthe interface a user-space program in linux uses to communicate withthe kernel. It can be used to add and remove interfaces, set up ipaddresses and routes, and confiugre ipsec. Netlink communicationrequires elevated privileges, so in most cases this code needs tobe run as root. The low level primitives for netlink are containedin the nl subpackage. This package attempts to provide a high-levelinterface that is loosly modeled on the iproute2 cli.

Index

Constants

View Source
const (// ConntrackTable Conntrack table//https://github.com/torvalds/linux/blob/master/include/uapi/linux/netfilter/nfnetlink.h -> #define NFNL_SUBSYS_CTNETLINK 1ConntrackTable = 1// ConntrackExpectTable Conntrack expect table//https://github.com/torvalds/linux/blob/master/include/uapi/linux/netfilter/nfnetlink.h -> #define NFNL_SUBSYS_CTNETLINK_EXP 2ConntrackExpectTable = 2)
View Source
const (ConntrackOrigSrcIP     =iota// -orig-src ip    Source address from original directionConntrackOrigDstIP// -orig-dst ip    Destination address from original directionConntrackReplySrcIP// --reply-src ip  Reply Source IPConntrackReplyDstIP// --reply-dst ip  Reply Destination IPConntrackReplyAnyIP// Match source or destination reply IPConntrackOrigSrcPort// --orig-port-src port    Source port in original directionConntrackOrigDstPort// --orig-port-dst port    Destination port in original directionConntrackMatchLabels// --label label1,label2   Labels used in entryConntrackUnmatchLabels// --label label1,label2   Labels not used in entryConntrackNatSrcIP      =ConntrackReplySrcIP// deprecated use instead ConntrackReplySrcIPConntrackNatDstIP      =ConntrackReplyDstIP// deprecated use instead ConntrackReplyDstIPConntrackNatAnyIP      =ConntrackReplyAnyIP// deprecated use instead ConntrackReplyAnyIP)
View Source
const (TC_ACT_EXT_SHIFT    = 28TC_ACT_EXT_VAL_MASK = (1 <<TC_ACT_EXT_SHIFT) - 1)
View Source
const (TC_U32_TERMINAL  =nl.TC_U32_TERMINALTC_U32_OFFSET    =nl.TC_U32_OFFSETTC_U32_VAROFFSET =nl.TC_U32_VAROFFSETTC_U32_EAT       =nl.TC_U32_EAT)

Constants used in TcU32Sel.Flags.

View Source
const (FOU_CMD_UNSPECuint8 =iotaFOU_CMD_ADDFOU_CMD_DELFOU_CMD_GETFOU_CMD_MAX =FOU_CMD_GET)
View Source
const (FOU_ATTR_UNSPEC =iotaFOU_ATTR_PORTFOU_ATTR_AFFOU_ATTR_IPPROTOFOU_ATTR_TYPEFOU_ATTR_REMCSUM_NOPARTIALFOU_ATTR_LOCAL_V4FOU_ATTR_LOCAL_V6FOU_ATTR_PEER_V4FOU_ATTR_PEER_V6FOU_ATTR_PEER_PORTFOU_ATTR_IFINDEXFOU_ATTR_MAX =FOU_ATTR_REMCSUM_NOPARTIAL)
View Source
const (FOU_ENCAP_UNSPEC =iotaFOU_ENCAP_DIRECTFOU_ENCAP_GUEFOU_ENCAP_MAX =FOU_ENCAP_GUE)
View Source
const (INET_DIAG_NONE =iotaINET_DIAG_MEMINFOINET_DIAG_INFOINET_DIAG_VEGASINFOINET_DIAG_CONGINET_DIAG_TOSINET_DIAG_TCLASSINET_DIAG_SKMEMINFOINET_DIAG_SHUTDOWNINET_DIAG_DCTCPINFOINET_DIAG_PROTOCOLINET_DIAG_SKV6ONLYINET_DIAG_LOCALSINET_DIAG_PEERSINET_DIAG_PADINET_DIAG_MARKINET_DIAG_BBRINFOINET_DIAG_CLASS_IDINET_DIAG_MD5SIGINET_DIAG_ULP_INFOINET_DIAG_SK_BPF_STORAGESINET_DIAG_CGROUP_IDINET_DIAG_SOCKOPTINET_DIAG_MAX)

INET_DIAG constatns

View Source
const (// ETHTOOL_GSSET_INFO gets string set infoETHTOOL_GSSET_INFO = 0x00000037// SIOCETHTOOL is Ethtool interfaceSIOCETHTOOL = 0x8946// ETHTOOL_GSTRINGS gets specified string setETHTOOL_GSTRINGS = 0x0000001b// ETHTOOL_GSTATS gets NIC-specific statisticsETHTOOL_GSTATS = 0x0000001d)

ioctl for statistics.

View Source
const (// ETH_SS_TEST is self-test result names, for use with %ETHTOOL_TESTETH_SS_TEST =iota// ETH_SS_STATS statistic names, for use with %ETHTOOL_GSTATSETH_SS_STATS// ETH_SS_PRIV_FLAGS are driver private flag namesETH_SS_PRIV_FLAGS// ETH_SS_FEATURES are device feature namesETH_SS_FEATURES// ETH_SS_RSS_HASH_FUNCS is RSS hush function namesETH_SS_RSS_HASH_FUNCS)

string set id.

View Source
const (OperUnknown        =iota// Status can't be determined.OperNotPresent// Some component is missing.OperDown// Down.OperLowerLayerDown// Down due to state of lower layer.OperTesting// In some test mode.OperDormant// Not up but pending an external event.OperUp// Up, ready to send packets.)
View Source
const (BOND_MODE_MASKuint64 = 1 << (1 +iota)BOND_ACTIVE_SLAVE_MASKBOND_MIIMON_MASKBOND_UPDELAY_MASKBOND_DOWNDELAY_MASKBOND_USE_CARRIER_MASKBOND_ARP_INTERVAL_MASKBOND_ARP_VALIDATE_MASKBOND_ARP_ALL_TARGETS_MASKBOND_PRIMARY_MASKBOND_PRIMARY_RESELECT_MASKBOND_FAIL_OVER_MAC_MASKBOND_XMIT_HASH_POLICY_MASKBOND_RESEND_IGMP_MASKBOND_NUM_PEER_NOTIF_MASKBOND_ALL_SLAVES_ACTIVE_MASKBOND_MIN_LINKS_MASKBOND_LP_INTERVAL_MASKBOND_PACKETS_PER_SLAVE_MASKBOND_LACP_RATE_MASKBOND_AD_SELECT_MASK)

Flag mask for bond options. Bond.Flagmask must be set to on for option to work.

View Source
const (CSumTunnelEncapFlag = 1 << 0CSum6                   = 1 << 1RemCSum                 = 1 << 2)
View Source
const (IP6_TNL_F_IGN_ENCAP_LIMITIP6TunnelFlag = 1// don't add encapsulation limit if one isn't present in inner packetIP6_TNL_F_USE_ORIG_TCLASS                  = 2// copy the traffic class field from the inner packetIP6_TNL_F_USE_ORIG_FLOWLABEL               = 4// copy the flowlabel from the inner packetIP6_TNL_F_MIP6_DEV                         = 8// being used for Mobile IPv6IP6_TNL_F_RCV_DSCP_COPY                    = 10// copy DSCP from the outer packetIP6_TNL_F_USE_ORIG_FWMARK                  = 20// copy fwmark from inner packetIP6_TNL_F_ALLOW_LOCAL_REMOTE               = 40// allow remote endpoint on the local node)
View Source
const (IPOIB_MODE_DATAGRAM =iotaIPOIB_MODE_CONNECTED)
View Source
const (CAN_STATE_ERROR_ACTIVE =iotaCAN_STATE_ERROR_WARNINGCAN_STATE_ERROR_PASSIVECAN_STATE_BUS_OFFCAN_STATE_STOPPEDCAN_STATE_SLEEPING)
View Source
const (SizeofLinkStats32 = 0x5cSizeofLinkStats64 = 0xb8)
View Source
const (TUNTAP_MODE_TUNTuntapMode =unix.IFF_TUNTUNTAP_MODE_TAPTuntapMode =unix.IFF_TAPTUNTAP_DEFAULTSTuntapFlag =unix.IFF_TUN_EXCL |unix.IFF_ONE_QUEUETUNTAP_VNET_HDRTuntapFlag =unix.IFF_VNET_HDRTUNTAP_TUN_EXCLTuntapFlag =unix.IFF_TUN_EXCLTUNTAP_NO_PITuntapFlag =unix.IFF_NO_PITUNTAP_ONE_QUEUETuntapFlag =unix.IFF_ONE_QUEUETUNTAP_MULTI_QUEUETuntapFlag =unix.IFF_MULTI_QUEUETUNTAP_MULTI_QUEUE_DEFAULTSTuntapFlag =TUNTAP_MULTI_QUEUE |TUNTAP_NO_PI)
View Source
const (VF_LINK_STATE_AUTOuint32 = 0VF_LINK_STATE_ENABLEuint32 = 1VF_LINK_STATE_DISABLEuint32 = 2)
View Source
const (SizeOfIfReq = 40IFNAMSIZ    = 16)

ideally golang.org/x/sys/unix would define IfReq but it only hasIFNAMSIZ, hence this minimalistic implementation

View Source
const (NDA_UNSPEC =iotaNDA_DSTNDA_LLADDRNDA_CACHEINFONDA_PROBESNDA_VLANNDA_PORTNDA_VNINDA_IFINDEXNDA_MASTERNDA_LINK_NETNSIDNDA_SRC_VNINDA_PROTOCOLNDA_NH_IDNDA_FDB_EXT_ATTRSNDA_FLAGS_EXTNDA_MAX =NDA_FLAGS_EXT)
View Source
const (NUD_NONE       = 0x00NUD_INCOMPLETE = 0x01NUD_REACHABLE  = 0x02NUD_STALE      = 0x04NUD_DELAY      = 0x08NUD_PROBE      = 0x10NUD_FAILED     = 0x20NUD_NOARP      = 0x40NUD_PERMANENT  = 0x80)

Neighbor Cache Entry States.

View Source
const (NTF_USE         = 0x01NTF_SELF        = 0x02NTF_MASTER      = 0x04NTF_PROXY       = 0x08NTF_EXT_LEARNED = 0x10NTF_OFFLOADED   = 0x20NTF_STICKY      = 0x40NTF_ROUTER      = 0x80)

Neighbor Flags

View Source
const (FAMILY_ALL  =nl.FAMILY_ALLFAMILY_V4   =nl.FAMILY_V4FAMILY_V6   =nl.FAMILY_V6FAMILY_MPLS =nl.FAMILY_MPLS)

Family type definitions

View Source
const (NETNSA_NSIDNETNSA_PIDNETNSA_FD)

These can be replaced by the values from sys/unix when it is next released.

View Source
const (PROC_EVENT_NONE     = 0x00000000PROC_EVENT_FORK     = 0x00000001PROC_EVENT_EXEC     = 0x00000002PROC_EVENT_UID      = 0x00000004PROC_EVENT_GID      = 0x00000040PROC_EVENT_SID      = 0x00000080PROC_EVENT_PTRACE   = 0x00000100PROC_EVENT_COMM     = 0x00000200PROC_EVENT_COREDUMP = 0x40000000PROC_EVENT_EXIT     = 0x80000000)
View Source
const (CN_VAL_PROC          = 0x1PROC_CN_MCAST_LISTEN = 0x1)
View Source
const (HANDLE_NONE      = 0HANDLE_INGRESS   = 0xFFFFFFF1HANDLE_CLSACT    =HANDLE_INGRESSHANDLE_ROOT      = 0xFFFFFFFFPRIORITY_MAP_LEN = 16)
View Source
const (HANDLE_MIN_INGRESS = 0xFFFFFFF2HANDLE_MIN_EGRESS  = 0xFFFFFFF3)
View Source
const (HORIZON_DROP_POLICY_CAP     = 0HORIZON_DROP_POLICY_DROP    = 1HORIZON_DROP_POLICY_DEFAULT = 255)
View Source
const (RT_FILTER_PROTOCOLuint64 = 1 << (1 +iota)RT_FILTER_SCOPERT_FILTER_TYPERT_FILTER_TOSRT_FILTER_IIFRT_FILTER_OIFRT_FILTER_DSTRT_FILTER_SRCRT_FILTER_GWRT_FILTER_TABLERT_FILTER_HOPLIMITRT_FILTER_PRIORITYRT_FILTER_MARKRT_FILTER_MASKRT_FILTER_REALM)
View Source
const (TCP_ESTABLISHED =iota + 0x01TCP_SYN_SENTTCP_SYN_RECVTCP_FIN_WAIT1TCP_FIN_WAIT2TCP_TIME_WAITTCP_CLOSETCP_CLOSE_WAITTCP_LAST_ACKTCP_LISTENTCP_CLOSINGTCP_NEW_SYN_RECTCP_MAX_STATES)

TCP States

View Source
const (UNIX_DIAG_NAME =iotaUNIX_DIAG_VFSUNIX_DIAG_PEERUNIX_DIAG_ICONSUNIX_DIAG_RQLENUNIX_DIAG_MEMINFOUNIX_DIAG_SHUTDOWNUNIX_DIAG_UIDUNIX_DIAG_MAX)

According to linux/include/uapi/linux/unix_diag.h

View Source
const (VIRTIO_NET_F_CSUM                = 0// Host handles pkts w/ partial csumVIRTIO_NET_F_GUEST_CSUM          = 1// Guest handles pkts w/ partial csumVIRTIO_NET_F_CTRL_GUEST_OFFLOADS = 2// Dynamic offload configuration.VIRTIO_NET_F_MTU                 = 3// Initial MTU adviceVIRTIO_NET_F_MAC                 = 5// Host has given MAC address.VIRTIO_NET_F_GUEST_TSO4          = 7// Guest can handle TSOv4 in.VIRTIO_NET_F_GUEST_TSO6          = 8// Guest can handle TSOv6 in.VIRTIO_NET_F_GUEST_ECN           = 9// Guest can handle TSO[6] w/ ECN in.VIRTIO_NET_F_GUEST_UFO           = 10// Guest can handle UFO in.VIRTIO_NET_F_HOST_TSO4           = 11// Host can handle TSOv4 in.VIRTIO_NET_F_HOST_TSO6           = 12// Host can handle TSOv6 in.VIRTIO_NET_F_HOST_ECN            = 13// Host can handle TSO[6] w/ ECN in.VIRTIO_NET_F_HOST_UFO            = 14// Host can handle UFO in.VIRTIO_NET_F_MRG_RXBUF           = 15// Host can merge receive buffers.VIRTIO_NET_F_STATUS              = 16// virtio_net_config.status availableVIRTIO_NET_F_CTRL_VQ             = 17// Control channel availableVIRTIO_NET_F_CTRL_RX             = 18// Control channel RX mode supportVIRTIO_NET_F_CTRL_VLAN           = 19// Control channel VLAN filteringVIRTIO_NET_F_CTRL_RX_EXTRA       = 20// Extra RX mode control supportVIRTIO_NET_F_GUEST_ANNOUNCE      = 21// Guest can announce device on the* networkVIRTIO_NET_F_MQ                  = 22// Device supports Receive Flow SteeringVIRTIO_NET_F_CTRL_MAC_ADDR       = 23// Set MAC addressVIRTIO_NET_F_VQ_NOTF_COAL        = 52// Device supports virtqueue notification coalescingVIRTIO_NET_F_NOTF_COAL           = 53// Device supports notifications coalescingVIRTIO_NET_F_GUEST_USO4          = 54// Guest can handle USOv4 in.VIRTIO_NET_F_GUEST_USO6          = 55// Guest can handle USOv6 in.VIRTIO_NET_F_HOST_USO            = 56// Host can handle USO in.VIRTIO_NET_F_HASH_REPORT         = 57// Supports hash reportVIRTIO_NET_F_GUEST_HDRLEN        = 59// Guest provides the exact hdr_len value.VIRTIO_NET_F_RSS                 = 60// Supports RSS RX steeringVIRTIO_NET_F_RSC_EXT             = 61// extended coalescing infoVIRTIO_NET_F_STANDBY             = 62// Act as standby for another device with the same MAC.VIRTIO_NET_F_SPEED_DUPLEX        = 63// Device set linkspeed and duplexVIRTIO_NET_F_GSO                 = 6// Host handles pkts any GSO type)

features for virtio net

View Source
const (VIRTIO_NET_S_LINK_UP  = 1// Link is upVIRTIO_NET_S_ANNOUNCE = 2// Announcement is needed)

virtio net status

View Source
const (// Do we get callbacks when the ring is completely used, even if we've// suppressed them?VIRTIO_F_NOTIFY_ON_EMPTY = 24// Can the device handle any descriptor layout?VIRTIO_F_ANY_LAYOUT = 27// v1.0 compliantVIRTIO_F_VERSION_1 = 32// If clear - device has the platform DMA (e.g. IOMMU) bypass quirk feature.// If set - use platform DMA tools to access the memory.// Note the reverse polarity (compared to most other features),// this is for compatibility with legacy systems.VIRTIO_F_ACCESS_PLATFORM = 33// Legacy name for VIRTIO_F_ACCESS_PLATFORM (for compatibility with old userspace)VIRTIO_F_IOMMU_PLATFORM =VIRTIO_F_ACCESS_PLATFORM// This feature indicates support for the packed virtqueue layout.VIRTIO_F_RING_PACKED = 34// Inorder feature indicates that all buffers are used by the device// in the same order in which they have been made available.VIRTIO_F_IN_ORDER = 35// This feature indicates that memory accesses by the driver and the// device are ordered in a way described by the platform.VIRTIO_F_ORDER_PLATFORM = 36// Does the device support Single Root I/O Virtualization?VIRTIO_F_SR_IOV = 37// This feature indicates that the driver passes extra data (besides// identifying the virtqueue) in its device notifications.VIRTIO_F_NOTIFICATION_DATA = 38// This feature indicates that the driver uses the data provided by the device// as a virtqueue identifier in available buffer notifications.VIRTIO_F_NOTIF_CONFIG_DATA = 39// This feature indicates that the driver can reset a queue individually.VIRTIO_F_RING_RESET = 40)

virtio config

View Source
const (VIRTIO_ID_NET            = 1// virtio netVIRTIO_ID_BLOCK          = 2// virtio blockVIRTIO_ID_CONSOLE        = 3// virtio consoleVIRTIO_ID_RNG            = 4// virtio rngVIRTIO_ID_BALLOON        = 5// virtio balloonVIRTIO_ID_IOMEM          = 6// virtio ioMemoryVIRTIO_ID_RPMSG          = 7// virtio remote processor messagingVIRTIO_ID_SCSI           = 8// virtio scsiVIRTIO_ID_9P             = 9// 9p virtio consoleVIRTIO_ID_MAC80211_WLAN  = 10// virtio WLAN MACVIRTIO_ID_RPROC_SERIAL   = 11// virtio remoteproc serial linkVIRTIO_ID_CAIF           = 12// Virtio caifVIRTIO_ID_MEMORY_BALLOON = 13// virtio memory balloonVIRTIO_ID_GPU            = 16// virtio GPUVIRTIO_ID_CLOCK          = 17// virtio clock/timerVIRTIO_ID_INPUT          = 18// virtio inputVIRTIO_ID_VSOCK          = 19// virtio vsock transportVIRTIO_ID_CRYPTO         = 20// virtio cryptoVIRTIO_ID_SIGNAL_DIST    = 21// virtio signal distribution deviceVIRTIO_ID_PSTORE         = 22// virtio pstore deviceVIRTIO_ID_IOMMU          = 23// virtio IOMMUVIRTIO_ID_MEM            = 24// virtio memVIRTIO_ID_SOUND          = 25// virtio soundVIRTIO_ID_FS             = 26// virtio filesystemVIRTIO_ID_PMEM           = 27// virtio pmemVIRTIO_ID_RPMB           = 28// virtio rpmbVIRTIO_ID_MAC80211_HWSIM = 29// virtio mac80211-hwsimVIRTIO_ID_VIDEO_ENCODER  = 30// virtio video encoderVIRTIO_ID_VIDEO_DECODER  = 31// virtio video decoderVIRTIO_ID_SCMI           = 32// virtio SCMIVIRTIO_ID_NITRO_SEC_MOD  = 33// virtio nitro secure moduleVIRTIO_ID_I2C_ADAPTER    = 34// virtio i2c adapterVIRTIO_ID_WATCHDOG       = 35// virtio watchdogVIRTIO_ID_CAN            = 36// virtio canVIRTIO_ID_DMABUF         = 37// virtio dmabufVIRTIO_ID_PARAM_SERV     = 38// virtio parameter serverVIRTIO_ID_AUDIO_POLICY   = 39// virtio audio policyVIRTIO_ID_BT             = 40// virtio bluetoothVIRTIO_ID_GPIO           = 41// virtio gpio// Virtio Transitional IDsVIRTIO_TRANS_ID_NET     = 0x1000// transitional virtio netVIRTIO_TRANS_ID_BLOCK   = 0x1001// transitional virtio blockVIRTIO_TRANS_ID_BALLOON = 0x1002// transitional virtio balloonVIRTIO_TRANS_ID_CONSOLE = 0x1003// transitional virtio consoleVIRTIO_TRANS_ID_SCSI    = 0x1004// transitional virtio SCSIVIRTIO_TRANS_ID_RNG     = 0x1005// transitional virtio rngVIRTIO_TRANS_ID_9P      = 0x1009// transitional virtio 9p console)

virtio device ids

View Source
const (XDP_SHOW_INFO = 1 <<iotaXDP_SHOW_RING_CFGXDP_SHOW_UMEMXDP_SHOW_MEMINFOXDP_SHOW_STATS)

XDP diagnosis show flag constants to request particular information elements.

View Source
const (XDP_DIAG_NONE                 =iotaXDP_DIAG_INFO// when using XDP_SHOW_INFOXDP_DIAG_UID// when using XDP_SHOW_INFOXDP_DIAG_RX_RING// when using XDP_SHOW_RING_CFGXDP_DIAG_TX_RING// when using XDP_SHOW_RING_CFGXDP_DIAG_UMEM// when using XDP_SHOW_UMEMXDP_DIAG_UMEM_FILL_RING// when using XDP_SHOW_UMEMXDP_DIAG_UMEM_COMPLETION_RING// when using XDP_SHOW_UMEMXDP_DIAG_MEMINFO// when using XDP_SHOW_MEMINFOXDP_DIAG_STATS// when using XDP_SHOW_STATS)

XDP diag element constants

View Source
const CN_IDX_PROC = 0x1
View Source
const (FOU_GENL_NAME = "fou")
View Source
const FibRuleInvert = 0x2
View Source
const (NTF_EXT_MANAGED = 0x00000001)

Extended Neighbor Flags

View Source
const (TIME_UNITS_PER_SEC = 1000000)
View Source
const TUN = "/dev/net/tun"
View Source
const (XDP_DU_F_ZEROCOPY = 1 <<iota)

Variables

View Source
var ErrDumpInterrupted =nl.ErrDumpInterrupted

ErrDumpInterrupted is an alias fornl.ErrDumpInterrupted.

View Source
var (// ErrNotImplemented is returned when a requested feature is not implemented.ErrNotImplemented =errors.New("not implemented"))
View Source
var StringToBondAdSelectMap = map[string]BondAdSelect{"stable":BOND_AD_SELECT_STABLE,"bandwidth":BOND_AD_SELECT_BANDWIDTH,"count":BOND_AD_SELECT_COUNT,}
View Source
var StringToBondArpAllTargetsMap = map[string]BondArpAllTargets{"any":BOND_ARP_ALL_TARGETS_ANY,"all":BOND_ARP_ALL_TARGETS_ALL,}
View Source
var StringToBondLacpRateMap = map[string]BondLacpRate{"slow":BOND_LACP_RATE_SLOW,"fast":BOND_LACP_RATE_FAST,}
View Source
var StringToBondModeMap = map[string]BondMode{"balance-rr":BOND_MODE_BALANCE_RR,"active-backup":BOND_MODE_ACTIVE_BACKUP,"balance-xor":BOND_MODE_BALANCE_XOR,"broadcast":BOND_MODE_BROADCAST,"802.3ad":BOND_MODE_802_3AD,"balance-tlb":BOND_MODE_BALANCE_TLB,"balance-alb":BOND_MODE_BALANCE_ALB,}
View Source
var StringToIPoIBMode = map[string]IPoIBMode{"datagram":IPOIB_MODE_DATAGRAM,"connected":IPOIB_MODE_CONNECTED,}
View Source
var StringToTuntapModeMap = map[string]TuntapMode{"tun":TUNTAP_MODE_TUN,"tap":TUNTAP_MODE_TAP,}
View Source
var StringToVlanProtocolMap = map[string]VlanProtocol{"802.1q":VLAN_PROTOCOL_8021Q,"802.1ad":VLAN_PROTOCOL_8021AD,}
View Source
var VlanProtocolToString = map[VlanProtocol]string{VLAN_PROTOCOL_8021Q:  "802.1q",VLAN_PROTOCOL_8021AD: "802.1ad",}

Functions

funcAddrAdd

func AddrAdd(linkLink, addr *Addr)error

AddrAdd will add an IP address to a link device.

Equivalent to: `ip addr add $addr dev $link`

If `addr` is an IPv4 address and the broadcast address is not given, itwill be automatically computed based on the IP mask if /30 or larger.If `net.IPv4zero` is given as the broadcast address, broadcast is disabled.

funcAddrDel

func AddrDel(linkLink, addr *Addr)error

AddrDel will delete an IP address from a link device.

Equivalent to: `ip addr del $addr dev $link`

funcAddrReplace

func AddrReplace(linkLink, addr *Addr)error

AddrReplace will replace (or, if not present, add) an IP address on a link device.

Equivalent to: `ip addr replace $addr dev $link`

If `addr` is an IPv4 address and the broadcast address is not given, itwill be automatically computed based on the IP mask if /30 or larger.If `net.IPv4zero` is given as the broadcast address, broadcast is disabled.

funcAddrSubscribe

func AddrSubscribe(ch chan<-AddrUpdate, done <-chan struct{})error

AddrSubscribe takes a chan down which notifications will be sentwhen addresses change. Close the 'done' chan to stop subscription.

funcAddrSubscribeAt

func AddrSubscribeAt(nsnetns.NsHandle, ch chan<-AddrUpdate, done <-chan struct{})error

AddrSubscribeAt works like AddrSubscribe plus it allows the callerto choose the network namespace in which to subscribe (ns).

funcAddrSubscribeWithOptions

func AddrSubscribeWithOptions(ch chan<-AddrUpdate, done <-chan struct{}, optionsAddrSubscribeOptions)error

AddrSubscribeWithOptions work like AddrSubscribe but enable toprovide additional options to modify the behavior. Currently, thenamespace can be provided as well as an error callback.

funcAdjustSize

func AdjustSize(szuint, mpuuint, linklayerint)uint

funcAlignToAtm

func AlignToAtm(sizeuint)uint

funcBridgeSetMcastSnoop

func BridgeSetMcastSnoop(linkLink, onbool)error

funcBridgeSetVlanDefaultPVIDadded inv1.2.1

func BridgeSetVlanDefaultPVID(linkLink, pviduint16)error

funcBridgeSetVlanFilteringadded inv1.2.1

func BridgeSetVlanFiltering(linkLink, onbool)error

funcBridgeVlanAdd

func BridgeVlanAdd(linkLink, viduint16, pvid, untagged, self, masterbool)error

BridgeVlanAdd adds a new vlan filter entryEquivalent to: `bridge vlan add dev DEV vid VID [ pvid ] [ untagged ] [ self ] [ master ]`

funcBridgeVlanAddRangeadded inv1.2.1

func BridgeVlanAddRange(linkLink, vid, vidEnduint16, pvid, untagged, self, masterbool)error

BridgeVlanAddRange adds a new vlan filter entryEquivalent to: `bridge vlan add dev DEV vid VID-VIDEND [ pvid ] [ untagged ] [ self ] [ master ]`

funcBridgeVlanAddRangeTunnelInfoRangeadded inv1.3.1

func BridgeVlanAddRangeTunnelInfoRange(linkLink, vid, vidEnduint16, tunid, tunidEnduint32, self, masterbool)error

BridgeVlanAddRangeTunnelInfoRange adds a new vlan filter entryEquivalent to: `bridge vlan add dev DEV vid VID-VIDEND tunnel_info id VIN-VINEND [ self ] [ master ]`

funcBridgeVlanAddTunnelInfoadded inv1.3.1

func BridgeVlanAddTunnelInfo(linkLink, viduint16, tuniduint32, self, masterbool)error

BridgeVlanAddTunnelInfo adds a new vlan filter entryEquivalent to: `bridge vlan add dev DEV vid VID tunnel_info id TUNID [ self ] [ master ]`

funcBridgeVlanDel

func BridgeVlanDel(linkLink, viduint16, pvid, untagged, self, masterbool)error

BridgeVlanDel adds a new vlan filter entryEquivalent to: `bridge vlan del dev DEV vid VID [ pvid ] [ untagged ] [ self ] [ master ]`

funcBridgeVlanDelRangeadded inv1.2.1

func BridgeVlanDelRange(linkLink, vid, vidEnduint16, pvid, untagged, self, masterbool)error

BridgeVlanDelRange adds a new vlan filter entryEquivalent to: `bridge vlan del dev DEV vid VID-VIDEND [ pvid ] [ untagged ] [ self ] [ master ]`

funcBridgeVlanDelRangeTunnelInfoRangeadded inv1.3.1

func BridgeVlanDelRangeTunnelInfoRange(linkLink, vid, vidEnduint16, tunid, tunidEnduint32, self, masterbool)error

BridgeVlanDelRangeTunnelInfoRange adds a new vlan filter entryEquivalent to: `bridge vlan del dev DEV vid VID-VIDEND tunnel_info id VIN-VINEND [ self ] [ master ]`

funcBridgeVlanDelTunnelInfoadded inv1.3.1

func BridgeVlanDelTunnelInfo(linkLink, viduint16, tuniduint32, self, masterbool)error

BridgeVlanDelTunnelInfo adds a new vlan filter entryEquivalent to: `bridge vlan del dev DEV vid VID tunnel_info id TUNID [ self ] [ master ]`

funcBridgeVlanList

func BridgeVlanList() (map[int32][]*nl.BridgeVlanInfo,error)

BridgeVlanList gets a map of device id to bridge vlan infos.Equivalent to: `bridge vlan show`

If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.

funcBridgeVlanTunnelShowadded inv1.3.1

func BridgeVlanTunnelShow() ([]nl.TunnelInfo,error)

BridgeVlanTunnelShow gets vlanid-tunnelid mapping.Equivalent to: `bridge vlan tunnelshow`

If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.

funcCalcRtable

func CalcRtable(rate *nl.TcRateSpec, rtab []uint32, cellLogint, mtuuint32, linklayerint)int

funcChainAddadded inv1.2.1

func ChainAdd(linkLink, chainChain)error

ChainAdd will add a chain to the system.Equivalent to: `tc chain add`

funcChainDeladded inv1.2.1

func ChainDel(linkLink, chainChain)error

ChainDel will delete a chain from the system.

funcClassAdd

func ClassAdd(classClass)error

ClassAdd will add a class to the system.Equivalent to: `tc class add $class`

funcClassChange

func ClassChange(classClass)error

ClassChange will change a class in placeEquivalent to: `tc class change $class`The parent and handle MUST NOT be changed.

funcClassDel

func ClassDel(classClass)error

ClassDel will delete a class from the system.Equivalent to: `tc class del $class`

funcClassReplace

func ClassReplace(classClass)error

ClassReplace will replace a class to the system.quivalent to: `tc class replace $class`The handle MAY be changed.If a class already exist with this parent/handle pair, the class is changed.If a class does not already exist with this parent/handle, a new class is created.

funcClockFactor

func ClockFactor()float64

funcConntrackCreateadded inv1.2.1

func ConntrackCreate(tableConntrackTableType, familyInetFamily, flow *ConntrackFlow)error

ConntrackCreate creates a new conntrack flow in the desired tableconntrack -I [table]Create a conntrack or expectation

funcConntrackDeleteFilterdeprecated

func ConntrackDeleteFilter(tableConntrackTableType, familyInetFamily, filterCustomConntrackFilter) (uint,error)

ConntrackDeleteFilter deletes entries on the specified table on the base of the filterconntrack -D [table] parameters Delete conntrack or expectation

Deprecated: useConntrackDeleteFilters instead.

funcConntrackDeleteFiltersadded inv1.2.1

func ConntrackDeleteFilters(tableConntrackTableType, familyInetFamily, filters ...CustomConntrackFilter) (uint,error)

ConntrackDeleteFilters deletes entries on the specified table matching any of the specified filtersconntrack -D [table] parameters Delete conntrack or expectation

funcConntrackTableFlush

func ConntrackTableFlush(tableConntrackTableType)error

ConntrackTableFlush flushes all the flows of a specified tableconntrack -F [table] Flush tableThe flush operation applies to all the family types

funcConntrackUpdateadded inv1.2.1

func ConntrackUpdate(tableConntrackTableType, familyInetFamily, flow *ConntrackFlow)error

ConntrackUpdate updates an existing conntrack flow in the desired table using the handleconntrack -U [table]Update a conntrack

funcDeserializeRtab

func DeserializeRtab(b []byte) [256]uint32

funcDevLinkPortDeladded inv1.2.1

func DevLinkPortDel(Busstring, Devicestring, PortIndexuint32)error

DevLinkPortDel deletes a devlink port and returns success or error code.

funcDevLinkSetEswitchModeadded inv1.1.0

func DevLinkSetEswitchMode(Dev *DevlinkDevice, NewModestring)error

DevLinkSetEswitchMode sets eswitch mode if able to set successfully orreturns an error code.Equivalent to: `devlink dev eswitch set $dev mode switchdev`Equivalent to: `devlink dev eswitch set $dev mode legacy`

funcDevlinkGetDeviceInfoByNameAsMapadded inv1.2.1

func DevlinkGetDeviceInfoByNameAsMap(Busstring, Devicestring) (map[string]string,error)

DevlinkGetDeviceInfoByNameAsMap returns devlink info for selected device as a map,otherwise returns an error code.Equivalent to: `devlink dev info $dev`

funcDevlinkPortFnSetadded inv1.2.1

func DevlinkPortFnSet(Busstring, Devicestring, PortIndexuint32, FnAttrsDevlinkPortFnSetAttrs)error

DevlinkPortFnSet sets one or more port function attributes specified by the attribute mask.It returns 0 on success or error code.

funcDevlinkSetDeviceParamadded inv1.2.1

func DevlinkSetDeviceParam(busstring, devicestring, paramstring, cmodeuint8, value interface{})error

DevlinkSetDeviceParam set specific parameter for devlink deviceEquivalent to: `devlink dev param set <bus>/<device> name <param> cmode <cmode> value <value>`cmode argument should contain valid cmode value as uint8, modes are define in nl.DEVLINK_PARAM_CMODE_* constantsvalue argument should have one of the following types: uint8, uint16, uint32, string, bool

funcEncodeActions

func EncodeActions(attr *nl.RtAttr, actions []Action)error

funcFilterAdd

func FilterAdd(filterFilter)error

FilterAdd will add a filter to the system.Equivalent to: `tc filter add $filter`

funcFilterDel

func FilterDel(filterFilter)error

FilterDel will delete a filter from the system.Equivalent to: `tc filter del $filter`

funcFilterReplaceadded inv1.1.0

func FilterReplace(filterFilter)error

FilterReplace will replace a filter.Equivalent to: `tc filter replace $filter`

funcFouAdd

func FouAdd(fFou)error

funcFouDel

func FouDel(fFou)error

funcFouFamilyId

func FouFamilyId() (int,error)

funcGTPPDPAdd

func GTPPDPAdd(linkLink, pdp *PDP)error

funcGTPPDPDel

func GTPPDPDel(linkLink, pdp *PDP)error

funcGetNetNsIdByFdadded inv1.1.0

func GetNetNsIdByFd(fdint) (int,error)

GetNetNsIdByFd looks up the network namespace ID for a given fd.fd must be an open file descriptor to a namespace file.Returns -1 if the namespace does not have an ID set.

funcGetNetNsIdByPidadded inv1.1.0

func GetNetNsIdByPid(pidint) (int,error)

GetNetNsIdByPid looks up the network namespace ID for a given pid (really thread id).Returns -1 if the namespace does not have an ID set.

funcGetSocketTimeoutadded inv1.2.1

func GetSocketTimeout()time.Duration

GetSocketTimeout returns the timeout value used by default netlink sockets

funcHandleStr

func HandleStr(handleuint32)string

funcHz

func Hz()float64

funcIpsetAddadded inv1.2.1

func IpsetAdd(setnamestring, entry *IPSetEntry)error

IpsetAdd adds an entry to an existing ipset.

funcIpsetCreateadded inv1.2.1

func IpsetCreate(setname, typenamestring, optionsIpsetCreateOptions)error

IpsetCreate creates a new ipset

funcIpsetDeladded inv1.2.1

func IpsetDel(setnamestring, entry *IPSetEntry)error

IpsetDel deletes an entry from an existing ipset.

funcIpsetDestroyadded inv1.2.1

func IpsetDestroy(setnamestring)error

IpsetDestroy destroys an existing ipset

funcIpsetFlushadded inv1.2.1

func IpsetFlush(setnamestring)error

IpsetFlush flushes an existing ipset

funcIpsetProtocoladded inv1.2.1

func IpsetProtocol() (uint8,uint8,error)

IpsetProtocol returns the ipset protocol version from the kernel

funcIpsetSwapadded inv1.2.1

func IpsetSwap(setname, othersetnamestring)error

IpsetSwap swaps two ipsets.

funcIpsetTestadded inv1.2.1

func IpsetTest(setnamestring, entry *IPSetEntry) (bool,error)

IpsetTest tests whether an entry is in a set or not.

funcIsBitSetadded inv1.2.1

func IsBitSet(inputuint64, posint)bool

IsBitSet check if specific bit is set in the uint64 input valueusage example:hasNetClass := IsBitSet(mgmtDev, VIRTIO_ID_NET)

funcLinkAdd

func LinkAdd(linkLink)error

LinkAdd adds a new link device. The type and features of the deviceare taken from the parameters in the link object.Equivalent to: `ip link add $link`

funcLinkAddAltNameadded inv1.2.1

func LinkAddAltName(linkLink, namestring)error

LinkAddAltName adds a new alternative name for the link device.Equivalent to: `ip link property add $link altname $name`

funcLinkDel

func LinkDel(linkLink)error

LinkDel deletes link device. Either Index or Name must be set inthe link object for it to be deleted. The other values are ignored.Equivalent to: `ip link del $link`

funcLinkDelAltNameadded inv1.2.1

func LinkDelAltName(linkLink, namestring)error

LinkDelAltName delete an alternative name for the link device.Equivalent to: `ip link property del $link altname $name`

funcLinkDelBondSlaveadded inv1.2.1

func LinkDelBondSlave(linkLink, master *Bond)error

LinkSetBondSlave removes specified slave from bond link via ioctl interface.

funcLinkModifyadded inv1.2.1

func LinkModify(linkLink)error

funcLinkSetARPOff

func LinkSetARPOff(linkLink)error

funcLinkSetARPOn

func LinkSetARPOn(linkLink)error

funcLinkSetAlias

func LinkSetAlias(linkLink, namestring)error

LinkSetAlias sets the alias of the link device.Equivalent to: `ip link set dev $link alias $name`

funcLinkSetAllmulticastOffadded inv1.1.0

func LinkSetAllmulticastOff(linkLink)error

LinkSetAllmulticastOff disables the reception of all hardware multicast packets for the link device.Equivalent to: `ip link set $link allmulticast off`

funcLinkSetAllmulticastOnadded inv1.1.0

func LinkSetAllmulticastOn(linkLink)error

LinkSetAllmulticastOn enables the reception of all hardware multicast packets for the link device.Equivalent to: `ip link set $link allmulticast on`

funcLinkSetBRSlaveGroupFwdMaskadded inv1.2.1

func LinkSetBRSlaveGroupFwdMask(linkLink, maskuint16)error

LinkSetBRSlaveGroupFwdMask set the group_fwd_mask of a bridge slave interface

funcLinkSetBondSlave

func LinkSetBondSlave(linkLink, master *Bond)error

LinkSetBondSlave add slave to bond link via ioctl interface.

funcLinkSetBondSlaveActiveadded inv1.2.1

func LinkSetBondSlaveActive(linkLink, master *Bond)error

LinkSetBondSlaveActive sets specified slave to ACTIVE in an `active-backup` bond link via ioctl interface.

Multiple calls keeps the status unchanged(shown in the unit test).

funcLinkSetBondSlaveQueueIdadded inv1.1.0

func LinkSetBondSlaveQueueId(linkLink, queueIduint16)error

LinkSetBondSlaveQueueId modify bond slave queue-id.

funcLinkSetBrNeighSuppressadded inv1.2.1

func LinkSetBrNeighSuppress(linkLink, modebool)error

funcLinkSetBrProxyArp

func LinkSetBrProxyArp(linkLink, modebool)error

funcLinkSetBrProxyArpWiFi

func LinkSetBrProxyArpWiFi(linkLink, modebool)error

funcLinkSetDown

func LinkSetDown(linkLink)error

LinkSetDown disables link device.Equivalent to: `ip link set $link down`

funcLinkSetFastLeave

func LinkSetFastLeave(linkLink, modebool)error

funcLinkSetFlood

func LinkSetFlood(linkLink, modebool)error

funcLinkSetGROIPv4MaxSizeadded inv1.2.1

func LinkSetGROIPv4MaxSize(linkLink, maxSizeint)error

LinkSetGROIPv4MaxSize sets the IPv4 GRO maximum size of the link device.Equivalent to: `ip link set $link gro_ipv4_max_size $maxSize`

funcLinkSetGROMaxSizeadded inv1.2.1

func LinkSetGROMaxSize(linkLink, maxSizeint)error

LinkSetGROMaxSize sets the IPv6 GRO maximum size of the link device.Equivalent to: `ip link set $link gro_max_size $maxSize`

funcLinkSetGSOIPv4MaxSizeadded inv1.2.1

func LinkSetGSOIPv4MaxSize(linkLink, maxSizeint)error

LinkSetGSOIPv4MaxSize sets the IPv4 GSO maximum size of the link device.Equivalent to: `ip link set $link gso_ipv4_max_size $maxSize`

funcLinkSetGSOMaxSegsadded inv1.2.1

func LinkSetGSOMaxSegs(linkLink, maxSegsint)error

LinkSetGSOMaxSegs sets the GSO maximum segment count of the link device.Equivalent to: `ip link set $link gso_max_segs $maxSegs`

funcLinkSetGSOMaxSizeadded inv1.2.1

func LinkSetGSOMaxSize(linkLink, maxSizeint)error

LinkSetGSOMaxSize sets the IPv6 GSO maximum size of the link device.Equivalent to: `ip link set $link gso_max_size $maxSize`

funcLinkSetGroupadded inv1.1.0

func LinkSetGroup(linkLink, groupint)error

LinkSetGroup sets the link group id which can be used to perform mass actionswith iproute2 as well use it as a reference in nft filters.Equivalent to: `ip link set $link group $id`

funcLinkSetGuard

func LinkSetGuard(linkLink, modebool)error

funcLinkSetHairpin

func LinkSetHairpin(linkLink, modebool)error

funcLinkSetHardwareAddr

func LinkSetHardwareAddr(linkLink, hwaddrnet.HardwareAddr)error

LinkSetHardwareAddr sets the hardware address of the link device.Equivalent to: `ip link set $link address $hwaddr`

funcLinkSetIP6AddrGenModeadded inv1.3.1

func LinkSetIP6AddrGenMode(linkLink, modeint)error

LinkSetIP6AddrGenMode sets the IPv6 address generation mode of the link device.Equivalent to: `ip link set $link addrgenmode $mode`

funcLinkSetIsolatedadded inv1.2.1

func LinkSetIsolated(linkLink, modebool)error

funcLinkSetLearning

func LinkSetLearning(linkLink, modebool)error

funcLinkSetMTU

func LinkSetMTU(linkLink, mtuint)error

LinkSetMTU sets the mtu of the link device.Equivalent to: `ip link set $link mtu $mtu`

funcLinkSetMacvlanModeadded inv1.2.1

func LinkSetMacvlanMode(linkLink, modeMacvlanMode)error

LinkSetMacvlanMode sets the mode of a macvlan or macvtap link device.Note that passthrough mode cannot be set to and from and will fail.Equivalent to: `ip link set $link type (macvlan|macvtap) mode $mode

funcLinkSetMaster

func LinkSetMaster(linkLink, masterLink)error

LinkSetMaster sets the master of the link device.Equivalent to: `ip link set $link master $master`

funcLinkSetMasterByIndex

func LinkSetMasterByIndex(linkLink, masterIndexint)error

LinkSetMasterByIndex sets the master of the link device.Equivalent to: `ip link set $link master $master`

funcLinkSetMulticastOffadded inv1.2.1

func LinkSetMulticastOff(linkLink)error

LinkSetAllmulticastOff disables the reception of multicast packets for the link device.Equivalent to: `ip link set $link multicast off`

funcLinkSetMulticastOnadded inv1.2.1

func LinkSetMulticastOn(linkLink)error

LinkSetMulticastOn enables the reception of multicast packets for the link device.Equivalent to: `ip link set $link multicast on`

funcLinkSetName

func LinkSetName(linkLink, namestring)error

LinkSetName sets the name of the link device.Equivalent to: `ip link set $link name $name`

funcLinkSetNoMaster

func LinkSetNoMaster(linkLink)error

LinkSetNoMaster removes the master of the link device.Equivalent to: `ip link set $link nomaster`

funcLinkSetNsFd

func LinkSetNsFd(linkLink, fdint)error

LinkSetNsFd puts the device into a new network namespace. Thefd must be an open file descriptor to a network namespace.Similar to: `ip link set $link netns $ns`

funcLinkSetNsPid

func LinkSetNsPid(linkLink, nspidint)error

LinkSetNsPid puts the device into a new network namespace. Thepid must be a pid of a running process.Equivalent to: `ip link set $link netns $pid`

funcLinkSetRootBlock

func LinkSetRootBlock(linkLink, modebool)error

funcLinkSetTxQLen

func LinkSetTxQLen(linkLink, qlenint)error

LinkSetTxQLen sets the transaction queue length for the link.Equivalent to: `ip link set $link txqlen $qlen`

funcLinkSetUp

func LinkSetUp(linkLink)error

LinkSetUp enables the link device.Equivalent to: `ip link set $link up`

funcLinkSetVfHardwareAddr

func LinkSetVfHardwareAddr(linkLink, vfint, hwaddrnet.HardwareAddr)error

LinkSetVfHardwareAddr sets the hardware address of a vf for the link.Equivalent to: `ip link set $link vf $vf mac $hwaddr`

funcLinkSetVfNodeGUIDadded inv1.1.0

func LinkSetVfNodeGUID(linkLink, vfint, nodeguidnet.HardwareAddr)error

LinkSetVfNodeGUID sets the node GUID of a vf for the link.Equivalent to: `ip link set dev $link vf $vf node_guid $nodeguid`

funcLinkSetVfPortGUIDadded inv1.1.0

func LinkSetVfPortGUID(linkLink, vfint, portguidnet.HardwareAddr)error

LinkSetVfPortGUID sets the port GUID of a vf for the link.Equivalent to: `ip link set dev $link vf $vf port_guid $portguid`

funcLinkSetVfRateadded inv1.1.0

func LinkSetVfRate(linkLink, vf, minRate, maxRateint)error

LinkSetVfRate sets the min and max tx rate of a vf for the link.Equivalent to: `ip link set $link vf $vf min_tx_rate $min_rate max_tx_rate $max_rate`

funcLinkSetVfSpoofchk

func LinkSetVfSpoofchk(linkLink, vfint, checkbool)error

LinkSetVfSpoofchk enables/disables spoof check on a vf for the link.Equivalent to: `ip link set $link vf $vf spoofchk $check`

funcLinkSetVfStateadded inv1.1.0

func LinkSetVfState(linkLink, vfint, stateuint32)error

LinkSetVfState enables/disables virtual link state on a vf.Equivalent to: `ip link set $link vf $vf state $state`

funcLinkSetVfTrust

func LinkSetVfTrust(linkLink, vfint, statebool)error

LinkSetVfTrust enables/disables trust state on a vf for the link.Equivalent to: `ip link set $link vf $vf trust $state`

funcLinkSetVfTxRate

func LinkSetVfTxRate(linkLink, vf, rateint)error

LinkSetVfTxRate sets the tx rate of a vf for the link.Equivalent to: `ip link set $link vf $vf rate $rate`

funcLinkSetVfVlan

func LinkSetVfVlan(linkLink, vf, vlanint)error

LinkSetVfVlan sets the vlan of a vf for the link.Equivalent to: `ip link set $link vf $vf vlan $vlan`

funcLinkSetVfVlanQosadded inv1.1.0

func LinkSetVfVlanQos(linkLink, vf, vlan, qosint)error

LinkSetVfVlanQos sets the vlan and qos priority of a vf for the link.Equivalent to: `ip link set $link vf $vf vlan $vlan qos $qos`

funcLinkSetVfVlanQosProtoadded inv1.2.1

func LinkSetVfVlanQosProto(linkLink, vf, vlan, qos, protoint)error

LinkSetVfVlanQosProto sets the vlan, qos and protocol of a vf for the link.Equivalent to: `ip link set $link vf $vf vlan $vlan qos $qos proto $proto`

funcLinkSetVlanTunneladded inv1.3.1

func LinkSetVlanTunnel(linkLink, modebool)error

funcLinkSetXdpFd

func LinkSetXdpFd(linkLink, fdint)error

LinkSetXdpFd adds a bpf function to the driver. The fd must be a bpfprogram loaded with bpf(type=BPF_PROG_TYPE_XDP)

funcLinkSetXdpFdWithFlags

func LinkSetXdpFdWithFlags(linkLink, fd, flagsint)error

LinkSetXdpFdWithFlags adds a bpf function to the driver with the givenoptions. The fd must be a bpf program loaded with bpf(type=BPF_PROG_TYPE_XDP)

funcLinkSubscribe

func LinkSubscribe(ch chan<-LinkUpdate, done <-chan struct{})error

LinkSubscribe takes a chan down which notifications will be sentwhen links change. Close the 'done' chan to stop subscription.

funcLinkSubscribeAt

func LinkSubscribeAt(nsnetns.NsHandle, ch chan<-LinkUpdate, done <-chan struct{})error

LinkSubscribeAt works like LinkSubscribe plus it allows the callerto choose the network namespace in which to subscribe (ns).

funcLinkSubscribeWithOptions

func LinkSubscribeWithOptions(ch chan<-LinkUpdate, done <-chan struct{}, optionsLinkSubscribeOptions)error

LinkSubscribeWithOptions work like LinkSubscribe but enable toprovide additional options to modify the behavior. Currently, thenamespace can be provided as well as an error callback.

When options.ListExisting is true, options.ErrorCallback may becalled withErrDumpInterrupted to indicate that results fromthe initial dump of links may be inconsistent or incomplete.

funcMacvlanMACAddrAdd

func MacvlanMACAddrAdd(linkLink, addrnet.HardwareAddr)error

funcMacvlanMACAddrDel

func MacvlanMACAddrDel(linkLink, addrnet.HardwareAddr)error

funcMacvlanMACAddrFlush

func MacvlanMACAddrFlush(linkLink)error

funcMacvlanMACAddrSet

func MacvlanMACAddrSet(linkLink, addrs []net.HardwareAddr)error

funcMajorMinor

func MajorMinor(handleuint32) (uint16,uint16)

funcMakeHandle

func MakeHandle(major, minoruint16)uint32

funcNeighAdd

func NeighAdd(neigh *Neigh)error

NeighAdd will add an IP to MAC mapping to the ARP tableEquivalent to: `ip neigh add ....`

funcNeighAppend

func NeighAppend(neigh *Neigh)error

NeighAppend will append an entry to FDBEquivalent to: `bridge fdb append...`

funcNeighDel

func NeighDel(neigh *Neigh)error

NeighDel will delete an IP address from a link device.Equivalent to: `ip addr del $addr dev $link`

funcNeighSet

func NeighSet(neigh *Neigh)error

NeighSet will add or replace an IP to MAC mapping to the ARP tableEquivalent to: `ip neigh replace....`

funcNeighSubscribeadded inv1.1.0

func NeighSubscribe(ch chan<-NeighUpdate, done <-chan struct{})error

NeighSubscribe takes a chan down which notifications will be sentwhen neighbors are added or deleted. Close the 'done' chan to stop subscription.

funcNeighSubscribeAtadded inv1.1.0

func NeighSubscribeAt(nsnetns.NsHandle, ch chan<-NeighUpdate, done <-chan struct{})error

NeighSubscribeAt works like NeighSubscribe plus it allows the callerto choose the network namespace in which to subscribe (ns).

funcNeighSubscribeWithOptionsadded inv1.1.0

func NeighSubscribeWithOptions(ch chan<-NeighUpdate, done <-chan struct{}, optionsNeighSubscribeOptions)error

NeighSubscribeWithOptions work like NeighSubscribe but enable toprovide additional options to modify the behavior. Currently, thenamespace can be provided as well as an error callback.

When options.ListExisting is true, options.ErrorCallback may becalled withErrDumpInterrupted to indicate that results fromthe initial dump of links may be inconsistent or incomplete.

funcNewIPNet

func NewIPNet(ipnet.IP) *net.IPNet

NewIPNet generates an IPNet from an ip address using a netmask of 32 or 128.

funcParseIPNet

func ParseIPNet(sstring) (*net.IPNet,error)

ParseIPNet parses a string in ip/net format and returns a net.IPNet.This is valuable because addresses in netlink are often IPNets andParseCIDR returns an IPNet with the IP part set to the base IP of therange.

funcPercentage2u32

func Percentage2u32(percentagefloat32)uint32

funcProcEventMonitoradded inv1.2.1

func ProcEventMonitor(ch chan<-ProcEvent, done <-chan struct{}, errorChan chan<-error)error

funcQdiscAdd

func QdiscAdd(qdiscQdisc)error

QdiscAdd will add a qdisc to the system.Equivalent to: `tc qdisc add $qdisc`

funcQdiscChange

func QdiscChange(qdiscQdisc)error

QdiscChange will change a qdisc in placeEquivalent to: `tc qdisc change $qdisc`The parent and handle MUST NOT be changed.

funcQdiscDel

func QdiscDel(qdiscQdisc)error

QdiscDel will delete a qdisc from the system.Equivalent to: `tc qdisc del $qdisc`

funcQdiscReplace

func QdiscReplace(qdiscQdisc)error

QdiscReplace will replace a qdisc to the system.Equivalent to: `tc qdisc replace $qdisc`The handle MUST change.

funcRdmaLinkAddadded inv1.2.1

func RdmaLinkAdd(linkName, linkType, netdevstring)error

RdmaLinkAdd adds an rdma link for the specified type to the network device.Similar to: rdma link add NAME type TYPE netdev NETDEV

NAME - specifies the new name of the rdma link to addTYPE - specifies which rdma type to use.  Link types:rxe - Soft RoCE driversiw - Soft iWARP driverNETDEV - specifies the network device to which the link is bound

REF:https://man7.org/linux/man-pages/man8/rdma-link.8.html

funcRdmaLinkDeladded inv1.2.1

func RdmaLinkDel(namestring)error

RdmaLinkDel deletes an rdma link

Similar to: rdma link delete NAMEREF:https://man7.org/linux/man-pages/man8/rdma-link.8.html

funcRdmaLinkSetNameadded inv1.1.0

func RdmaLinkSetName(link *RdmaLink, namestring)error

RdmaLinkSetName sets the name of the rdma link device. Return nil on successor error otherwise.Equivalent to: `rdma dev set $old_devname name $name`

funcRdmaLinkSetNsFdadded inv1.1.0

func RdmaLinkSetNsFd(link *RdmaLink, fduint32)error

RdmaLinkSetNsFd puts the RDMA device into a new network namespace. Thefd must be an open file descriptor to a network namespace.Similar to: `rdma dev set $dev netns $ns`

funcRdmaSystemGetNetnsModeadded inv1.1.0

func RdmaSystemGetNetnsMode() (string,error)

RdmaSystemGetNetnsMode gets the net namespace mode for RDMA subsystemReturns mode string and error status as nil on success or returns errorotherwise.Equivalent to: `rdma system show netns'

funcRdmaSystemSetNetnsModeadded inv1.1.0

func RdmaSystemSetNetnsMode(NewModestring)error

RdmaSystemSetNetnsMode sets the net namespace mode for RDMA subsystemReturns nil on success or appropriate error code.Equivalent to: `rdma system set netns { shared | exclusive }'

funcRouteAdd

func RouteAdd(route *Route)error

RouteAdd will add a route to the system.Equivalent to: `ip route add $route`

funcRouteAddEcmpadded inv1.2.1

func RouteAddEcmp(route *Route)error

RouteAddEcmp will add a route to the system.

funcRouteAppendadded inv1.2.1

func RouteAppend(route *Route)error

RouteAppend will append a route to the system.Equivalent to: `ip route append $route`

funcRouteChangeadded inv1.2.1

func RouteChange(route *Route)error

RouteChange will change an existing route in the system.Equivalent to: `ip route change $route`

funcRouteDel

func RouteDel(route *Route)error

RouteDel will delete a route from the system.Equivalent to: `ip route del $route`

funcRouteListFilteredIteradded inv1.2.1

func RouteListFilteredIter(familyint, filter *Route, filterMaskuint64, f func(Route) (contbool))error

RouteListFilteredIter passes each route that matches the filter to the given iterator func. Iteration continuesuntil all routes are loaded or the func returns false.

If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.

funcRouteReplace

func RouteReplace(route *Route)error

RouteReplace will add a route to the system.Equivalent to: `ip route replace $route`

funcRouteSubscribe

func RouteSubscribe(ch chan<-RouteUpdate, done <-chan struct{})error

RouteSubscribe takes a chan down which notifications will be sentwhen routes are added or deleted. Close the 'done' chan to stop subscription.

funcRouteSubscribeAt

func RouteSubscribeAt(nsnetns.NsHandle, ch chan<-RouteUpdate, done <-chan struct{})error

RouteSubscribeAt works like RouteSubscribe plus it allows the callerto choose the network namespace in which to subscribe (ns).

funcRouteSubscribeWithOptions

func RouteSubscribeWithOptions(ch chan<-RouteUpdate, done <-chan struct{}, optionsRouteSubscribeOptions)error

RouteSubscribeWithOptions work like RouteSubscribe but enable toprovide additional options to modify the behavior. Currently, thenamespace can be provided as well as an error callback.

When options.ListExisting is true, options.ErrorCallback may becalled withErrDumpInterrupted to indicate that results fromthe initial dump of links may be inconsistent or incomplete.

funcRuleAdd

func RuleAdd(rule *Rule)error

RuleAdd adds a rule to the system.Equivalent to: ip rule add

funcRuleDel

func RuleDel(rule *Rule)error

RuleDel deletes a rule from the system.Equivalent to: ip rule del

funcSerializeRtab

func SerializeRtab(rtab [256]uint32) []byte

funcSetBitsadded inv1.2.1

func SetBits(inputuint64, pos ...int)uint64

SetBits set provided bits in the uint64 input valueusage example:features := SetBits(0, VIRTIO_NET_F_MTU, VIRTIO_NET_F_CTRL_MAC_ADDR)

funcSetNetNsIdByFdadded inv1.1.0

func SetNetNsIdByFd(fd, nsidint)error

SetNetNSIdByFd sets the ID of the network namespace for a given fd.fd must be an open file descriptor to a namespace file.The ID can only be set for namespaces without an ID already set.

funcSetNetNsIdByPidadded inv1.1.0

func SetNetNsIdByPid(pid, nsidint)error

SetNetNSIdByPid sets the ID of the network namespace for a given pid (really thread id).The ID can only be set for namespaces without an ID already set.

funcSetPromiscOff

func SetPromiscOff(linkLink)error

funcSetPromiscOn

func SetPromiscOn(linkLink)error

funcSetSocketTimeoutadded inv1.2.1

func SetSocketTimeout(totime.Duration)error

SetSocketTimeout configures timeout for default netlink sockets

funcSocketDestroyadded inv1.2.1

func SocketDestroy(local, remotenet.Addr)error

SocketDestroy kills the Socket identified by its local and remote addresses.

funcTcActExtCmpadded inv1.2.1

func TcActExtCmp(combinedint32, opcodeint32)bool

funcTickInUsec

func TickInUsec()float64

funcVDPADelDevadded inv1.2.1

func VDPADelDev(namestring)error

VDPADelDev removes VDPA deviceEquivalent to: `vdpa dev del <name>`

funcVDPANewDevadded inv1.2.1

func VDPANewDev(name, mgmtBus, mgmtNamestring, paramsVDPANewDevParams)error

VDPANewDev adds new VDPA deviceEquivalent to: `vdpa dev add name <name> mgmtdev <mgmtBus>/mgmtName [params]`

funcVethPeerIndex

func VethPeerIndex(link *Veth) (int,error)

VethPeerIndex get veth peer index.

funcXfrmMonitor

func XfrmMonitor(ch chan<-XfrmMsg, done <-chan struct{}, errorChan chan<-error,types ...nl.XfrmMsgType)error

funcXfrmPolicyAdd

func XfrmPolicyAdd(policy *XfrmPolicy)error

XfrmPolicyAdd will add an xfrm policy to the system.Equivalent to: `ip xfrm policy add $policy`

funcXfrmPolicyDel

func XfrmPolicyDel(policy *XfrmPolicy)error

XfrmPolicyDel will delete an xfrm policy from the system. Note thatthe Tmpls are ignored when matching the policy to delete.Equivalent to: `ip xfrm policy del $policy`

funcXfrmPolicyFlush

func XfrmPolicyFlush()error

XfrmPolicyFlush will flush the policies on the system.Equivalent to: `ip xfrm policy flush`

funcXfrmPolicyUpdate

func XfrmPolicyUpdate(policy *XfrmPolicy)error

XfrmPolicyUpdate will update an xfrm policy to the system.Equivalent to: `ip xfrm policy update $policy`

funcXfrmStateAdd

func XfrmStateAdd(state *XfrmState)error

XfrmStateAdd will add an xfrm state to the system.Equivalent to: `ip xfrm state add $state`

funcXfrmStateDel

func XfrmStateDel(state *XfrmState)error

XfrmStateDel will delete an xfrm state from the system. Note thatthe Algos are ignored when matching the state to delete.Equivalent to: `ip xfrm state del $state`

funcXfrmStateFlush

func XfrmStateFlush(protoProto)error

XfrmStateFlush will flush the xfrm state on the system.proto = 0 means any transformation protocolsEquivalent to: `ip xfrm state flush [ proto XFRM-PROTO ]`

funcXfrmStateUpdate

func XfrmStateUpdate(state *XfrmState)error

XfrmStateUpdate will update an xfrm state to the system.Equivalent to: `ip xfrm state update $state`

funcXmitsizeadded inv1.2.1

func Xmitsize(rateuint64, ticksuint32)uint32

funcXmittime

func Xmittime(rateuint64, sizeuint32)uint32

Types

typeAction

type Action interface {Attrs() *ActionAttrsType()string}

Action represents an action in any supported filter.

typeActionAttrs

type ActionAttrs struct {IndexintCapabintActionTcActRefcntintBindcntintStatistics *ActionStatisticTimestamp  *ActionTimestamp}

func (ActionAttrs)String

func (qActionAttrs) String()string

typeActionStatisticadded inv1.2.1

type ActionStatisticClassStatistics

typeActionTimestampadded inv1.2.1

type ActionTimestamp struct {Installeduint64LastUseduint64Expiresuint64FirstUseduint64}

func (ActionTimestamp)Stringadded inv1.2.1

func (tActionTimestamp) String()string

typeAddr

type Addr struct {*net.IPNetLabelstringFlagsintScopeintPeer        *net.IPNetBroadcastnet.IPPreferedLftintValidLftintLinkIndexint}

Addr represents an IP address from netlink. Netlink ip addressesinclude a mask, so it stores the address as a net.IPNet.

funcAddrList

func AddrList(linkLink, familyint) ([]Addr,error)

AddrList gets a list of IP addresses in the system.Equivalent to: `ip addr show`.The list can be filtered by link and ip family.

If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.

funcParseAddr

func ParseAddr(sstring) (*Addr,error)

ParseAddr parses the string representation of an address in theform $ip/$netmask $label. The label portion is optional

func (Addr)Equal

func (aAddr) Equal(xAddr)bool

Equal returns true if both Addrs have the same net.IPNet value.

func (Addr)PeerEqual

func (aAddr) PeerEqual(xAddr)bool

func (Addr)String

func (aAddr) String()string

String returns $ip/$netmask $label

typeAddrSubscribeOptions

type AddrSubscribeOptions struct {Namespace              *netns.NsHandleErrorCallback          func(error)ListExistingboolReceiveBufferSizeintReceiveBufferForceSizeboolReceiveTimeout         *unix.Timeval}

AddrSubscribeOptions contains a set of options to use withAddrSubscribeWithOptions.

typeAddrUpdate

type AddrUpdate struct {LinkAddressnet.IPNetLinkIndexintFlagsintScopeintPreferedLftintValidLftintNewAddrbool// true=added false=deleted}

typeBPFAttr

type BPFAttr struct {ProgTypeuint32InsnCntuint32InsnsuintptrLicenseuintptrLogLeveluint32LogSizeuint32LogBufuintptrKernVersionuint32}

typeBareUDPadded inv1.2.1

type BareUDP struct {LinkAttrsPortuint16EtherTypeuint16SrcPortMinuint16MultiProtobool}

func (*BareUDP)Attrsadded inv1.2.1

func (bareudp *BareUDP) Attrs() *LinkAttrs

func (*BareUDP)Typeadded inv1.2.1

func (bareudp *BareUDP) Type()string

typeBond

type Bond struct {LinkAttrsModeBondModeActiveSlaveintMiimonintUpDelayintDownDelayintUseCarrierintArpIntervalintArpIpTargets    []net.IPArpValidateBondArpValidateArpAllTargetsBondArpAllTargetsPrimaryintPrimaryReselectBondPrimaryReselectFailOverMacBondFailOverMacXmitHashPolicyBondXmitHashPolicyResendIgmpintNumPeerNotifintAllSlavesActiveintMinLinksintLpIntervalintPacketsPerSlaveintLacpRateBondLacpRateAdSelectBondAdSelect// looking at iproute tool AdInfo can only be retrived. It can't be set.AdInfo         *BondAdInfoAdActorSysPriointAdUserPortKeyintAdActorSystemnet.HardwareAddrTlbDynamicLbint}

Bond representation

funcNewLinkBond

func NewLinkBond(atrLinkAttrs) *Bond

func (*Bond)Attrs

func (bond *Bond) Attrs() *LinkAttrs

Attrs implementation.

func (*Bond)Type

func (bond *Bond) Type()string

Type implementation fro Vxlan.

typeBondAdInfo

type BondAdInfo struct {AggregatorIdintNumPortsintActorKeyintPartnerKeyintPartnerMacnet.HardwareAddr}

BondAdInfo represents ad info for bond

typeBondAdSelect

type BondAdSelectint

BondAdSelect type

const (BOND_AD_SELECT_STABLEBondAdSelect =iotaBOND_AD_SELECT_BANDWIDTHBOND_AD_SELECT_COUNT)

Possible BondAdSelect value

func (BondAdSelect)Stringadded inv1.2.1

func (bBondAdSelect) String()string

typeBondArpAllTargets

type BondArpAllTargetsint

BondArpAllTargets type

const (BOND_ARP_ALL_TARGETS_ANYBondArpAllTargets =iotaBOND_ARP_ALL_TARGETS_ALL)

Possible BondArpAllTargets value

func (BondArpAllTargets)Stringadded inv1.2.1

func (bBondArpAllTargets) String()string

typeBondArpValidate

type BondArpValidateint

BondArpValidate type

const (BOND_ARP_VALIDATE_NONEBondArpValidate =iotaBOND_ARP_VALIDATE_ACTIVEBOND_ARP_VALIDATE_BACKUPBOND_ARP_VALIDATE_ALL)

Possible BondArpValidate value

func (BondArpValidate)Stringadded inv1.2.1

func (bBondArpValidate) String()string

typeBondFailOverMac

type BondFailOverMacint

BondFailOverMac type

const (BOND_FAIL_OVER_MAC_NONEBondFailOverMac =iotaBOND_FAIL_OVER_MAC_ACTIVEBOND_FAIL_OVER_MAC_FOLLOW)

Possible BondFailOverMac value

func (BondFailOverMac)Stringadded inv1.2.1

func (bBondFailOverMac) String()string

typeBondLacpRate

type BondLacpRateint

BondLacpRate type

const (BOND_LACP_RATE_SLOWBondLacpRate =iotaBOND_LACP_RATE_FASTBOND_LACP_RATE_UNKNOWN)

Possible BondLacpRate value

funcStringToBondLacpRate

func StringToBondLacpRate(sstring)BondLacpRate

StringToBondLacpRate returns bond lacp arte, or unknown is the s is invalid.

func (BondLacpRate)String

func (bBondLacpRate) String()string

typeBondMode

type BondModeint

BondMode type

const (BOND_MODE_BALANCE_RRBondMode =iotaBOND_MODE_ACTIVE_BACKUPBOND_MODE_BALANCE_XORBOND_MODE_BROADCASTBOND_MODE_802_3ADBOND_MODE_BALANCE_TLBBOND_MODE_BALANCE_ALBBOND_MODE_UNKNOWN)

Possible BondMode

funcStringToBondMode

func StringToBondMode(sstring)BondMode

StringToBondMode returns bond mode, or unknown is the s is invalid.

func (BondMode)String

func (bBondMode) String()string

typeBondPrimaryReselect

type BondPrimaryReselectint

BondPrimaryReselect type

const (BOND_PRIMARY_RESELECT_ALWAYSBondPrimaryReselect =iotaBOND_PRIMARY_RESELECT_BETTERBOND_PRIMARY_RESELECT_FAILURE)

Possible BondPrimaryReselect value

func (BondPrimaryReselect)Stringadded inv1.2.1

func (bBondPrimaryReselect) String()string

typeBondSlaveadded inv1.1.0

type BondSlave struct {StateBondSlaveStateMiiStatusBondSlaveMiiStatusLinkFailureCountuint32PermHardwareAddrnet.HardwareAddrQueueIduint16AggregatorIduint16AdActorOperPortStateuint8AdPartnerOperPortStateuint16}

func (*BondSlave)SlaveTypeadded inv1.1.0

func (b *BondSlave) SlaveType()string

typeBondSlaveMiiStatusadded inv1.1.0

type BondSlaveMiiStatusuint8

BondSlaveMiiStatus represents the values of the IFLA_BOND_SLAVE_MII_STATUS bond slaveattribute, which contains the status of MII link monitoring

const (//BondLinkUp link is up and running.BondLinkUpBondSlaveMiiStatus =iota//BondLinkFail link has just gone down.BondLinkFail//BondLinkDown link has been down for too long time.BondLinkDown//BondLinkBack link is going back.BondLinkBack)

func (BondSlaveMiiStatus)Stringadded inv1.1.0

func (sBondSlaveMiiStatus) String()string

typeBondSlaveStateadded inv1.1.0

type BondSlaveStateuint8

BondSlaveState represents the values of the IFLA_BOND_SLAVE_STATE bond slaveattribute, which contains the state of the bond slave.

const (//BondStateActive Link is active.BondStateActiveBondSlaveState =iota//BondStateBackup Link is backup.BondStateBackup)

func (BondSlaveState)Stringadded inv1.1.0

func (sBondSlaveState) String()string

typeBondXmitHashPolicy

type BondXmitHashPolicyint

BondXmitHashPolicy type

const (BOND_XMIT_HASH_POLICY_LAYER2BondXmitHashPolicy =iotaBOND_XMIT_HASH_POLICY_LAYER3_4BOND_XMIT_HASH_POLICY_LAYER2_3BOND_XMIT_HASH_POLICY_ENCAP2_3BOND_XMIT_HASH_POLICY_ENCAP3_4BOND_XMIT_HASH_POLICY_VLAN_SRCMACBOND_XMIT_HASH_POLICY_UNKNOWN)

Possible BondXmitHashPolicy value

funcStringToBondXmitHashPolicy

func StringToBondXmitHashPolicy(sstring)BondXmitHashPolicy

StringToBondXmitHashPolicy returns bond lacp arte, or unknown is the s is invalid.

func (BondXmitHashPolicy)String

func (bBondXmitHashPolicy) String()string

typeBpfAction

type BpfAction struct {ActionAttrsFdintNamestring}

func (*BpfAction)Attrs

func (action *BpfAction) Attrs() *ActionAttrs

func (*BpfAction)Type

func (action *BpfAction) Type()string

typeBpfEncapadded inv1.2.1

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

func (*BpfEncap)Decodeadded inv1.2.1

func (e *BpfEncap) Decode(buf []byte)error

func (*BpfEncap)Encodeadded inv1.2.1

func (e *BpfEncap) Encode() ([]byte,error)

func (*BpfEncap)Equaladded inv1.2.1

func (e *BpfEncap) Equal(xEncap)bool

func (*BpfEncap)SetProgadded inv1.2.1

func (e *BpfEncap) SetProg(mode, progFdint, progNamestring)error

SetProg adds a bpf function to the route via netlink RTA_ENCAP. The fd must be a bpfprogram loaded with bpf(type=BPF_PROG_TYPE_LWT_*) matching the direction the program shouldbe applied to (LWT_BPF_IN, LWT_BPF_OUT, LWT_BPF_XMIT).

func (*BpfEncap)SetXmitHeadroomadded inv1.2.1

func (e *BpfEncap) SetXmitHeadroom(headroomint)error

SetXmitHeadroom sets the xmit headroom (LWT_BPF_MAX_HEADROOM) via netlink RTA_ENCAP.maximum headroom is LWT_BPF_MAX_HEADROOM

func (*BpfEncap)Stringadded inv1.2.1

func (e *BpfEncap) String()string

func (*BpfEncap)Typeadded inv1.2.1

func (e *BpfEncap) Type()int

typeBpfFilter

type BpfFilter struct {FilterAttrsClassIduint32FdintNamestringDirectActionboolIdintTagstring}

func (*BpfFilter)Attrs

func (filter *BpfFilter) Attrs() *FilterAttrs

func (*BpfFilter)Type

func (filter *BpfFilter) Type()string

typeBpfProgType

type BpfProgTypeuint32
const (BPF_PROG_TYPE_UNSPECBpfProgType =iotaBPF_PROG_TYPE_SOCKET_FILTERBPF_PROG_TYPE_KPROBEBPF_PROG_TYPE_SCHED_CLSBPF_PROG_TYPE_SCHED_ACTBPF_PROG_TYPE_TRACEPOINTBPF_PROG_TYPE_XDPBPF_PROG_TYPE_PERF_EVENTBPF_PROG_TYPE_CGROUP_SKBBPF_PROG_TYPE_CGROUP_SOCKBPF_PROG_TYPE_LWT_INBPF_PROG_TYPE_LWT_OUTBPF_PROG_TYPE_LWT_XMITBPF_PROG_TYPE_SOCK_OPSBPF_PROG_TYPE_SK_SKBBPF_PROG_TYPE_CGROUP_DEVICEBPF_PROG_TYPE_SK_MSGBPF_PROG_TYPE_RAW_TRACEPOINTBPF_PROG_TYPE_CGROUP_SOCK_ADDRBPF_PROG_TYPE_LWT_SEG6LOCALBPF_PROG_TYPE_LIRC_MODE2BPF_PROG_TYPE_SK_REUSEPORTBPF_PROG_TYPE_FLOW_DISSECTORBPF_PROG_TYPE_CGROUP_SYSCTLBPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLEBPF_PROG_TYPE_CGROUP_SOCKOPTBPF_PROG_TYPE_TRACINGBPF_PROG_TYPE_STRUCT_OPSBPF_PROG_TYPE_EXTBPF_PROG_TYPE_LSMBPF_PROG_TYPE_SK_LOOKUP)

typeBridge

type Bridge struct {LinkAttrsMulticastSnooping *boolAgeingTime        *uint32HelloTime         *uint32VlanFiltering     *boolVlanDefaultPVID   *uint16GroupFwdMask      *uint16}

Bridge links are simple linux bridges

func (*Bridge)Attrs

func (bridge *Bridge) Attrs() *LinkAttrs

func (*Bridge)Type

func (bridge *Bridge) Type()string

typeCanadded inv1.2.1

type Can struct {LinkAttrsBitRateuint32SamplePointuint32TimeQuantauint32PropagationSegmentuint32PhaseSegment1uint32PhaseSegment2uint32SyncJumpWidthuint32BitRatePreScaleruint32NamestringTimeSegment1Minuint32TimeSegment1Maxuint32TimeSegment2Minuint32TimeSegment2Maxuint32SyncJumpWidthMaxuint32BitRatePreScalerMinuint32BitRatePreScalerMaxuint32BitRatePreScalerIncuint32ClockFrequencyuint32Stateuint32Maskuint32Flagsuint32TxErroruint16RxErroruint16RestartMsuint32}

func (*Can)Attrsadded inv1.2.1

func (can *Can) Attrs() *LinkAttrs

func (*Can)Typeadded inv1.2.1

func (can *Can) Type()string

typeChainadded inv1.2.1

type Chain struct {Parentuint32Chainuint32}

Chain contains the attributes of a Chain

funcChainListadded inv1.2.1

func ChainList(linkLink, parentuint32) ([]Chain,error)

ChainList gets a list of chains in the system.Equivalent to: `tc chain list`.The list can be filtered by link.

If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.

funcNewChainadded inv1.2.1

func NewChain(parentuint32, chainuint32)Chain

func (Chain)Stringadded inv1.2.1

func (cChain) String()string

typeClass

type Class interface {Attrs() *ClassAttrsType()string}

Class interfaces for all classes

funcClassList

func ClassList(linkLink, parentuint32) ([]Class,error)

ClassList gets a list of classes in the system.Equivalent to: `tc class show`.

Generally returns nothing if link and parent are not specified.If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.

typeClassAttrs

type ClassAttrs struct {LinkIndexintHandleuint32Parentuint32Leafuint32Statistics *ClassStatistics}

ClassAttrs represents a netlink class. A filter is associated with a link,has a handle and a parent. The root filter of a device should have aparent == HANDLE_ROOT.

func (ClassAttrs)String

func (qClassAttrs) String()string

typeClassStatisticsadded inv1.1.0

type ClassStatistics struct {Basic   *GnetStatsBasicQueue   *GnetStatsQueueRateEst *GnetStatsRateEstBasicHw *GnetStatsBasic// Hardward statistics added in kernel 4.20}

ClassStatistics representation based on generic networking statistics for netlink.See Documentation/networking/gen_stats.txt in Linux source code for more details.

funcNewClassStatisticsadded inv1.1.0

func NewClassStatistics() *ClassStatistics

NewClassStatistics Construct a ClassStatistics struct which fields are all initialized by 0.

typeClsactadded inv1.2.1

type Clsact struct {QdiscAttrs}

Clsact is a qdisc for adding filters

func (*Clsact)Attrsadded inv1.2.1

func (qdisc *Clsact) Attrs() *QdiscAttrs

func (*Clsact)Typeadded inv1.2.1

func (qdisc *Clsact) Type()string

typeCommProcEventadded inv1.2.1

type CommProcEvent struct {ProcessPiduint32ProcessTgiduint32Comm        [16]byte}

func (*CommProcEvent)Pidadded inv1.2.1

func (e *CommProcEvent) Pid()uint32

func (*CommProcEvent)Tgidadded inv1.2.1

func (e *CommProcEvent) Tgid()uint32

typeConnmarkActionadded inv1.1.0

type ConnmarkAction struct {ActionAttrsZoneuint16}

funcNewConnmarkActionadded inv1.1.0

func NewConnmarkAction() *ConnmarkAction

func (*ConnmarkAction)Attrsadded inv1.1.0

func (action *ConnmarkAction) Attrs() *ActionAttrs

func (*ConnmarkAction)Typeadded inv1.1.0

func (action *ConnmarkAction) Type()string

typeConntrackFilter

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

func (*ConntrackFilter)AddIP

AddIP adds an IP to the conntrack filter

func (*ConntrackFilter)AddIPNetadded inv1.2.1

func (f *ConntrackFilter) AddIPNet(tpConntrackFilterType, ipNet *net.IPNet)error

AddIPNet adds a IP subnet to the conntrack filter

func (*ConntrackFilter)AddLabelsadded inv1.2.1

func (f *ConntrackFilter) AddLabels(tpConntrackFilterType, labels [][]byte)error

AddLabels adds the provided list (zero or more) of labels to the conntrack filterConntrackFilterType here can be either:

  1. ConntrackMatchLabels: This matches every flow that has a label value (len(flow.Labels) > 0)against the list of provided labels. If `flow.Labels` contains ALL the provided labelsit is considered a match. This can be used when you want to match flows that containone or more labels.
  2. ConntrackUnmatchLabels: This matches every flow that has a label value (len(flow.Labels) > 0)against the list of provided labels. If `flow.Labels` does NOT contain ALL the provided labelsit is considered a match. This can be used when you want to match flows that don't containone or more labels.

func (*ConntrackFilter)AddPortadded inv1.2.1

AddPort adds a Port to the conntrack filter if the Layer 4 protocol allows it

func (*ConntrackFilter)AddProtocoladded inv1.2.1

func (f *ConntrackFilter) AddProtocol(protouint8)error

AddProtocol adds the Layer 4 protocol to the conntrack filter

func (*ConntrackFilter)AddZoneadded inv1.2.1

func (f *ConntrackFilter) AddZone(zoneuint16)error

AddZone adds a zone to the conntrack filter

func (*ConntrackFilter)MatchConntrackFlow

func (f *ConntrackFilter) MatchConntrackFlow(flow *ConntrackFlow)bool

MatchConntrackFlow applies the filter to the flow and returns true if the flow matches the filterfalse otherwise

typeConntrackFilterType

type ConntrackFilterTypeuint8

Filter types

typeConntrackFlow

type ConntrackFlow struct {FamilyTypeuint8ForwardIPTupleReverseIPTupleMarkuint32Zoneuint16TimeStartuint64TimeStopuint64TimeOutuint32Labels     []byteProtoInfoProtoInfo}

funcConntrackTableList

func ConntrackTableList(tableConntrackTableType, familyInetFamily) ([]*ConntrackFlow,error)

ConntrackTableList returns the flow list of a table of a specific familyconntrack -L [table] [options] List conntrack or expectation table

If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.

func (*ConntrackFlow)String

func (s *ConntrackFlow) String()string

typeConntrackTableType

type ConntrackTableTypeuint8

ConntrackTableType Conntrack table for the netlink operation

typeCsumActionadded inv1.2.1

type CsumAction struct {ActionAttrsUpdateFlagsCsumUpdateFlags}

funcNewCsumActionadded inv1.2.1

func NewCsumAction() *CsumAction

func (*CsumAction)Attrsadded inv1.2.1

func (action *CsumAction) Attrs() *ActionAttrs

func (*CsumAction)Typeadded inv1.2.1

func (action *CsumAction) Type()string

typeCsumUpdateFlagsadded inv1.2.1

type CsumUpdateFlagsuint32
const (TCA_CSUM_UPDATE_FLAG_IPV4HDRCsumUpdateFlags = 1TCA_CSUM_UPDATE_FLAG_ICMPCsumUpdateFlags = 2TCA_CSUM_UPDATE_FLAG_IGMPCsumUpdateFlags = 4TCA_CSUM_UPDATE_FLAG_TCPCsumUpdateFlags = 8TCA_CSUM_UPDATE_FLAG_UDPCsumUpdateFlags = 16TCA_CSUM_UPDATE_FLAG_UDPLITECsumUpdateFlags = 32TCA_CSUM_UPDATE_FLAG_SCTPCsumUpdateFlags = 64)

typeCustomConntrackFilter

type CustomConntrackFilter interface {// MatchConntrackFlow applies the filter to the flow and returns true if the flow matches// the filter or false otherwiseMatchConntrackFlow(flow *ConntrackFlow)bool}

typeDestination

type Destination interface {Family()intDecode([]byte)errorEncode() ([]byte,error)String()stringEqual(Destination)bool}

typeDevLinkPortAddAttrsadded inv1.2.1

type DevLinkPortAddAttrs struct {Controlleruint32SfNumberuint32PortIndexuint32PfNumberuint16SfNumberValidboolPortIndexValidboolControllerValidbool}

typeDevice

type Device struct {LinkAttrs}

Device links cannot be created via netlink. These linksare links created by udev like 'lo' and 'etho0'

func (*Device)Attrs

func (device *Device) Attrs() *LinkAttrs

func (*Device)Type

func (device *Device) Type()string

typeDevlinkDevAttrsadded inv1.1.0

type DevlinkDevAttrs struct {EswitchDevlinkDevEswitchAttr}

DevlinkDevAttrs represents device attributes

typeDevlinkDevEswitchAttradded inv1.1.0

type DevlinkDevEswitchAttr struct {ModestringInlineModestringEncapModestring}

DevlinkDevEswitchAttr represents device's eswitch attributes

typeDevlinkDeviceadded inv1.1.0

type DevlinkDevice struct {BusNamestringDeviceNamestringAttrsDevlinkDevAttrs}

DevlinkDevice represents device and its attributes

funcDevLinkGetDeviceByNameadded inv1.1.0

func DevLinkGetDeviceByName(Busstring, Devicestring) (*DevlinkDevice,error)

DevlinkGetDeviceByName provides a pointer to devlink device and nil error,otherwise returns an error code.

funcDevLinkGetDeviceListadded inv1.1.0

func DevLinkGetDeviceList() ([]*DevlinkDevice,error)

DevLinkGetDeviceList provides a pointer to devlink devices and nil error,otherwise returns an error code.

If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.

func (*DevlinkDevice)GetDevlinkInfoadded inv1.2.1

func (d *DevlinkDevice) GetDevlinkInfo() (*DevlinkDeviceInfo,error)

GetDevlinkInfo returns devlink info for target device,otherwise returns an error code.

func (*DevlinkDevice)GetDevlinkInfoAsMapadded inv1.2.1

func (d *DevlinkDevice) GetDevlinkInfoAsMap() (map[string]string,error)

GetDevlinkInfoAsMap returns devlink info for target device as a map,otherwise returns an error code.

typeDevlinkDeviceInfoadded inv1.2.1

type DevlinkDeviceInfo struct {DriverstringSerialNumberstringBoardIDstringFwAppstringFwAppBoundleIDstringFwAppNamestringFwBoundleIDstringFwMgmtstringFwMgmtAPIstringFwMgmtBuildstringFwNetliststringFwNetlistBuildstringFwPsidAPIstringFwUndistring}

DevlinkDeviceInfo represents devlink info

funcDevlinkGetDeviceInfoByNameadded inv1.2.1

func DevlinkGetDeviceInfoByName(Busstring, Devicestring) (*DevlinkDeviceInfo,error)

DevlinkGetDeviceInfoByName returns devlink info for selected device,otherwise returns an error code.Equivalent to: `devlink dev info $dev`

typeDevlinkParamadded inv1.2.1

type DevlinkParam struct {NamestringIsGenericboolTypeuint8// possible values are in nl.DEVLINK_PARAM_TYPE_* constantsValues    []DevlinkParamValue}

DevlinkParam represents parameter of the device

funcDevlinkGetDeviceParamByNameadded inv1.2.1

func DevlinkGetDeviceParamByName(busstring, devicestring, paramstring) (*DevlinkParam,error)

DevlinkGetDeviceParamByName returns specific parameter for devlink deviceEquivalent to: `devlink dev param show <bus>/<device> name <param>`

funcDevlinkGetDeviceParamsadded inv1.2.1

func DevlinkGetDeviceParams(busstring, devicestring) ([]*DevlinkParam,error)

DevlinkGetDeviceParams returns parameters for devlink deviceEquivalent to: `devlink dev param show <bus>/<device>`

If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.

typeDevlinkParamValueadded inv1.2.1

type DevlinkParamValue struct {Data  interface{}CMODEuint8// possible values are in nl.DEVLINK_PARAM_CMODE_* constants// contains filtered or unexported fields}

DevlinkParamValue contains values of the parameterData field contains specific type which can be casted by unsing info from the DevlinkParam.Type field

typeDevlinkPortadded inv1.2.1

type DevlinkPort struct {BusNamestringDeviceNamestringPortIndexuint32PortTypeuint16NetdeviceNamestringNetdevIfIndexuint32RdmaDeviceNamestringPortFlavouruint16Fn             *DevlinkPortFn}

DevlinkPort represents port and its attributes

funcDevLinkGetAllPortListadded inv1.2.1

func DevLinkGetAllPortList() ([]*DevlinkPort,error)

DevLinkGetPortList provides a pointer to devlink ports and nil error,otherwise returns an error code.If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.

funcDevLinkGetPortByIndexadded inv1.2.1

func DevLinkGetPortByIndex(Busstring, Devicestring, PortIndexuint32) (*DevlinkPort,error)

DevLinkGetPortByIndex provides a pointer to devlink portand nil error,otherwise returns an error code.

funcDevLinkPortAddadded inv1.2.1

func DevLinkPortAdd(Busstring, Devicestring, Flavouruint16, AttrsDevLinkPortAddAttrs) (*DevlinkPort,error)

DevLinkPortAdd adds a devlink port and returns a port on successotherwise returns nil port and an error code.

typeDevlinkPortFnadded inv1.2.1

type DevlinkPortFn struct {HwAddrnet.HardwareAddrStateuint8OpStateuint8}

DevlinkPortFn represents port function and its attributes

typeDevlinkPortFnSetAttrsadded inv1.2.1

type DevlinkPortFnSetAttrs struct {FnAttrsDevlinkPortFnHwAddrValidboolStateValidbool}

DevlinkPortFnSetAttrs represents attributes to set

typeDevlinkResourceadded inv1.2.1

type DevlinkResource struct {NamestringIDuint64Sizeuint64SizeNewuint64SizeMinuint64SizeMaxuint64SizeGranularityuint64PendingChangeboolUnituint8SizeValidboolOCCValidboolOCCSizeuint64Parent          *DevlinkResourceChildren        []DevlinkResource}

DevlinkResource represents a device resource

typeDevlinkResourcesadded inv1.2.1

type DevlinkResources struct {BusstringDevicestringResources []DevlinkResource}

DevlinkResources represents all devlink resources of a devlink device

funcDevlinkGetDeviceResourcesadded inv1.2.1

func DevlinkGetDeviceResources(busstring, devicestring) (*DevlinkResources,error)

DevlinkGetDeviceResources returns devlink device resources

typeDir

type Diruint8

Dir is an enum representing an ipsec template direction.

const (XFRM_DIR_INDir =iotaXFRM_DIR_OUTXFRM_DIR_FWDXFRM_SOCKET_INXFRM_SOCKET_OUTXFRM_SOCKET_FWD)

func (Dir)String

func (dDir) String()string

typeDummy

type Dummy struct {LinkAttrs}

Dummy links are dummy ethernet devices

func (*Dummy)Attrs

func (dummy *Dummy) Attrs() *LinkAttrs

func (*Dummy)Type

func (dummy *Dummy) Type()string

typeEncap

type Encap interface {Type()intDecode([]byte)errorEncode() ([]byte,error)String()stringEqual(Encap)bool}

typeEncapType

type EncapTypeuint8

EncapType is an enum representing the optional packet encapsulation.

const (XFRM_ENCAP_ESPINUDP_NONIKEEncapType =iota + 1XFRM_ENCAP_ESPINUDP)

func (EncapType)String

func (eEncapType) String()string

typeExecProcEventadded inv1.2.1

type ExecProcEvent struct {ProcessPiduint32ProcessTgiduint32}

func (*ExecProcEvent)Pidadded inv1.2.1

func (e *ExecProcEvent) Pid()uint32

func (*ExecProcEvent)Tgidadded inv1.2.1

func (e *ExecProcEvent) Tgid()uint32

typeExitProcEventadded inv1.2.1

type ExitProcEvent struct {ProcessPiduint32ProcessTgiduint32ExitCodeuint32ExitSignaluint32ParentPiduint32ParentTgiduint32}

func (*ExitProcEvent)Pidadded inv1.2.1

func (e *ExitProcEvent) Pid()uint32

func (*ExitProcEvent)Tgidadded inv1.2.1

func (e *ExitProcEvent) Tgid()uint32

typeFilter

type Filter interface {Attrs() *FilterAttrsType()string}

funcFilterList

func FilterList(linkLink, parentuint32) ([]Filter,error)

FilterList gets a list of filters in the system.Equivalent to: `tc filter show`.

Generally returns nothing if link and parent are not specified.If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.

typeFilterAttrs

type FilterAttrs struct {LinkIndexintHandleuint32Parentuint32Priorityuint16// lower is higher priorityProtocoluint16// unix.ETH_P_*Chain     *uint32}

FilterAttrs represents a netlink filter. A filter is associated with a link,has a handle and a parent. The root filter of a device should have aparent == HANDLE_ROOT.

func (FilterAttrs)String

func (qFilterAttrs) String()string

typeFloweradded inv1.2.1

type Flower struct {FilterAttrsClassIduint32DestIPnet.IPDestIPMasknet.IPMaskSrcIPnet.IPSrcIPMasknet.IPMaskEthTypeuint16EncDestIPnet.IPEncDestIPMasknet.IPMaskEncSrcIPnet.IPEncSrcIPMasknet.IPMaskEncDestPortuint16EncKeyIduint32SrcMacnet.HardwareAddrDestMacnet.HardwareAddrVlanIduint16SkipHwboolSkipSwboolIPProto         *nl.IPProtoDestPortuint16SrcPortuint16SrcPortRangeMinuint16SrcPortRangeMaxuint16DstPortRangeMinuint16DstPortRangeMaxuint16Actions []Action}

func (*Flower)Attrsadded inv1.2.1

func (filter *Flower) Attrs() *FilterAttrs

func (*Flower)Typeadded inv1.2.1

func (filter *Flower) Type()string

typeForkProcEventadded inv1.2.1

type ForkProcEvent struct {ParentPiduint32ParentTgiduint32ChildPiduint32ChildTgiduint32}

func (*ForkProcEvent)Pidadded inv1.2.1

func (e *ForkProcEvent) Pid()uint32

func (*ForkProcEvent)Tgidadded inv1.2.1

func (e *ForkProcEvent) Tgid()uint32

typeFou

type Fou struct {FamilyintPortintProtocolintEncapTypeintLocalnet.IPPeernet.IPPeerPortintIfIndexint}

funcFouList

func FouList(famint) ([]Fou,error)

If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.

typeFq

type Fq struct {QdiscAttrsPacketLimituint32FlowPacketLimituint32// In bytesQuantumuint32InitialQuantumuint32// called RateEnable under the hoodPacinguint32FlowDefaultRateuint32FlowMaxRateuint32// called BucketsLog under the hoodBucketsuint32FlowRefillDelayuint32LowRateThresholduint32Horizonuint32HorizonDropPolicyuint8}

Fq is a classless packet scheduler meant to be mostly used for locally generated traffic.

funcNewFq

func NewFq(attrsQdiscAttrs) *Fq

func (*Fq)Attrs

func (qdisc *Fq) Attrs() *QdiscAttrs

func (*Fq)Stringadded inv1.1.0

func (fq *Fq) String()string

func (*Fq)Type

func (qdisc *Fq) Type()string

typeFqCodel

type FqCodel struct {QdiscAttrsTargetuint32Limituint32Intervaluint32ECNuint32Flowsuint32Quantumuint32CEThresholduint32DropBatchSizeuint32MemoryLimituint32}

FQ_Codel (Fair Queuing Controlled Delay) is queuing discipline that combines Fair Queuing with the CoDel AQM scheme.

funcNewFqCodel

func NewFqCodel(attrsQdiscAttrs) *FqCodel

func (*FqCodel)Attrs

func (qdisc *FqCodel) Attrs() *QdiscAttrs

func (*FqCodel)Stringadded inv1.1.0

func (fqcodel *FqCodel) String()string

func (*FqCodel)Type

func (qdisc *FqCodel) Type()string

typeFwFilteradded inv1.2.1

type FwFilter struct {FilterAttrsClassIduint32InDevstringMaskuint32Police  *PoliceActionActions []Action}

func (*FwFilter)Attrsadded inv1.2.1

func (filter *FwFilter) Attrs() *FilterAttrs

func (*FwFilter)Typeadded inv1.2.1

func (filter *FwFilter) Type()string

typeGTP

type GTP struct {LinkAttrsFD0intFD1intRoleintPDPHashsizeint}

func (*GTP)Attrs

func (gtp *GTP) Attrs() *LinkAttrs

func (*GTP)Type

func (gtp *GTP) Type()string

typeGenericAction

type GenericAction struct {ActionAttrsChainint32}

func (*GenericAction)Attrs

func (action *GenericAction) Attrs() *ActionAttrs

func (*GenericAction)Type

func (action *GenericAction) Type()string

typeGenericClass

type GenericClass struct {ClassAttrsClassTypestring}

GenericClass classes represent types that are not currently understoodby this netlink library.

func (*GenericClass)Attrs

func (class *GenericClass) Attrs() *ClassAttrs

Attrs return the class attributes

func (*GenericClass)Type

func (class *GenericClass) Type()string

Type return the class type

typeGenericFilter

type GenericFilter struct {FilterAttrsFilterTypestring}

GenericFilter filters represent types that are not currently understoodby this netlink library.

func (*GenericFilter)Attrs

func (filter *GenericFilter) Attrs() *FilterAttrs

func (*GenericFilter)Type

func (filter *GenericFilter) Type()string

typeGenericLink

type GenericLink struct {LinkAttrsLinkTypestring}

GenericLink links represent types that are not currently understoodby this netlink library.

func (*GenericLink)Attrs

func (generic *GenericLink) Attrs() *LinkAttrs

func (*GenericLink)Type

func (generic *GenericLink) Type()string

typeGenericQdisc

type GenericQdisc struct {QdiscAttrsQdiscTypestring}

GenericQdisc qdiscs represent types that are not currently understoodby this netlink library.

func (*GenericQdisc)Attrs

func (qdisc *GenericQdisc) Attrs() *QdiscAttrs

func (*GenericQdisc)Type

func (qdisc *GenericQdisc) Type()string

typeGeneveadded inv1.2.1

type Geneve struct {LinkAttrsIDuint32// vniRemotenet.IPTtluint8Tosuint8Dportuint16UdpCsumuint8UdpZeroCsum6Txuint8UdpZeroCsum6Rxuint8Linkuint32FlowBasedboolInnerProtoInheritboolDfGeneveDfPortLowintPortHighint}

Geneve devices must specify RemoteIP and ID (VNI) on createhttps://github.com/torvalds/linux/blob/47ec5303d73ea344e84f46660fff693c57641386/drivers/net/geneve.c#L1209-L1223

func (*Geneve)Attrsadded inv1.2.1

func (geneve *Geneve) Attrs() *LinkAttrs

func (*Geneve)Typeadded inv1.2.1

func (geneve *Geneve) Type()string

typeGeneveDfadded inv1.2.1

type GeneveDfuint8
const (GENEVE_DF_UNSETGeneveDf =iotaGENEVE_DF_SETGENEVE_DF_INHERITGENEVE_DF_MAX)

typeGenlFamily

type GenlFamily struct {IDuint16HdrSizeuint32NamestringVersionuint32MaxAttruint32Ops     []GenlOpGroups  []GenlMulticastGroup}

funcGenlFamilyGet

func GenlFamilyGet(namestring) (*GenlFamily,error)

funcGenlFamilyList

func GenlFamilyList() ([]*GenlFamily,error)

If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.

typeGenlMulticastGroup

type GenlMulticastGroup struct {IDuint32Namestring}

typeGenlOp

type GenlOp struct {IDuint32Flagsuint32}

typeGnetStatsBasicadded inv1.1.0

type GnetStatsBasic struct {Bytesuint64// number of seen bytesPacketsuint32// number of seen packets}

GnetStatsBasic Ref: struct gnet_stats_basic { ... }

typeGnetStatsQueueadded inv1.1.0

type GnetStatsQueue struct {Qlenuint32// queue lengthBackloguint32// backlog size of queueDropsuint32// number of dropped packetsRequeuesuint32// number of requuesOverlimitsuint32// number of enqueues over the limit}

GnetStatsQueue Ref: struct gnet_stats_queue { ... }

typeGnetStatsRateEstadded inv1.1.0

type GnetStatsRateEst struct {Bpsuint32// current byte ratePpsuint32// current packet rate}

GnetStatsRateEst Ref: struct gnet_stats_rate_est { ... }

typeGnetStatsRateEst64added inv1.1.0

type GnetStatsRateEst64 struct {Bpsuint64// current byte ratePpsuint64// current packet rate}

GnetStatsRateEst64 Ref: struct gnet_stats_rate_est64 { ... }

typeGretap

type Gretap struct {LinkAttrsIKeyuint32OKeyuint32EncapSportuint16EncapDportuint16Localnet.IPRemotenet.IPIFlagsuint16OFlagsuint16PMtuDiscuint8Ttluint8Tosuint8EncapTypeuint16EncapFlagsuint16Linkuint32FlowBasedbool}

Gretap devices must specify LocalIP and RemoteIP on create

func (*Gretap)Attrs

func (gretap *Gretap) Attrs() *LinkAttrs

func (*Gretap)Type

func (gretap *Gretap) Type()string

typeGretun

type Gretun struct {LinkAttrsLinkuint32IFlagsuint16OFlagsuint16IKeyuint32OKeyuint32Localnet.IPRemotenet.IPTtluint8Tosuint8PMtuDiscuint8EncapTypeuint16EncapFlagsuint16EncapSportuint16EncapDportuint16FlowBasedbool}

func (*Gretun)Attrs

func (gretun *Gretun) Attrs() *LinkAttrs

func (*Gretun)Type

func (gretun *Gretun) Type()string

typeHandle

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

Handle is an handle for the netlink requests on aspecific network namespace. All the requests on thesame netlink family share the same netlink socket,which gets released when the handle is Close'd.

funcNewHandle

func NewHandle(nlFamilies ...int) (*Handle,error)

NewHandle returns a netlink handle on the current network namespace.Caller may specify the netlink families the handle should support.If no families are specified, all the families the netlink packagesupports will be automatically added.

funcNewHandleAt

func NewHandleAt(nsnetns.NsHandle, nlFamilies ...int) (*Handle,error)

NewHandleAt returns a netlink handle on the network namespacespecified by ns. If ns=netns.None(), current network namespacewill be assumed

funcNewHandleAtFrom

func NewHandleAtFrom(newNs, curNsnetns.NsHandle) (*Handle,error)

NewHandleAtFrom works as NewHandle but allows client to specify thenew and the origin netns Handle.

func (*Handle)AddrAdd

func (h *Handle) AddrAdd(linkLink, addr *Addr)error

AddrAdd will add an IP address to a link device.

Equivalent to: `ip addr add $addr dev $link`

If `addr` is an IPv4 address and the broadcast address is not given, itwill be automatically computed based on the IP mask if /30 or larger.If `net.IPv4zero` is given as the broadcast address, broadcast is disabled.

func (*Handle)AddrDel

func (h *Handle) AddrDel(linkLink, addr *Addr)error

AddrDel will delete an IP address from a link device.

Equivalent to: `ip addr del $addr dev $link`

func (*Handle)AddrList

func (h *Handle) AddrList(linkLink, familyint) ([]Addr,error)

AddrList gets a list of IP addresses in the system.Equivalent to: `ip addr show`.The list can be filtered by link and ip family.

If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.

func (*Handle)AddrReplace

func (h *Handle) AddrReplace(linkLink, addr *Addr)error

AddrReplace will replace (or, if not present, add) an IP address on a link device.

Equivalent to: `ip addr replace $addr dev $link`

If `addr` is an IPv4 address and the broadcast address is not given, itwill be automatically computed based on the IP mask if /30 or larger.If `net.IPv4zero` is given as the broadcast address, broadcast is disabled.

func (*Handle)BridgeSetMcastSnoop

func (h *Handle) BridgeSetMcastSnoop(linkLink, onbool)error

func (*Handle)BridgeSetVlanDefaultPVIDadded inv1.2.1

func (h *Handle) BridgeSetVlanDefaultPVID(linkLink, pviduint16)error

func (*Handle)BridgeSetVlanFilteringadded inv1.2.1

func (h *Handle) BridgeSetVlanFiltering(linkLink, onbool)error

func (*Handle)BridgeVlanAdd

func (h *Handle) BridgeVlanAdd(linkLink, viduint16, pvid, untagged, self, masterbool)error

BridgeVlanAdd adds a new vlan filter entryEquivalent to: `bridge vlan add dev DEV vid VID [ pvid ] [ untagged ] [ self ] [ master ]`

func (*Handle)BridgeVlanAddRangeadded inv1.2.1

func (h *Handle) BridgeVlanAddRange(linkLink, vid, vidEnduint16, pvid, untagged, self, masterbool)error

BridgeVlanAddRange adds a new vlan filter entryEquivalent to: `bridge vlan add dev DEV vid VID-VIDEND [ pvid ] [ untagged ] [ self ] [ master ]`

func (*Handle)BridgeVlanAddTunnelInfoadded inv1.3.1

func (h *Handle) BridgeVlanAddTunnelInfo(linkLink, vid, vidEnduint16, tunid, tunidEnduint32, self, masterbool)error

func (*Handle)BridgeVlanDel

func (h *Handle) BridgeVlanDel(linkLink, viduint16, pvid, untagged, self, masterbool)error

BridgeVlanDel adds a new vlan filter entryEquivalent to: `bridge vlan del dev DEV vid VID [ pvid ] [ untagged ] [ self ] [ master ]`

func (*Handle)BridgeVlanDelRangeadded inv1.2.1

func (h *Handle) BridgeVlanDelRange(linkLink, vid, vidEnduint16, pvid, untagged, self, masterbool)error

BridgeVlanDelRange adds a new vlan filter entryEquivalent to: `bridge vlan del dev DEV vid VID-VIDEND [ pvid ] [ untagged ] [ self ] [ master ]`

func (*Handle)BridgeVlanDelTunnelInfoadded inv1.3.1

func (h *Handle) BridgeVlanDelTunnelInfo(linkLink, vid, vidEnduint16, tunid, tunidEnduint32, self, masterbool)error

func (*Handle)BridgeVlanList

func (h *Handle) BridgeVlanList() (map[int32][]*nl.BridgeVlanInfo,error)

BridgeVlanList gets a map of device id to bridge vlan infos.Equivalent to: `bridge vlan show`

If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.

func (*Handle)BridgeVlanTunnelShowadded inv1.3.1

func (h *Handle) BridgeVlanTunnelShow() ([]nl.TunnelInfo,error)

func (*Handle)ChainAddadded inv1.2.1

func (h *Handle) ChainAdd(linkLink, chainChain)error

ChainAdd will add a chain to the system.Equivalent to: `tc chain add`

func (*Handle)ChainDeladded inv1.2.1

func (h *Handle) ChainDel(linkLink, chainChain)error

ChainDel will delete a chain from the system.Equivalent to: `tc chain del $chain`

func (*Handle)ChainListadded inv1.2.1

func (h *Handle) ChainList(linkLink, parentuint32) ([]Chain,error)

ChainList gets a list of chains in the system.Equivalent to: `tc chain list`.The list can be filtered by link.

If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.

func (*Handle)ClassAdd

func (h *Handle) ClassAdd(classClass)error

ClassAdd will add a class to the system.Equivalent to: `tc class add $class`

func (*Handle)ClassChange

func (h *Handle) ClassChange(classClass)error

ClassChange will change a class in placeEquivalent to: `tc class change $class`The parent and handle MUST NOT be changed.

func (*Handle)ClassDel

func (h *Handle) ClassDel(classClass)error

ClassDel will delete a class from the system.Equivalent to: `tc class del $class`

func (*Handle)ClassList

func (h *Handle) ClassList(linkLink, parentuint32) ([]Class,error)

ClassList gets a list of classes in the system.Equivalent to: `tc class show`.

Generally returns nothing if link and parent are not specified.If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.

func (*Handle)ClassReplace

func (h *Handle) ClassReplace(classClass)error

ClassReplace will replace a class to the system.quivalent to: `tc class replace $class`The handle MAY be changed.If a class already exist with this parent/handle pair, the class is changed.If a class does not already exist with this parent/handle, a new class is created.

func (*Handle)Closeadded inv1.2.1

func (h *Handle) Close()

Close releases the resources allocated to this handle

func (*Handle)ConntrackCreateadded inv1.2.1

func (h *Handle) ConntrackCreate(tableConntrackTableType, familyInetFamily, flow *ConntrackFlow)error

ConntrackCreate creates a new conntrack flow in the desired table using the handleconntrack -I [table]Create a conntrack or expectation

func (*Handle)ConntrackDeleteFilterdeprecated

func (h *Handle) ConntrackDeleteFilter(tableConntrackTableType, familyInetFamily, filterCustomConntrackFilter) (uint,error)

ConntrackDeleteFilter deletes entries on the specified table on the base of the filter using the netlink handle passedconntrack -D [table] parameters Delete conntrack or expectation

Deprecated: useHandle.ConntrackDeleteFilters instead.

func (*Handle)ConntrackDeleteFiltersadded inv1.2.1

func (h *Handle) ConntrackDeleteFilters(tableConntrackTableType, familyInetFamily, filters ...CustomConntrackFilter) (uint,error)

ConntrackDeleteFilters deletes entries on the specified table matching any of the specified filters using the netlink handle passedconntrack -D [table] parameters Delete conntrack or expectation

func (*Handle)ConntrackTableFlush

func (h *Handle) ConntrackTableFlush(tableConntrackTableType)error

ConntrackTableFlush flushes all the flows of a specified table using the netlink handle passedconntrack -F [table] Flush tableThe flush operation applies to all the family types

func (*Handle)ConntrackTableList

func (h *Handle) ConntrackTableList(tableConntrackTableType, familyInetFamily) ([]*ConntrackFlow,error)

ConntrackTableList returns the flow list of a table of a specific family using the netlink handle passedconntrack -L [table] [options] List conntrack or expectation table

If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.

func (*Handle)ConntrackUpdateadded inv1.2.1

func (h *Handle) ConntrackUpdate(tableConntrackTableType, familyInetFamily, flow *ConntrackFlow)error

ConntrackUpdate updates an existing conntrack flow in the desired table using the handleconntrack -U [table]Update a conntrack

func (*Handle)Deletedeprecated

func (h *Handle) Delete()

Delete releases the resources allocated to this handle

Deprecated: use Close instead which is in line with typical resource releasepatterns for files and other resources.

func (*Handle)DevLinkGetAllPortListadded inv1.2.1

func (h *Handle) DevLinkGetAllPortList() ([]*DevlinkPort,error)

DevLinkGetPortList provides a pointer to devlink ports and nil error,otherwise returns an error code.If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.

func (*Handle)DevLinkGetDeviceByNameadded inv1.1.0

func (h *Handle) DevLinkGetDeviceByName(Busstring, Devicestring) (*DevlinkDevice,error)

DevlinkGetDeviceByName provides a pointer to devlink device and nil error,otherwise returns an error code.

func (*Handle)DevLinkGetDeviceListadded inv1.1.0

func (h *Handle) DevLinkGetDeviceList() ([]*DevlinkDevice,error)

DevLinkGetDeviceList provides a pointer to devlink devices and nil error,otherwise returns an error code.If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.

func (*Handle)DevLinkGetPortByIndexadded inv1.2.1

func (h *Handle) DevLinkGetPortByIndex(Busstring, Devicestring, PortIndexuint32) (*DevlinkPort,error)

DevLinkGetPortByIndexprovides a pointer to devlink device and nil error,otherwise returns an error code.

func (*Handle)DevLinkPortAddadded inv1.2.1

func (h *Handle) DevLinkPortAdd(Busstring, Devicestring, Flavouruint16, AttrsDevLinkPortAddAttrs) (*DevlinkPort,error)

DevLinkPortAdd adds a devlink port and returns a port on successotherwise returns nil port and an error code.

func (*Handle)DevLinkPortDeladded inv1.2.1

func (h *Handle) DevLinkPortDel(Busstring, Devicestring, PortIndexuint32)error

DevLinkPortDel deletes a devlink port and returns success or error code.

func (*Handle)DevLinkSetEswitchModeadded inv1.1.0

func (h *Handle) DevLinkSetEswitchMode(Dev *DevlinkDevice, NewModestring)error

DevLinkSetEswitchMode sets eswitch mode if able to set successfully orreturns an error code.Equivalent to: `devlink dev eswitch set $dev mode switchdev`Equivalent to: `devlink dev eswitch set $dev mode legacy`

func (*Handle)DevlinkGetDeviceInfoByNameadded inv1.2.1

func (h *Handle) DevlinkGetDeviceInfoByName(Busstring, Devicestring, getInfoMsg devlinkInfoGetter) (*DevlinkDeviceInfo,error)

DevlinkGetDeviceInfoByName returns devlink info for selected device,otherwise returns an error code.Equivalent to: `devlink dev info $dev`

func (*Handle)DevlinkGetDeviceInfoByNameAsMapadded inv1.2.1

func (h *Handle) DevlinkGetDeviceInfoByNameAsMap(Busstring, Devicestring, getInfoMsg devlinkInfoGetter) (map[string]string,error)

DevlinkGetDeviceInfoByNameAsMap returns devlink info for selected device as a map,otherwise returns an error code.Equivalent to: `devlink dev info $dev`

func (*Handle)DevlinkGetDeviceParamByNameadded inv1.2.1

func (h *Handle) DevlinkGetDeviceParamByName(busstring, devicestring, paramstring) (*DevlinkParam,error)

DevlinkGetDeviceParamByName returns specific parameter for devlink deviceEquivalent to: `devlink dev param show <bus>/<device> name <param>`

func (*Handle)DevlinkGetDeviceParamsadded inv1.2.1

func (h *Handle) DevlinkGetDeviceParams(busstring, devicestring) ([]*DevlinkParam,error)

DevlinkGetDeviceParams returns parameters for devlink deviceEquivalent to: `devlink dev param show <bus>/<device>`

If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.

func (*Handle)DevlinkGetDeviceResourcesadded inv1.2.1

func (h *Handle) DevlinkGetDeviceResources(busstring, devicestring) (*DevlinkResources,error)

DevlinkGetDeviceResources returns devlink device resources

func (*Handle)DevlinkPortFnSetadded inv1.2.1

func (h *Handle) DevlinkPortFnSet(Busstring, Devicestring, PortIndexuint32, FnAttrsDevlinkPortFnSetAttrs)error

DevlinkPortFnSet sets one or more port function attributes specified by the attribute mask.It returns 0 on success or error code.

func (*Handle)DevlinkSetDeviceParamadded inv1.2.1

func (h *Handle) DevlinkSetDeviceParam(busstring, devicestring, paramstring, cmodeuint8, value interface{})error

DevlinkSetDeviceParam set specific parameter for devlink deviceEquivalent to: `devlink dev param set <bus>/<device> name <param> cmode <cmode> value <value>`cmode argument should contain valid cmode value as uint8, modes are define in nl.DEVLINK_PARAM_CMODE_* constantsvalue argument should have one of the following types: uint8, uint16, uint32, string, bool

func (*Handle)FilterAdd

func (h *Handle) FilterAdd(filterFilter)error

FilterAdd will add a filter to the system.Equivalent to: `tc filter add $filter`

func (*Handle)FilterDel

func (h *Handle) FilterDel(filterFilter)error

FilterDel will delete a filter from the system.Equivalent to: `tc filter del $filter`

func (*Handle)FilterList

func (h *Handle) FilterList(linkLink, parentuint32) ([]Filter,error)

FilterList gets a list of filters in the system.Equivalent to: `tc filter show`.

Generally returns nothing if link and parent are not specified.If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.

func (*Handle)FilterReplaceadded inv1.1.0

func (h *Handle) FilterReplace(filterFilter)error

FilterReplace will replace a filter.Equivalent to: `tc filter replace $filter`

func (*Handle)FouAdd

func (h *Handle) FouAdd(fFou)error

func (*Handle)FouDel

func (h *Handle) FouDel(fFou)error

func (*Handle)FouList

func (h *Handle) FouList(famint) ([]Fou,error)

If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.

func (*Handle)GTPPDPAdd

func (h *Handle) GTPPDPAdd(linkLink, pdp *PDP)error

func (*Handle)GTPPDPByITEI

func (h *Handle) GTPPDPByITEI(linkLink, iteiint) (*PDP,error)

func (*Handle)GTPPDPByMSAddress

func (h *Handle) GTPPDPByMSAddress(linkLink, addrnet.IP) (*PDP,error)

func (*Handle)GTPPDPByTID

func (h *Handle) GTPPDPByTID(linkLink, tidint) (*PDP,error)

func (*Handle)GTPPDPDel

func (h *Handle) GTPPDPDel(linkLink, pdp *PDP)error

func (*Handle)GTPPDPList

func (h *Handle) GTPPDPList() ([]*PDP,error)

If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.

func (*Handle)GenlFamilyGet

func (h *Handle) GenlFamilyGet(namestring) (*GenlFamily,error)

func (*Handle)GenlFamilyList

func (h *Handle) GenlFamilyList() ([]*GenlFamily,error)

If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.

func (*Handle)GetNetNsIdByFdadded inv1.1.0

func (h *Handle) GetNetNsIdByFd(fdint) (int,error)

GetNetNsIdByFd looks up the network namespace ID for a given fd.fd must be an open file descriptor to a namespace file.Returns -1 if the namespace does not have an ID set.

func (*Handle)GetNetNsIdByPidadded inv1.1.0

func (h *Handle) GetNetNsIdByPid(pidint) (int,error)

GetNetNsIdByPid looks up the network namespace ID for a given pid (really thread id).Returns -1 if the namespace does not have an ID set.

func (*Handle)GetSocketReceiveBufferSize

func (h *Handle) GetSocketReceiveBufferSize() ([]int,error)

GetSocketReceiveBufferSize gets the receiver buffer size for eachsocket in the netlink handle. The retrieved value should be thedouble to the one set for SetSocketReceiveBufferSize.

func (*Handle)IpsetAddadded inv1.2.1

func (h *Handle) IpsetAdd(setnamestring, entry *IPSetEntry)error

IpsetAdd adds an entry to an existing ipset.

func (*Handle)IpsetCreateadded inv1.2.1

func (h *Handle) IpsetCreate(setname, typenamestring, optionsIpsetCreateOptions)error

func (*Handle)IpsetDeladded inv1.2.1

func (h *Handle) IpsetDel(setnamestring, entry *IPSetEntry)error

IpsetDel deletes an entry from an existing ipset.

func (*Handle)IpsetDestroyadded inv1.2.1

func (h *Handle) IpsetDestroy(setnamestring)error

func (*Handle)IpsetFlushadded inv1.2.1

func (h *Handle) IpsetFlush(setnamestring)error

func (*Handle)IpsetListadded inv1.2.1

func (h *Handle) IpsetList(namestring) (*IPSetResult,error)

func (*Handle)IpsetListAlladded inv1.2.1

func (h *Handle) IpsetListAll() ([]IPSetResult,error)

func (*Handle)IpsetProtocoladded inv1.2.1

func (h *Handle) IpsetProtocol() (protocoluint8, minVersionuint8, errerror)

func (*Handle)IpsetSwapadded inv1.2.1

func (h *Handle) IpsetSwap(setname, othersetnamestring)error

func (*Handle)IpsetTestadded inv1.2.1

func (h *Handle) IpsetTest(setnamestring, entry *IPSetEntry) (bool,error)

func (*Handle)LinkAdd

func (h *Handle) LinkAdd(linkLink)error

LinkAdd adds a new link device. The type and features of the deviceare taken from the parameters in the link object.Equivalent to: `ip link add $link`

func (*Handle)LinkAddAltNameadded inv1.2.1

func (h *Handle) LinkAddAltName(linkLink, namestring)error

LinkAddAltName adds a new alternative name for the link device.Equivalent to: `ip link property add $link altname $name`

func (*Handle)LinkByAlias

func (h *Handle) LinkByAlias(aliasstring) (Link,error)

LinkByAlias finds a link by its alias and returns a pointer to the object.If there are multiple links with the alias it returns the first one

If the kernel doesn't support IFLA_IFALIAS, this method will fall back tofiltering a dump of all link names. In this case, if the returned error isErrDumpInterrupted the result may be missing or outdated.

func (*Handle)LinkByIndex

func (h *Handle) LinkByIndex(indexint) (Link,error)

LinkByIndex finds a link by index and returns a pointer to the object.

func (*Handle)LinkByName

func (h *Handle) LinkByName(namestring) (Link,error)

LinkByName finds a link by name and returns a pointer to the object.

If the kernel doesn't support IFLA_IFNAME, this method will fall back tofiltering a dump of all link names. In this case, if the returned error isErrDumpInterrupted the result may be missing or outdated.

func (*Handle)LinkDel

func (h *Handle) LinkDel(linkLink)error

LinkDel deletes link device. Either Index or Name must be set inthe link object for it to be deleted. The other values are ignored.Equivalent to: `ip link del $link`

func (*Handle)LinkDelAltNameadded inv1.2.1

func (h *Handle) LinkDelAltName(linkLink, namestring)error

LinkDelAltName delete an alternative name for the link device.Equivalent to: `ip link property del $link altname $name`

func (*Handle)LinkGetProtinfo

func (h *Handle) LinkGetProtinfo(linkLink) (Protinfo,error)

If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.

func (*Handle)LinkList

func (h *Handle) LinkList() ([]Link,error)

LinkList gets a list of link devices.Equivalent to: `ip link show`

If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.

func (*Handle)LinkModifyadded inv1.2.1

func (h *Handle) LinkModify(linkLink)error

func (*Handle)LinkSetARPOff

func (h *Handle) LinkSetARPOff(linkLink)error

func (*Handle)LinkSetARPOn

func (h *Handle) LinkSetARPOn(linkLink)error

func (*Handle)LinkSetAlias

func (h *Handle) LinkSetAlias(linkLink, namestring)error

LinkSetAlias sets the alias of the link device.Equivalent to: `ip link set dev $link alias $name`

func (*Handle)LinkSetAllmulticastOffadded inv1.1.0

func (h *Handle) LinkSetAllmulticastOff(linkLink)error

LinkSetAllmulticastOff disables the reception of all hardware multicast packets for the link device.Equivalent to: `ip link set $link allmulticast off`

func (*Handle)LinkSetAllmulticastOnadded inv1.1.0

func (h *Handle) LinkSetAllmulticastOn(linkLink)error

LinkSetAllmulticastOn enables the reception of all hardware multicast packets for the link device.Equivalent to: `ip link set $link allmulticast on`

func (*Handle)LinkSetBRSlaveGroupFwdMaskadded inv1.2.1

func (h *Handle) LinkSetBRSlaveGroupFwdMask(linkLink, maskuint16)error

LinkSetBRSlaveGroupFwdMask set the group_fwd_mask of a bridge slave interface

func (*Handle)LinkSetBondSlaveQueueIdadded inv1.1.0

func (h *Handle) LinkSetBondSlaveQueueId(linkLink, queueIduint16)error

LinkSetBondSlaveQueueId modify bond slave queue-id.

func (*Handle)LinkSetBrNeighSuppressadded inv1.2.1

func (h *Handle) LinkSetBrNeighSuppress(linkLink, modebool)error

func (*Handle)LinkSetBrProxyArp

func (h *Handle) LinkSetBrProxyArp(linkLink, modebool)error

func (*Handle)LinkSetBrProxyArpWiFi

func (h *Handle) LinkSetBrProxyArpWiFi(linkLink, modebool)error

func (*Handle)LinkSetDown

func (h *Handle) LinkSetDown(linkLink)error

LinkSetDown disables link device.Equivalent to: `ip link set $link down`

func (*Handle)LinkSetFastLeave

func (h *Handle) LinkSetFastLeave(linkLink, modebool)error

func (*Handle)LinkSetFlood

func (h *Handle) LinkSetFlood(linkLink, modebool)error

func (*Handle)LinkSetGROIPv4MaxSizeadded inv1.2.1

func (h *Handle) LinkSetGROIPv4MaxSize(linkLink, maxSizeint)error

LinkSetGROIPv4MaxSize sets the IPv4 GRO maximum size of the link device.Equivalent to: `ip link set $link gro_ipv4_max_size $maxSize`

func (*Handle)LinkSetGROMaxSizeadded inv1.2.1

func (h *Handle) LinkSetGROMaxSize(linkLink, maxSizeint)error

LinkSetGROMaxSize sets the IPv6 GRO maximum size of the link device.Equivalent to: `ip link set $link gro_max_size $maxSize`

func (*Handle)LinkSetGSOIPv4MaxSizeadded inv1.2.1

func (h *Handle) LinkSetGSOIPv4MaxSize(linkLink, maxSizeint)error

LinkSetGSOIPv4MaxSize sets the IPv4 GSO maximum size of the link device.Equivalent to: `ip link set $link gso_ipv4_max_size $maxSize`

func (*Handle)LinkSetGSOMaxSegsadded inv1.2.1

func (h *Handle) LinkSetGSOMaxSegs(linkLink, maxSizeint)error

LinkSetGSOMaxSegs sets the GSO maximum segment count of the link device.Equivalent to: `ip link set $link gso_max_segs $maxSegs`

func (*Handle)LinkSetGSOMaxSizeadded inv1.2.1

func (h *Handle) LinkSetGSOMaxSize(linkLink, maxSizeint)error

LinkSetGSOMaxSize sets the IPv6 GSO maximum size of the link device.Equivalent to: `ip link set $link gso_max_size $maxSize`

func (*Handle)LinkSetGroupadded inv1.1.0

func (h *Handle) LinkSetGroup(linkLink, groupint)error

LinkSetGroup sets the link group id which can be used to perform mass actionswith iproute2 as well use it as a reference in nft filters.Equivalent to: `ip link set $link group $id`

func (*Handle)LinkSetGuard

func (h *Handle) LinkSetGuard(linkLink, modebool)error

func (*Handle)LinkSetHairpin

func (h *Handle) LinkSetHairpin(linkLink, modebool)error

func (*Handle)LinkSetHardwareAddr

func (h *Handle) LinkSetHardwareAddr(linkLink, hwaddrnet.HardwareAddr)error

LinkSetHardwareAddr sets the hardware address of the link device.Equivalent to: `ip link set $link address $hwaddr`

func (*Handle)LinkSetIP6AddrGenModeadded inv1.3.1

func (h *Handle) LinkSetIP6AddrGenMode(linkLink, modeint)error

LinkSetIP6AddrGenMode sets the IPv6 address generation mode of the link device.Equivalent to: `ip link set $link addrgenmode $mode`

func (*Handle)LinkSetIsolatedadded inv1.2.1

func (h *Handle) LinkSetIsolated(linkLink, modebool)error

func (*Handle)LinkSetLearning

func (h *Handle) LinkSetLearning(linkLink, modebool)error

func (*Handle)LinkSetMTU

func (h *Handle) LinkSetMTU(linkLink, mtuint)error

LinkSetMTU sets the mtu of the link device.Equivalent to: `ip link set $link mtu $mtu`

func (*Handle)LinkSetMacvlanModeadded inv1.2.1

func (h *Handle) LinkSetMacvlanMode(linkLink, modeMacvlanMode)error

LinkSetMacvlanMode sets the mode of the macvlan or macvtap link device.Note that passthrough mode cannot be set to and from and will fail.Equivalent to: `ip link set $link type (macvlan|macvtap) mode $mode

func (*Handle)LinkSetMaster

func (h *Handle) LinkSetMaster(linkLink, masterLink)error

LinkSetMaster sets the master of the link device.Equivalent to: `ip link set $link master $master`

func (*Handle)LinkSetMasterByIndex

func (h *Handle) LinkSetMasterByIndex(linkLink, masterIndexint)error

LinkSetMasterByIndex sets the master of the link device.Equivalent to: `ip link set $link master $master`

func (*Handle)LinkSetMulticastOffadded inv1.2.1

func (h *Handle) LinkSetMulticastOff(linkLink)error

LinkSetAllmulticastOff disables the reception of multicast packets for the link device.Equivalent to: `ip link set $link multicast off`

func (*Handle)LinkSetMulticastOnadded inv1.2.1

func (h *Handle) LinkSetMulticastOn(linkLink)error

LinkSetMulticastOn enables the reception of multicast packets for the link device.Equivalent to: `ip link set $link multicast on`

func (*Handle)LinkSetName

func (h *Handle) LinkSetName(linkLink, namestring)error

LinkSetName sets the name of the link device.Equivalent to: `ip link set $link name $name`

func (*Handle)LinkSetNoMaster

func (h *Handle) LinkSetNoMaster(linkLink)error

LinkSetNoMaster removes the master of the link device.Equivalent to: `ip link set $link nomaster`

func (*Handle)LinkSetNsFd

func (h *Handle) LinkSetNsFd(linkLink, fdint)error

LinkSetNsFd puts the device into a new network namespace. Thefd must be an open file descriptor to a network namespace.Similar to: `ip link set $link netns $ns`

func (*Handle)LinkSetNsPid

func (h *Handle) LinkSetNsPid(linkLink, nspidint)error

LinkSetNsPid puts the device into a new network namespace. Thepid must be a pid of a running process.Equivalent to: `ip link set $link netns $pid`

func (*Handle)LinkSetRootBlock

func (h *Handle) LinkSetRootBlock(linkLink, modebool)error

func (*Handle)LinkSetTxQLen

func (h *Handle) LinkSetTxQLen(linkLink, qlenint)error

LinkSetTxQLen sets the transaction queue length for the link.Equivalent to: `ip link set $link txqlen $qlen`

func (*Handle)LinkSetUp

func (h *Handle) LinkSetUp(linkLink)error

LinkSetUp enables the link device.Equivalent to: `ip link set $link up`

func (*Handle)LinkSetVfGUIDadded inv1.1.0

func (h *Handle) LinkSetVfGUID(linkLink, vfint, vfGuidnet.HardwareAddr, guidTypeint)error

LinkSetVfGUID sets the node or port GUID of a vf for the link.

func (*Handle)LinkSetVfHardwareAddr

func (h *Handle) LinkSetVfHardwareAddr(linkLink, vfint, hwaddrnet.HardwareAddr)error

LinkSetVfHardwareAddr sets the hardware address of a vf for the link.Equivalent to: `ip link set $link vf $vf mac $hwaddr`

func (*Handle)LinkSetVfRateadded inv1.1.0

func (h *Handle) LinkSetVfRate(linkLink, vf, minRate, maxRateint)error

LinkSetVfRate sets the min and max tx rate of a vf for the link.Equivalent to: `ip link set $link vf $vf min_tx_rate $min_rate max_tx_rate $max_rate`

func (*Handle)LinkSetVfSpoofchk

func (h *Handle) LinkSetVfSpoofchk(linkLink, vfint, checkbool)error

LinkSetVfSpoofchk enables/disables spoof check on a vf for the link.Equivalent to: `ip link set $link vf $vf spoofchk $check`

func (*Handle)LinkSetVfStateadded inv1.1.0

func (h *Handle) LinkSetVfState(linkLink, vfint, stateuint32)error

LinkSetVfState enables/disables virtual link state on a vf.Equivalent to: `ip link set $link vf $vf state $state`

func (*Handle)LinkSetVfTrust

func (h *Handle) LinkSetVfTrust(linkLink, vfint, statebool)error

LinkSetVfTrust enables/disables trust state on a vf for the link.Equivalent to: `ip link set $link vf $vf trust $state`

func (*Handle)LinkSetVfTxRate

func (h *Handle) LinkSetVfTxRate(linkLink, vf, rateint)error

LinkSetVfTxRate sets the tx rate of a vf for the link.Equivalent to: `ip link set $link vf $vf rate $rate`

func (*Handle)LinkSetVfVlan

func (h *Handle) LinkSetVfVlan(linkLink, vf, vlanint)error

LinkSetVfVlan sets the vlan of a vf for the link.Equivalent to: `ip link set $link vf $vf vlan $vlan`

func (*Handle)LinkSetVfVlanQosadded inv1.1.0

func (h *Handle) LinkSetVfVlanQos(linkLink, vf, vlan, qosint)error

LinkSetVfVlanQos sets the vlan and qos priority of a vf for the link.Equivalent to: `ip link set $link vf $vf vlan $vlan qos $qos`

func (*Handle)LinkSetVfVlanQosProtoadded inv1.2.1

func (h *Handle) LinkSetVfVlanQosProto(linkLink, vf, vlan, qos, protoint)error

LinkSetVfVlanQosProto sets the vlan, qos and protocol of a vf for the link.Equivalent to: `ip link set $link vf $vf vlan $vlan qos $qos proto $proto`

func (*Handle)LinkSetVlanTunneladded inv1.3.1

func (h *Handle) LinkSetVlanTunnel(linkLink, modebool)error

func (*Handle)MacvlanMACAddrAdd

func (h *Handle) MacvlanMACAddrAdd(linkLink, addrnet.HardwareAddr)error

func (*Handle)MacvlanMACAddrDel

func (h *Handle) MacvlanMACAddrDel(linkLink, addrnet.HardwareAddr)error

func (*Handle)MacvlanMACAddrFlush

func (h *Handle) MacvlanMACAddrFlush(linkLink)error

func (*Handle)MacvlanMACAddrSet

func (h *Handle) MacvlanMACAddrSet(linkLink, addrs []net.HardwareAddr)error

func (*Handle)NeighAdd

func (h *Handle) NeighAdd(neigh *Neigh)error

NeighAdd will add an IP to MAC mapping to the ARP tableEquivalent to: `ip neigh add ....`

func (*Handle)NeighAppend

func (h *Handle) NeighAppend(neigh *Neigh)error

NeighAppend will append an entry to FDBEquivalent to: `bridge fdb append...`

func (*Handle)NeighDel

func (h *Handle) NeighDel(neigh *Neigh)error

NeighDel will delete an IP address from a link device.Equivalent to: `ip addr del $addr dev $link`

func (*Handle)NeighList

func (h *Handle) NeighList(linkIndex, familyint) ([]Neigh,error)

NeighList returns a list of IP-MAC mappings in the system (ARP table).Equivalent to: `ip neighbor show`.The list can be filtered by link and ip family.

If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.

func (*Handle)NeighListExecuteadded inv1.1.0

func (h *Handle) NeighListExecute(msgNdmsg) ([]Neigh,error)

NeighListExecute returns a list of neighbour entries filtered by link, ip family, flag and state.

If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.

func (*Handle)NeighProxyList

func (h *Handle) NeighProxyList(linkIndex, familyint) ([]Neigh,error)

NeighProxyList returns a list of neighbor proxies in the system.Equivalent to: `ip neighbor show proxy`.The list can be filtered by link, ip family.

If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.

func (*Handle)NeighSet

func (h *Handle) NeighSet(neigh *Neigh)error

NeighSet will add or replace an IP to MAC mapping to the ARP tableEquivalent to: `ip neigh replace....`

func (*Handle)QdiscAdd

func (h *Handle) QdiscAdd(qdiscQdisc)error

QdiscAdd will add a qdisc to the system.Equivalent to: `tc qdisc add $qdisc`

func (*Handle)QdiscChange

func (h *Handle) QdiscChange(qdiscQdisc)error

QdiscChange will change a qdisc in placeEquivalent to: `tc qdisc change $qdisc`The parent and handle MUST NOT be changed.

func (*Handle)QdiscDel

func (h *Handle) QdiscDel(qdiscQdisc)error

QdiscDel will delete a qdisc from the system.Equivalent to: `tc qdisc del $qdisc`

func (*Handle)QdiscList

func (h *Handle) QdiscList(linkLink) ([]Qdisc,error)

QdiscList gets a list of qdiscs in the system.Equivalent to: `tc qdisc show`.The list can be filtered by link.

If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.

func (*Handle)QdiscReplace

func (h *Handle) QdiscReplace(qdiscQdisc)error

QdiscReplace will replace a qdisc to the system.Equivalent to: `tc qdisc replace $qdisc`The handle MUST change.

func (*Handle)RdmaLinkAddadded inv1.2.1

func (h *Handle) RdmaLinkAdd(linkNamestring, linkTypestring, netdevstring)error

RdmaLinkAdd adds an rdma link for the specified type to the network device.

func (*Handle)RdmaLinkByNameadded inv1.1.0

func (h *Handle) RdmaLinkByName(namestring) (*RdmaLink,error)

RdmaLinkByName finds a link by name and returns a pointer to the object iffound and nil error, otherwise returns error code.

If the returned error isErrDumpInterrupted, the result may be missing oroutdated and the caller should retry.

func (*Handle)RdmaLinkDeladded inv1.2.1

func (h *Handle) RdmaLinkDel(namestring)error

RdmaLinkDel deletes an rdma link.

If the returned error isErrDumpInterrupted, the caller should retry.

func (*Handle)RdmaLinkListadded inv1.2.1

func (h *Handle) RdmaLinkList() ([]*RdmaLink,error)

RdmaLinkList gets a list of RDMA link devices.Equivalent to: `rdma dev show`

If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.

func (*Handle)RdmaLinkSetNameadded inv1.1.0

func (h *Handle) RdmaLinkSetName(link *RdmaLink, namestring)error

RdmaLinkSetName sets the name of the rdma link device. Return nil on successor error otherwise.Equivalent to: `rdma dev set $old_devname name $name`

func (*Handle)RdmaLinkSetNsFdadded inv1.1.0

func (h *Handle) RdmaLinkSetNsFd(link *RdmaLink, fduint32)error

RdmaLinkSetNsFd puts the RDMA device into a new network namespace. Thefd must be an open file descriptor to a network namespace.Similar to: `rdma dev set $dev netns $ns`

func (*Handle)RdmaPortStatisticListadded inv1.3.1

func (h *Handle) RdmaPortStatisticList(link *RdmaLink, portuint32) (*RdmaPortStatistic,error)

RdmaPortStatisticList get rdma device port statistic countersReturns rdma device port statistic counters on success or returns errorotherwise.Equivalent to: `rdma statistic show linkDEV/PORT'

func (*Handle)RdmaResourceListadded inv1.3.1

func (h *Handle) RdmaResourceList() ([]*RdmaResource,error)

RdmaResourceList list rdma resource tracking informationReturns all rdma devices resource tracking summary on success or returns errorotherwise.Equivalent to: `rdma resource'

func (*Handle)RdmaStatisticadded inv1.3.1

func (h *Handle) RdmaStatistic(link *RdmaLink) (*RdmaDeviceStatistic,error)

RdmaStatistic get rdma device statistic countersReturns rdma device statistic counters on success or returns errorotherwise.Equivalent to: `rdma statistic show link [DEV]'

func (*Handle)RdmaSystemGetNetnsModeadded inv1.1.0

func (h *Handle) RdmaSystemGetNetnsMode() (string,error)

RdmaSystemGetNetnsMode gets the net namespace mode for RDMA subsystemReturns mode string and error status as nil on success or returns errorotherwise.Equivalent to: `rdma system show netns'

func (*Handle)RdmaSystemSetNetnsModeadded inv1.1.0

func (h *Handle) RdmaSystemSetNetnsMode(NewModestring)error

RdmaSystemSetNetnsMode sets the net namespace mode for RDMA subsystemReturns nil on success or appropriate error code.Equivalent to: `rdma system set netns { shared | exclusive }'

func (*Handle)RouteAdd

func (h *Handle) RouteAdd(route *Route)error

RouteAdd will add a route to the system.Equivalent to: `ip route add $route`

func (*Handle)RouteAddEcmpadded inv1.2.1

func (h *Handle) RouteAddEcmp(route *Route)error

RouteAddEcmp will add a route to the system.

func (*Handle)RouteAppendadded inv1.2.1

func (h *Handle) RouteAppend(route *Route)error

RouteAppend will append a route to the system.Equivalent to: `ip route append $route`

func (*Handle)RouteChangeadded inv1.2.1

func (h *Handle) RouteChange(route *Route)error

RouteChange will change an existing route in the system.Equivalent to: `ip route change $route`

func (*Handle)RouteDel

func (h *Handle) RouteDel(route *Route)error

RouteDel will delete a route from the system.Equivalent to: `ip route del $route`

func (*Handle)RouteGet

func (h *Handle) RouteGet(destinationnet.IP) ([]Route,error)

RouteGet gets a route to a specific destination from the host system.Equivalent to: 'ip route get'.

func (*Handle)RouteGetWithOptionsadded inv1.2.1

func (h *Handle) RouteGetWithOptions(destinationnet.IP, options *RouteGetOptions) ([]Route,error)

RouteGetWithOptions gets a route to a specific destination from the host system.Equivalent to: 'ip route get <> vrf <VrfName>'.

func (*Handle)RouteList

func (h *Handle) RouteList(linkLink, familyint) ([]Route,error)

RouteList gets a list of routes in the system.Equivalent to: `ip route show`.The list can be filtered by link and ip family.

If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.

func (*Handle)RouteListFiltered

func (h *Handle) RouteListFiltered(familyint, filter *Route, filterMaskuint64) ([]Route,error)

RouteListFiltered gets a list of routes in the system filtered with specified rules.All rules must be defined in RouteFilter struct

If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.

func (*Handle)RouteListFilteredIteradded inv1.2.1

func (h *Handle) RouteListFilteredIter(familyint, filter *Route, filterMaskuint64, f func(Route) (contbool))error

If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.

func (*Handle)RouteReplace

func (h *Handle) RouteReplace(route *Route)error

RouteReplace will add a route to the system.Equivalent to: `ip route replace $route`

func (*Handle)RuleAdd

func (h *Handle) RuleAdd(rule *Rule)error

RuleAdd adds a rule to the system.Equivalent to: ip rule add

func (*Handle)RuleDel

func (h *Handle) RuleDel(rule *Rule)error

RuleDel deletes a rule from the system.Equivalent to: ip rule del

func (*Handle)RuleList

func (h *Handle) RuleList(familyint) ([]Rule,error)

RuleList lists rules in the system.Equivalent to: ip rule list

If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.

func (*Handle)RuleListFilteredadded inv1.2.1

func (h *Handle) RuleListFiltered(familyint, filter *Rule, filterMaskuint64) ([]Rule,error)

RuleListFiltered lists rules in the system.Equivalent to: ip rule list

If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.

func (*Handle)SetNetNsIdByFdadded inv1.1.0

func (h *Handle) SetNetNsIdByFd(fd, nsidint)error

SetNetNSIdByFd sets the ID of the network namespace for a given fd.fd must be an open file descriptor to a namespace file.The ID can only be set for namespaces without an ID already set.

func (*Handle)SetNetNsIdByPidadded inv1.1.0

func (h *Handle) SetNetNsIdByPid(pid, nsidint)error

SetNetNSIdByPid sets the ID of the network namespace for a given pid (really thread id).The ID can only be set for namespaces without an ID already set.

func (*Handle)SetPromiscOff

func (h *Handle) SetPromiscOff(linkLink)error

func (*Handle)SetPromiscOn

func (h *Handle) SetPromiscOn(linkLink)error

func (*Handle)SetSocketReceiveBufferSize

func (h *Handle) SetSocketReceiveBufferSize(sizeint, forcebool)error

SetSocketReceiveBufferSize sets the receive buffer size for eachsocket in the netlink handle. The maximum value is capped by/proc/sys/net/core/rmem_max.

func (*Handle)SetSocketTimeout

func (h *Handle) SetSocketTimeout(totime.Duration)error

SetSocketTimeout sets the send and receive timeout for each socket in thenetlink handle. Although the socket timeout has granularity of onemicrosecond, the effective granularity is floored by the kernel timer tick,which default value is four milliseconds.

func (*Handle)SetStrictCheckadded inv1.2.1

func (h *Handle) SetStrictCheck(statebool)error

SetStrictCheck sets the strict check socket option for each socket in the netlink handle. Returns early if any set operation fails

func (*Handle)SocketDestroyadded inv1.2.1

func (h *Handle) SocketDestroy(local, remotenet.Addr)error

SocketDestroy kills the Socket identified by its local and remote addresses.

func (*Handle)SocketDiagTCPadded inv1.2.1

func (h *Handle) SocketDiagTCP(familyuint8) ([]*Socket,error)

SocketDiagTCP requests INET_DIAG_INFO for TCP protocol for specified family type and return related socket.

If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.

func (*Handle)SocketDiagTCPInfoadded inv1.2.1

func (h *Handle) SocketDiagTCPInfo(familyuint8) ([]*InetDiagTCPInfoResp,error)

SocketDiagTCPInfo requests INET_DIAG_INFO for TCP protocol for specified family type and return with extension TCP info.

If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.

func (*Handle)SocketDiagUDPadded inv1.2.1

func (h *Handle) SocketDiagUDP(familyuint8) ([]*Socket,error)

SocketDiagUDP requests INET_DIAG_INFO for UDP protocol for specified family type and return related socket.

If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.

func (*Handle)SocketDiagUDPInfoadded inv1.2.1

func (h *Handle) SocketDiagUDPInfo(familyuint8) ([]*InetDiagUDPInfoResp,error)

SocketDiagUDPInfo requests INET_DIAG_INFO for UDP protocol for specified family type and return with extension info.

If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.

func (*Handle)SocketGetadded inv1.2.1

func (h *Handle) SocketGet(local, remotenet.Addr) (*Socket,error)

SocketGet returns the Socket identified by its local and remote addresses.

If the returned error isErrDumpInterrupted, the search for a result maybe incomplete and the caller should retry.

func (*Handle)SupportsNetlinkFamily

func (h *Handle) SupportsNetlinkFamily(nlFamilyint)bool

SupportsNetlinkFamily reports whether the passed netlink family is supported by this Handle

func (*Handle)UnixSocketDiagadded inv1.2.1

func (h *Handle) UnixSocketDiag() ([]*UnixSocket,error)

UnixSocketDiag requests UNIX_DIAG_INFO for unix sockets.

If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.

func (*Handle)UnixSocketDiagInfoadded inv1.2.1

func (h *Handle) UnixSocketDiagInfo() ([]*UnixDiagInfoResp,error)

UnixSocketDiagInfo requests UNIX_DIAG_INFO for unix sockets and return with extension info.

If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.

func (*Handle)VDPADelDevadded inv1.2.1

func (h *Handle) VDPADelDev(namestring)error

VDPADelDev removes VDPA deviceEquivalent to: `vdpa dev del <name>`

func (*Handle)VDPAGetDevByNameadded inv1.2.1

func (h *Handle) VDPAGetDevByName(namestring) (*VDPADev,error)

VDPAGetDevByName returns VDPA device selected by nameEquivalent to: `vdpa dev show <name>`

func (*Handle)VDPAGetDevConfigByNameadded inv1.2.1

func (h *Handle) VDPAGetDevConfigByName(namestring) (*VDPADevConfig,error)

VDPAGetDevConfigByName returns VDPA device configuration selected by nameEquivalent to: `vdpa dev config show <name>`

func (*Handle)VDPAGetDevConfigListadded inv1.2.1

func (h *Handle) VDPAGetDevConfigList() ([]*VDPADevConfig,error)

VDPAGetDevConfigList returns list of VDPA devices configurationsEquivalent to: `vdpa dev config show`

If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.

func (*Handle)VDPAGetDevListadded inv1.2.1

func (h *Handle) VDPAGetDevList() ([]*VDPADev,error)

VDPAGetDevList returns list of VDPA devicesEquivalent to: `vdpa dev show`

If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.

func (*Handle)VDPAGetDevVStatsadded inv1.2.1

func (h *Handle) VDPAGetDevVStats(namestring, queueIndexuint32) (*VDPADevVStats,error)

VDPAGetDevVStats returns vstats for VDPA deviceEquivalent to: `vdpa dev vstats show <name> qidx <queueIndex>`

func (*Handle)VDPAGetMGMTDevByBusAndNameadded inv1.2.1

func (h *Handle) VDPAGetMGMTDevByBusAndName(bus, namestring) (*VDPAMGMTDev,error)

VDPAGetMGMTDevByBusAndName returns mgmt devices selected by bus and nameEquivalent to: `vdpa mgmtdev show <bus>/<name>`

func (*Handle)VDPAGetMGMTDevListadded inv1.2.1

func (h *Handle) VDPAGetMGMTDevList() ([]*VDPAMGMTDev,error)

VDPAGetMGMTDevList returns list of mgmt devicesEquivalent to: `vdpa mgmtdev show`

If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.

func (*Handle)VDPANewDevadded inv1.2.1

func (h *Handle) VDPANewDev(name, mgmtBus, mgmtNamestring, paramsVDPANewDevParams)error

VDPANewDev adds new VDPA deviceEquivalent to: `vdpa dev add name <name> mgmtdev <mgmtBus>/mgmtName [params]`

func (*Handle)XfrmPolicyAdd

func (h *Handle) XfrmPolicyAdd(policy *XfrmPolicy)error

XfrmPolicyAdd will add an xfrm policy to the system.Equivalent to: `ip xfrm policy add $policy`

func (*Handle)XfrmPolicyDel

func (h *Handle) XfrmPolicyDel(policy *XfrmPolicy)error

XfrmPolicyDel will delete an xfrm policy from the system. Note thatthe Tmpls are ignored when matching the policy to delete.Equivalent to: `ip xfrm policy del $policy`

func (*Handle)XfrmPolicyFlush

func (h *Handle) XfrmPolicyFlush()error

XfrmPolicyFlush will flush the policies on the system.Equivalent to: `ip xfrm policy flush`

func (*Handle)XfrmPolicyGet

func (h *Handle) XfrmPolicyGet(policy *XfrmPolicy) (*XfrmPolicy,error)

XfrmPolicyGet gets a the policy described by the index or selector, if found.Equivalent to: `ip xfrm policy get { SELECTOR | index INDEX } dir DIR [ctx CTX ] [ mark MARK [ mask MASK ] ] [ ptype PTYPE ]`.

func (*Handle)XfrmPolicyList

func (h *Handle) XfrmPolicyList(familyint) ([]XfrmPolicy,error)

XfrmPolicyList gets a list of xfrm policies in the system.Equivalent to: `ip xfrm policy show`.The list can be filtered by ip family.

If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.

func (*Handle)XfrmPolicyUpdate

func (h *Handle) XfrmPolicyUpdate(policy *XfrmPolicy)error

XfrmPolicyUpdate will update an xfrm policy to the system.Equivalent to: `ip xfrm policy update $policy`

func (*Handle)XfrmStateAdd

func (h *Handle) XfrmStateAdd(state *XfrmState)error

XfrmStateAdd will add an xfrm state to the system.Equivalent to: `ip xfrm state add $state`

func (*Handle)XfrmStateDel

func (h *Handle) XfrmStateDel(state *XfrmState)error

XfrmStateDel will delete an xfrm state from the system. Note thatthe Algos are ignored when matching the state to delete.Equivalent to: `ip xfrm state del $state`

func (*Handle)XfrmStateFlush

func (h *Handle) XfrmStateFlush(protoProto)error

XfrmStateFlush will flush the xfrm state on the system.proto = 0 means any transformation protocolsEquivalent to: `ip xfrm state flush [ proto XFRM-PROTO ]`

func (*Handle)XfrmStateGet

func (h *Handle) XfrmStateGet(state *XfrmState) (*XfrmState,error)

XfrmStateGet gets the xfrm state described by the ID, if found.Equivalent to: `ip xfrm state get ID [ mark MARK [ mask MASK ] ]`.Only the fields which constitue the SA ID must be filled in:ID := [ src ADDR ] [ dst ADDR ] [ proto XFRM-PROTO ] [ spi SPI ]mark is optional

func (*Handle)XfrmStateList

func (h *Handle) XfrmStateList(familyint) ([]XfrmState,error)

XfrmStateList gets a list of xfrm states in the system.Equivalent to: `ip xfrm state show`.The list can be filtered by ip family.

If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.

func (*Handle)XfrmStateUpdate

func (h *Handle) XfrmStateUpdate(state *XfrmState)error

XfrmStateUpdate will update an xfrm state to the system.Equivalent to: `ip xfrm state update $state`

typeHfscadded inv1.1.0

type Hfsc struct {QdiscAttrsDefclsuint16}

funcNewHfscadded inv1.1.0

func NewHfsc(attrsQdiscAttrs) *Hfsc

func (*Hfsc)Attrsadded inv1.1.0

func (hfsc *Hfsc) Attrs() *QdiscAttrs

func (*Hfsc)Stringadded inv1.1.0

func (hfsc *Hfsc) String()string

func (*Hfsc)Typeadded inv1.1.0

func (hfsc *Hfsc) Type()string

typeHfscClassadded inv1.1.0

type HfscClass struct {ClassAttrsRscServiceCurveFscServiceCurveUscServiceCurve}

HfscClass is a representation of the HFSC class

funcNewHfscClassadded inv1.1.0

func NewHfscClass(attrsClassAttrs) *HfscClass

NewHfscClass returns a new HFSC struct with the set parameters

func (*HfscClass)Attrsadded inv1.1.0

func (hfsc *HfscClass) Attrs() *ClassAttrs

Attrs return the Hfsc parameters

func (*HfscClass)SetFscadded inv1.1.0

func (hfsc *HfscClass) SetFsc(m1uint32, duint32, m2uint32)

SetFsc sets the Fsc curve. The bandwidth (m1 and m2) is specified in bits and the delay inseconds.

func (*HfscClass)SetLSadded inv1.1.0

func (hfsc *HfscClass) SetLS(m1uint32, duint32, m2uint32)

SetLS implements the LS from the `tc` CLI. This function behaves the same as if one would set theUSC through the `tc` command-line tool. This means bandwidth (m1 and m2) is specified in bits andthe delay in ms.

func (*HfscClass)SetRscadded inv1.1.0

func (hfsc *HfscClass) SetRsc(m1uint32, duint32, m2uint32)

SetRsc sets the Rsc curve. The bandwidth (m1 and m2) is specified in bits and the delay inseconds.

func (*HfscClass)SetSCadded inv1.1.0

func (hfsc *HfscClass) SetSC(m1uint32, duint32, m2uint32)

SetSC implements the SC from the `tc` CLI. This function behaves the same as if one would set theUSC through the `tc` command-line tool. This means bandwidth (m1 and m2) is specified in bits andthe delay in ms.

func (*HfscClass)SetULadded inv1.1.0

func (hfsc *HfscClass) SetUL(m1uint32, duint32, m2uint32)

SetUL implements the UL from the `tc` CLI. This function behaves the same as if one would set theUSC through the `tc` command-line tool. This means bandwidth (m1 and m2) is specified in bits andthe delay in ms.

func (*HfscClass)SetUscadded inv1.1.0

func (hfsc *HfscClass) SetUsc(m1uint32, duint32, m2uint32)

SetUsc sets the USC curve. The bandwidth (m1 and m2) is specified in bits and the delay inseconds.

func (*HfscClass)Stringadded inv1.1.0

func (hfsc *HfscClass) String()string

String() returns a string that contains the information and attributes of the HFSC class

func (*HfscClass)Typeadded inv1.1.0

func (hfsc *HfscClass) Type()string

Type return the type of the class

typeHtb

type Htb struct {QdiscAttrsVersionuint32Rate2Quantumuint32Defclsuint32Debuguint32DirectPktsuint32DirectQlen   *uint32}

Htb is a classful qdisc that rate limits based on tokens

funcNewHtb

func NewHtb(attrsQdiscAttrs) *Htb

func (*Htb)Attrs

func (qdisc *Htb) Attrs() *QdiscAttrs

func (*Htb)Type

func (qdisc *Htb) Type()string

typeHtbClass

type HtbClass struct {ClassAttrsRateuint64Ceiluint64Bufferuint32Cbufferuint32Quantumuint32Leveluint32Priouint32}

HtbClass represents an Htb class

funcNewHtbClass

func NewHtbClass(attrsClassAttrs, cattrsHtbClassAttrs) *HtbClass

NewHtbClass NOTE: function is in here because it uses other linux functions

func (*HtbClass)Attrs

func (q *HtbClass) Attrs() *ClassAttrs

Attrs returns the class attributes

func (HtbClass)String

func (qHtbClass) String()string

func (*HtbClass)Type

func (q *HtbClass) Type()string

Type return the class type

typeHtbClassAttrs

type HtbClassAttrs struct {// TODO handle all attributesRateuint64Ceiluint64Bufferuint32Cbufferuint32Quantumuint32Leveluint32Priouint32}

HtbClassAttrs stores the attributes of HTB class

func (HtbClassAttrs)String

func (qHtbClassAttrs) String()string

typeIP6tnlEncapadded inv1.2.1

type IP6tnlEncap struct {IDuint64Dstnet.IPSrcnet.IPHoplimituint8TCuint8Flagsuint16}

IP6tnlEncap definition

func (*IP6tnlEncap)Decodeadded inv1.2.1

func (e *IP6tnlEncap) Decode(buf []byte)error

func (*IP6tnlEncap)Encodeadded inv1.2.1

func (e *IP6tnlEncap) Encode() ([]byte,error)

func (*IP6tnlEncap)Equaladded inv1.2.1

func (e *IP6tnlEncap) Equal(xEncap)bool

func (*IP6tnlEncap)Stringadded inv1.2.1

func (e *IP6tnlEncap) String()string

func (*IP6tnlEncap)Typeadded inv1.2.1

func (e *IP6tnlEncap) Type()int

typeIPSetEntryadded inv1.2.1

type IPSetEntry struct {CommentstringMACnet.HardwareAddrIPnet.IPCIDRuint8Timeout  *uint32Packets  *uint64Bytes    *uint64Protocol *uint8Port     *uint16IP2net.IPCIDR2uint8IFacestringMark     *uint32Replacebool// replace existing entry}

IPSetEntry is used for adding, updating, retreiving and deleting entries

typeIPSetResultadded inv1.2.1

type IPSetResult struct {Nfgenmsg           *nl.NfgenmsgProtocoluint8ProtocolMinVersionuint8Revisionuint8Familyuint8Flagsuint8SetNamestringTypeNamestringCommentstringMarkMaskuint32IPFromnet.IPIPTonet.IPPortFromuint16PortTouint16HashSizeuint32NumEntriesuint32MaxElementsuint32Referencesuint32SizeInMemoryuint32CadtFlagsuint32Timeout      *uint32LineNouint32Entries []IPSetEntry}

IPSetResult is the result of a dump request for a set

funcIpsetListadded inv1.2.1

func IpsetList(setnamestring) (*IPSetResult,error)

IpsetList dumps an specific ipset.

funcIpsetListAlladded inv1.2.1

func IpsetListAll() ([]IPSetResult,error)

IpsetListAll dumps all ipsets.

typeIPTupleadded inv1.2.1

type IPTuple struct {Bytesuint64DstIPnet.IPDstPortuint16Packetsuint64Protocoluint8SrcIPnet.IPSrcPortuint16}

The full conntrack flow structure is very complicated and can be found in the file:http://git.netfilter.org/libnetfilter_conntrack/tree/include/internal/object.hFor the time being, the structure below allows to parse and extract the base information of a flow

typeIPVlan

type IPVlan struct {LinkAttrsModeIPVlanModeFlagIPVlanFlag}

func (*IPVlan)Attrs

func (ipvlan *IPVlan) Attrs() *LinkAttrs

func (*IPVlan)Type

func (ipvlan *IPVlan) Type()string

typeIPVlanFlagadded inv1.1.0

type IPVlanFlaguint16
const (IPVLAN_FLAG_BRIDGEIPVlanFlag =iotaIPVLAN_FLAG_PRIVATEIPVLAN_FLAG_VEPA)

typeIPVlanMode

type IPVlanModeuint16
const (IPVLAN_MODE_L2IPVlanMode =iotaIPVLAN_MODE_L3IPVLAN_MODE_L3SIPVLAN_MODE_MAX)

typeIPVtapadded inv1.2.1

type IPVtap struct {IPVlan}

IPVtap - IPVtap is a virtual interfaces based on ipvlan

func (*IPVtap)Attrsadded inv1.2.1

func (ipvtap *IPVtap) Attrs() *LinkAttrs

func (IPVtap)Typeadded inv1.2.1

func (ipvtapIPVtap) Type()string

typeIPoIBadded inv1.1.0

type IPoIB struct {LinkAttrsPkeyuint16ModeIPoIBModeUmcastuint16}

func (*IPoIB)Attrsadded inv1.1.0

func (ipoib *IPoIB) Attrs() *LinkAttrs

func (*IPoIB)Typeadded inv1.1.0

func (ipoib *IPoIB) Type()string

typeIPoIBModeadded inv1.1.0

type IPoIBModeuint16

func (*IPoIBMode)Stringadded inv1.1.0

func (m *IPoIBMode) String()string

typeIfb

type Ifb struct {LinkAttrs}

Ifb links are advanced dummy devices for packet filtering

func (*Ifb)Attrs

func (ifb *Ifb) Attrs() *LinkAttrs

func (*Ifb)Type

func (ifb *Ifb) Type()string

typeIfreq

type Ifreq struct {Name [unix.IFNAMSIZ]byteDatauintptr}

Ifreq is a struct for ioctl ethernet manipulation syscalls.

typeIfreqSlave

type IfreqSlave struct {Name  [unix.IFNAMSIZ]byteSlave [unix.IFNAMSIZ]byte}

IfreqSlave is a struct for ioctl bond manipulation syscalls.It is used to assign slave to bond interface with Name.

typeInetDiagTCPInfoRespadded inv1.2.1

type InetDiagTCPInfoResp struct {InetDiagMsg *SocketTCPInfo     *TCPInfoTCPBBRInfo  *TCPBBRInfo}

funcSocketDiagTCPInfoadded inv1.2.1

func SocketDiagTCPInfo(familyuint8) ([]*InetDiagTCPInfoResp,error)

SocketDiagTCPInfo requests INET_DIAG_INFO for TCP protocol for specified family type and return with extension TCP info.

If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.

typeInetDiagUDPInfoRespadded inv1.2.1

type InetDiagUDPInfoResp struct {InetDiagMsg *SocketMemory      *MemInfo}

funcSocketDiagUDPInfoadded inv1.2.1

func SocketDiagUDPInfo(familyuint8) ([]*InetDiagUDPInfoResp,error)

SocketDiagUDPInfo requests INET_DIAG_INFO for UDP protocol for specified family type and return with extension info.

If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.

typeInetFamily

type InetFamilyuint8

InetFamily Family type

typeIngress

type Ingress struct {QdiscAttrs}

Ingress is a qdisc for adding ingress filters

func (*Ingress)Attrs

func (qdisc *Ingress) Attrs() *QdiscAttrs

func (*Ingress)Type

func (qdisc *Ingress) Type()string

typeIp6tnladded inv1.1.0

type Ip6tnl struct {LinkAttrsLinkuint32Localnet.IPRemotenet.IPTtluint8Tosuint8Flagsuint32Protouint8FlowInfouint32EncapLimituint8EncapTypeuint16EncapFlagsuint16EncapSportuint16EncapDportuint16FlowBasedbool}

func (*Ip6tnl)Attrsadded inv1.1.0

func (ip6tnl *Ip6tnl) Attrs() *LinkAttrs

func (*Ip6tnl)Typeadded inv1.1.0

func (ip6tnl *Ip6tnl) Type()string

typeIpsetCreateOptionsadded inv1.2.1

type IpsetCreateOptions struct {Replacebool// replace existing ipsetTimeout  *uint32CountersboolCommentsboolSkbinfoboolFamilyuint8Revisionuint8IPFromnet.IPIPTonet.IPPortFromuint16PortTouint16MaxElementsuint32}

IpsetCreateOptions is the options struct for creating a new ipset

typeIptun

type Iptun struct {LinkAttrsTtluint8Tosuint8PMtuDiscuint8Linkuint32Localnet.IPRemotenet.IPEncapSportuint16EncapDportuint16EncapTypeuint16EncapFlagsuint16FlowBasedboolProtouint8}

func (*Iptun)Attrs

func (iptun *Iptun) Attrs() *LinkAttrs

func (*Iptun)Type

func (iptun *Iptun) Type()string

typeLink

type Link interface {Attrs() *LinkAttrsType()string}

Link represents a link device from netlink. Shared link attributeslike name may be retrieved using the Attrs() method. Unique datacan be retrieved by casting the object to the proper type.

funcLinkByAlias

func LinkByAlias(aliasstring) (Link,error)

LinkByAlias finds a link by its alias and returns a pointer to the object.If there are multiple links with the alias it returns the first one

If the kernel doesn't support IFLA_IFALIAS, this method will fall back tofiltering a dump of all link names. In this case, if the returned error isErrDumpInterrupted the result may be missing or outdated.

funcLinkByIndex

func LinkByIndex(indexint) (Link,error)

LinkByIndex finds a link by index and returns a pointer to the object.

funcLinkByName

func LinkByName(namestring) (Link,error)

LinkByName finds a link by name and returns a pointer to the object.

If the kernel doesn't support IFLA_IFNAME, this method will fall back tofiltering a dump of all link names. In this case, if the returned error isErrDumpInterrupted the result may be missing or outdated.

funcLinkDeserialize

func LinkDeserialize(hdr *unix.NlMsghdr, m []byte) (Link,error)

LinkDeserialize deserializes a raw message received from netlink intoa link object.

funcLinkList

func LinkList() ([]Link,error)

LinkList gets a list of link devices.Equivalent to: `ip link show`

typeLinkAttrs

type LinkAttrs struct {IndexintMTUintTxQLenint// Transmit Queue LengthNamestringHardwareAddrnet.HardwareAddrFlagsnet.FlagsRawFlagsuint32ParentIndexint// index of the parent link deviceMasterIndexint// must be the index of a bridgeNamespace      interface{}// nil | NsPid | NsFdAliasstringAltNames       []stringStatistics     *LinkStatisticsPromiscintAllmultiintMultiintXdp            *LinkXdpEncapTypestringProtinfo       *ProtinfoOperStateLinkOperStatePhysSwitchIDintNetNsIDintNumTxQueuesintNumRxQueuesintTSOMaxSegsuint32TSOMaxSizeuint32GSOMaxSegsuint32GSOMaxSizeuint32GROMaxSizeuint32GSOIPv4MaxSizeuint32GROIPv4MaxSizeuint32Vfs            []VfInfo// virtual functions available on linkGroupuint32PermHWAddrnet.HardwareAddrParentDevstringParentDevBusstringSlaveLinkSlave}

LinkAttrs represents data shared by most link types

funcNewLinkAttrs

func NewLinkAttrs()LinkAttrs

NewLinkAttrs returns LinkAttrs structure filled with default values

typeLinkNotFoundError

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

LinkNotFoundError wraps the various not found errors whengetting/reading links. This is intended for better errorhandling by dependent code so that "not found error" canbe distinguished from other errors

typeLinkOperState

type LinkOperStateuint8

LinkOperState represents the values of the IFLA_OPERSTATE linkattribute, which contains the RFC2863 state of the interface.

func (LinkOperState)String

func (sLinkOperState) String()string

typeLinkSlaveadded inv1.1.0

type LinkSlave interface {SlaveType()string}

LinkSlave represents a slave device.

typeLinkStatistics

type LinkStatisticsLinkStatistics64

typeLinkStatistics32

type LinkStatistics32 struct {RxPacketsuint32TxPacketsuint32RxBytesuint32TxBytesuint32RxErrorsuint32TxErrorsuint32RxDroppeduint32TxDroppeduint32Multicastuint32Collisionsuint32RxLengthErrorsuint32RxOverErrorsuint32RxCrcErrorsuint32RxFrameErrorsuint32RxFifoErrorsuint32RxMissedErrorsuint32TxAbortedErrorsuint32TxCarrierErrorsuint32TxFifoErrorsuint32TxHeartbeatErrorsuint32TxWindowErrorsuint32RxCompresseduint32TxCompresseduint32}

Ref: struct rtnl_link_stats {...}

typeLinkStatistics64

type LinkStatistics64 struct {RxPacketsuint64TxPacketsuint64RxBytesuint64TxBytesuint64RxErrorsuint64TxErrorsuint64RxDroppeduint64TxDroppeduint64Multicastuint64Collisionsuint64RxLengthErrorsuint64RxOverErrorsuint64RxCrcErrorsuint64RxFrameErrorsuint64RxFifoErrorsuint64RxMissedErrorsuint64TxAbortedErrorsuint64TxCarrierErrorsuint64TxFifoErrorsuint64TxHeartbeatErrorsuint64TxWindowErrorsuint64RxCompresseduint64TxCompresseduint64}

Ref: struct rtnl_link_stats64 {...}

typeLinkSubscribeOptions

type LinkSubscribeOptions struct {Namespace              *netns.NsHandleErrorCallback          func(error)ListExistingboolReceiveBufferSizeintReceiveBufferForceSizeboolReceiveTimeout         *unix.Timeval}

LinkSubscribeOptions contains a set of options to use withLinkSubscribeWithOptions.

typeLinkUpdate

type LinkUpdate struct {nl.IfInfomsgHeaderunix.NlMsghdrLink}

LinkUpdate is used to pass information back from LinkSubscribe()

typeLinkXdp

type LinkXdp struct {FdintAttachedboolAttachModeuint32Flagsuint32ProgIduint32}

typeMPLSDestination

type MPLSDestination struct {Labels []int}

func (*MPLSDestination)Decode

func (d *MPLSDestination) Decode(buf []byte)error

func (*MPLSDestination)Encode

func (d *MPLSDestination) Encode() ([]byte,error)

func (*MPLSDestination)Equal

func (*MPLSDestination)Family

func (d *MPLSDestination) Family()int

func (*MPLSDestination)String

func (d *MPLSDestination) String()string

typeMPLSEncap

type MPLSEncap struct {Labels []int}

func (*MPLSEncap)Decode

func (e *MPLSEncap) Decode(buf []byte)error

func (*MPLSEncap)Encode

func (e *MPLSEncap) Encode() ([]byte,error)

func (*MPLSEncap)Equal

func (e *MPLSEncap) Equal(xEncap)bool

func (*MPLSEncap)String

func (e *MPLSEncap) String()string

func (*MPLSEncap)Type

func (e *MPLSEncap) Type()int

typeMacvlan

type Macvlan struct {LinkAttrsModeMacvlanMode// MACAddrs is only populated for Macvlan SOURCE linksMACAddrs []net.HardwareAddrBCQueueLenuint32UsedBCQueueLenuint32}

Macvlan links have ParentIndex set in their Attrs()

func (*Macvlan)Attrs

func (macvlan *Macvlan) Attrs() *LinkAttrs

func (*Macvlan)Type

func (macvlan *Macvlan) Type()string

typeMacvlanMode

type MacvlanModeuint16
const (MACVLAN_MODE_DEFAULTMacvlanMode =iotaMACVLAN_MODE_PRIVATEMACVLAN_MODE_VEPAMACVLAN_MODE_BRIDGEMACVLAN_MODE_PASSTHRUMACVLAN_MODE_SOURCE)

typeMacvtap

type Macvtap struct {Macvlan}

Macvtap - macvtap is a virtual interfaces based on macvlan

func (Macvtap)Type

func (macvtapMacvtap) Type()string

typeMatchAll

type MatchAll struct {FilterAttrsClassIduint32Actions []Action}

MatchAll filters match all packets

func (*MatchAll)Attrs

func (filter *MatchAll) Attrs() *FilterAttrs

func (*MatchAll)Type

func (filter *MatchAll) Type()string

typeMemInfoadded inv1.2.1

type MemInfo struct {RMemuint32WMemuint32FMemuint32TMemuint32}

According tohttps://man7.org/linux/man-pages/man7/sock_diag.7.html

typeMirredAct

type MirredActuint8
const (TCA_EGRESS_REDIRMirredAct = 1/* packet redirect to EGRESS*/TCA_EGRESS_MIRRORMirredAct = 2/* mirror packet to EGRESS */TCA_INGRESS_REDIRMirredAct = 3/* packet redirect to INGRESS*/TCA_INGRESS_MIRRORMirredAct = 4/* mirror packet to INGRESS */)

func (MirredAct)String

func (aMirredAct) String()string

typeMirredAction

type MirredAction struct {ActionAttrsMirredActionMirredActIfindexint}

funcNewMirredAction

func NewMirredAction(redirIndexint) *MirredAction

func (*MirredAction)Attrs

func (action *MirredAction) Attrs() *ActionAttrs

func (*MirredAction)Type

func (action *MirredAction) Type()string

typeMode

type Modeuint8

Mode is an enum representing an ipsec transport.

const (XFRM_MODE_TRANSPORTMode =iotaXFRM_MODE_TUNNELXFRM_MODE_ROUTEOPTIMIZATIONXFRM_MODE_IN_TRIGGERXFRM_MODE_BEETXFRM_MODE_MAX)

func (Mode)String

func (mMode) String()string

typeNdmsg

type Ndmsg struct {Familyuint8Indexuint32Stateuint16Flagsuint8Typeuint8}

Ndmsg is for adding, removing or receiving information about a neighbor table entry

func (*Ndmsg)Len

func (msg *Ndmsg) Len()int

func (*Ndmsg)Serialize

func (msg *Ndmsg) Serialize() []byte

typeNeigh

type Neigh struct {LinkIndexintFamilyintStateintTypeintFlagsintFlagsExtintIPnet.IPHardwareAddrnet.HardwareAddrLLIPAddrnet.IP//Used in the case of NHRPVlanintVNIintMasterIndexint// These values are expressed as "clock ticks ago".  To// convert these clock ticks to seconds divide by sysconf(_SC_CLK_TCK).// When _SC_CLK_TCK is 100, for example, the ndm_* times are expressed// in centiseconds.Confirmeduint32// The last time ARP/ND succeeded OR higher layer confirmation was receivedUseduint32// The last time ARP/ND took place for this neighborUpdateduint32// The time when the current NUD state was entered}

Neigh represents a link layer neighbor from netlink.

funcNeighDeserialize

func NeighDeserialize(m []byte) (*Neigh,error)

funcNeighList

func NeighList(linkIndex, familyint) ([]Neigh,error)

NeighList returns a list of IP-MAC mappings in the system (ARP table).Equivalent to: `ip neighbor show`.The list can be filtered by link and ip family.

If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.

funcNeighListExecuteadded inv1.1.0

func NeighListExecute(msgNdmsg) ([]Neigh,error)

NeighListExecute returns a list of neighbour entries filtered by link, ip family, flag and state.

If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.

funcNeighProxyList

func NeighProxyList(linkIndex, familyint) ([]Neigh,error)

NeighProxyList returns a list of neighbor proxies in the system.Equivalent to: `ip neighbor show proxy`.The list can be filtered by link and ip family.

If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.

func (*Neigh)String

func (neigh *Neigh) String()string

String returns $ip/$hwaddr $label

typeNeighSubscribeOptionsadded inv1.1.0

type NeighSubscribeOptions struct {Namespace     *netns.NsHandleErrorCallback func(error)ListExistingbool// max size is based on value of /proc/sys/net/core/rmem_maxReceiveBufferSizeintReceiveBufferForceSizeboolReceiveTimeout         *unix.Timeval}

NeighSubscribeOptions contains a set of options to use withNeighSubscribeWithOptions.

typeNeighUpdateadded inv1.1.0

type NeighUpdate struct {Typeuint16Neigh}

NeighUpdate is sent when a neighbor changes - type is RTM_NEWNEIGH or RTM_DELNEIGH.

typeNetem

type Netem struct {QdiscAttrsLatencyuint32DelayCorruint32Limituint32Lossuint32LossCorruint32Gapuint32Duplicateuint32DuplicateCorruint32Jitteruint32ReorderProbuint32ReorderCorruint32CorruptProbuint32CorruptCorruint32Rate64uint64}

funcNewNetem

func NewNetem(attrsQdiscAttrs, nattrsNetemQdiscAttrs) *Netem

NOTE function is here because it uses other linux functions

func (*Netem)Attrs

func (qdisc *Netem) Attrs() *QdiscAttrs

func (*Netem)Stringadded inv1.1.0

func (netem *Netem) String()string

func (*Netem)Type

func (qdisc *Netem) Type()string

typeNetemQdiscAttrs

type NetemQdiscAttrs struct {Latencyuint32// in usDelayCorrfloat32// in %Limituint32Lossfloat32// in %LossCorrfloat32// in %Gapuint32Duplicatefloat32// in %DuplicateCorrfloat32// in %Jitteruint32// in usReorderProbfloat32// in %ReorderCorrfloat32// in %CorruptProbfloat32// in %CorruptCorrfloat32// in %Rate64uint64}

func (NetemQdiscAttrs)String

func (qNetemQdiscAttrs) String()string

typeNetkitadded inv1.2.1

type Netkit struct {LinkAttrsModeNetkitModePolicyNetkitPolicyPeerPolicyNetkitPolicyScrubNetkitScrubPeerScrubNetkitScrub// contains filtered or unexported fields}

func (*Netkit)Attrsadded inv1.2.1

func (n *Netkit) Attrs() *LinkAttrs

func (*Netkit)IsPrimaryadded inv1.2.1

func (n *Netkit) IsPrimary()bool

func (*Netkit)SetPeerAttrsadded inv1.2.1

func (n *Netkit) SetPeerAttrs(Attrs *LinkAttrs)

SetPeerAttrs will not take effect if trying to modify an existing netkit device

func (*Netkit)SupportsScrubadded inv1.3.1

func (n *Netkit) SupportsScrub()bool

func (*Netkit)Typeadded inv1.2.1

func (n *Netkit) Type()string

typeNetkitModeadded inv1.2.1

type NetkitModeuint32
const (NETKIT_MODE_L2NetkitMode =iotaNETKIT_MODE_L3)

typeNetkitPolicyadded inv1.2.1

type NetkitPolicyint
const (NETKIT_POLICY_FORWARDNetkitPolicy = 0NETKIT_POLICY_BLACKHOLENetkitPolicy = 2)

typeNetkitScrubadded inv1.3.1

type NetkitScrubint
const (NETKIT_SCRUB_NONENetkitScrub = 0NETKIT_SCRUB_DEFAULTNetkitScrub = 1)

typeNextHopFlag

type NextHopFlagint

typeNexthopInfo

type NexthopInfo struct {LinkIndexintHopsintGwnet.IPFlagsintNewDstDestinationEncapEncapViaDestination}

func (NexthopInfo)Equal

func (*NexthopInfo)ListFlags

func (n *NexthopInfo) ListFlags() []string

func (*NexthopInfo)String

func (n *NexthopInfo) String()string

typeNsFd

type NsFdint

typeNsPid

type NsPidint

typePDP

type PDP struct {Versionuint32TIDuint64PeerAddressnet.IPMSAddressnet.IPFlowuint16NetNSFDuint32ITEIuint32OTEIuint32}

funcGTPPDPByITEI

func GTPPDPByITEI(linkLink, iteiint) (*PDP,error)

funcGTPPDPByMSAddress

func GTPPDPByMSAddress(linkLink, addrnet.IP) (*PDP,error)

funcGTPPDPByTID

func GTPPDPByTID(linkLink, tidint) (*PDP,error)

funcGTPPDPList

func GTPPDPList() ([]*PDP,error)

If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.

func (*PDP)String

func (pdp *PDP) String()string

typePeditActionadded inv1.2.1

type PeditAction struct {ActionAttrsProtouint8SrcMacAddrnet.HardwareAddrDstMacAddrnet.HardwareAddrSrcIPnet.IPDstIPnet.IPSrcPortuint16DstPortuint16}

funcNewPeditActionadded inv1.2.1

func NewPeditAction() *PeditAction

func (*PeditAction)Attrsadded inv1.2.1

func (p *PeditAction) Attrs() *ActionAttrs

func (*PeditAction)Typeadded inv1.2.1

func (p *PeditAction) Type()string

typePfifoFast

type PfifoFast struct {QdiscAttrsBandsuint8PriorityMap [PRIORITY_MAP_LEN]uint8}

PfifoFast is the default qdisc created by the kernel if one has notbeen defined for the interface

func (*PfifoFast)Attrs

func (qdisc *PfifoFast) Attrs() *QdiscAttrs

func (*PfifoFast)Type

func (qdisc *PfifoFast) Type()string

typePoliceActionadded inv1.2.1

type PoliceAction struct {ActionAttrsRateuint32// in byte per secondBurstuint32// in byteRCellLogintMtuuint32Mpuuint16// in bytePeakRateuint32// in byte per secondPCellLogintAvRateuint32// in byte per secondOverheaduint16LinkLayerintExceedActionTcPolActNotExceedActionTcPolAct}

funcNewPoliceActionadded inv1.2.1

func NewPoliceAction() *PoliceAction

func (*PoliceAction)Attrsadded inv1.2.1

func (action *PoliceAction) Attrs() *ActionAttrs

func (*PoliceAction)Typeadded inv1.2.1

func (action *PoliceAction) Type()string

typePolicyActionadded inv1.1.0

type PolicyActionuint8

PolicyAction is an enum representing an ipsec policy action.

const (XFRM_POLICY_ALLOWPolicyAction = 0XFRM_POLICY_BLOCKPolicyAction = 1)

func (PolicyAction)Stringadded inv1.1.0

func (aPolicyAction) String()string

typePrio

type Prio struct {QdiscAttrsBandsuint8PriorityMap [PRIORITY_MAP_LEN]uint8}

Prio is a basic qdisc that works just like PfifoFast

funcNewPrio

func NewPrio(attrsQdiscAttrs) *Prio

func (*Prio)Attrs

func (qdisc *Prio) Attrs() *QdiscAttrs

func (*Prio)Type

func (qdisc *Prio) Type()string

typeProcEventadded inv1.2.1

type ProcEvent struct {ProcEventHeaderMsgProcEventMsg}

typeProcEventHeaderadded inv1.2.1

type ProcEventHeader struct {Whatuint32CPUuint32Timestampuint64}

typeProcEventMsgadded inv1.2.1

type ProcEventMsg interface {Pid()uint32Tgid()uint32}

typeProtinfo

type Protinfo struct {HairpinboolGuardboolFastLeaveboolRootBlockboolLearningboolFloodboolProxyArpboolProxyArpWiFiboolIsolatedboolNeighSuppressboolVlanTunnelbool}

Protinfo represents bridge flags from netlink.

funcLinkGetProtinfo

func LinkGetProtinfo(linkLink) (Protinfo,error)

If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.

func (*Protinfo)String

func (prot *Protinfo) String()string

String returns a list of enabled flags

typeProto

type Protouint8

Proto is an enum representing an ipsec protocol.

const (XFRM_PROTO_ROUTE2Proto =unix.IPPROTO_ROUTINGXFRM_PROTO_ESPProto =unix.IPPROTO_ESPXFRM_PROTO_AHProto =unix.IPPROTO_AHXFRM_PROTO_HAOProto =unix.IPPROTO_DSTOPTSXFRM_PROTO_COMPProto =unix.IPPROTO_COMPXFRM_PROTO_IPSEC_ANYProto =unix.IPPROTO_RAW)

func (Proto)String

func (pProto) String()string

typeProtoInfoadded inv1.2.1

type ProtoInfo interface {Protocol()string}

ProtoInfo wraps an L4-protocol structure - roughly corresponds to the__nfct_protoinfo union found in libnetfilter_conntrack/include/internal/object.h.Currently, only protocol names, and TCP state is supported.

typeProtoInfoDCCPadded inv1.2.1

type ProtoInfoDCCP struct{}

ProtoInfoDCCP only supports the protocol name.

func (*ProtoInfoDCCP)Protocoladded inv1.2.1

func (*ProtoInfoDCCP) Protocol()string

Protocol returns "dccp".

typeProtoInfoSCTPadded inv1.2.1

type ProtoInfoSCTP struct{}

ProtoInfoSCTP only supports the protocol name.

func (*ProtoInfoSCTP)Protocoladded inv1.2.1

func (*ProtoInfoSCTP) Protocol()string

Protocol returns "sctp".

typeProtoInfoTCPadded inv1.2.1

type ProtoInfoTCP struct {Stateuint8}

ProtoInfoTCP corresponds to the `tcp` struct of the __nfct_protoinfo union.Only TCP state is currently supported.

func (*ProtoInfoTCP)Protocoladded inv1.2.1

func (*ProtoInfoTCP) Protocol()string

Protocol returns "tcp".

typeQdisc

type Qdisc interface {Attrs() *QdiscAttrsType()string}

funcQdiscList

func QdiscList(linkLink) ([]Qdisc,error)

QdiscList gets a list of qdiscs in the system.Equivalent to: `tc qdisc show`.The list can be filtered by link.

If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.

typeQdiscAttrs

type QdiscAttrs struct {LinkIndexintHandleuint32Parentuint32Refcntuint32// read onlyIngressBlock *uint32Statistics   *QdiscStatistics}

QdiscAttrs represents a netlink qdisc. A qdisc is associated with a link,has a handle, a parent and a refcnt. The root qdisc of a device shouldhave parent == HANDLE_ROOT.

func (QdiscAttrs)String

func (qQdiscAttrs) String()string

typeQdiscStatisticsadded inv1.2.1

type QdiscStatisticsClassStatistics

typeQueueInfoadded inv1.2.1

type QueueInfo struct {RQueueuint32WQueueuint32}

typeRdmaDeviceStatisticadded inv1.3.1

type RdmaDeviceStatistic struct {RdmaPortStatistics []*RdmaPortStatistic}

RdmaDeviceStatistic represents a rdma device statistic counter

funcRdmaStatisticadded inv1.3.1

func RdmaStatistic(link *RdmaLink) (*RdmaDeviceStatistic,error)

RdmaStatistic get rdma device statistic countersReturns rdma device statistic counters on success or returns errorotherwise.Equivalent to: `rdma statistic show link [DEV]'

typeRdmaLinkadded inv1.1.0

type RdmaLink struct {AttrsRdmaLinkAttrs}

Link represents a rdma device from netlink.

funcRdmaLinkByNameadded inv1.1.0

func RdmaLinkByName(namestring) (*RdmaLink,error)

RdmaLinkByName finds a link by name and returns a pointer to the object iffound and nil error, otherwise returns error code.

If the returned error isErrDumpInterrupted, the result may be missing oroutdated and the caller should retry.

funcRdmaLinkListadded inv1.2.1

func RdmaLinkList() ([]*RdmaLink,error)

RdmaLinkList gets a list of RDMA link devices.Equivalent to: `rdma dev show`

If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.

typeRdmaLinkAttrsadded inv1.1.0

type RdmaLinkAttrs struct {Indexuint32NamestringFirmwareVersionstringNodeGuidstringSysImageGuidstringNumPortsuint32}

LinkAttrs represents data shared by most link types

typeRdmaPortStatisticadded inv1.3.1

type RdmaPortStatistic struct {PortIndexuint32Statistics map[string]uint64}

RdmaPortStatistic represents a rdma port statistic counter

funcRdmaPortStatisticListadded inv1.3.1

func RdmaPortStatisticList(link *RdmaLink, portuint32) (*RdmaPortStatistic,error)

RdmaPortStatisticList get rdma device port statistic countersReturns rdma device port statistic counters on success or returns errorotherwise.Equivalent to: `rdma statistic show linkDEV/PORT'

typeRdmaResourceadded inv1.3.1

type RdmaResource struct {Indexuint32NamestringRdmaResourceSummaryEntries map[string]uint64}

RdmaResource represents a rdma device resource tracking summaries

funcRdmaResourceListadded inv1.3.1

func RdmaResourceList() ([]*RdmaResource,error)

RdmaResourceList list rdma resource tracking informationReturns all rdma devices resource tracking summary on success or returns errorotherwise.Equivalent to: `rdma resource'

typeRoute

type Route struct {LinkIndexintILinkIndexintScopeScopeDst              *net.IPNetSrcnet.IPGwnet.IPMultiPath        []*NexthopInfoProtocolRouteProtocolPriorityintFamilyintTableintTypeintTosintFlagsintMPLSDst          *intNewDstDestinationEncapEncapViaDestinationRealmintMTUintMTULockboolWindowintRttintRttVarintSsthreshintCwndintAdvMSSintReorderingintHoplimitintInitCwndintFeaturesintRtoMinintRtoMinLockboolInitRwndintQuickACKintCongctlstringFastOpenNoCookieint}

Route represents a netlink route.

funcRouteGet

func RouteGet(destinationnet.IP) ([]Route,error)

RouteGet gets a route to a specific destination from the host system.Equivalent to: 'ip route get'.

funcRouteGetWithOptionsadded inv1.2.1

func RouteGetWithOptions(destinationnet.IP, options *RouteGetOptions) ([]Route,error)

RouteGetWithOptions gets a route to a specific destination from the host system.Equivalent to: 'ip route get <> vrf <VrfName>'.

funcRouteList

func RouteList(linkLink, familyint) ([]Route,error)

RouteList gets a list of routes in the system.Equivalent to: `ip route show`.The list can be filtered by link and ip family.

If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.

funcRouteListFiltered

func RouteListFiltered(familyint, filter *Route, filterMaskuint64) ([]Route,error)

RouteListFiltered gets a list of routes in the system filtered with specified rules.All rules must be defined in RouteFilter struct

func (*Route)ClearFlag

func (r *Route) ClearFlag(flagNextHopFlag)

func (Route)Equal

func (rRoute) Equal(xRoute)bool

func (*Route)ListFlags

func (r *Route) ListFlags() []string

func (*Route)SetFlag

func (r *Route) SetFlag(flagNextHopFlag)

func (Route)String

func (rRoute) String()string

typeRouteGetOptionsadded inv1.2.1

type RouteGetOptions struct {IifstringIifIndexintOifstringOifIndexintVrfNamestringSrcAddrnet.IPUID      *uint32Markuint32FIBMatchbool}

RouteGetOptions contains a set of options to use withRouteGetWithOptions

typeRouteProtocoladded inv1.2.1

type RouteProtocolint

Protocol describe what was the originator of the route

func (RouteProtocol)Stringadded inv1.2.1

func (pRouteProtocol) String()string

typeRouteSubscribeOptions

type RouteSubscribeOptions struct {Namespace              *netns.NsHandleErrorCallback          func(error)ListExistingboolReceiveBufferSizeintReceiveBufferForceSizeboolReceiveTimeout         *unix.Timeval}

RouteSubscribeOptions contains a set of options to use withRouteSubscribeWithOptions.

typeRouteUpdate

type RouteUpdate struct {Typeuint16NlFlagsuint16Route}

NlFlags is only non-zero for RTM_NEWROUTE, the following flags can be set:

  • unix.NLM_F_REPLACE - Replace existing matching config object with this request
  • unix.NLM_F_EXCL - Don't replace the config object if it already exists
  • unix.NLM_F_CREATE - Create config object if it doesn't already exist
  • unix.NLM_F_APPEND - Add to the end of the object list

typeRule

type Rule struct {PriorityintFamilyintTableintMarkuint32Mask              *uint32TosuintTunIDuintGotointSrc               *net.IPNetDst               *net.IPNetFlowintIifNamestringOifNamestringSuppressIfgroupintSuppressPrefixlenintInvertboolDport             *RulePortRangeSport             *RulePortRangeIPProtointUIDRange          *RuleUIDRangeProtocoluint8Typeuint8}

Rule represents a netlink rule.

funcNewRule

func NewRule() *Rule

NewRule return empty rules.

funcRuleList

func RuleList(familyint) ([]Rule,error)

RuleList lists rules in the system.Equivalent to: ip rule list

If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.

funcRuleListFilteredadded inv1.2.1

func RuleListFiltered(familyint, filter *Rule, filterMaskuint64) ([]Rule,error)

RuleListFiltered gets a list of rules in the system filtered by thespecified rule template `filter`.Equivalent to: ip rule list

If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.

func (Rule)String

func (rRule) String()string

typeRulePortRangeadded inv1.2.1

type RulePortRange struct {Startuint16Enduint16}

RulePortRange represents rule sport/dport range.

funcNewRulePortRangeadded inv1.2.1

func NewRulePortRange(start, enduint16) *RulePortRange

NewRulePortRange creates rule sport/dport range.

typeRuleUIDRangeadded inv1.2.1

type RuleUIDRange struct {Startuint32Enduint32}

RuleUIDRange represents rule uid range.

funcNewRuleUIDRangeadded inv1.2.1

func NewRuleUIDRange(start, enduint32) *RuleUIDRange

NewRuleUIDRange creates rule uid range.

typeSADiradded inv1.3.1

type SADiruint8

SADir is an enum representing an ipsec template direction.

const (XFRM_SA_DIR_INSADir =iota + 1XFRM_SA_DIR_OUT)

typeSEG6Encap

type SEG6Encap struct {ModeintSegments []net.IP}

SEG6 definitions

func (*SEG6Encap)Decode

func (e *SEG6Encap) Decode(buf []byte)error

func (*SEG6Encap)Encode

func (e *SEG6Encap) Encode() ([]byte,error)

func (*SEG6Encap)Equal

func (e *SEG6Encap) Equal(xEncap)bool

func (*SEG6Encap)String

func (e *SEG6Encap) String()string

func (*SEG6Encap)Type

func (e *SEG6Encap) Type()int

typeSEG6LocalEncapadded inv1.1.0

type SEG6LocalEncap struct {Flags    [nl.SEG6_LOCAL_MAX]boolActionintSegments []net.IP// from SRH in seg6_local_lwtTableint// table id for End.T and End.DT6VrfTableint// vrftable id for END.DT4 and END.DT6InAddrnet.IPIn6Addrnet.IPIifintOifint// contains filtered or unexported fields}

SEG6LocalEncap definitions

func (*SEG6LocalEncap)Decodeadded inv1.1.0

func (e *SEG6LocalEncap) Decode(buf []byte)error

func (*SEG6LocalEncap)Encodeadded inv1.1.0

func (e *SEG6LocalEncap) Encode() ([]byte,error)

func (*SEG6LocalEncap)Equaladded inv1.1.0

func (e *SEG6LocalEncap) Equal(xEncap)bool

func (*SEG6LocalEncap)SetProgadded inv1.2.1

func (e *SEG6LocalEncap) SetProg(progFdint, progNamestring)error

func (*SEG6LocalEncap)Stringadded inv1.1.0

func (e *SEG6LocalEncap) String()string

func (*SEG6LocalEncap)Typeadded inv1.1.0

func (e *SEG6LocalEncap) Type()int

typeSampleActionadded inv1.3.1

type SampleAction struct {ActionAttrsGroupuint32Rateuint32TruncSizeuint32}

funcNewSampleActionadded inv1.3.1

func NewSampleAction() *SampleAction

func (*SampleAction)Attrsadded inv1.3.1

func (action *SampleAction) Attrs() *ActionAttrs

func (*SampleAction)Typeadded inv1.3.1

func (action *SampleAction) Type()string

typeScope

type Scopeuint8

Scope is an enum representing a route scope.

const (SCOPE_UNIVERSEScope =unix.RT_SCOPE_UNIVERSESCOPE_SITEScope =unix.RT_SCOPE_SITESCOPE_LINKScope =unix.RT_SCOPE_LINKSCOPE_HOSTScope =unix.RT_SCOPE_HOSTSCOPE_NOWHEREScope =unix.RT_SCOPE_NOWHERE)

func (Scope)Stringadded inv1.2.1

func (sScope) String()string

typeServiceCurveadded inv1.1.0

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

ServiceCurve is a nondecreasing function of some time unit, returning the amount of service(an allowed or allocated amount of bandwidth) at some specific point in time. The purpose of itshould be subconsciously obvious: if a class was allowed to transfer not less than the amountspecified by its service curve, then the service curve is not violated.

func (*ServiceCurve)Attrsadded inv1.1.0

func (c *ServiceCurve) Attrs() (uint32,uint32,uint32)

Attrs return the parameters of the service curve

func (*ServiceCurve)Burstadded inv1.2.1

func (c *ServiceCurve) Burst()uint32

Burst returns the burst rate (m1) of the curve

func (*ServiceCurve)Delayadded inv1.2.1

func (c *ServiceCurve) Delay()uint32

Delay return the delay (d) of the curve

func (*ServiceCurve)Rateadded inv1.2.1

func (c *ServiceCurve) Rate()uint32

Rate returns the rate (m2) of the curve

typeSfqadded inv1.2.1

type Sfq struct {QdiscAttrs// TODO: Only the simplified options for SFQ are handled here. Support for the extended one can be added later.Quantumuint32Perturbint32Limituint32Divisoruint32}

func (*Sfq)Attrsadded inv1.2.1

func (qdisc *Sfq) Attrs() *QdiscAttrs

func (*Sfq)Stringadded inv1.2.1

func (sfq *Sfq) String()string

func (*Sfq)Typeadded inv1.2.1

func (qdisc *Sfq) Type()string

typeSittun

type Sittun struct {LinkAttrsLinkuint32Ttluint8Tosuint8PMtuDiscuint8Protouint8Localnet.IPRemotenet.IPEncapLimituint8EncapTypeuint16EncapFlagsuint16EncapSportuint16EncapDportuint16}

func (*Sittun)Attrs

func (sittun *Sittun) Attrs() *LinkAttrs

func (*Sittun)Type

func (sittun *Sittun) Type()string

typeSkbEditActionadded inv1.1.0

type SkbEditAction struct {ActionAttrsQueueMapping *uint16PType        *uint16Priority     *uint32Mark         *uint32Mask         *uint32}

funcNewSkbEditActionadded inv1.1.0

func NewSkbEditAction() *SkbEditAction

func (*SkbEditAction)Attrsadded inv1.1.0

func (action *SkbEditAction) Attrs() *ActionAttrs

func (*SkbEditAction)Typeadded inv1.1.0

func (action *SkbEditAction) Type()string

typeSocket

type Socket struct {Familyuint8Stateuint8Timeruint8Retransuint8IDSocketIDExpiresuint32RQueueuint32WQueueuint32UIDuint32INodeuint32}

Socket represents a netlink socket.

funcSocketDiagTCPadded inv1.2.1

func SocketDiagTCP(familyuint8) ([]*Socket,error)

SocketDiagTCP requests INET_DIAG_INFO for TCP protocol for specified family type and return related socket.

If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.

funcSocketDiagUDPadded inv1.2.1

func SocketDiagUDP(familyuint8) ([]*Socket,error)

SocketDiagUDP requests INET_DIAG_INFO for UDP protocol for specified family type and return related socket.

If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.

funcSocketGet

func SocketGet(local, remotenet.Addr) (*Socket,error)

SocketGet returns the Socket identified by its local and remote addresses.

If the returned error isErrDumpInterrupted, the search for a result maybe incomplete and the caller should retry.

typeSocketID

type SocketID struct {SourcePortuint16DestinationPortuint16Sourcenet.IPDestinationnet.IPInterfaceuint32Cookie          [2]uint32}

SocketID identifies a single socket.

typeTCPBBRInfoadded inv1.2.1

type TCPBBRInfo struct {BBRBWuint64BBRMinRTTuint32BBRPacingGainuint32BBRCwndGainuint32}

typeTCPInfoadded inv1.2.1

type TCPInfo struct {Stateuint8Ca_stateuint8Retransmitsuint8Probesuint8Backoffuint8Optionsuint8Snd_wscaleuint8// no uint4Rcv_wscaleuint8Delivery_rate_app_limiteduint8Fastopen_client_failuint8Rtouint32Atouint32Snd_mssuint32Rcv_mssuint32Unackeduint32Sackeduint32Lostuint32Retransuint32Facketsuint32Last_data_sentuint32Last_ack_sentuint32Last_data_recvuint32Last_ack_recvuint32Pmtuuint32Rcv_ssthreshuint32Rttuint32Rttvaruint32Snd_ssthreshuint32Snd_cwnduint32Advmssuint32Reorderinguint32Rcv_rttuint32Rcv_spaceuint32Total_retransuint32Pacing_rateuint64Max_pacing_rateuint64Bytes_ackeduint64/* RFC4898 tcpEStatsAppHCThruOctetsAcked */Bytes_receiveduint64/* RFC4898 tcpEStatsAppHCThruOctetsReceived */Segs_outuint32/* RFC4898 tcpEStatsPerfSegsOut */Segs_inuint32/* RFC4898 tcpEStatsPerfSegsIn */Notsent_bytesuint32Min_rttuint32Data_segs_inuint32/* RFC4898 tcpEStatsDataSegsIn */Data_segs_outuint32/* RFC4898 tcpEStatsDataSegsOut */Delivery_rateuint64Busy_timeuint64/* Time (usec) busy sending data */Rwnd_limiteduint64/* Time (usec) limited by receive window */Sndbuf_limiteduint64/* Time (usec) limited by send buffer */Delivereduint32Delivered_ceuint32Bytes_sentuint64/* RFC4898 tcpEStatsPerfHCDataOctetsOut */Bytes_retransuint64/* RFC4898 tcpEStatsPerfOctetsRetrans */Dsack_dupsuint32/* RFC4898 tcpEStatsStackDSACKDups */Reord_seenuint32/* reordering events seen */Rcv_ooopackuint32/* Out-of-order packets received */Snd_wnduint32/* peer's advertised receive window after * scaling (bytes) */}

typeTbf

type Tbf struct {QdiscAttrsRateuint64Limituint32Bufferuint32Peakrateuint64Minburstuint32}

Tbf is a classless qdisc that rate limits based on tokens

func (*Tbf)Attrs

func (qdisc *Tbf) Attrs() *QdiscAttrs

func (*Tbf)Type

func (qdisc *Tbf) Type()string

typeTcAct

type TcActint32
const (TC_ACT_UNSPECTcAct = -1TC_ACT_OKTcAct = 0TC_ACT_RECLASSIFYTcAct = 1TC_ACT_SHOTTcAct = 2TC_ACT_PIPETcAct = 3TC_ACT_STOLENTcAct = 4TC_ACT_QUEUEDTcAct = 5TC_ACT_REPEATTcAct = 6TC_ACT_REDIRECTTcAct = 7TC_ACT_JUMPTcAct = 0x10000000)

func (TcAct)String

func (aTcAct) String()string

typeTcPolAct

type TcPolActint32
const (TC_POLICE_UNSPECTcPolAct =TcPolAct(TC_ACT_UNSPEC)TC_POLICE_OKTcPolAct =TcPolAct(TC_ACT_OK)TC_POLICE_RECLASSIFYTcPolAct =TcPolAct(TC_ACT_RECLASSIFY)TC_POLICE_SHOTTcPolAct =TcPolAct(TC_ACT_SHOT)TC_POLICE_PIPETcPolAct =TcPolAct(TC_ACT_PIPE))

func (TcPolAct)String

func (aTcPolAct) String()string

typeTcU32Key

type TcU32Key =nl.TcU32Key

TcU32Key contained of Sel in the U32 filters. This is the type alias and thefrontend representation of nl.TcU32Key. It is serialized into chanonicalnl.TcU32Sel with the appropriate endianness.

typeTcU32Sel

type TcU32Sel =nl.TcU32Sel

Sel of the U32 filters that contains multiple TcU32Key. This is the typealias and the frontend representation of nl.TcU32Sel. It is serialized intocanonical nl.TcU32Sel with the appropriate endianness.

typeTunnelKeyActadded inv1.1.0

type TunnelKeyActint8
const (TCA_TUNNEL_KEY_SETTunnelKeyAct = 1// set tunnel keyTCA_TUNNEL_KEY_UNSETTunnelKeyAct = 2// unset tunnel key)

typeTunnelKeyActionadded inv1.1.0

type TunnelKeyAction struct {ActionAttrsActionTunnelKeyActSrcAddrnet.IPDstAddrnet.IPKeyIDuint32DestPortuint16}

funcNewTunnelKeyActionadded inv1.1.0

func NewTunnelKeyAction() *TunnelKeyAction

func (*TunnelKeyAction)Attrsadded inv1.1.0

func (action *TunnelKeyAction) Attrs() *ActionAttrs

func (*TunnelKeyAction)Typeadded inv1.1.0

func (action *TunnelKeyAction) Type()string

typeTuntap

type Tuntap struct {LinkAttrsModeTuntapModeFlagsTuntapFlagNonPersistboolQueuesintDisabledQueuesintFds            []*os.FileOwneruint32Groupuint32}

Tuntap links created via /dev/tun/tap, but can be destroyed via netlink

func (*Tuntap)AddQueuesadded inv1.3.1

func (tuntap *Tuntap) AddQueues(countint) ([]*os.File,error)

AddQueues opens and attaches multiple queue file descriptors to an existingTUN/TAP interface in multi-queue mode.

It performs TUNSETIFF ioctl on each opened file descriptor with the currenttuntap configuration. Each resulting fd is set to non-blocking mode andreturned as *os.File.

If the interface was created with a name pattern (e.g. "tap%d"),the first successful TUNSETIFF call will return the resolved name,which is saved back into tuntap.Name.

This method assumes that the interface already exists and is in multi-queue mode.The returned FDs are also appended to tuntap.Fds and tuntap.Queues is updated.

It is the caller's responsibility to close the FDs when they are no longer needed.

func (*Tuntap)Attrs

func (tuntap *Tuntap) Attrs() *LinkAttrs

func (*Tuntap)RemoveQueuesadded inv1.3.1

func (tuntap *Tuntap) RemoveQueues(fds ...*os.File)error

RemoveQueues closes the given TAP queue file descriptors and removes themfrom the tuntap.Fds list.

This is a logical counterpart to AddQueues and allows releasing specific queues(e.g., to simulate queue failure or perform partial detach).

The method updates tuntap.Queues to reflect the number of remaining active queues.

It is safe to call with a subset of tuntap.Fds, but the caller must ensurethat the passed *os.File descriptors belong to this interface.

func (*Tuntap)Type

func (tuntap *Tuntap) Type()string

typeTuntapFlag

type TuntapFlaguint16

typeTuntapMode

type TuntapModeuint16

func (TuntapMode)Stringadded inv1.2.1

func (ttmTuntapMode) String()string

typeU32

type U32 struct {FilterAttrsClassIduint32Divisoruint32// Divisor MUST be power of 2.Hashuint32Linkuint32RedirIndexintSel        *TcU32SelActions    []ActionPolice     *PoliceAction}

U32 filters on many packet related properties

func (*U32)Attrs

func (filter *U32) Attrs() *FilterAttrs

func (*U32)Type

func (filter *U32) Type()string

typeUnixDiagInfoRespadded inv1.2.1

type UnixDiagInfoResp struct {DiagMsg  *UnixSocketName     *stringPeer     *uint32Queue    *QueueInfoShutdown *uint8}

funcUnixSocketDiagInfoadded inv1.2.1

func UnixSocketDiagInfo() ([]*UnixDiagInfoResp,error)

UnixSocketDiagInfo requests UNIX_DIAG_INFO for unix sockets and return with extension info.

If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.

typeUnixSocketadded inv1.2.1

type UnixSocket struct {Typeuint8Familyuint8Stateuint8INodeuint32Cookie [2]uint32// contains filtered or unexported fields}

UnixSocket represents a netlink unix socket.

funcUnixSocketDiagadded inv1.2.1

func UnixSocketDiag() ([]*UnixSocket,error)

UnixSocketDiag requests UNIX_DIAG_INFO for unix sockets.

If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.

typeVDPADevadded inv1.2.1

type VDPADev struct {VendorIDuint32MaxVQSuint32MaxVQSizeuint16MinVQSizeuint16// contains filtered or unexported fields}

VDPADev contains info about VDPA device

funcVDPAGetDevByNameadded inv1.2.1

func VDPAGetDevByName(namestring) (*VDPADev,error)

VDPAGetDevByName returns VDPA device selected by nameEquivalent to: `vdpa dev show <name>`

funcVDPAGetDevListadded inv1.2.1

func VDPAGetDevList() ([]*VDPADev,error)

VDPAGetDevList returns list of VDPA devicesEquivalent to: `vdpa dev show`

If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.

typeVDPADevConfigadded inv1.2.1

type VDPADevConfig struct {Featuresuint64NegotiatedFeaturesuint64NetVDPADevConfigNet// contains filtered or unexported fields}

VDPADevConfig contains configuration of the VDPA device

funcVDPAGetDevConfigByNameadded inv1.2.1

func VDPAGetDevConfigByName(namestring) (*VDPADevConfig,error)

VDPAGetDevConfigByName returns VDPA device configuration selected by nameEquivalent to: `vdpa dev config show <name>`

funcVDPAGetDevConfigListadded inv1.2.1

func VDPAGetDevConfigList() ([]*VDPADevConfig,error)

VDPAGetDevConfigList returns list of VDPA devices configurationsEquivalent to: `vdpa dev config show`

If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.

typeVDPADevConfigNetadded inv1.2.1

type VDPADevConfigNet struct {StatusVDPADevConfigNetStatusCfgVDPADevConfigNetCfg}

VDPADevConfigNet conatins status and net config for the VDPA device

typeVDPADevConfigNetCfgadded inv1.2.1

type VDPADevConfigNetCfg struct {MACAddrnet.HardwareAddrMaxVQPuint16MTUuint16}

VDPADevConfigNetCfg contains net config for the VDPA device

typeVDPADevConfigNetStatusadded inv1.2.1

type VDPADevConfigNetStatus struct {LinkUpboolAnnouncebool}

VDPADevConfigNetStatus contains info about net status

typeVDPADevVStatsadded inv1.2.1

type VDPADevVStats struct {QueueIndexuint32Vendor             []VDPADevVStatsVendorNegotiatedFeaturesuint64// contains filtered or unexported fields}

VDPADevVStats conatins vStats for the VDPA device

funcVDPAGetDevVStatsadded inv1.2.1

func VDPAGetDevVStats(namestring, queueIndexuint32) (*VDPADevVStats,error)

VDPAGetDevVStats returns vstats for VDPA deviceEquivalent to: `vdpa dev vstats show <name> qidx <queueIndex>`

typeVDPADevVStatsVendoradded inv1.2.1

type VDPADevVStatsVendor struct {NamestringValueuint64}

VDPADevVStatsVendor conatins name and value for vendor specific vstat option

typeVDPAMGMTDevadded inv1.2.1

type VDPAMGMTDev struct {BusNamestringDevNamestringSupportedClassesuint64SupportedFeaturesuint64MaxVQSuint32}

VDPAMGMTDev conatins info about VDPA management device

funcVDPAGetMGMTDevByBusAndNameadded inv1.2.1

func VDPAGetMGMTDevByBusAndName(bus, namestring) (*VDPAMGMTDev,error)

VDPAGetMGMTDevByBusAndName returns mgmt devices selected by bus and nameEquivalent to: `vdpa mgmtdev show <bus>/<name>`

funcVDPAGetMGMTDevListadded inv1.2.1

func VDPAGetMGMTDevList() ([]*VDPAMGMTDev,error)

VDPAGetMGMTDevList returns list of mgmt devicesEquivalent to: `vdpa mgmtdev show`

If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.

typeVDPANewDevParamsadded inv1.2.1

type VDPANewDevParams struct {MACAddrnet.HardwareAddrMaxVQPuint16MTUuint16Featuresuint64}

VDPANewDevParams contains parameters for new VDPA deviceuse SetBits to configure requried features for the deviceexample:

VDPANewDevParams{Features: SetBits(0, VIRTIO_NET_F_MTU, VIRTIO_NET_F_CTRL_MAC_ADDR)}

typeVeth

type Veth struct {LinkAttrsPeerNamestring// veth on create onlyPeerHardwareAddrnet.HardwareAddrPeerNamespace    interface{}PeerTxQLenintPeerNumTxQueuesuint32PeerNumRxQueuesuint32PeerMTUuint32}

Veth devices must specify PeerName on create

funcNewVethadded inv1.3.1

func NewVeth(attrLinkAttrs) *Veth

func (*Veth)Attrs

func (veth *Veth) Attrs() *LinkAttrs

func (*Veth)Type

func (veth *Veth) Type()string

typeVfInfoadded inv1.1.0

type VfInfo struct {IDintMacnet.HardwareAddrVlanintQosintVlanProtointTxRateint// IFLA_VF_TX_RATE  Max TxRateSpoofchkboolLinkStateuint32MaxTxRateuint32// IFLA_VF_RATE Max TxRateMinTxRateuint32// IFLA_VF_RATE Min TxRateRxPacketsuint64TxPacketsuint64RxBytesuint64TxBytesuint64Multicastuint64Broadcastuint64RxDroppeduint64TxDroppeduint64RssQueryuint32Trustuint32}

VfInfo represents configuration of virtual function

typeViaadded inv1.2.1

type Via struct {AddrFamilyintAddrnet.IP}

func (*Via)Decodeadded inv1.2.1

func (v *Via) Decode(b []byte)error

func (*Via)Encodeadded inv1.2.1

func (v *Via) Encode() ([]byte,error)

func (*Via)Equaladded inv1.2.1

func (v *Via) Equal(xDestination)bool

func (*Via)Familyadded inv1.2.1

func (v *Via) Family()int

func (*Via)Stringadded inv1.2.1

func (v *Via) String()string

typeVlan

type Vlan struct {LinkAttrsVlanIdintVlanProtocolVlanProtocolIngressQosMap map[uint32]uint32EgressQosMap  map[uint32]uint32ReorderHdr    *boolGvrp          *boolLooseBinding  *boolMvrp          *boolBridgeBinding *bool}

Vlan links have ParentIndex set in their Attrs()

func (*Vlan)Attrs

func (vlan *Vlan) Attrs() *LinkAttrs

func (*Vlan)Type

func (vlan *Vlan) Type()string

typeVlanActadded inv1.3.1

type VlanActint8
const (TCA_VLAN_ACT_POPVlanAct = 1TCA_VLAN_ACT_PUSHVlanAct = 2)

typeVlanActionadded inv1.3.1

type VlanAction struct {ActionAttrsActionVlanActVlanIDuint16}

funcNewVlanActionadded inv1.3.1

func NewVlanAction() *VlanAction

func (*VlanAction)Attrsadded inv1.3.1

func (action *VlanAction) Attrs() *ActionAttrs

func (*VlanAction)Typeadded inv1.3.1

func (action *VlanAction) Type()string

typeVlanProtocoladded inv1.1.0

type VlanProtocolint

VlanProtocol type

const (VLAN_PROTOCOL_UNKNOWNVlanProtocol = 0VLAN_PROTOCOL_8021QVlanProtocol = 0x8100VLAN_PROTOCOL_8021ADVlanProtocol = 0x88A8)

VlanProtocol possible values

funcStringToVlanProtocoladded inv1.1.0

func StringToVlanProtocol(sstring)VlanProtocol

StringToVlanProtocol returns vlan protocol, or unknown is the s is invalid.

func (VlanProtocol)Stringadded inv1.1.0

func (pVlanProtocol) String()string

typeVrf

type Vrf struct {LinkAttrsTableuint32}

func (*Vrf)Attrs

func (vrf *Vrf) Attrs() *LinkAttrs

func (*Vrf)Type

func (vrf *Vrf) Type()string

typeVrfSlaveadded inv1.2.1

type VrfSlave struct {Tableuint32}

func (*VrfSlave)SlaveTypeadded inv1.2.1

func (v *VrfSlave) SlaveType()string

typeVti

type Vti struct {LinkAttrsIKeyuint32OKeyuint32Linkuint32Localnet.IPRemotenet.IP}

func (*Vti)Attrs

func (vti *Vti) Attrs() *LinkAttrs

func (*Vti)Type

func (vti *Vti) Type()string

typeVxlan

type Vxlan struct {LinkAttrsVxlanIdintVtepDevIndexintSrcAddrnet.IPGroupnet.IPTTLintTOSintLearningboolProxyboolRSCboolL2missboolL3missboolUDPCSumboolUDP6ZeroCSumTxboolUDP6ZeroCSumRxboolNoAgeboolGBPboolFlowBasedboolAgeintLimitintPortintPortLowintPortHighint}

func (*Vxlan)Attrs

func (vxlan *Vxlan) Attrs() *LinkAttrs

func (*Vxlan)Type

func (vxlan *Vxlan) Type()string

typeWireguardadded inv1.2.1

type Wireguard struct {LinkAttrs}

Wireguard represent links of type "wireguard", seehttps://www.wireguard.com/

func (*Wireguard)Attrsadded inv1.2.1

func (wg *Wireguard) Attrs() *LinkAttrs

func (*Wireguard)Typeadded inv1.2.1

func (wg *Wireguard) Type()string

typeXDPDiagInfoRespadded inv1.2.1

type XDPDiagInfoResp struct {XDPDiagMsg *XDPSocketXDPInfo    *XDPInfo}

https://elixir.bootlin.com/linux/v6.2/source/include/uapi/linux/xdp_diag.h#L21

funcSocketDiagXDPadded inv1.2.1

func SocketDiagXDP() ([]*XDPDiagInfoResp,error)

SocketDiagXDP requests XDP_DIAG_INFO for XDP family sockets.

If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.

funcSocketXDPGetInfoadded inv1.2.1

func SocketXDPGetInfo(inouint32, cookieuint64) (*XDPDiagInfoResp,error)

SocketXDPGetInfo returns the XDP socket identified by its inode number and/orsocket cookie. Specify the cookie as SOCK_ANY_COOKIE if

If the returned error isErrDumpInterrupted, the caller should retry.

typeXDPDiagStatsadded inv1.2.1

type XDPDiagStats struct {RxDroppeduint64RxInvaliduint64RxFulluint64FillRingEmptyuint64TxInvaliduint64TxRingEmptyuint64}

XDPDiagStats contains ring statistics for an XDP socket.

https://elixir.bootlin.com/linux/v6.2/source/include/uapi/linux/xdp_diag.h#L74

typeXDPDiagUmemadded inv1.2.1

type XDPDiagUmem struct {Sizeuint64IDuint32NumPagesuint32ChunkSizeuint32Headroomuint32Ifindexuint32QueueIDuint32Flagsuint32Refsuint32}

XDPDiagUmem describes the umem attached to an XDP socket.

https://elixir.bootlin.com/linux/v6.2/source/include/uapi/linux/xdp_diag.h#L62

typeXDPInfoadded inv1.2.1

type XDPInfo struct {// XDP_DIAG_INFO/xdp_diag_info//https://elixir.bootlin.com/linux/v6.2/source/include/uapi/linux/xdp_diag.h#L51Ifindexuint32QueueIDuint32// XDP_DIAG_UIDUIDuint32// XDP_RX_RING//https://elixir.bootlin.com/linux/v6.2/source/include/uapi/linux/xdp_diag.h#L56RxRingEntriesuint32TxRingEntriesuint32UmemFillRingEntriesuint32UmemCompletionRingEntriesuint32// XDR_DIAG_UMEMUmem *XDPDiagUmem// XDR_DIAG_STATSStats *XDPDiagStats}

typeXDPSocketadded inv1.2.1

type XDPSocket struct {// xdp_diag_msg//https://elixir.bootlin.com/linux/v6.2/source/include/uapi/linux/xdp_diag.h#L21Familyuint8Typeuint8Inouint32Cookie [2]uint32// contains filtered or unexported fields}

XDPSocket represents an XDP socket (and the common diagnosis part inparticular). Please note that in contrast toUnixSocket the XDPSocket typedoes not feature “State” information.

typeXfrmMark

type XfrmMark struct {Valueuint32Maskuint32}

XfrmMark represents the mark associated to the state or policy

func (*XfrmMark)String

func (m *XfrmMark) String()string

typeXfrmMsg

type XfrmMsg interface {Type()nl.XfrmMsgType}

typeXfrmMsgExpire

type XfrmMsgExpire struct {XfrmState *XfrmStateHardbool}

func (*XfrmMsgExpire)Type

func (ue *XfrmMsgExpire) Type()nl.XfrmMsgType

typeXfrmPolicy

type XfrmPolicy struct {Dst      *net.IPNetSrc      *net.IPNetProtoProtoDstPortintSrcPortintDirDirPriorityintIndexintActionPolicyActionIfindexintIfidintMark     *XfrmMarkTmpls    []XfrmPolicyTmpl}

XfrmPolicy represents an ipsec policy. It represents the overlay networkand has a list of XfrmPolicyTmpls representing the base addresses ofthe policy.

funcXfrmPolicyGet

func XfrmPolicyGet(policy *XfrmPolicy) (*XfrmPolicy,error)

XfrmPolicyGet gets a the policy described by the index or selector, if found.Equivalent to: `ip xfrm policy get { SELECTOR | index INDEX } dir DIR [ctx CTX ] [ mark MARK [ mask MASK ] ] [ ptype PTYPE ]`.

funcXfrmPolicyList

func XfrmPolicyList(familyint) ([]XfrmPolicy,error)

XfrmPolicyList gets a list of xfrm policies in the system.Equivalent to: `ip xfrm policy show`.The list can be filtered by ip family.

If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.

func (XfrmPolicy)String

func (pXfrmPolicy) String()string

typeXfrmPolicyTmpl

type XfrmPolicyTmpl struct {Dstnet.IPSrcnet.IPProtoProtoModeModeSpiintReqidintOptionalint}

XfrmPolicyTmpl encapsulates a rule for the base addresses of an ipsecpolicy. These rules are matched with XfrmState to determine encryptionand authentication algorithms.

func (XfrmPolicyTmpl)String

func (tXfrmPolicyTmpl) String()string

typeXfrmReplayStateadded inv1.2.1

type XfrmReplayState struct {OSequint32Sequint32BitMapuint32}

XfrmReplayState represents the sequence number states for"legacy" anti-replay mode.

func (XfrmReplayState)Stringadded inv1.2.1

func (rXfrmReplayState) String()string

typeXfrmState

type XfrmState struct {Dstnet.IPSrcnet.IPProtoProtoModeModeSpiintReqidintReplayWindowintLimitsXfrmStateLimitsStatisticsXfrmStateStatsMark          *XfrmMarkOutputMark    *XfrmMarkSADirSADirIfidintPcpunum       *uint32Auth          *XfrmStateAlgoCrypt         *XfrmStateAlgoAead          *XfrmStateAlgoEncap         *XfrmStateEncapESNboolDontEncapDSCPboolOSeqMayWrapboolReplay        *XfrmReplayStateSelector      *XfrmPolicy}

XfrmState represents the state of an ipsec policy. It optionallycontains an XfrmStateAlgo for encryption and one for authentication.

funcXfrmStateAllocSpi

func XfrmStateAllocSpi(state *XfrmState) (*XfrmState,error)

XfrmStateAllocSpi will allocate an xfrm state in the system.Equivalent to: `ip xfrm state allocspi`

funcXfrmStateGet

func XfrmStateGet(state *XfrmState) (*XfrmState,error)

XfrmStateGet gets the xfrm state described by the ID, if found.Equivalent to: `ip xfrm state get ID [ mark MARK [ mask MASK ] ]`.Only the fields which constitue the SA ID must be filled in:ID := [ src ADDR ] [ dst ADDR ] [ proto XFRM-PROTO ] [ spi SPI ]mark is optional

funcXfrmStateList

func XfrmStateList(familyint) ([]XfrmState,error)

XfrmStateList gets a list of xfrm states in the system.Equivalent to: `ip [-4|-6] xfrm state show`.The list can be filtered by ip family.

If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.

func (XfrmState)Print

func (saXfrmState) Print(statsbool)string

func (XfrmState)String

func (saXfrmState) String()string

typeXfrmStateAlgo

type XfrmStateAlgo struct {NamestringKey         []byteTruncateLenint// Auth onlyICVLenint// AEAD only}

XfrmStateAlgo represents the algorithm to use for the ipsec encryption.

func (XfrmStateAlgo)String

func (aXfrmStateAlgo) String()string

typeXfrmStateEncap

type XfrmStateEncap struct {TypeEncapTypeSrcPortintDstPortintOriginalAddressnet.IP}

XfrmStateEncap represents the encapsulation to use for the ipsec encryption.

func (XfrmStateEncap)String

func (eXfrmStateEncap) String()string

typeXfrmStateLimits

type XfrmStateLimits struct {ByteSoftuint64ByteHarduint64PacketSoftuint64PacketHarduint64TimeSoftuint64TimeHarduint64TimeUseSoftuint64TimeUseHarduint64}

XfrmStateLimits represents the configured limits for the state.

typeXfrmStateStats

type XfrmStateStats struct {ReplayWindowuint32Replayuint32Faileduint32Bytesuint64Packetsuint64AddTimeuint64UseTimeuint64}

XfrmStateStats represents the current number of bytes/packetsprocessed by this State, the State's installation and first usetime and the replay window counters.

typeXfrmiadded inv1.1.0

type Xfrmi struct {LinkAttrsIfiduint32}

Virtual XFRM Interfaces

Named "xfrmi" to prevent confusion with XFRM objects

func (*Xfrmi)Attrsadded inv1.1.0

func (xfrm *Xfrmi) Attrs() *LinkAttrs

func (*Xfrmi)Typeadded inv1.1.0

func (xfrm *Xfrmi) Type()string

Source Files

View all Source files

Directories

PathSynopsis
cmd
ipset-testcommand
Package nl has low level primitives for making Netlink calls.
Package nl has low level primitives for making Netlink calls.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp