netlink
packagemoduleThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
README¶
netlink - netlink library for go
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/netlinkTesting dependencies:
go get github.com/vishvananda/netnsTesting (requires root):
sudo -E go test github.com/vishvananda/netlinkExamples
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
- Variables
- func AddrAdd(link Link, addr *Addr) error
- func AddrDel(link Link, addr *Addr) error
- func AddrReplace(link Link, addr *Addr) error
- func AddrSubscribe(ch chan<- AddrUpdate, done <-chan struct{}) error
- func AddrSubscribeAt(ns netns.NsHandle, ch chan<- AddrUpdate, done <-chan struct{}) error
- func AddrSubscribeWithOptions(ch chan<- AddrUpdate, done <-chan struct{}, options AddrSubscribeOptions) error
- func AdjustSize(sz uint, mpu uint, linklayer int) uint
- func AlignToAtm(size uint) uint
- func BridgeSetMcastSnoop(link Link, on bool) error
- func BridgeSetVlanDefaultPVID(link Link, pvid uint16) error
- func BridgeSetVlanFiltering(link Link, on bool) error
- func BridgeVlanAdd(link Link, vid uint16, pvid, untagged, self, master bool) error
- func BridgeVlanAddRange(link Link, vid, vidEnd uint16, pvid, untagged, self, master bool) error
- func BridgeVlanAddRangeTunnelInfoRange(link Link, vid, vidEnd uint16, tunid, tunidEnd uint32, self, master bool) error
- func BridgeVlanAddTunnelInfo(link Link, vid uint16, tunid uint32, self, master bool) error
- func BridgeVlanDel(link Link, vid uint16, pvid, untagged, self, master bool) error
- func BridgeVlanDelRange(link Link, vid, vidEnd uint16, pvid, untagged, self, master bool) error
- func BridgeVlanDelRangeTunnelInfoRange(link Link, vid, vidEnd uint16, tunid, tunidEnd uint32, self, master bool) error
- func BridgeVlanDelTunnelInfo(link Link, vid uint16, tunid uint32, self, master bool) error
- func BridgeVlanList() (map[int32][]*nl.BridgeVlanInfo, error)
- func BridgeVlanTunnelShow() ([]nl.TunnelInfo, error)
- func CalcRtable(rate *nl.TcRateSpec, rtab []uint32, cellLog int, mtu uint32, linklayer int) int
- func ChainAdd(link Link, chain Chain) error
- func ChainDel(link Link, chain Chain) error
- func ClassAdd(class Class) error
- func ClassChange(class Class) error
- func ClassDel(class Class) error
- func ClassReplace(class Class) error
- func ClockFactor() float64
- func ConntrackCreate(table ConntrackTableType, family InetFamily, flow *ConntrackFlow) error
- func ConntrackDeleteFilter(table ConntrackTableType, family InetFamily, filter CustomConntrackFilter) (uint, error)deprecated
- func ConntrackDeleteFilters(table ConntrackTableType, family InetFamily, filters ...CustomConntrackFilter) (uint, error)
- func ConntrackTableFlush(table ConntrackTableType) error
- func ConntrackUpdate(table ConntrackTableType, family InetFamily, flow *ConntrackFlow) error
- func DeserializeRtab(b []byte) [256]uint32
- func DevLinkPortDel(Bus string, Device string, PortIndex uint32) error
- func DevLinkSetEswitchMode(Dev *DevlinkDevice, NewMode string) error
- func DevlinkGetDeviceInfoByNameAsMap(Bus string, Device string) (map[string]string, error)
- func DevlinkPortFnSet(Bus string, Device string, PortIndex uint32, FnAttrs DevlinkPortFnSetAttrs) error
- func DevlinkSetDeviceParam(bus string, device string, param string, cmode uint8, value interface{}) error
- func EncodeActions(attr *nl.RtAttr, actions []Action) error
- func FilterAdd(filter Filter) error
- func FilterDel(filter Filter) error
- func FilterReplace(filter Filter) error
- func FouAdd(f Fou) error
- func FouDel(f Fou) error
- func FouFamilyId() (int, error)
- func GTPPDPAdd(link Link, pdp *PDP) error
- func GTPPDPDel(link Link, pdp *PDP) error
- func GetNetNsIdByFd(fd int) (int, error)
- func GetNetNsIdByPid(pid int) (int, error)
- func GetSocketTimeout() time.Duration
- func HandleStr(handle uint32) string
- func Hz() float64
- func IpsetAdd(setname string, entry *IPSetEntry) error
- func IpsetCreate(setname, typename string, options IpsetCreateOptions) error
- func IpsetDel(setname string, entry *IPSetEntry) error
- func IpsetDestroy(setname string) error
- func IpsetFlush(setname string) error
- func IpsetProtocol() (uint8, uint8, error)
- func IpsetSwap(setname, othersetname string) error
- func IpsetTest(setname string, entry *IPSetEntry) (bool, error)
- func IsBitSet(input uint64, pos int) bool
- func LinkAdd(link Link) error
- func LinkAddAltName(link Link, name string) error
- func LinkDel(link Link) error
- func LinkDelAltName(link Link, name string) error
- func LinkDelBondSlave(link Link, master *Bond) error
- func LinkModify(link Link) error
- func LinkSetARPOff(link Link) error
- func LinkSetARPOn(link Link) error
- func LinkSetAlias(link Link, name string) error
- func LinkSetAllmulticastOff(link Link) error
- func LinkSetAllmulticastOn(link Link) error
- func LinkSetBRSlaveGroupFwdMask(link Link, mask uint16) error
- func LinkSetBondSlave(link Link, master *Bond) error
- func LinkSetBondSlaveActive(link Link, master *Bond) error
- func LinkSetBondSlaveQueueId(link Link, queueId uint16) error
- func LinkSetBrNeighSuppress(link Link, mode bool) error
- func LinkSetBrProxyArp(link Link, mode bool) error
- func LinkSetBrProxyArpWiFi(link Link, mode bool) error
- func LinkSetDown(link Link) error
- func LinkSetFastLeave(link Link, mode bool) error
- func LinkSetFlood(link Link, mode bool) error
- func LinkSetGROIPv4MaxSize(link Link, maxSize int) error
- func LinkSetGROMaxSize(link Link, maxSize int) error
- func LinkSetGSOIPv4MaxSize(link Link, maxSize int) error
- func LinkSetGSOMaxSegs(link Link, maxSegs int) error
- func LinkSetGSOMaxSize(link Link, maxSize int) error
- func LinkSetGroup(link Link, group int) error
- func LinkSetGuard(link Link, mode bool) error
- func LinkSetHairpin(link Link, mode bool) error
- func LinkSetHardwareAddr(link Link, hwaddr net.HardwareAddr) error
- func LinkSetIP6AddrGenMode(link Link, mode int) error
- func LinkSetIsolated(link Link, mode bool) error
- func LinkSetLearning(link Link, mode bool) error
- func LinkSetMTU(link Link, mtu int) error
- func LinkSetMacvlanMode(link Link, mode MacvlanMode) error
- func LinkSetMaster(link Link, master Link) error
- func LinkSetMasterByIndex(link Link, masterIndex int) error
- func LinkSetMulticastOff(link Link) error
- func LinkSetMulticastOn(link Link) error
- func LinkSetName(link Link, name string) error
- func LinkSetNoMaster(link Link) error
- func LinkSetNsFd(link Link, fd int) error
- func LinkSetNsPid(link Link, nspid int) error
- func LinkSetRootBlock(link Link, mode bool) error
- func LinkSetTxQLen(link Link, qlen int) error
- func LinkSetUp(link Link) error
- func LinkSetVfHardwareAddr(link Link, vf int, hwaddr net.HardwareAddr) error
- func LinkSetVfNodeGUID(link Link, vf int, nodeguid net.HardwareAddr) error
- func LinkSetVfPortGUID(link Link, vf int, portguid net.HardwareAddr) error
- func LinkSetVfRate(link Link, vf, minRate, maxRate int) error
- func LinkSetVfSpoofchk(link Link, vf int, check bool) error
- func LinkSetVfState(link Link, vf int, state uint32) error
- func LinkSetVfTrust(link Link, vf int, state bool) error
- func LinkSetVfTxRate(link Link, vf, rate int) error
- func LinkSetVfVlan(link Link, vf, vlan int) error
- func LinkSetVfVlanQos(link Link, vf, vlan, qos int) error
- func LinkSetVfVlanQosProto(link Link, vf, vlan, qos, proto int) error
- func LinkSetVlanTunnel(link Link, mode bool) error
- func LinkSetXdpFd(link Link, fd int) error
- func LinkSetXdpFdWithFlags(link Link, fd, flags int) error
- func LinkSubscribe(ch chan<- LinkUpdate, done <-chan struct{}) error
- func LinkSubscribeAt(ns netns.NsHandle, ch chan<- LinkUpdate, done <-chan struct{}) error
- func LinkSubscribeWithOptions(ch chan<- LinkUpdate, done <-chan struct{}, options LinkSubscribeOptions) error
- func MacvlanMACAddrAdd(link Link, addr net.HardwareAddr) error
- func MacvlanMACAddrDel(link Link, addr net.HardwareAddr) error
- func MacvlanMACAddrFlush(link Link) error
- func MacvlanMACAddrSet(link Link, addrs []net.HardwareAddr) error
- func MajorMinor(handle uint32) (uint16, uint16)
- func MakeHandle(major, minor uint16) uint32
- func NeighAdd(neigh *Neigh) error
- func NeighAppend(neigh *Neigh) error
- func NeighDel(neigh *Neigh) error
- func NeighSet(neigh *Neigh) error
- func NeighSubscribe(ch chan<- NeighUpdate, done <-chan struct{}) error
- func NeighSubscribeAt(ns netns.NsHandle, ch chan<- NeighUpdate, done <-chan struct{}) error
- func NeighSubscribeWithOptions(ch chan<- NeighUpdate, done <-chan struct{}, options NeighSubscribeOptions) error
- func NewIPNet(ip net.IP) *net.IPNet
- func ParseIPNet(s string) (*net.IPNet, error)
- func Percentage2u32(percentage float32) uint32
- func ProcEventMonitor(ch chan<- ProcEvent, done <-chan struct{}, errorChan chan<- error) error
- func QdiscAdd(qdisc Qdisc) error
- func QdiscChange(qdisc Qdisc) error
- func QdiscDel(qdisc Qdisc) error
- func QdiscReplace(qdisc Qdisc) error
- func RdmaLinkAdd(linkName, linkType, netdev string) error
- func RdmaLinkDel(name string) error
- func RdmaLinkSetName(link *RdmaLink, name string) error
- func RdmaLinkSetNsFd(link *RdmaLink, fd uint32) error
- func RdmaSystemGetNetnsMode() (string, error)
- func RdmaSystemSetNetnsMode(NewMode string) error
- func RouteAdd(route *Route) error
- func RouteAddEcmp(route *Route) error
- func RouteAppend(route *Route) error
- func RouteChange(route *Route) error
- func RouteDel(route *Route) error
- func RouteListFilteredIter(family int, filter *Route, filterMask uint64, f func(Route) (cont bool)) error
- func RouteReplace(route *Route) error
- func RouteSubscribe(ch chan<- RouteUpdate, done <-chan struct{}) error
- func RouteSubscribeAt(ns netns.NsHandle, ch chan<- RouteUpdate, done <-chan struct{}) error
- func RouteSubscribeWithOptions(ch chan<- RouteUpdate, done <-chan struct{}, options RouteSubscribeOptions) error
- func RuleAdd(rule *Rule) error
- func RuleDel(rule *Rule) error
- func SerializeRtab(rtab [256]uint32) []byte
- func SetBits(input uint64, pos ...int) uint64
- func SetNetNsIdByFd(fd, nsid int) error
- func SetNetNsIdByPid(pid, nsid int) error
- func SetPromiscOff(link Link) error
- func SetPromiscOn(link Link) error
- func SetSocketTimeout(to time.Duration) error
- func SocketDestroy(local, remote net.Addr) error
- func TcActExtCmp(combined int32, opcode int32) bool
- func TickInUsec() float64
- func VDPADelDev(name string) error
- func VDPANewDev(name, mgmtBus, mgmtName string, params VDPANewDevParams) error
- func VethPeerIndex(link *Veth) (int, error)
- func XfrmMonitor(ch chan<- XfrmMsg, done <-chan struct{}, errorChan chan<- error, ...) error
- func XfrmPolicyAdd(policy *XfrmPolicy) error
- func XfrmPolicyDel(policy *XfrmPolicy) error
- func XfrmPolicyFlush() error
- func XfrmPolicyUpdate(policy *XfrmPolicy) error
- func XfrmStateAdd(state *XfrmState) error
- func XfrmStateDel(state *XfrmState) error
- func XfrmStateFlush(proto Proto) error
- func XfrmStateUpdate(state *XfrmState) error
- func Xmitsize(rate uint64, ticks uint32) uint32
- func Xmittime(rate uint64, size uint32) uint32
- type Action
- type ActionAttrs
- type ActionStatistic
- type ActionTimestamp
- type Addr
- type AddrSubscribeOptions
- type AddrUpdate
- type BPFAttr
- type BareUDP
- type Bond
- type BondAdInfo
- type BondAdSelect
- type BondArpAllTargets
- type BondArpValidate
- type BondFailOverMac
- type BondLacpRate
- type BondMode
- type BondPrimaryReselect
- type BondSlave
- type BondSlaveMiiStatus
- type BondSlaveState
- type BondXmitHashPolicy
- type BpfAction
- type BpfEncap
- func (e *BpfEncap) Decode(buf []byte) error
- func (e *BpfEncap) Encode() ([]byte, error)
- func (e *BpfEncap) Equal(x Encap) bool
- func (e *BpfEncap) SetProg(mode, progFd int, progName string) error
- func (e *BpfEncap) SetXmitHeadroom(headroom int) error
- func (e *BpfEncap) String() string
- func (e *BpfEncap) Type() int
- type BpfFilter
- type BpfProgType
- type Bridge
- type Can
- type Chain
- type Class
- type ClassAttrs
- type ClassStatistics
- type Clsact
- type CommProcEvent
- type ConnmarkAction
- type ConntrackFilter
- func (f *ConntrackFilter) AddIP(tp ConntrackFilterType, ip net.IP) error
- func (f *ConntrackFilter) AddIPNet(tp ConntrackFilterType, ipNet *net.IPNet) error
- func (f *ConntrackFilter) AddLabels(tp ConntrackFilterType, labels [][]byte) error
- func (f *ConntrackFilter) AddPort(tp ConntrackFilterType, port uint16) error
- func (f *ConntrackFilter) AddProtocol(proto uint8) error
- func (f *ConntrackFilter) AddZone(zone uint16) error
- func (f *ConntrackFilter) MatchConntrackFlow(flow *ConntrackFlow) bool
- type ConntrackFilterType
- type ConntrackFlow
- type ConntrackTableType
- type CsumAction
- type CsumUpdateFlags
- type CustomConntrackFilter
- type Destination
- type DevLinkPortAddAttrs
- type Device
- type DevlinkDevAttrs
- type DevlinkDevEswitchAttr
- type DevlinkDevice
- type DevlinkDeviceInfo
- type DevlinkParam
- type DevlinkParamValue
- type DevlinkPort
- type DevlinkPortFn
- type DevlinkPortFnSetAttrs
- type DevlinkResource
- type DevlinkResources
- type Dir
- type Dummy
- type Encap
- type EncapType
- type ExecProcEvent
- type ExitProcEvent
- type Filter
- type FilterAttrs
- type Flower
- type ForkProcEvent
- type Fou
- type Fq
- type FqCodel
- type FwFilter
- type GTP
- type GenericAction
- type GenericClass
- type GenericFilter
- type GenericLink
- type GenericQdisc
- type Geneve
- type GeneveDf
- type GenlFamily
- type GenlMulticastGroup
- type GenlOp
- type GnetStatsBasic
- type GnetStatsQueue
- type GnetStatsRateEst
- type GnetStatsRateEst64
- type Gretap
- type Gretun
- type Handle
- func (h *Handle) AddrAdd(link Link, addr *Addr) error
- func (h *Handle) AddrDel(link Link, addr *Addr) error
- func (h *Handle) AddrList(link Link, family int) ([]Addr, error)
- func (h *Handle) AddrReplace(link Link, addr *Addr) error
- func (h *Handle) BridgeSetMcastSnoop(link Link, on bool) error
- func (h *Handle) BridgeSetVlanDefaultPVID(link Link, pvid uint16) error
- func (h *Handle) BridgeSetVlanFiltering(link Link, on bool) error
- func (h *Handle) BridgeVlanAdd(link Link, vid uint16, pvid, untagged, self, master bool) error
- func (h *Handle) BridgeVlanAddRange(link Link, vid, vidEnd uint16, pvid, untagged, self, master bool) error
- func (h *Handle) BridgeVlanAddTunnelInfo(link Link, vid, vidEnd uint16, tunid, tunidEnd uint32, self, master bool) error
- func (h *Handle) BridgeVlanDel(link Link, vid uint16, pvid, untagged, self, master bool) error
- func (h *Handle) BridgeVlanDelRange(link Link, vid, vidEnd uint16, pvid, untagged, self, master bool) error
- func (h *Handle) BridgeVlanDelTunnelInfo(link Link, vid, vidEnd uint16, tunid, tunidEnd uint32, self, master bool) error
- func (h *Handle) BridgeVlanList() (map[int32][]*nl.BridgeVlanInfo, error)
- func (h *Handle) BridgeVlanTunnelShow() ([]nl.TunnelInfo, error)
- func (h *Handle) ChainAdd(link Link, chain Chain) error
- func (h *Handle) ChainDel(link Link, chain Chain) error
- func (h *Handle) ChainList(link Link, parent uint32) ([]Chain, error)
- func (h *Handle) ClassAdd(class Class) error
- func (h *Handle) ClassChange(class Class) error
- func (h *Handle) ClassDel(class Class) error
- func (h *Handle) ClassList(link Link, parent uint32) ([]Class, error)
- func (h *Handle) ClassReplace(class Class) error
- func (h *Handle) Close()
- func (h *Handle) ConntrackCreate(table ConntrackTableType, family InetFamily, flow *ConntrackFlow) error
- func (h *Handle) ConntrackDeleteFilter(table ConntrackTableType, family InetFamily, filter CustomConntrackFilter) (uint, error)deprecated
- func (h *Handle) ConntrackDeleteFilters(table ConntrackTableType, family InetFamily, filters ...CustomConntrackFilter) (uint, error)
- func (h *Handle) ConntrackTableFlush(table ConntrackTableType) error
- func (h *Handle) ConntrackTableList(table ConntrackTableType, family InetFamily) ([]*ConntrackFlow, error)
- func (h *Handle) ConntrackUpdate(table ConntrackTableType, family InetFamily, flow *ConntrackFlow) error
- func (h *Handle) Delete()deprecated
- func (h *Handle) DevLinkGetAllPortList() ([]*DevlinkPort, error)
- func (h *Handle) DevLinkGetDeviceByName(Bus string, Device string) (*DevlinkDevice, error)
- func (h *Handle) DevLinkGetDeviceList() ([]*DevlinkDevice, error)
- func (h *Handle) DevLinkGetPortByIndex(Bus string, Device string, PortIndex uint32) (*DevlinkPort, error)
- func (h *Handle) DevLinkPortAdd(Bus string, Device string, Flavour uint16, Attrs DevLinkPortAddAttrs) (*DevlinkPort, error)
- func (h *Handle) DevLinkPortDel(Bus string, Device string, PortIndex uint32) error
- func (h *Handle) DevLinkSetEswitchMode(Dev *DevlinkDevice, NewMode string) error
- func (h *Handle) DevlinkGetDeviceInfoByName(Bus string, Device string, getInfoMsg devlinkInfoGetter) (*DevlinkDeviceInfo, error)
- func (h *Handle) DevlinkGetDeviceInfoByNameAsMap(Bus string, Device string, getInfoMsg devlinkInfoGetter) (map[string]string, error)
- func (h *Handle) DevlinkGetDeviceParamByName(bus string, device string, param string) (*DevlinkParam, error)
- func (h *Handle) DevlinkGetDeviceParams(bus string, device string) ([]*DevlinkParam, error)
- func (h *Handle) DevlinkGetDeviceResources(bus string, device string) (*DevlinkResources, error)
- func (h *Handle) DevlinkPortFnSet(Bus string, Device string, PortIndex uint32, FnAttrs DevlinkPortFnSetAttrs) error
- func (h *Handle) DevlinkSetDeviceParam(bus string, device string, param string, cmode uint8, value interface{}) error
- func (h *Handle) FilterAdd(filter Filter) error
- func (h *Handle) FilterDel(filter Filter) error
- func (h *Handle) FilterList(link Link, parent uint32) ([]Filter, error)
- func (h *Handle) FilterReplace(filter Filter) error
- func (h *Handle) FouAdd(f Fou) error
- func (h *Handle) FouDel(f Fou) error
- func (h *Handle) FouList(fam int) ([]Fou, error)
- func (h *Handle) GTPPDPAdd(link Link, pdp *PDP) error
- func (h *Handle) GTPPDPByITEI(link Link, itei int) (*PDP, error)
- func (h *Handle) GTPPDPByMSAddress(link Link, addr net.IP) (*PDP, error)
- func (h *Handle) GTPPDPByTID(link Link, tid int) (*PDP, error)
- func (h *Handle) GTPPDPDel(link Link, pdp *PDP) error
- func (h *Handle) GTPPDPList() ([]*PDP, error)
- func (h *Handle) GenlFamilyGet(name string) (*GenlFamily, error)
- func (h *Handle) GenlFamilyList() ([]*GenlFamily, error)
- func (h *Handle) GetNetNsIdByFd(fd int) (int, error)
- func (h *Handle) GetNetNsIdByPid(pid int) (int, error)
- func (h *Handle) GetSocketReceiveBufferSize() ([]int, error)
- func (h *Handle) IpsetAdd(setname string, entry *IPSetEntry) error
- func (h *Handle) IpsetCreate(setname, typename string, options IpsetCreateOptions) error
- func (h *Handle) IpsetDel(setname string, entry *IPSetEntry) error
- func (h *Handle) IpsetDestroy(setname string) error
- func (h *Handle) IpsetFlush(setname string) error
- func (h *Handle) IpsetList(name string) (*IPSetResult, error)
- func (h *Handle) IpsetListAll() ([]IPSetResult, error)
- func (h *Handle) IpsetProtocol() (protocol uint8, minVersion uint8, err error)
- func (h *Handle) IpsetSwap(setname, othersetname string) error
- func (h *Handle) IpsetTest(setname string, entry *IPSetEntry) (bool, error)
- func (h *Handle) LinkAdd(link Link) error
- func (h *Handle) LinkAddAltName(link Link, name string) error
- func (h *Handle) LinkByAlias(alias string) (Link, error)
- func (h *Handle) LinkByIndex(index int) (Link, error)
- func (h *Handle) LinkByName(name string) (Link, error)
- func (h *Handle) LinkDel(link Link) error
- func (h *Handle) LinkDelAltName(link Link, name string) error
- func (h *Handle) LinkGetProtinfo(link Link) (Protinfo, error)
- func (h *Handle) LinkList() ([]Link, error)
- func (h *Handle) LinkModify(link Link) error
- func (h *Handle) LinkSetARPOff(link Link) error
- func (h *Handle) LinkSetARPOn(link Link) error
- func (h *Handle) LinkSetAlias(link Link, name string) error
- func (h *Handle) LinkSetAllmulticastOff(link Link) error
- func (h *Handle) LinkSetAllmulticastOn(link Link) error
- func (h *Handle) LinkSetBRSlaveGroupFwdMask(link Link, mask uint16) error
- func (h *Handle) LinkSetBondSlaveQueueId(link Link, queueId uint16) error
- func (h *Handle) LinkSetBrNeighSuppress(link Link, mode bool) error
- func (h *Handle) LinkSetBrProxyArp(link Link, mode bool) error
- func (h *Handle) LinkSetBrProxyArpWiFi(link Link, mode bool) error
- func (h *Handle) LinkSetDown(link Link) error
- func (h *Handle) LinkSetFastLeave(link Link, mode bool) error
- func (h *Handle) LinkSetFlood(link Link, mode bool) error
- func (h *Handle) LinkSetGROIPv4MaxSize(link Link, maxSize int) error
- func (h *Handle) LinkSetGROMaxSize(link Link, maxSize int) error
- func (h *Handle) LinkSetGSOIPv4MaxSize(link Link, maxSize int) error
- func (h *Handle) LinkSetGSOMaxSegs(link Link, maxSize int) error
- func (h *Handle) LinkSetGSOMaxSize(link Link, maxSize int) error
- func (h *Handle) LinkSetGroup(link Link, group int) error
- func (h *Handle) LinkSetGuard(link Link, mode bool) error
- func (h *Handle) LinkSetHairpin(link Link, mode bool) error
- func (h *Handle) LinkSetHardwareAddr(link Link, hwaddr net.HardwareAddr) error
- func (h *Handle) LinkSetIP6AddrGenMode(link Link, mode int) error
- func (h *Handle) LinkSetIsolated(link Link, mode bool) error
- func (h *Handle) LinkSetLearning(link Link, mode bool) error
- func (h *Handle) LinkSetMTU(link Link, mtu int) error
- func (h *Handle) LinkSetMacvlanMode(link Link, mode MacvlanMode) error
- func (h *Handle) LinkSetMaster(link Link, master Link) error
- func (h *Handle) LinkSetMasterByIndex(link Link, masterIndex int) error
- func (h *Handle) LinkSetMulticastOff(link Link) error
- func (h *Handle) LinkSetMulticastOn(link Link) error
- func (h *Handle) LinkSetName(link Link, name string) error
- func (h *Handle) LinkSetNoMaster(link Link) error
- func (h *Handle) LinkSetNsFd(link Link, fd int) error
- func (h *Handle) LinkSetNsPid(link Link, nspid int) error
- func (h *Handle) LinkSetRootBlock(link Link, mode bool) error
- func (h *Handle) LinkSetTxQLen(link Link, qlen int) error
- func (h *Handle) LinkSetUp(link Link) error
- func (h *Handle) LinkSetVfGUID(link Link, vf int, vfGuid net.HardwareAddr, guidType int) error
- func (h *Handle) LinkSetVfHardwareAddr(link Link, vf int, hwaddr net.HardwareAddr) error
- func (h *Handle) LinkSetVfRate(link Link, vf, minRate, maxRate int) error
- func (h *Handle) LinkSetVfSpoofchk(link Link, vf int, check bool) error
- func (h *Handle) LinkSetVfState(link Link, vf int, state uint32) error
- func (h *Handle) LinkSetVfTrust(link Link, vf int, state bool) error
- func (h *Handle) LinkSetVfTxRate(link Link, vf, rate int) error
- func (h *Handle) LinkSetVfVlan(link Link, vf, vlan int) error
- func (h *Handle) LinkSetVfVlanQos(link Link, vf, vlan, qos int) error
- func (h *Handle) LinkSetVfVlanQosProto(link Link, vf, vlan, qos, proto int) error
- func (h *Handle) LinkSetVlanTunnel(link Link, mode bool) error
- func (h *Handle) MacvlanMACAddrAdd(link Link, addr net.HardwareAddr) error
- func (h *Handle) MacvlanMACAddrDel(link Link, addr net.HardwareAddr) error
- func (h *Handle) MacvlanMACAddrFlush(link Link) error
- func (h *Handle) MacvlanMACAddrSet(link Link, addrs []net.HardwareAddr) error
- func (h *Handle) NeighAdd(neigh *Neigh) error
- func (h *Handle) NeighAppend(neigh *Neigh) error
- func (h *Handle) NeighDel(neigh *Neigh) error
- func (h *Handle) NeighList(linkIndex, family int) ([]Neigh, error)
- func (h *Handle) NeighListExecute(msg Ndmsg) ([]Neigh, error)
- func (h *Handle) NeighProxyList(linkIndex, family int) ([]Neigh, error)
- func (h *Handle) NeighSet(neigh *Neigh) error
- func (h *Handle) QdiscAdd(qdisc Qdisc) error
- func (h *Handle) QdiscChange(qdisc Qdisc) error
- func (h *Handle) QdiscDel(qdisc Qdisc) error
- func (h *Handle) QdiscList(link Link) ([]Qdisc, error)
- func (h *Handle) QdiscReplace(qdisc Qdisc) error
- func (h *Handle) RdmaLinkAdd(linkName string, linkType string, netdev string) error
- func (h *Handle) RdmaLinkByName(name string) (*RdmaLink, error)
- func (h *Handle) RdmaLinkDel(name string) error
- func (h *Handle) RdmaLinkList() ([]*RdmaLink, error)
- func (h *Handle) RdmaLinkSetName(link *RdmaLink, name string) error
- func (h *Handle) RdmaLinkSetNsFd(link *RdmaLink, fd uint32) error
- func (h *Handle) RdmaPortStatisticList(link *RdmaLink, port uint32) (*RdmaPortStatistic, error)
- func (h *Handle) RdmaResourceList() ([]*RdmaResource, error)
- func (h *Handle) RdmaStatistic(link *RdmaLink) (*RdmaDeviceStatistic, error)
- func (h *Handle) RdmaSystemGetNetnsMode() (string, error)
- func (h *Handle) RdmaSystemSetNetnsMode(NewMode string) error
- func (h *Handle) RouteAdd(route *Route) error
- func (h *Handle) RouteAddEcmp(route *Route) error
- func (h *Handle) RouteAppend(route *Route) error
- func (h *Handle) RouteChange(route *Route) error
- func (h *Handle) RouteDel(route *Route) error
- func (h *Handle) RouteGet(destination net.IP) ([]Route, error)
- func (h *Handle) RouteGetWithOptions(destination net.IP, options *RouteGetOptions) ([]Route, error)
- func (h *Handle) RouteList(link Link, family int) ([]Route, error)
- func (h *Handle) RouteListFiltered(family int, filter *Route, filterMask uint64) ([]Route, error)
- func (h *Handle) RouteListFilteredIter(family int, filter *Route, filterMask uint64, f func(Route) (cont bool)) error
- func (h *Handle) RouteReplace(route *Route) error
- func (h *Handle) RuleAdd(rule *Rule) error
- func (h *Handle) RuleDel(rule *Rule) error
- func (h *Handle) RuleList(family int) ([]Rule, error)
- func (h *Handle) RuleListFiltered(family int, filter *Rule, filterMask uint64) ([]Rule, error)
- func (h *Handle) SetNetNsIdByFd(fd, nsid int) error
- func (h *Handle) SetNetNsIdByPid(pid, nsid int) error
- func (h *Handle) SetPromiscOff(link Link) error
- func (h *Handle) SetPromiscOn(link Link) error
- func (h *Handle) SetSocketReceiveBufferSize(size int, force bool) error
- func (h *Handle) SetSocketTimeout(to time.Duration) error
- func (h *Handle) SetStrictCheck(state bool) error
- func (h *Handle) SocketDestroy(local, remote net.Addr) error
- func (h *Handle) SocketDiagTCP(family uint8) ([]*Socket, error)
- func (h *Handle) SocketDiagTCPInfo(family uint8) ([]*InetDiagTCPInfoResp, error)
- func (h *Handle) SocketDiagUDP(family uint8) ([]*Socket, error)
- func (h *Handle) SocketDiagUDPInfo(family uint8) ([]*InetDiagUDPInfoResp, error)
- func (h *Handle) SocketGet(local, remote net.Addr) (*Socket, error)
- func (h *Handle) SupportsNetlinkFamily(nlFamily int) bool
- func (h *Handle) UnixSocketDiag() ([]*UnixSocket, error)
- func (h *Handle) UnixSocketDiagInfo() ([]*UnixDiagInfoResp, error)
- func (h *Handle) VDPADelDev(name string) error
- func (h *Handle) VDPAGetDevByName(name string) (*VDPADev, error)
- func (h *Handle) VDPAGetDevConfigByName(name string) (*VDPADevConfig, error)
- func (h *Handle) VDPAGetDevConfigList() ([]*VDPADevConfig, error)
- func (h *Handle) VDPAGetDevList() ([]*VDPADev, error)
- func (h *Handle) VDPAGetDevVStats(name string, queueIndex uint32) (*VDPADevVStats, error)
- func (h *Handle) VDPAGetMGMTDevByBusAndName(bus, name string) (*VDPAMGMTDev, error)
- func (h *Handle) VDPAGetMGMTDevList() ([]*VDPAMGMTDev, error)
- func (h *Handle) VDPANewDev(name, mgmtBus, mgmtName string, params VDPANewDevParams) error
- func (h *Handle) XfrmPolicyAdd(policy *XfrmPolicy) error
- func (h *Handle) XfrmPolicyDel(policy *XfrmPolicy) error
- func (h *Handle) XfrmPolicyFlush() error
- func (h *Handle) XfrmPolicyGet(policy *XfrmPolicy) (*XfrmPolicy, error)
- func (h *Handle) XfrmPolicyList(family int) ([]XfrmPolicy, error)
- func (h *Handle) XfrmPolicyUpdate(policy *XfrmPolicy) error
- func (h *Handle) XfrmStateAdd(state *XfrmState) error
- func (h *Handle) XfrmStateDel(state *XfrmState) error
- func (h *Handle) XfrmStateFlush(proto Proto) error
- func (h *Handle) XfrmStateGet(state *XfrmState) (*XfrmState, error)
- func (h *Handle) XfrmStateList(family int) ([]XfrmState, error)
- func (h *Handle) XfrmStateUpdate(state *XfrmState) error
- type Hfsc
- type HfscClass
- func (hfsc *HfscClass) Attrs() *ClassAttrs
- func (hfsc *HfscClass) SetFsc(m1 uint32, d uint32, m2 uint32)
- func (hfsc *HfscClass) SetLS(m1 uint32, d uint32, m2 uint32)
- func (hfsc *HfscClass) SetRsc(m1 uint32, d uint32, m2 uint32)
- func (hfsc *HfscClass) SetSC(m1 uint32, d uint32, m2 uint32)
- func (hfsc *HfscClass) SetUL(m1 uint32, d uint32, m2 uint32)
- func (hfsc *HfscClass) SetUsc(m1 uint32, d uint32, m2 uint32)
- func (hfsc *HfscClass) String() string
- func (hfsc *HfscClass) Type() string
- type Htb
- type HtbClass
- type HtbClassAttrs
- type IP6TunnelFlag
- type IP6tnlEncap
- type IPSetEntry
- type IPSetResult
- type IPTuple
- type IPVlan
- type IPVlanFlag
- type IPVlanMode
- type IPVtap
- type IPoIB
- type IPoIBMode
- type Ifb
- type Ifreq
- type IfreqSlave
- type InetDiagTCPInfoResp
- type InetDiagUDPInfoResp
- type InetFamily
- type Ingress
- type Ip6tnl
- type IpsetCreateOptions
- type Iptun
- type Link
- type LinkAttrs
- type LinkNotFoundError
- type LinkOperState
- type LinkSlave
- type LinkStatistics
- type LinkStatistics32
- type LinkStatistics64
- type LinkSubscribeOptions
- type LinkUpdate
- type LinkXdp
- type MPLSDestination
- type MPLSEncap
- type Macvlan
- type MacvlanMode
- type Macvtap
- type MatchAll
- type MemInfo
- type MirredAct
- type MirredAction
- type Mode
- type Ndmsg
- type Neigh
- type NeighSubscribeOptions
- type NeighUpdate
- type Netem
- type NetemQdiscAttrs
- type Netkit
- type NetkitMode
- type NetkitPolicy
- type NetkitScrub
- type NextHopFlag
- type NexthopInfo
- type NsFd
- type NsPid
- type PDP
- type PeditAction
- type PfifoFast
- type PoliceAction
- type PolicyAction
- type Prio
- type ProcEvent
- type ProcEventHeader
- type ProcEventMsg
- type Protinfo
- type Proto
- type ProtoInfo
- type ProtoInfoDCCP
- type ProtoInfoSCTP
- type ProtoInfoTCP
- type Qdisc
- type QdiscAttrs
- type QdiscStatistics
- type QueueInfo
- type RdmaDeviceStatistic
- type RdmaLink
- type RdmaLinkAttrs
- type RdmaPortStatistic
- type RdmaResource
- type Route
- type RouteGetOptions
- type RouteProtocol
- type RouteSubscribeOptions
- type RouteUpdate
- type Rule
- type RulePortRange
- type RuleUIDRange
- type SADir
- type SEG6Encap
- type SEG6LocalEncap
- type SampleAction
- type Scope
- type ServiceCurve
- type Sfq
- type Sittun
- type SkbEditAction
- type Socket
- type SocketID
- type TCPBBRInfo
- type TCPInfo
- type Tbf
- type TcAct
- type TcPolAct
- type TcU32Key
- type TcU32Sel
- type TunnelEncapFlag
- type TunnelEncapType
- type TunnelKeyAct
- type TunnelKeyAction
- type Tuntap
- type TuntapFlag
- type TuntapMode
- type U32
- type UnixDiagInfoResp
- type UnixSocket
- type VDPADev
- type VDPADevConfig
- type VDPADevConfigNet
- type VDPADevConfigNetCfg
- type VDPADevConfigNetStatus
- type VDPADevVStats
- type VDPADevVStatsVendor
- type VDPAMGMTDev
- type VDPANewDevParams
- type Veth
- type VfInfo
- type Via
- type Vlan
- type VlanAct
- type VlanAction
- type VlanProtocol
- type Vrf
- type VrfSlave
- type Vti
- type Vxlan
- type Wireguard
- type XDPDiagInfoResp
- type XDPDiagStats
- type XDPDiagUmem
- type XDPInfo
- type XDPSocket
- type XfrmMark
- type XfrmMsg
- type XfrmMsgExpire
- type XfrmPolicy
- type XfrmPolicyTmpl
- type XfrmReplayState
- type XfrmState
- type XfrmStateAlgo
- type XfrmStateEncap
- type XfrmStateLimits
- type XfrmStateStats
- type Xfrmi
Constants¶
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)
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)
const (TC_ACT_EXT_SHIFT = 28TC_ACT_EXT_VAL_MASK = (1 <<TC_ACT_EXT_SHIFT) - 1)
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.
const (FOU_CMD_UNSPECuint8 =iotaFOU_CMD_ADDFOU_CMD_DELFOU_CMD_GETFOU_CMD_MAX =FOU_CMD_GET)
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)
const (FOU_ENCAP_UNSPEC =iotaFOU_ENCAP_DIRECTFOU_ENCAP_GUEFOU_ENCAP_MAX =FOU_ENCAP_GUE)
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
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.
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.
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.)
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.
const (CSumTunnelEncapFlag = 1 << 0CSum6 = 1 << 1RemCSum = 1 << 2)
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)
const (IPOIB_MODE_DATAGRAM =iotaIPOIB_MODE_CONNECTED)
const (CAN_STATE_ERROR_ACTIVE =iotaCAN_STATE_ERROR_WARNINGCAN_STATE_ERROR_PASSIVECAN_STATE_BUS_OFFCAN_STATE_STOPPEDCAN_STATE_SLEEPING)
const (SizeofLinkStats32 = 0x5cSizeofLinkStats64 = 0xb8)
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)
const (VF_LINK_STATE_AUTOuint32 = 0VF_LINK_STATE_ENABLEuint32 = 1VF_LINK_STATE_DISABLEuint32 = 2)
const (SizeOfIfReq = 40IFNAMSIZ = 16)
ideally golang.org/x/sys/unix would define IfReq but it only hasIFNAMSIZ, hence this minimalistic implementation
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)
const (NUD_NONE = 0x00NUD_INCOMPLETE = 0x01NUD_REACHABLE = 0x02NUD_STALE = 0x04NUD_DELAY = 0x08NUD_PROBE = 0x10NUD_FAILED = 0x20NUD_NOARP = 0x40NUD_PERMANENT = 0x80)
Neighbor Cache Entry States.
const (NTF_USE = 0x01NTF_SELF = 0x02NTF_MASTER = 0x04NTF_PROXY = 0x08NTF_EXT_LEARNED = 0x10NTF_OFFLOADED = 0x20NTF_STICKY = 0x40NTF_ROUTER = 0x80)
Neighbor Flags
const (FAMILY_ALL =nl.FAMILY_ALLFAMILY_V4 =nl.FAMILY_V4FAMILY_V6 =nl.FAMILY_V6FAMILY_MPLS =nl.FAMILY_MPLS)
Family type definitions
const (NETNSA_NSIDNETNSA_PIDNETNSA_FD)
These can be replaced by the values from sys/unix when it is next released.
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)
const (CN_VAL_PROC = 0x1PROC_CN_MCAST_LISTEN = 0x1)
const (HANDLE_NONE = 0HANDLE_INGRESS = 0xFFFFFFF1HANDLE_CLSACT =HANDLE_INGRESSHANDLE_ROOT = 0xFFFFFFFFPRIORITY_MAP_LEN = 16)
const (HANDLE_MIN_INGRESS = 0xFFFFFFF2HANDLE_MIN_EGRESS = 0xFFFFFFF3)
const (HORIZON_DROP_POLICY_CAP = 0HORIZON_DROP_POLICY_DROP = 1HORIZON_DROP_POLICY_DEFAULT = 255)
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)
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
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
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
const (VIRTIO_NET_S_LINK_UP = 1// Link is upVIRTIO_NET_S_ANNOUNCE = 2// Announcement is needed)
virtio net status
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
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
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.
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
const CN_IDX_PROC = 0x1const (FOU_GENL_NAME = "fou")const FibRuleInvert = 0x2const (NTF_EXT_MANAGED = 0x00000001)Extended Neighbor Flags
const SOCK_ANY_COOKIE =uint64(nl.TCPDIAG_NOCOOKIE)<<32 +uint64(nl.TCPDIAG_NOCOOKIE)const (TIME_UNITS_PER_SEC = 1000000)const TUN = "/dev/net/tun"const (XDP_DU_F_ZEROCOPY = 1 <<iota)Variables¶
var ErrDumpInterrupted =nl.ErrDumpInterruptedErrDumpInterrupted is an alias fornl.ErrDumpInterrupted.
var (// ErrNotImplemented is returned when a requested feature is not implemented.ErrNotImplemented =errors.New("not implemented"))
var StringToBondAdSelectMap = map[string]BondAdSelect{"stable":BOND_AD_SELECT_STABLE,"bandwidth":BOND_AD_SELECT_BANDWIDTH,"count":BOND_AD_SELECT_COUNT,}
var StringToBondArpAllTargetsMap = map[string]BondArpAllTargets{"any":BOND_ARP_ALL_TARGETS_ANY,"all":BOND_ARP_ALL_TARGETS_ALL,}
var StringToBondArpValidateMap = map[string]BondArpValidate{"none":BOND_ARP_VALIDATE_NONE,"active":BOND_ARP_VALIDATE_ACTIVE,"backup":BOND_ARP_VALIDATE_BACKUP,"all":BOND_ARP_VALIDATE_ALL,}
var StringToBondFailOverMacMap = map[string]BondFailOverMac{"none":BOND_FAIL_OVER_MAC_NONE,"active":BOND_FAIL_OVER_MAC_ACTIVE,"follow":BOND_FAIL_OVER_MAC_FOLLOW,}
var StringToBondLacpRateMap = map[string]BondLacpRate{"slow":BOND_LACP_RATE_SLOW,"fast":BOND_LACP_RATE_FAST,}
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,}
var StringToBondPrimaryReselectMap = map[string]BondPrimaryReselect{"always":BOND_PRIMARY_RESELECT_ALWAYS,"better":BOND_PRIMARY_RESELECT_BETTER,"failure":BOND_PRIMARY_RESELECT_FAILURE,}
var StringToBondXmitHashPolicyMap = map[string]BondXmitHashPolicy{"layer2":BOND_XMIT_HASH_POLICY_LAYER2,"layer3+4":BOND_XMIT_HASH_POLICY_LAYER3_4,"layer2+3":BOND_XMIT_HASH_POLICY_LAYER2_3,"encap2+3":BOND_XMIT_HASH_POLICY_ENCAP2_3,"encap3+4":BOND_XMIT_HASH_POLICY_ENCAP3_4,"vlan+srcmac":BOND_XMIT_HASH_POLICY_VLAN_SRCMAC,}
var StringToIPoIBMode = map[string]IPoIBMode{"datagram":IPOIB_MODE_DATAGRAM,"connected":IPOIB_MODE_CONNECTED,}
var StringToTuntapModeMap = map[string]TuntapMode{"tun":TUNTAP_MODE_TUN,"tap":TUNTAP_MODE_TAP,}
var StringToVlanProtocolMap = map[string]VlanProtocol{"802.1q":VLAN_PROTOCOL_8021Q,"802.1ad":VLAN_PROTOCOL_8021AD,}
var VlanProtocolToString = map[VlanProtocol]string{VLAN_PROTOCOL_8021Q: "802.1q",VLAN_PROTOCOL_8021AD: "802.1ad",}
Functions¶
funcAddrAdd¶
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¶
AddrDel will delete an IP address from a link device.
Equivalent to: `ip addr del $addr dev $link`
funcAddrReplace¶
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.
funcAlignToAtm¶
funcBridgeSetVlanDefaultPVID¶added inv1.2.1
funcBridgeSetVlanFiltering¶added inv1.2.1
funcBridgeVlanAdd¶
BridgeVlanAdd adds a new vlan filter entryEquivalent to: `bridge vlan add dev DEV vid VID [ pvid ] [ untagged ] [ self ] [ master ]`
funcBridgeVlanAddRange¶added inv1.2.1
BridgeVlanAddRange adds a new vlan filter entryEquivalent to: `bridge vlan add dev DEV vid VID-VIDEND [ pvid ] [ untagged ] [ self ] [ master ]`
funcBridgeVlanAddRangeTunnelInfoRange¶added 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 ]`
funcBridgeVlanAddTunnelInfo¶added inv1.3.1
BridgeVlanAddTunnelInfo adds a new vlan filter entryEquivalent to: `bridge vlan add dev DEV vid VID tunnel_info id TUNID [ self ] [ master ]`
funcBridgeVlanDel¶
BridgeVlanDel adds a new vlan filter entryEquivalent to: `bridge vlan del dev DEV vid VID [ pvid ] [ untagged ] [ self ] [ master ]`
funcBridgeVlanDelRange¶added inv1.2.1
BridgeVlanDelRange adds a new vlan filter entryEquivalent to: `bridge vlan del dev DEV vid VID-VIDEND [ pvid ] [ untagged ] [ self ] [ master ]`
funcBridgeVlanDelRangeTunnelInfoRange¶added 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 ]`
funcBridgeVlanDelTunnelInfo¶added inv1.3.1
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.
funcBridgeVlanTunnelShow¶added 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¶
funcClassChange¶
ClassChange will change a class in placeEquivalent to: `tc class change $class`The parent and handle MUST NOT be changed.
funcClassReplace¶
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
funcConntrackCreate¶added 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.
funcConntrackDeleteFilters¶added 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
funcConntrackUpdate¶added 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¶
funcDevLinkPortDel¶added inv1.2.1
DevLinkPortDel deletes a devlink port and returns success or error code.
funcDevLinkSetEswitchMode¶added 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`
funcDevlinkGetDeviceInfoByNameAsMap¶added inv1.2.1
DevlinkGetDeviceInfoByNameAsMap returns devlink info for selected device as a map,otherwise returns an error code.Equivalent to: `devlink dev info $dev`
funcDevlinkPortFnSet¶added 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.
funcDevlinkSetDeviceParam¶added 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
funcFilterReplace¶added inv1.1.0
FilterReplace will replace a filter.Equivalent to: `tc filter replace $filter`
funcFouFamilyId¶
funcGetNetNsIdByFd¶added inv1.1.0
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.
funcGetNetNsIdByPid¶added inv1.1.0
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.
funcGetSocketTimeout¶added inv1.2.1
GetSocketTimeout returns the timeout value used by default netlink sockets
funcIpsetAdd¶added inv1.2.1
func IpsetAdd(setnamestring, entry *IPSetEntry)error
IpsetAdd adds an entry to an existing ipset.
funcIpsetCreate¶added inv1.2.1
func IpsetCreate(setname, typenamestring, optionsIpsetCreateOptions)error
IpsetCreate creates a new ipset
funcIpsetDel¶added inv1.2.1
func IpsetDel(setnamestring, entry *IPSetEntry)error
IpsetDel deletes an entry from an existing ipset.
funcIpsetDestroy¶added inv1.2.1
IpsetDestroy destroys an existing ipset
funcIpsetFlush¶added inv1.2.1
IpsetFlush flushes an existing ipset
funcIpsetProtocol¶added inv1.2.1
IpsetProtocol returns the ipset protocol version from the kernel
funcIpsetTest¶added inv1.2.1
func IpsetTest(setnamestring, entry *IPSetEntry) (bool,error)
IpsetTest tests whether an entry is in a set or not.
funcIsBitSet¶added inv1.2.1
IsBitSet check if specific bit is set in the uint64 input valueusage example:hasNetClass := IsBitSet(mgmtDev, VIRTIO_ID_NET)
funcLinkAdd¶
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`
funcLinkAddAltName¶added inv1.2.1
LinkAddAltName adds a new alternative name for the link device.Equivalent to: `ip link property add $link altname $name`
funcLinkDel¶
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`
funcLinkDelAltName¶added inv1.2.1
LinkDelAltName delete an alternative name for the link device.Equivalent to: `ip link property del $link altname $name`
funcLinkDelBondSlave¶added inv1.2.1
LinkSetBondSlave removes specified slave from bond link via ioctl interface.
funcLinkModify¶added inv1.2.1
funcLinkSetARPOff¶
funcLinkSetARPOn¶
funcLinkSetAlias¶
LinkSetAlias sets the alias of the link device.Equivalent to: `ip link set dev $link alias $name`
funcLinkSetAllmulticastOff¶added inv1.1.0
LinkSetAllmulticastOff disables the reception of all hardware multicast packets for the link device.Equivalent to: `ip link set $link allmulticast off`
funcLinkSetAllmulticastOn¶added inv1.1.0
LinkSetAllmulticastOn enables the reception of all hardware multicast packets for the link device.Equivalent to: `ip link set $link allmulticast on`
funcLinkSetBRSlaveGroupFwdMask¶added inv1.2.1
LinkSetBRSlaveGroupFwdMask set the group_fwd_mask of a bridge slave interface
funcLinkSetBondSlave¶
LinkSetBondSlave add slave to bond link via ioctl interface.
funcLinkSetBondSlaveActive¶added inv1.2.1
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).
funcLinkSetBondSlaveQueueId¶added inv1.1.0
LinkSetBondSlaveQueueId modify bond slave queue-id.
funcLinkSetBrNeighSuppress¶added inv1.2.1
funcLinkSetDown¶
LinkSetDown disables link device.Equivalent to: `ip link set $link down`
funcLinkSetFlood¶
funcLinkSetGROIPv4MaxSize¶added inv1.2.1
LinkSetGROIPv4MaxSize sets the IPv4 GRO maximum size of the link device.Equivalent to: `ip link set $link gro_ipv4_max_size $maxSize`
funcLinkSetGROMaxSize¶added inv1.2.1
LinkSetGROMaxSize sets the IPv6 GRO maximum size of the link device.Equivalent to: `ip link set $link gro_max_size $maxSize`
funcLinkSetGSOIPv4MaxSize¶added inv1.2.1
LinkSetGSOIPv4MaxSize sets the IPv4 GSO maximum size of the link device.Equivalent to: `ip link set $link gso_ipv4_max_size $maxSize`
funcLinkSetGSOMaxSegs¶added inv1.2.1
LinkSetGSOMaxSegs sets the GSO maximum segment count of the link device.Equivalent to: `ip link set $link gso_max_segs $maxSegs`
funcLinkSetGSOMaxSize¶added inv1.2.1
LinkSetGSOMaxSize sets the IPv6 GSO maximum size of the link device.Equivalent to: `ip link set $link gso_max_size $maxSize`
funcLinkSetGroup¶added inv1.1.0
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¶
funcLinkSetHairpin¶
funcLinkSetHardwareAddr¶
func LinkSetHardwareAddr(linkLink, hwaddrnet.HardwareAddr)error
LinkSetHardwareAddr sets the hardware address of the link device.Equivalent to: `ip link set $link address $hwaddr`
funcLinkSetIP6AddrGenMode¶added inv1.3.1
LinkSetIP6AddrGenMode sets the IPv6 address generation mode of the link device.Equivalent to: `ip link set $link addrgenmode $mode`
funcLinkSetIsolated¶added inv1.2.1
funcLinkSetLearning¶
funcLinkSetMTU¶
LinkSetMTU sets the mtu of the link device.Equivalent to: `ip link set $link mtu $mtu`
funcLinkSetMacvlanMode¶added 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¶
LinkSetMaster sets the master of the link device.Equivalent to: `ip link set $link master $master`
funcLinkSetMasterByIndex¶
LinkSetMasterByIndex sets the master of the link device.Equivalent to: `ip link set $link master $master`
funcLinkSetMulticastOff¶added inv1.2.1
LinkSetAllmulticastOff disables the reception of multicast packets for the link device.Equivalent to: `ip link set $link multicast off`
funcLinkSetMulticastOn¶added inv1.2.1
LinkSetMulticastOn enables the reception of multicast packets for the link device.Equivalent to: `ip link set $link multicast on`
funcLinkSetName¶
LinkSetName sets the name of the link device.Equivalent to: `ip link set $link name $name`
funcLinkSetNoMaster¶
LinkSetNoMaster removes the master of the link device.Equivalent to: `ip link set $link nomaster`
funcLinkSetNsFd¶
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¶
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`
funcLinkSetTxQLen¶
LinkSetTxQLen sets the transaction queue length for the link.Equivalent to: `ip link set $link txqlen $qlen`
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`
funcLinkSetVfNodeGUID¶added 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`
funcLinkSetVfPortGUID¶added 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`
funcLinkSetVfRate¶added inv1.1.0
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¶
LinkSetVfSpoofchk enables/disables spoof check on a vf for the link.Equivalent to: `ip link set $link vf $vf spoofchk $check`
funcLinkSetVfState¶added inv1.1.0
LinkSetVfState enables/disables virtual link state on a vf.Equivalent to: `ip link set $link vf $vf state $state`
funcLinkSetVfTrust¶
LinkSetVfTrust enables/disables trust state on a vf for the link.Equivalent to: `ip link set $link vf $vf trust $state`
funcLinkSetVfTxRate¶
LinkSetVfTxRate sets the tx rate of a vf for the link.Equivalent to: `ip link set $link vf $vf rate $rate`
funcLinkSetVfVlan¶
LinkSetVfVlan sets the vlan of a vf for the link.Equivalent to: `ip link set $link vf $vf vlan $vlan`
funcLinkSetVfVlanQos¶added inv1.1.0
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`
funcLinkSetVfVlanQosProto¶added inv1.2.1
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`
funcLinkSetVlanTunnel¶added inv1.3.1
funcLinkSetXdpFd¶
LinkSetXdpFd adds a bpf function to the driver. The fd must be a bpfprogram loaded with bpf(type=BPF_PROG_TYPE_XDP)
funcLinkSetXdpFdWithFlags¶
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
funcMacvlanMACAddrSet¶
func MacvlanMACAddrSet(linkLink, addrs []net.HardwareAddr)error
funcMajorMinor¶
funcMakeHandle¶
funcNeighAdd¶
NeighAdd will add an IP to MAC mapping to the ARP tableEquivalent to: `ip neigh add ....`
funcNeighAppend¶
NeighAppend will append an entry to FDBEquivalent to: `bridge fdb append...`
funcNeighDel¶
NeighDel will delete an IP address from a link device.Equivalent to: `ip addr del $addr dev $link`
funcNeighSet¶
NeighSet will add or replace an IP to MAC mapping to the ARP tableEquivalent to: `ip neigh replace....`
funcNeighSubscribe¶added 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.
funcNeighSubscribeAt¶added 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).
funcNeighSubscribeWithOptions¶added 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.
funcParseIPNet¶
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¶
funcProcEventMonitor¶added inv1.2.1
funcQdiscChange¶
QdiscChange will change a qdisc in placeEquivalent to: `tc qdisc change $qdisc`The parent and handle MUST NOT be changed.
funcQdiscReplace¶
QdiscReplace will replace a qdisc to the system.Equivalent to: `tc qdisc replace $qdisc`The handle MUST change.
funcRdmaLinkAdd¶added inv1.2.1
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
funcRdmaLinkDel¶added inv1.2.1
RdmaLinkDel deletes an rdma link
Similar to: rdma link delete NAMEREF:https://man7.org/linux/man-pages/man8/rdma-link.8.html
funcRdmaLinkSetName¶added inv1.1.0
RdmaLinkSetName sets the name of the rdma link device. Return nil on successor error otherwise.Equivalent to: `rdma dev set $old_devname name $name`
funcRdmaLinkSetNsFd¶added inv1.1.0
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`
funcRdmaSystemGetNetnsMode¶added inv1.1.0
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'
funcRdmaSystemSetNetnsMode¶added inv1.1.0
RdmaSystemSetNetnsMode sets the net namespace mode for RDMA subsystemReturns nil on success or appropriate error code.Equivalent to: `rdma system set netns { shared | exclusive }'
funcRouteAddEcmp¶added inv1.2.1
RouteAddEcmp will add a route to the system.
funcRouteAppend¶added inv1.2.1
RouteAppend will append a route to the system.Equivalent to: `ip route append $route`
funcRouteChange¶added inv1.2.1
RouteChange will change an existing route in the system.Equivalent to: `ip route change $route`
funcRouteListFilteredIter¶added 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¶
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.
funcSerializeRtab¶
funcSetBits¶added inv1.2.1
SetBits set provided bits in the uint64 input valueusage example:features := SetBits(0, VIRTIO_NET_F_MTU, VIRTIO_NET_F_CTRL_MAC_ADDR)
funcSetNetNsIdByFd¶added inv1.1.0
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.
funcSetNetNsIdByPid¶added inv1.1.0
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¶
funcSetPromiscOn¶
funcSetSocketTimeout¶added inv1.2.1
SetSocketTimeout configures timeout for default netlink sockets
funcSocketDestroy¶added inv1.2.1
SocketDestroy kills the Socket identified by its local and remote addresses.
funcTcActExtCmp¶added inv1.2.1
funcTickInUsec¶
func TickInUsec()float64
funcVDPADelDev¶added inv1.2.1
VDPADelDev removes VDPA deviceEquivalent to: `vdpa dev del <name>`
funcVDPANewDev¶added 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]`
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¶
XfrmStateAdd will add an xfrm state to the system.Equivalent to: `ip xfrm state add $state`
funcXfrmStateDel¶
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¶
XfrmStateFlush will flush the xfrm state on the system.proto = 0 means any transformation protocolsEquivalent to: `ip xfrm state flush [ proto XFRM-PROTO ]`
funcXfrmStateUpdate¶
XfrmStateUpdate will update an xfrm state to the system.Equivalent to: `ip xfrm state update $state`
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
typeActionStatistic¶added inv1.2.1
type ActionStatisticClassStatistics
typeActionTimestamp¶added inv1.2.1
func (ActionTimestamp)String¶added 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¶
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¶
ParseAddr parses the string representation of an address in theform $ip/$netmask $label. The label portion is optional
typeAddrSubscribeOptions¶
type AddrSubscribeOptions struct {Namespace *netns.NsHandleErrorCallback func(error)ListExistingboolReceiveBufferSizeintReceiveBufferForceSizeboolReceiveTimeout *unix.Timeval}AddrSubscribeOptions contains a set of options to use withAddrSubscribeWithOptions.
typeAddrUpdate¶
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¶
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)String¶added 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)String¶added 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)String¶added 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)String¶added 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¶
StringToBondMode returns bond mode, or unknown is the s is invalid.
typeBondPrimaryReselect¶
type BondPrimaryReselectint
BondPrimaryReselect type
const (BOND_PRIMARY_RESELECT_ALWAYSBondPrimaryReselect =iotaBOND_PRIMARY_RESELECT_BETTERBOND_PRIMARY_RESELECT_FAILURE)
Possible BondPrimaryReselect value
func (BondPrimaryReselect)String¶added inv1.2.1
func (bBondPrimaryReselect) String()string
typeBondSlave¶added inv1.1.0
type BondSlave struct {StateBondSlaveStateMiiStatusBondSlaveMiiStatusLinkFailureCountuint32PermHardwareAddrnet.HardwareAddrQueueIduint16AggregatorIduint16AdActorOperPortStateuint8AdPartnerOperPortStateuint16}typeBondSlaveMiiStatus¶added 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)String¶added inv1.1.0
func (sBondSlaveMiiStatus) String()string
typeBondSlaveState¶added 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)String¶added 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
typeBpfEncap¶added inv1.2.1
type BpfEncap struct {// contains filtered or unexported fields}func (*BpfEncap)SetProg¶added inv1.2.1
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)SetXmitHeadroom¶added inv1.2.1
SetXmitHeadroom sets the xmit headroom (LWT_BPF_MAX_HEADROOM) via netlink RTA_ENCAP.maximum headroom is LWT_BPF_MAX_HEADROOM
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
typeCan¶added inv1.2.1
type Can struct {LinkAttrsBitRateuint32SamplePointuint32TimeQuantauint32PropagationSegmentuint32PhaseSegment1uint32PhaseSegment2uint32SyncJumpWidthuint32BitRatePreScaleruint32NamestringTimeSegment1Minuint32TimeSegment1Maxuint32TimeSegment2Minuint32TimeSegment2Maxuint32SyncJumpWidthMaxuint32BitRatePreScalerMinuint32BitRatePreScalerMaxuint32BitRatePreScalerIncuint32ClockFrequencyuint32Stateuint32Maskuint32Flagsuint32TxErroruint16RxErroruint16RestartMsuint32}typeChain¶added inv1.2.1
Chain contains the attributes of a Chain
funcChainList¶added inv1.2.1
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.
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
typeClassStatistics¶added 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.
funcNewClassStatistics¶added inv1.1.0
func NewClassStatistics() *ClassStatistics
NewClassStatistics Construct a ClassStatistics struct which fields are all initialized by 0.
typeClsact¶added inv1.2.1
type Clsact struct {QdiscAttrs}Clsact is a qdisc for adding filters
func (*Clsact)Attrs¶added inv1.2.1
func (qdisc *Clsact) Attrs() *QdiscAttrs
typeCommProcEvent¶added inv1.2.1
func (*CommProcEvent)Pid¶added inv1.2.1
func (e *CommProcEvent) Pid()uint32
func (*CommProcEvent)Tgid¶added inv1.2.1
func (e *CommProcEvent) Tgid()uint32
typeConnmarkAction¶added inv1.1.0
type ConnmarkAction struct {ActionAttrsZoneuint16}funcNewConnmarkAction¶added inv1.1.0
func NewConnmarkAction() *ConnmarkAction
func (*ConnmarkAction)Attrs¶added inv1.1.0
func (action *ConnmarkAction) Attrs() *ActionAttrs
func (*ConnmarkAction)Type¶added inv1.1.0
func (action *ConnmarkAction) Type()string
typeConntrackFilter¶
type ConntrackFilter struct {// contains filtered or unexported fields}func (*ConntrackFilter)AddIP¶
func (f *ConntrackFilter) AddIP(tpConntrackFilterType, ipnet.IP)error
AddIP adds an IP to the conntrack filter
func (*ConntrackFilter)AddIPNet¶added inv1.2.1
func (f *ConntrackFilter) AddIPNet(tpConntrackFilterType, ipNet *net.IPNet)error
AddIPNet adds a IP subnet to the conntrack filter
func (*ConntrackFilter)AddLabels¶added 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:
- 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.
- 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)AddPort¶added inv1.2.1
func (f *ConntrackFilter) AddPort(tpConntrackFilterType, portuint16)error
AddPort adds a Port to the conntrack filter if the Layer 4 protocol allows it
func (*ConntrackFilter)AddProtocol¶added inv1.2.1
func (f *ConntrackFilter) AddProtocol(protouint8)error
AddProtocol adds the Layer 4 protocol to the conntrack filter
func (*ConntrackFilter)AddZone¶added 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
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
typeCsumAction¶added inv1.2.1
type CsumAction struct {ActionAttrsUpdateFlagsCsumUpdateFlags}funcNewCsumAction¶added inv1.2.1
func NewCsumAction() *CsumAction
func (*CsumAction)Attrs¶added inv1.2.1
func (action *CsumAction) Attrs() *ActionAttrs
func (*CsumAction)Type¶added inv1.2.1
func (action *CsumAction) Type()string
typeCsumUpdateFlags¶added 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¶
typeDevLinkPortAddAttrs¶added inv1.2.1
typeDevice¶
type Device struct {LinkAttrs}Device links cannot be created via netlink. These linksare links created by udev like 'lo' and 'etho0'
typeDevlinkDevAttrs¶added inv1.1.0
type DevlinkDevAttrs struct {EswitchDevlinkDevEswitchAttr}DevlinkDevAttrs represents device attributes
typeDevlinkDevEswitchAttr¶added inv1.1.0
DevlinkDevEswitchAttr represents device's eswitch attributes
typeDevlinkDevice¶added inv1.1.0
type DevlinkDevice struct {BusNamestringDeviceNamestringAttrsDevlinkDevAttrs}DevlinkDevice represents device and its attributes
funcDevLinkGetDeviceByName¶added inv1.1.0
func DevLinkGetDeviceByName(Busstring, Devicestring) (*DevlinkDevice,error)
DevlinkGetDeviceByName provides a pointer to devlink device and nil error,otherwise returns an error code.
funcDevLinkGetDeviceList¶added 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)GetDevlinkInfo¶added inv1.2.1
func (d *DevlinkDevice) GetDevlinkInfo() (*DevlinkDeviceInfo,error)
GetDevlinkInfo returns devlink info for target device,otherwise returns an error code.
func (*DevlinkDevice)GetDevlinkInfoAsMap¶added 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.
typeDevlinkDeviceInfo¶added inv1.2.1
type DevlinkDeviceInfo struct {DriverstringSerialNumberstringBoardIDstringFwAppstringFwAppBoundleIDstringFwAppNamestringFwBoundleIDstringFwMgmtstringFwMgmtAPIstringFwMgmtBuildstringFwNetliststringFwNetlistBuildstringFwPsidAPIstringFwUndistring}DevlinkDeviceInfo represents devlink info
funcDevlinkGetDeviceInfoByName¶added 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`
typeDevlinkParam¶added inv1.2.1
type DevlinkParam struct {NamestringIsGenericboolTypeuint8// possible values are in nl.DEVLINK_PARAM_TYPE_* constantsValues []DevlinkParamValue}DevlinkParam represents parameter of the device
funcDevlinkGetDeviceParamByName¶added 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>`
funcDevlinkGetDeviceParams¶added 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.
typeDevlinkParamValue¶added 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
typeDevlinkPort¶added inv1.2.1
type DevlinkPort struct {BusNamestringDeviceNamestringPortIndexuint32PortTypeuint16NetdeviceNamestringNetdevIfIndexuint32RdmaDeviceNamestringPortFlavouruint16Fn *DevlinkPortFn}DevlinkPort represents port and its attributes
funcDevLinkGetAllPortList¶added 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.
funcDevLinkGetPortByIndex¶added inv1.2.1
func DevLinkGetPortByIndex(Busstring, Devicestring, PortIndexuint32) (*DevlinkPort,error)
DevLinkGetPortByIndex provides a pointer to devlink portand nil error,otherwise returns an error code.
funcDevLinkPortAdd¶added 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.
typeDevlinkPortFn¶added inv1.2.1
type DevlinkPortFn struct {HwAddrnet.HardwareAddrStateuint8OpStateuint8}DevlinkPortFn represents port function and its attributes
typeDevlinkPortFnSetAttrs¶added inv1.2.1
type DevlinkPortFnSetAttrs struct {FnAttrsDevlinkPortFnHwAddrValidboolStateValidbool}DevlinkPortFnSetAttrs represents attributes to set
typeDevlinkResource¶added inv1.2.1
type DevlinkResource struct {NamestringIDuint64Sizeuint64SizeNewuint64SizeMinuint64SizeMaxuint64SizeGranularityuint64PendingChangeboolUnituint8SizeValidboolOCCValidboolOCCSizeuint64Parent *DevlinkResourceChildren []DevlinkResource}DevlinkResource represents a device resource
typeDevlinkResources¶added inv1.2.1
type DevlinkResources struct {BusstringDevicestringResources []DevlinkResource}DevlinkResources represents all devlink resources of a devlink device
funcDevlinkGetDeviceResources¶added inv1.2.1
func DevlinkGetDeviceResources(busstring, devicestring) (*DevlinkResources,error)
DevlinkGetDeviceResources returns devlink device resources
typeEncapType¶
type EncapTypeuint8
EncapType is an enum representing the optional packet encapsulation.
typeExecProcEvent¶added inv1.2.1
func (*ExecProcEvent)Pid¶added inv1.2.1
func (e *ExecProcEvent) Pid()uint32
func (*ExecProcEvent)Tgid¶added inv1.2.1
func (e *ExecProcEvent) Tgid()uint32
typeExitProcEvent¶added inv1.2.1
type ExitProcEvent struct {ProcessPiduint32ProcessTgiduint32ExitCodeuint32ExitSignaluint32ParentPiduint32ParentTgiduint32}func (*ExitProcEvent)Pid¶added inv1.2.1
func (e *ExitProcEvent) Pid()uint32
func (*ExitProcEvent)Tgid¶added inv1.2.1
func (e *ExitProcEvent) Tgid()uint32
typeFilter¶
type Filter interface {Attrs() *FilterAttrsType()string}funcFilterList¶
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
typeFlower¶added inv1.2.1
type Flower struct {FilterAttrsClassIduint32DestIPnet.IPDestIPMasknet.IPMaskSrcIPnet.IPSrcIPMasknet.IPMaskEthTypeuint16EncDestIPnet.IPEncDestIPMasknet.IPMaskEncSrcIPnet.IPEncSrcIPMasknet.IPMaskEncDestPortuint16EncKeyIduint32SrcMacnet.HardwareAddrDestMacnet.HardwareAddrVlanIduint16SkipHwboolSkipSwboolIPProto *nl.IPProtoDestPortuint16SrcPortuint16SrcPortRangeMinuint16SrcPortRangeMaxuint16DstPortRangeMinuint16DstPortRangeMaxuint16Actions []Action}func (*Flower)Attrs¶added inv1.2.1
func (filter *Flower) Attrs() *FilterAttrs
typeForkProcEvent¶added inv1.2.1
func (*ForkProcEvent)Pid¶added inv1.2.1
func (e *ForkProcEvent) Pid()uint32
func (*ForkProcEvent)Tgid¶added inv1.2.1
func (e *ForkProcEvent) Tgid()uint32
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
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
typeFwFilter¶added inv1.2.1
type FwFilter struct {FilterAttrsClassIduint32InDevstringMaskuint32Police *PoliceActionActions []Action}func (*FwFilter)Attrs¶added inv1.2.1
func (filter *FwFilter) Attrs() *FilterAttrs
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
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¶
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
typeGeneve¶added 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
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.
typeGnetStatsBasic¶added inv1.1.0
type GnetStatsBasic struct {Bytesuint64// number of seen bytesPacketsuint32// number of seen packets}GnetStatsBasic Ref: struct gnet_stats_basic { ... }
typeGnetStatsQueue¶added 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 { ... }
typeGnetStatsRateEst¶added inv1.1.0
GnetStatsRateEst Ref: struct gnet_stats_rate_est { ... }
typeGnetStatsRateEst64¶added inv1.1.0
GnetStatsRateEst64 Ref: struct gnet_stats_rate_est64 { ... }
typeGretap¶
type Gretap struct {LinkAttrsIKeyuint32OKeyuint32EncapSportuint16EncapDportuint16Localnet.IPRemotenet.IPIFlagsuint16OFlagsuint16PMtuDiscuint8Ttluint8Tosuint8EncapTypeuint16EncapFlagsuint16Linkuint32FlowBasedbool}Gretap devices must specify LocalIP and RemoteIP on create
typeGretun¶
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¶
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¶
NewHandleAt returns a netlink handle on the network namespacespecified by ns. If ns=netns.None(), current network namespacewill be assumed
funcNewHandleAtFrom¶
NewHandleAtFrom works as NewHandle but allows client to specify thenew and the origin netns Handle.
func (*Handle)AddrAdd¶
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¶
AddrDel will delete an IP address from a link device.
Equivalent to: `ip addr del $addr dev $link`
func (*Handle)AddrList¶
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¶
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)BridgeSetVlanDefaultPVID¶added inv1.2.1
func (*Handle)BridgeSetVlanFiltering¶added inv1.2.1
func (*Handle)BridgeVlanAdd¶
BridgeVlanAdd adds a new vlan filter entryEquivalent to: `bridge vlan add dev DEV vid VID [ pvid ] [ untagged ] [ self ] [ master ]`
func (*Handle)BridgeVlanAddRange¶added 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)BridgeVlanAddTunnelInfo¶added inv1.3.1
func (*Handle)BridgeVlanDel¶
BridgeVlanDel adds a new vlan filter entryEquivalent to: `bridge vlan del dev DEV vid VID [ pvid ] [ untagged ] [ self ] [ master ]`
func (*Handle)BridgeVlanDelRange¶added 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)BridgeVlanDelTunnelInfo¶added inv1.3.1
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)BridgeVlanTunnelShow¶added inv1.3.1
func (h *Handle) BridgeVlanTunnelShow() ([]nl.TunnelInfo,error)
func (*Handle)ChainAdd¶added inv1.2.1
ChainAdd will add a chain to the system.Equivalent to: `tc chain add`
func (*Handle)ChainDel¶added inv1.2.1
ChainDel will delete a chain from the system.Equivalent to: `tc chain del $chain`
func (*Handle)ChainList¶added inv1.2.1
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)ClassChange¶
ClassChange will change a class in placeEquivalent to: `tc class change $class`The parent and handle MUST NOT be changed.
func (*Handle)ClassDel¶
ClassDel will delete a class from the system.Equivalent to: `tc class del $class`
func (*Handle)ClassList¶
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¶
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)Close¶added inv1.2.1
func (h *Handle) Close()
Close releases the resources allocated to this handle
func (*Handle)ConntrackCreate¶added 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)ConntrackDeleteFilters¶added 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)ConntrackUpdate¶added 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)DevLinkGetAllPortList¶added 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)DevLinkGetDeviceByName¶added 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)DevLinkGetDeviceList¶added 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)DevLinkGetPortByIndex¶added 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)DevLinkPortAdd¶added 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)DevLinkPortDel¶added inv1.2.1
DevLinkPortDel deletes a devlink port and returns success or error code.
func (*Handle)DevLinkSetEswitchMode¶added 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)DevlinkGetDeviceInfoByName¶added 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)DevlinkGetDeviceInfoByNameAsMap¶added 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)DevlinkGetDeviceParamByName¶added 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)DevlinkGetDeviceParams¶added 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)DevlinkGetDeviceResources¶added inv1.2.1
func (h *Handle) DevlinkGetDeviceResources(busstring, devicestring) (*DevlinkResources,error)
DevlinkGetDeviceResources returns devlink device resources
func (*Handle)DevlinkPortFnSet¶added 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)DevlinkSetDeviceParam¶added 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¶
FilterAdd will add a filter to the system.Equivalent to: `tc filter add $filter`
func (*Handle)FilterDel¶
FilterDel will delete a filter from the system.Equivalent to: `tc filter del $filter`
func (*Handle)FilterList¶
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)FilterReplace¶added inv1.1.0
FilterReplace will replace a filter.Equivalent to: `tc filter replace $filter`
func (*Handle)FouList¶
If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.
func (*Handle)GTPPDPByMSAddress¶
func (*Handle)GTPPDPList¶
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)GetNetNsIdByFd¶added inv1.1.0
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)GetNetNsIdByPid¶added inv1.1.0
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¶
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)IpsetAdd¶added inv1.2.1
func (h *Handle) IpsetAdd(setnamestring, entry *IPSetEntry)error
IpsetAdd adds an entry to an existing ipset.
func (*Handle)IpsetCreate¶added inv1.2.1
func (h *Handle) IpsetCreate(setname, typenamestring, optionsIpsetCreateOptions)error
func (*Handle)IpsetDel¶added inv1.2.1
func (h *Handle) IpsetDel(setnamestring, entry *IPSetEntry)error
IpsetDel deletes an entry from an existing ipset.
func (*Handle)IpsetDestroy¶added inv1.2.1
func (*Handle)IpsetFlush¶added inv1.2.1
func (*Handle)IpsetListAll¶added inv1.2.1
func (h *Handle) IpsetListAll() ([]IPSetResult,error)
func (*Handle)IpsetProtocol¶added inv1.2.1
func (*Handle)IpsetTest¶added inv1.2.1
func (h *Handle) IpsetTest(setnamestring, entry *IPSetEntry) (bool,error)
func (*Handle)LinkAdd¶
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)LinkAddAltName¶added inv1.2.1
LinkAddAltName adds a new alternative name for the link device.Equivalent to: `ip link property add $link altname $name`
func (*Handle)LinkByAlias¶
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¶
LinkByIndex finds a link by index and returns a pointer to the object.
func (*Handle)LinkByName¶
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¶
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)LinkDelAltName¶added inv1.2.1
LinkDelAltName delete an alternative name for the link device.Equivalent to: `ip link property del $link altname $name`
func (*Handle)LinkGetProtinfo¶
If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.
func (*Handle)LinkList¶
LinkList gets a list of link devices.Equivalent to: `ip link show`
If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.
func (*Handle)LinkModify¶added inv1.2.1
func (*Handle)LinkSetARPOff¶
func (*Handle)LinkSetARPOn¶
func (*Handle)LinkSetAlias¶
LinkSetAlias sets the alias of the link device.Equivalent to: `ip link set dev $link alias $name`
func (*Handle)LinkSetAllmulticastOff¶added inv1.1.0
LinkSetAllmulticastOff disables the reception of all hardware multicast packets for the link device.Equivalent to: `ip link set $link allmulticast off`
func (*Handle)LinkSetAllmulticastOn¶added inv1.1.0
LinkSetAllmulticastOn enables the reception of all hardware multicast packets for the link device.Equivalent to: `ip link set $link allmulticast on`
func (*Handle)LinkSetBRSlaveGroupFwdMask¶added inv1.2.1
LinkSetBRSlaveGroupFwdMask set the group_fwd_mask of a bridge slave interface
func (*Handle)LinkSetBondSlaveQueueId¶added inv1.1.0
LinkSetBondSlaveQueueId modify bond slave queue-id.
func (*Handle)LinkSetBrNeighSuppress¶added inv1.2.1
func (*Handle)LinkSetDown¶
LinkSetDown disables link device.Equivalent to: `ip link set $link down`
func (*Handle)LinkSetGROIPv4MaxSize¶added inv1.2.1
LinkSetGROIPv4MaxSize sets the IPv4 GRO maximum size of the link device.Equivalent to: `ip link set $link gro_ipv4_max_size $maxSize`
func (*Handle)LinkSetGROMaxSize¶added inv1.2.1
LinkSetGROMaxSize sets the IPv6 GRO maximum size of the link device.Equivalent to: `ip link set $link gro_max_size $maxSize`
func (*Handle)LinkSetGSOIPv4MaxSize¶added inv1.2.1
LinkSetGSOIPv4MaxSize sets the IPv4 GSO maximum size of the link device.Equivalent to: `ip link set $link gso_ipv4_max_size $maxSize`
func (*Handle)LinkSetGSOMaxSegs¶added inv1.2.1
LinkSetGSOMaxSegs sets the GSO maximum segment count of the link device.Equivalent to: `ip link set $link gso_max_segs $maxSegs`
func (*Handle)LinkSetGSOMaxSize¶added inv1.2.1
LinkSetGSOMaxSize sets the IPv6 GSO maximum size of the link device.Equivalent to: `ip link set $link gso_max_size $maxSize`
func (*Handle)LinkSetGroup¶added inv1.1.0
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)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)LinkSetIP6AddrGenMode¶added inv1.3.1
LinkSetIP6AddrGenMode sets the IPv6 address generation mode of the link device.Equivalent to: `ip link set $link addrgenmode $mode`
func (*Handle)LinkSetIsolated¶added inv1.2.1
func (*Handle)LinkSetMTU¶
LinkSetMTU sets the mtu of the link device.Equivalent to: `ip link set $link mtu $mtu`
func (*Handle)LinkSetMacvlanMode¶added 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¶
LinkSetMaster sets the master of the link device.Equivalent to: `ip link set $link master $master`
func (*Handle)LinkSetMasterByIndex¶
LinkSetMasterByIndex sets the master of the link device.Equivalent to: `ip link set $link master $master`
func (*Handle)LinkSetMulticastOff¶added inv1.2.1
LinkSetAllmulticastOff disables the reception of multicast packets for the link device.Equivalent to: `ip link set $link multicast off`
func (*Handle)LinkSetMulticastOn¶added inv1.2.1
LinkSetMulticastOn enables the reception of multicast packets for the link device.Equivalent to: `ip link set $link multicast on`
func (*Handle)LinkSetName¶
LinkSetName sets the name of the link device.Equivalent to: `ip link set $link name $name`
func (*Handle)LinkSetNoMaster¶
LinkSetNoMaster removes the master of the link device.Equivalent to: `ip link set $link nomaster`
func (*Handle)LinkSetNsFd¶
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¶
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)LinkSetTxQLen¶
LinkSetTxQLen sets the transaction queue length for the link.Equivalent to: `ip link set $link txqlen $qlen`
func (*Handle)LinkSetVfGUID¶added inv1.1.0
LinkSetVfGUID sets the node or port GUID of a vf for the link.
func (*Handle)LinkSetVfHardwareAddr¶
LinkSetVfHardwareAddr sets the hardware address of a vf for the link.Equivalent to: `ip link set $link vf $vf mac $hwaddr`
func (*Handle)LinkSetVfRate¶added inv1.1.0
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¶
LinkSetVfSpoofchk enables/disables spoof check on a vf for the link.Equivalent to: `ip link set $link vf $vf spoofchk $check`
func (*Handle)LinkSetVfState¶added inv1.1.0
LinkSetVfState enables/disables virtual link state on a vf.Equivalent to: `ip link set $link vf $vf state $state`
func (*Handle)LinkSetVfTrust¶
LinkSetVfTrust enables/disables trust state on a vf for the link.Equivalent to: `ip link set $link vf $vf trust $state`
func (*Handle)LinkSetVfTxRate¶
LinkSetVfTxRate sets the tx rate of a vf for the link.Equivalent to: `ip link set $link vf $vf rate $rate`
func (*Handle)LinkSetVfVlan¶
LinkSetVfVlan sets the vlan of a vf for the link.Equivalent to: `ip link set $link vf $vf vlan $vlan`
func (*Handle)LinkSetVfVlanQos¶added inv1.1.0
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)LinkSetVfVlanQosProto¶added inv1.2.1
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)LinkSetVlanTunnel¶added inv1.3.1
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 (*Handle)MacvlanMACAddrSet¶
func (h *Handle) MacvlanMACAddrSet(linkLink, addrs []net.HardwareAddr)error
func (*Handle)NeighAdd¶
NeighAdd will add an IP to MAC mapping to the ARP tableEquivalent to: `ip neigh add ....`
func (*Handle)NeighAppend¶
NeighAppend will append an entry to FDBEquivalent to: `bridge fdb append...`
func (*Handle)NeighDel¶
NeighDel will delete an IP address from a link device.Equivalent to: `ip addr del $addr dev $link`
func (*Handle)NeighList¶
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)NeighListExecute¶added inv1.1.0
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¶
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¶
NeighSet will add or replace an IP to MAC mapping to the ARP tableEquivalent to: `ip neigh replace....`
func (*Handle)QdiscChange¶
QdiscChange will change a qdisc in placeEquivalent to: `tc qdisc change $qdisc`The parent and handle MUST NOT be changed.
func (*Handle)QdiscDel¶
QdiscDel will delete a qdisc from the system.Equivalent to: `tc qdisc del $qdisc`
func (*Handle)QdiscList¶
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¶
QdiscReplace will replace a qdisc to the system.Equivalent to: `tc qdisc replace $qdisc`The handle MUST change.
func (*Handle)RdmaLinkAdd¶added inv1.2.1
RdmaLinkAdd adds an rdma link for the specified type to the network device.
func (*Handle)RdmaLinkByName¶added inv1.1.0
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)RdmaLinkDel¶added inv1.2.1
RdmaLinkDel deletes an rdma link.
If the returned error isErrDumpInterrupted, the caller should retry.
func (*Handle)RdmaLinkList¶added inv1.2.1
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)RdmaLinkSetName¶added inv1.1.0
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)RdmaLinkSetNsFd¶added inv1.1.0
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)RdmaPortStatisticList¶added 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)RdmaResourceList¶added 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)RdmaStatistic¶added 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)RdmaSystemGetNetnsMode¶added inv1.1.0
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)RdmaSystemSetNetnsMode¶added inv1.1.0
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)RouteAddEcmp¶added inv1.2.1
RouteAddEcmp will add a route to the system.
func (*Handle)RouteAppend¶added inv1.2.1
RouteAppend will append a route to the system.Equivalent to: `ip route append $route`
func (*Handle)RouteChange¶added inv1.2.1
RouteChange will change an existing route in the system.Equivalent to: `ip route change $route`
func (*Handle)RouteDel¶
RouteDel will delete a route from the system.Equivalent to: `ip route del $route`
func (*Handle)RouteGet¶
RouteGet gets a route to a specific destination from the host system.Equivalent to: 'ip route get'.
func (*Handle)RouteGetWithOptions¶added inv1.2.1
RouteGetWithOptions gets a route to a specific destination from the host system.Equivalent to: 'ip route get <> vrf <VrfName>'.
func (*Handle)RouteList¶
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¶
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)RouteListFilteredIter¶added 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¶
RouteReplace will add a route to the system.Equivalent to: `ip route replace $route`
func (*Handle)RuleList¶
RuleList lists rules in the system.Equivalent to: ip rule list
If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.
func (*Handle)RuleListFiltered¶added inv1.2.1
RuleListFiltered lists rules in the system.Equivalent to: ip rule list
If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.
func (*Handle)SetNetNsIdByFd¶added inv1.1.0
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)SetNetNsIdByPid¶added inv1.1.0
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 (*Handle)SetPromiscOn¶
func (*Handle)SetSocketReceiveBufferSize¶
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¶
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)SetStrictCheck¶added inv1.2.1
SetStrictCheck sets the strict check socket option for each socket in the netlink handle. Returns early if any set operation fails
func (*Handle)SocketDestroy¶added inv1.2.1
SocketDestroy kills the Socket identified by its local and remote addresses.
func (*Handle)SocketDiagTCP¶added inv1.2.1
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)SocketDiagTCPInfo¶added 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)SocketDiagUDP¶added inv1.2.1
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)SocketDiagUDPInfo¶added 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)SocketGet¶added inv1.2.1
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¶
SupportsNetlinkFamily reports whether the passed netlink family is supported by this Handle
func (*Handle)UnixSocketDiag¶added 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)UnixSocketDiagInfo¶added 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)VDPADelDev¶added inv1.2.1
VDPADelDev removes VDPA deviceEquivalent to: `vdpa dev del <name>`
func (*Handle)VDPAGetDevByName¶added inv1.2.1
VDPAGetDevByName returns VDPA device selected by nameEquivalent to: `vdpa dev show <name>`
func (*Handle)VDPAGetDevConfigByName¶added 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)VDPAGetDevConfigList¶added 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)VDPAGetDevList¶added inv1.2.1
VDPAGetDevList returns list of VDPA devicesEquivalent to: `vdpa dev show`
If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.
func (*Handle)VDPAGetDevVStats¶added 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)VDPAGetMGMTDevByBusAndName¶added 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)VDPAGetMGMTDevList¶added 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)VDPANewDev¶added 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¶
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¶
XfrmStateAdd will add an xfrm state to the system.Equivalent to: `ip xfrm state add $state`
func (*Handle)XfrmStateDel¶
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¶
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¶
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¶
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¶
XfrmStateUpdate will update an xfrm state to the system.Equivalent to: `ip xfrm state update $state`
typeHfsc¶added inv1.1.0
type Hfsc struct {QdiscAttrsDefclsuint16}funcNewHfsc¶added inv1.1.0
func NewHfsc(attrsQdiscAttrs) *Hfsc
func (*Hfsc)Attrs¶added inv1.1.0
func (hfsc *Hfsc) Attrs() *QdiscAttrs
typeHfscClass¶added inv1.1.0
type HfscClass struct {ClassAttrsRscServiceCurveFscServiceCurveUscServiceCurve}HfscClass is a representation of the HFSC class
funcNewHfscClass¶added inv1.1.0
func NewHfscClass(attrsClassAttrs) *HfscClass
NewHfscClass returns a new HFSC struct with the set parameters
func (*HfscClass)Attrs¶added inv1.1.0
func (hfsc *HfscClass) Attrs() *ClassAttrs
Attrs return the Hfsc parameters
func (*HfscClass)SetFsc¶added inv1.1.0
SetFsc sets the Fsc curve. The bandwidth (m1 and m2) is specified in bits and the delay inseconds.
func (*HfscClass)SetLS¶added inv1.1.0
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)SetRsc¶added inv1.1.0
SetRsc sets the Rsc curve. The bandwidth (m1 and m2) is specified in bits and the delay inseconds.
func (*HfscClass)SetSC¶added inv1.1.0
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)SetUL¶added inv1.1.0
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)SetUsc¶added inv1.1.0
SetUsc sets the USC curve. The bandwidth (m1 and m2) is specified in bits and the delay inseconds.
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
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
typeHtbClassAttrs¶
type HtbClassAttrs struct {// TODO handle all attributesRateuint64Ceiluint64Bufferuint32Cbufferuint32Quantumuint32Leveluint32Priouint32}HtbClassAttrs stores the attributes of HTB class
func (HtbClassAttrs)String¶
func (qHtbClassAttrs) String()string
typeIP6TunnelFlag¶added inv1.2.1
type IP6TunnelFlaguint16
fromhttps://elixir.bootlin.com/linux/latest/source/include/uapi/linux/ip6_tunnel.h#L12
typeIP6tnlEncap¶added inv1.2.1
IP6tnlEncap definition
func (*IP6tnlEncap)Decode¶added inv1.2.1
func (e *IP6tnlEncap) Decode(buf []byte)error
func (*IP6tnlEncap)Encode¶added inv1.2.1
func (e *IP6tnlEncap) Encode() ([]byte,error)
func (*IP6tnlEncap)Equal¶added inv1.2.1
func (e *IP6tnlEncap) Equal(xEncap)bool
func (*IP6tnlEncap)String¶added inv1.2.1
func (e *IP6tnlEncap) String()string
func (*IP6tnlEncap)Type¶added inv1.2.1
func (e *IP6tnlEncap) Type()int
typeIPSetEntry¶added 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
typeIPSetResult¶added inv1.2.1
type IPSetResult struct {Nfgenmsg *nl.NfgenmsgProtocoluint8ProtocolMinVersionuint8Revisionuint8Familyuint8Flagsuint8SetNamestringTypeNamestringCommentstringMarkMaskuint32IPFromnet.IPIPTonet.IPPortFromuint16PortTouint16HashSizeuint32NumEntriesuint32MaxElementsuint32Referencesuint32SizeInMemoryuint32CadtFlagsuint32Timeout *uint32LineNouint32Entries []IPSetEntry}IPSetResult is the result of a dump request for a set
funcIpsetList¶added inv1.2.1
func IpsetList(setnamestring) (*IPSetResult,error)
IpsetList dumps an specific ipset.
funcIpsetListAll¶added inv1.2.1
func IpsetListAll() ([]IPSetResult,error)
IpsetListAll dumps all ipsets.
typeIPTuple¶added 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}typeIPVlanFlag¶added 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)
typeIPVtap¶added inv1.2.1
type IPVtap struct {IPVlan}IPVtap - IPVtap is a virtual interfaces based on ipvlan
typeIfreqSlave¶
IfreqSlave is a struct for ioctl bond manipulation syscalls.It is used to assign slave to bond interface with Name.
typeInetDiagTCPInfoResp¶added inv1.2.1
type InetDiagTCPInfoResp struct {InetDiagMsg *SocketTCPInfo *TCPInfoTCPBBRInfo *TCPBBRInfo}funcSocketDiagTCPInfo¶added 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.
typeInetDiagUDPInfoResp¶added inv1.2.1
funcSocketDiagUDPInfo¶added 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.
typeIngress¶
type Ingress struct {QdiscAttrs}Ingress is a qdisc for adding ingress filters
func (*Ingress)Attrs¶
func (qdisc *Ingress) Attrs() *QdiscAttrs
typeIp6tnl¶added inv1.1.0
typeIpsetCreateOptions¶added inv1.2.1
type IpsetCreateOptions struct {Replacebool// replace existing ipsetTimeout *uint32CountersboolCommentsboolSkbinfoboolFamilyuint8Revisionuint8IPFromnet.IPIPTonet.IPPortFromuint16PortTouint16MaxElementsuint32}IpsetCreateOptions is the options struct for creating a new ipset
typeIptun¶
typeLink¶
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¶
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¶
LinkByIndex finds a link by index and returns a pointer to the object.
funcLinkByName¶
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¶
LinkDeserialize deserializes a raw message received from netlink intoa link object.
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
typeLinkSlave¶added 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¶
LinkUpdate is used to pass information back from LinkSubscribe()
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 (d *MPLSDestination) Equal(xDestination)bool
func (*MPLSDestination)Family¶
func (d *MPLSDestination) Family()int
func (*MPLSDestination)String¶
func (d *MPLSDestination) String()string
typeMacvlan¶
type Macvlan struct {LinkAttrsModeMacvlanMode// MACAddrs is only populated for Macvlan SOURCE linksMACAddrs []net.HardwareAddrBCQueueLenuint32UsedBCQueueLenuint32}Macvlan links have ParentIndex set in their Attrs()
typeMacvlanMode¶
type MacvlanModeuint16
const (MACVLAN_MODE_DEFAULTMacvlanMode =iotaMACVLAN_MODE_PRIVATEMACVLAN_MODE_VEPAMACVLAN_MODE_BRIDGEMACVLAN_MODE_PASSTHRUMACVLAN_MODE_SOURCE)
typeMatchAll¶
type MatchAll struct {FilterAttrsClassIduint32Actions []Action}MatchAll filters match all packets
func (*MatchAll)Attrs¶
func (filter *MatchAll) Attrs() *FilterAttrs
typeMemInfo¶added inv1.2.1
According tohttps://man7.org/linux/man-pages/man7/sock_diag.7.html
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
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.
funcNeighList¶
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.
funcNeighListExecute¶added inv1.1.0
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¶
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.
typeNeighSubscribeOptions¶added 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.
typeNeighUpdate¶added inv1.1.0
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
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
typeNetkit¶added inv1.2.1
type Netkit struct {LinkAttrsModeNetkitModePolicyNetkitPolicyPeerPolicyNetkitPolicyScrubNetkitScrubPeerScrubNetkitScrub// contains filtered or unexported fields}func (*Netkit)SetPeerAttrs¶added inv1.2.1
SetPeerAttrs will not take effect if trying to modify an existing netkit device
func (*Netkit)SupportsScrub¶added inv1.3.1
typeNetkitMode¶added inv1.2.1
type NetkitModeuint32
const (NETKIT_MODE_L2NetkitMode =iotaNETKIT_MODE_L3)
typeNetkitPolicy¶added inv1.2.1
type NetkitPolicyint
const (NETKIT_POLICY_FORWARDNetkitPolicy = 0NETKIT_POLICY_BLACKHOLENetkitPolicy = 2)
typeNetkitScrub¶added inv1.3.1
type NetkitScrubint
const (NETKIT_SCRUB_NONENetkitScrub = 0NETKIT_SCRUB_DEFAULTNetkitScrub = 1)
typeNextHopFlag¶
type NextHopFlagint
const (FLAG_ONLINKNextHopFlag =unix.RTNH_F_ONLINKFLAG_PERVASIVENextHopFlag =unix.RTNH_F_PERVASIVE)
typeNexthopInfo¶
type NexthopInfo struct {LinkIndexintHopsintGwnet.IPFlagsintNewDstDestinationEncapEncapViaDestination}func (NexthopInfo)Equal¶
func (nNexthopInfo) Equal(xNexthopInfo)bool
func (*NexthopInfo)ListFlags¶
func (n *NexthopInfo) ListFlags() []string
func (*NexthopInfo)String¶
func (n *NexthopInfo) String()string
typePDP¶
type PDP struct {Versionuint32TIDuint64PeerAddressnet.IPMSAddressnet.IPFlowuint16NetNSFDuint32ITEIuint32OTEIuint32}funcGTPPDPList¶
If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.
typePeditAction¶added inv1.2.1
type PeditAction struct {ActionAttrsProtouint8SrcMacAddrnet.HardwareAddrDstMacAddrnet.HardwareAddrSrcIPnet.IPDstIPnet.IPSrcPortuint16DstPortuint16}funcNewPeditAction¶added inv1.2.1
func NewPeditAction() *PeditAction
func (*PeditAction)Attrs¶added inv1.2.1
func (p *PeditAction) Attrs() *ActionAttrs
func (*PeditAction)Type¶added 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
typePoliceAction¶added inv1.2.1
type PoliceAction struct {ActionAttrsRateuint32// in byte per secondBurstuint32// in byteRCellLogintMtuuint32Mpuuint16// in bytePeakRateuint32// in byte per secondPCellLogintAvRateuint32// in byte per secondOverheaduint16LinkLayerintExceedActionTcPolActNotExceedActionTcPolAct}funcNewPoliceAction¶added inv1.2.1
func NewPoliceAction() *PoliceAction
func (*PoliceAction)Attrs¶added inv1.2.1
func (action *PoliceAction) Attrs() *ActionAttrs
func (*PoliceAction)Type¶added inv1.2.1
func (action *PoliceAction) Type()string
typePolicyAction¶added inv1.1.0
type PolicyActionuint8
PolicyAction is an enum representing an ipsec policy action.
const (XFRM_POLICY_ALLOWPolicyAction = 0XFRM_POLICY_BLOCKPolicyAction = 1)
func (PolicyAction)String¶added 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
typeProcEvent¶added inv1.2.1
type ProcEvent struct {ProcEventHeaderMsgProcEventMsg}typeProcEventHeader¶added inv1.2.1
typeProcEventMsg¶added inv1.2.1
typeProtinfo¶
type Protinfo struct {HairpinboolGuardboolFastLeaveboolRootBlockboolLearningboolFloodboolProxyArpboolProxyArpWiFiboolIsolatedboolNeighSuppressboolVlanTunnelbool}Protinfo represents bridge flags from netlink.
funcLinkGetProtinfo¶
If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.
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)
typeProtoInfo¶added 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.
typeProtoInfoDCCP¶added inv1.2.1
type ProtoInfoDCCP struct{}ProtoInfoDCCP only supports the protocol name.
func (*ProtoInfoDCCP)Protocol¶added inv1.2.1
func (*ProtoInfoDCCP) Protocol()string
Protocol returns "dccp".
typeProtoInfoSCTP¶added inv1.2.1
type ProtoInfoSCTP struct{}ProtoInfoSCTP only supports the protocol name.
func (*ProtoInfoSCTP)Protocol¶added inv1.2.1
func (*ProtoInfoSCTP) Protocol()string
Protocol returns "sctp".
typeProtoInfoTCP¶added 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)Protocol¶added inv1.2.1
func (*ProtoInfoTCP) Protocol()string
Protocol returns "tcp".
typeQdisc¶
type Qdisc interface {Attrs() *QdiscAttrsType()string}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
typeQdiscStatistics¶added inv1.2.1
type QdiscStatisticsClassStatistics
typeRdmaDeviceStatistic¶added inv1.3.1
type RdmaDeviceStatistic struct {RdmaPortStatistics []*RdmaPortStatistic}RdmaDeviceStatistic represents a rdma device statistic counter
funcRdmaStatistic¶added 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]'
typeRdmaLink¶added inv1.1.0
type RdmaLink struct {AttrsRdmaLinkAttrs}Link represents a rdma device from netlink.
funcRdmaLinkByName¶added inv1.1.0
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.
funcRdmaLinkList¶added inv1.2.1
RdmaLinkList gets a list of RDMA link devices.Equivalent to: `rdma dev show`
If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.
typeRdmaLinkAttrs¶added inv1.1.0
type RdmaLinkAttrs struct {Indexuint32NamestringFirmwareVersionstringNodeGuidstringSysImageGuidstringNumPortsuint32}LinkAttrs represents data shared by most link types
typeRdmaPortStatistic¶added inv1.3.1
RdmaPortStatistic represents a rdma port statistic counter
funcRdmaPortStatisticList¶added 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'
typeRdmaResource¶added inv1.3.1
RdmaResource represents a rdma device resource tracking summaries
funcRdmaResourceList¶added 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¶
RouteGet gets a route to a specific destination from the host system.Equivalent to: 'ip route get'.
funcRouteGetWithOptions¶added 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¶
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¶
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)SetFlag¶
func (r *Route) SetFlag(flagNextHopFlag)
typeRouteGetOptions¶added inv1.2.1
type RouteGetOptions struct {IifstringIifIndexintOifstringOifIndexintVrfNamestringSrcAddrnet.IPUID *uint32Markuint32FIBMatchbool}RouteGetOptions contains a set of options to use withRouteGetWithOptions
typeRouteProtocol¶added inv1.2.1
type RouteProtocolint
Protocol describe what was the originator of the route
func (RouteProtocol)String¶added 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¶
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.
funcRuleList¶
RuleList lists rules in the system.Equivalent to: ip rule list
If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.
funcRuleListFiltered¶added inv1.2.1
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.
typeRulePortRange¶added inv1.2.1
RulePortRange represents rule sport/dport range.
funcNewRulePortRange¶added inv1.2.1
func NewRulePortRange(start, enduint16) *RulePortRange
NewRulePortRange creates rule sport/dport range.
typeRuleUIDRange¶added inv1.2.1
RuleUIDRange represents rule uid range.
funcNewRuleUIDRange¶added inv1.2.1
func NewRuleUIDRange(start, enduint32) *RuleUIDRange
NewRuleUIDRange creates rule uid range.
typeSEG6LocalEncap¶added 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)Decode¶added inv1.1.0
func (e *SEG6LocalEncap) Decode(buf []byte)error
func (*SEG6LocalEncap)Encode¶added inv1.1.0
func (e *SEG6LocalEncap) Encode() ([]byte,error)
func (*SEG6LocalEncap)Equal¶added inv1.1.0
func (e *SEG6LocalEncap) Equal(xEncap)bool
func (*SEG6LocalEncap)SetProg¶added inv1.2.1
func (e *SEG6LocalEncap) SetProg(progFdint, progNamestring)error
func (*SEG6LocalEncap)String¶added inv1.1.0
func (e *SEG6LocalEncap) String()string
func (*SEG6LocalEncap)Type¶added inv1.1.0
func (e *SEG6LocalEncap) Type()int
typeSampleAction¶added inv1.3.1
type SampleAction struct {ActionAttrsGroupuint32Rateuint32TruncSizeuint32}funcNewSampleAction¶added inv1.3.1
func NewSampleAction() *SampleAction
func (*SampleAction)Attrs¶added inv1.3.1
func (action *SampleAction) Attrs() *ActionAttrs
func (*SampleAction)Type¶added 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)
typeServiceCurve¶added 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)Attrs¶added inv1.1.0
func (c *ServiceCurve) Attrs() (uint32,uint32,uint32)
Attrs return the parameters of the service curve
func (*ServiceCurve)Burst¶added inv1.2.1
func (c *ServiceCurve) Burst()uint32
Burst returns the burst rate (m1) of the curve
func (*ServiceCurve)Delay¶added inv1.2.1
func (c *ServiceCurve) Delay()uint32
Delay return the delay (d) of the curve
func (*ServiceCurve)Rate¶added inv1.2.1
func (c *ServiceCurve) Rate()uint32
Rate returns the rate (m2) of the curve
typeSfq¶added 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)Attrs¶added inv1.2.1
func (qdisc *Sfq) Attrs() *QdiscAttrs
typeSittun¶
typeSkbEditAction¶added inv1.1.0
type SkbEditAction struct {ActionAttrsQueueMapping *uint16PType *uint16Priority *uint32Mark *uint32Mask *uint32}funcNewSkbEditAction¶added inv1.1.0
func NewSkbEditAction() *SkbEditAction
func (*SkbEditAction)Attrs¶added inv1.1.0
func (action *SkbEditAction) Attrs() *ActionAttrs
func (*SkbEditAction)Type¶added inv1.1.0
func (action *SkbEditAction) Type()string
typeSocket¶
type Socket struct {Familyuint8Stateuint8Timeruint8Retransuint8IDSocketIDExpiresuint32RQueueuint32WQueueuint32UIDuint32INodeuint32}Socket represents a netlink socket.
funcSocketDiagTCP¶added inv1.2.1
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.
funcSocketDiagUDP¶added inv1.2.1
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.
typeSocketID¶
type SocketID struct {SourcePortuint16DestinationPortuint16Sourcenet.IPDestinationnet.IPInterfaceuint32Cookie [2]uint32}SocketID identifies a single socket.
typeTCPBBRInfo¶added inv1.2.1
typeTCPInfo¶added 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¶
Tbf is a classless qdisc that rate limits based on tokens
func (*Tbf)Attrs¶
func (qdisc *Tbf) Attrs() *QdiscAttrs
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))
typeTcU32Key¶
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¶
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.
typeTunnelEncapFlag¶added inv1.2.1
type TunnelEncapFlaguint16
fromhttps://elixir.bootlin.com/linux/v5.15.4/source/include/uapi/linux/if_tunnel.h#L91
typeTunnelEncapType¶added inv1.2.1
type TunnelEncapTypeuint16
fromhttps://elixir.bootlin.com/linux/v5.15.4/source/include/uapi/linux/if_tunnel.h#L84
const (NoneTunnelEncapType =iotaFOUGUE)
typeTunnelKeyAct¶added inv1.1.0
type TunnelKeyActint8
const (TCA_TUNNEL_KEY_SETTunnelKeyAct = 1// set tunnel keyTCA_TUNNEL_KEY_UNSETTunnelKeyAct = 2// unset tunnel key)
typeTunnelKeyAction¶added inv1.1.0
type TunnelKeyAction struct {ActionAttrsActionTunnelKeyActSrcAddrnet.IPDstAddrnet.IPKeyIDuint32DestPortuint16}funcNewTunnelKeyAction¶added inv1.1.0
func NewTunnelKeyAction() *TunnelKeyAction
func (*TunnelKeyAction)Attrs¶added inv1.1.0
func (action *TunnelKeyAction) Attrs() *ActionAttrs
func (*TunnelKeyAction)Type¶added 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)AddQueues¶added inv1.3.1
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)RemoveQueues¶added inv1.3.1
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.
typeTuntapFlag¶
type TuntapFlaguint16
typeTuntapMode¶
type TuntapModeuint16
func (TuntapMode)String¶added 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
typeUnixDiagInfoResp¶added inv1.2.1
type UnixDiagInfoResp struct {DiagMsg *UnixSocketName *stringPeer *uint32Queue *QueueInfoShutdown *uint8}funcUnixSocketDiagInfo¶added 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.
typeUnixSocket¶added inv1.2.1
type UnixSocket struct {Typeuint8Familyuint8Stateuint8INodeuint32Cookie [2]uint32// contains filtered or unexported fields}UnixSocket represents a netlink unix socket.
funcUnixSocketDiag¶added 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.
typeVDPADev¶added inv1.2.1
type VDPADev struct {VendorIDuint32MaxVQSuint32MaxVQSizeuint16MinVQSizeuint16// contains filtered or unexported fields}VDPADev contains info about VDPA device
funcVDPAGetDevByName¶added inv1.2.1
VDPAGetDevByName returns VDPA device selected by nameEquivalent to: `vdpa dev show <name>`
funcVDPAGetDevList¶added inv1.2.1
VDPAGetDevList returns list of VDPA devicesEquivalent to: `vdpa dev show`
If the returned error isErrDumpInterrupted, results may be inconsistentor incomplete.
typeVDPADevConfig¶added inv1.2.1
type VDPADevConfig struct {Featuresuint64NegotiatedFeaturesuint64NetVDPADevConfigNet// contains filtered or unexported fields}VDPADevConfig contains configuration of the VDPA device
funcVDPAGetDevConfigByName¶added inv1.2.1
func VDPAGetDevConfigByName(namestring) (*VDPADevConfig,error)
VDPAGetDevConfigByName returns VDPA device configuration selected by nameEquivalent to: `vdpa dev config show <name>`
funcVDPAGetDevConfigList¶added 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.
typeVDPADevConfigNet¶added inv1.2.1
type VDPADevConfigNet struct {StatusVDPADevConfigNetStatusCfgVDPADevConfigNetCfg}VDPADevConfigNet conatins status and net config for the VDPA device
typeVDPADevConfigNetCfg¶added inv1.2.1
type VDPADevConfigNetCfg struct {MACAddrnet.HardwareAddrMaxVQPuint16MTUuint16}VDPADevConfigNetCfg contains net config for the VDPA device
typeVDPADevConfigNetStatus¶added inv1.2.1
VDPADevConfigNetStatus contains info about net status
typeVDPADevVStats¶added inv1.2.1
type VDPADevVStats struct {QueueIndexuint32Vendor []VDPADevVStatsVendorNegotiatedFeaturesuint64// contains filtered or unexported fields}VDPADevVStats conatins vStats for the VDPA device
funcVDPAGetDevVStats¶added inv1.2.1
func VDPAGetDevVStats(namestring, queueIndexuint32) (*VDPADevVStats,error)
VDPAGetDevVStats returns vstats for VDPA deviceEquivalent to: `vdpa dev vstats show <name> qidx <queueIndex>`
typeVDPADevVStatsVendor¶added inv1.2.1
VDPADevVStatsVendor conatins name and value for vendor specific vstat option
typeVDPAMGMTDev¶added inv1.2.1
type VDPAMGMTDev struct {BusNamestringDevNamestringSupportedClassesuint64SupportedFeaturesuint64MaxVQSuint32}VDPAMGMTDev conatins info about VDPA management device
funcVDPAGetMGMTDevByBusAndName¶added inv1.2.1
func VDPAGetMGMTDevByBusAndName(bus, namestring) (*VDPAMGMTDev,error)
VDPAGetMGMTDevByBusAndName returns mgmt devices selected by bus and nameEquivalent to: `vdpa mgmtdev show <bus>/<name>`
funcVDPAGetMGMTDevList¶added 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.
typeVDPANewDevParams¶added 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
typeVfInfo¶added 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
typeVlan¶
type Vlan struct {LinkAttrsVlanIdintVlanProtocolVlanProtocolIngressQosMap map[uint32]uint32EgressQosMap map[uint32]uint32ReorderHdr *boolGvrp *boolLooseBinding *boolMvrp *boolBridgeBinding *bool}Vlan links have ParentIndex set in their Attrs()
typeVlanAction¶added inv1.3.1
type VlanAction struct {ActionAttrsActionVlanActVlanIDuint16}funcNewVlanAction¶added inv1.3.1
func NewVlanAction() *VlanAction
func (*VlanAction)Attrs¶added inv1.3.1
func (action *VlanAction) Attrs() *ActionAttrs
func (*VlanAction)Type¶added inv1.3.1
func (action *VlanAction) Type()string
typeVlanProtocol¶added inv1.1.0
type VlanProtocolint
VlanProtocol type
const (VLAN_PROTOCOL_UNKNOWNVlanProtocol = 0VLAN_PROTOCOL_8021QVlanProtocol = 0x8100VLAN_PROTOCOL_8021ADVlanProtocol = 0x88A8)
VlanProtocol possible values
funcStringToVlanProtocol¶added inv1.1.0
func StringToVlanProtocol(sstring)VlanProtocol
StringToVlanProtocol returns vlan protocol, or unknown is the s is invalid.
func (VlanProtocol)String¶added inv1.1.0
func (pVlanProtocol) String()string
typeVxlan¶
typeWireguard¶added inv1.2.1
type Wireguard struct {LinkAttrs}Wireguard represent links of type "wireguard", seehttps://www.wireguard.com/
typeXDPDiagInfoResp¶added inv1.2.1
https://elixir.bootlin.com/linux/v6.2/source/include/uapi/linux/xdp_diag.h#L21
funcSocketDiagXDP¶added 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.
funcSocketXDPGetInfo¶added 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.
typeXDPDiagStats¶added 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
typeXDPDiagUmem¶added 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
typeXDPInfo¶added 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}typeXDPSocket¶added 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.
typeXfrmMsg¶
type XfrmMsg interface {Type()nl.XfrmMsgType}typeXfrmMsgExpire¶
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¶
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
typeXfrmReplayState¶added inv1.2.1
XfrmReplayState represents the sequence number states for"legacy" anti-replay mode.
func (XfrmReplayState)String¶added 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¶
XfrmStateAllocSpi will allocate an xfrm state in the system.Equivalent to: `ip xfrm state allocspi`
funcXfrmStateGet¶
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¶
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.
typeXfrmStateAlgo¶
XfrmStateAlgo represents the algorithm to use for the ipsec encryption.
func (XfrmStateAlgo)String¶
func (aXfrmStateAlgo) String()string
typeXfrmStateEncap¶
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.
Source Files¶
- addr.go
- addr_linux.go
- bpf_linux.go
- bridge_linux.go
- chain.go
- chain_linux.go
- class.go
- class_linux.go
- conntrack_linux.go
- devlink_linux.go
- filter.go
- filter_linux.go
- fou.go
- fou_linux.go
- genetlink_linux.go
- gtp_linux.go
- handle_linux.go
- inet_diag.go
- ioctl_linux.go
- ipset_linux.go
- link.go
- link_linux.go
- link_tuntap_linux.go
- neigh.go
- neigh_linux.go
- netlink.go
- netlink_linux.go
- netns_linux.go
- order.go
- proc_event_linux.go
- protinfo.go
- protinfo_linux.go
- qdisc.go
- qdisc_linux.go
- rdma_link_linux.go
- route.go
- route_linux.go
- rule.go
- rule_linux.go
- socket.go
- socket_linux.go
- socket_xdp_linux.go
- tcp.go
- tcp_linux.go
- unix_diag.go
- vdpa_linux.go
- virtio.go
- xdp_diag.go
- xdp_linux.go
- xfrm_linux.go
- xfrm_monitor_linux.go
- xfrm_policy_linux.go
- xfrm_state_linux.go
Directories¶
| Path | Synopsis |
|---|---|
cmd | |
ipset-testcommand | |
Package nl has low level primitives for making Netlink calls. | Package nl has low level primitives for making Netlink calls. |