package netlink
import "github.com/vishvananda/netlink"
Package netlink provides a simple library for netlink. Netlink is the interface a user-space program in linux uses to communicate with the kernel. It can be used to add and remove interfaces, set up ip addresses and routes, and confiugre ipsec. Netlink communication requires elevated privileges, so in most cases this code needs to be run as root. The low level primitives for netlink are contained in the nl subpackage. This package attempts to provide a high-level interface 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 ConntrackDeleteFilter(table ConntrackTableType, family InetFamily, filter *ConntrackFilter) (uint, error)
- func ConntrackTableFlush(table ConntrackTableType) error
- func FouAdd(f Fou) error
- func FouDel(f Fou) error
- func HandleStr(handle uint32) string
- func LinkAdd(link Link) error
- func LinkDel(link Link) error
- func LinkSetARPOff(link Link) error
- func LinkSetARPOn(link Link) error
- func LinkSetAlias(link Link, name string) error
- func LinkSetDown(link Link) error
- func LinkSetFastLeave(link Link, mode bool) error
- func LinkSetFlood(link Link, mode bool) error
- func LinkSetGuard(link Link, mode bool) error
- func LinkSetHairpin(link Link, mode bool) error
- func LinkSetHardwareAddr(link Link, hwaddr net.HardwareAddr) error
- func LinkSetLearning(link Link, mode bool) error
- func LinkSetMTU(link Link, mtu int) error
- func LinkSetMaster(link Link, master *Bridge) error
- func LinkSetMasterByIndex(link Link, masterIndex int) 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 LinkSetVfTxRate(link Link, vf, rate int) error
- func LinkSetVfVlan(link Link, vf, vlan int) error
- func LinkSetXdpFd(link Link, fd int) 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 NewIPNet(ip net.IP) *net.IPNet
- func ParseIPNet(s string) (*net.IPNet, error)
- func Percentage2u32(percentage float32) uint32
- func RouteAdd(route *Route) error
- func RouteDel(route *Route) error
- func SetFastLeave(link Link, mode bool) error
- func SetFlood(link Link, mode bool) error
- func SetGuard(link Link, mode bool) error
- func SetHairpin(link Link, mode bool) error
- func SetLearning(link Link, mode bool) error
- func SetRootBlock(link Link, mode bool) error
- func XfrmPolicyAdd(policy *XfrmPolicy) error
- func XfrmPolicyDel(policy *XfrmPolicy) error
- func XfrmStateAdd(policy *XfrmState) error
- func XfrmStateDel(policy *XfrmState) error
- type Action
- type ActionAttrs
- type Addr
- func AddrList(link Link, family int) ([]Addr, error)
- func ParseAddr(s string) (*Addr, error)
- func (a Addr) Equal(x Addr) bool
- func (a Addr) PeerEqual(x Addr) bool
- func (a Addr) String() string
- type Bond
- func NewLinkBond(atr LinkAttrs) *Bond
- func (bond *Bond) Attrs() *LinkAttrs
- func (bond *Bond) Type() string
- type BondAdInfo
- type BondAdSelect
- type BondArpAllTargets
- type BondArpValidate
- type BondFailOverMac
- type BondLacpRate
- type BondMode
- type BondPrimaryReselect
- type BondXmitHashPolicy
- func StringToBondXmitHashPolicy(s string) BondXmitHashPolicy
- func (b BondXmitHashPolicy) String() string
- type BpfAction
- type BpfFilter
- type Bridge
- type Class
- type ClassAttrs
- type ConntrackFilter
- type ConntrackFlow
- type ConntrackTableType
- type Destination
- type Device
- type Dir
- type Dummy
- type Encap
- type EncapType
- type Filter
- type FilterAttrs
- type FilterFwAttrs
- type Fou
- type Fq
- func NewFq(attrs QdiscAttrs) *Fq
- func (qdisc *Fq) Attrs() *QdiscAttrs
- func (qdisc *Fq) Type() string
- type FqCodel
- func NewFqCodel(attrs QdiscAttrs) *FqCodel
- func (qdisc *FqCodel) Attrs() *QdiscAttrs
- func (qdisc *FqCodel) Type() string
- type GTP
- type GenericAction
- type GenericClass
- type GenericFilter
- type GenericLink
- type GenericQdisc
- type GenlFamily
- type GenlMulticastGroup
- type GenlOp
- type Gretap
- type Gretun
- type Handle
- func NewHandle(nlFamilies ...int) (*Handle, error)
- func NewHandleAt(ns netns.NsHandle, nlFamilies ...int) (*Handle, error)
- func NewHandleAtFrom(newNs, curNs netns.NsHandle) (*Handle, error)
- 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) 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) ConntrackDeleteFilter(table ConntrackTableType, family InetFamily, filter *ConntrackFilter) (uint, error)
- func (h *Handle) ConntrackTableFlush(table ConntrackTableType) error
- func (h *Handle) ConntrackTableList(table ConntrackTableType, family InetFamily) ([]*ConntrackFlow, error)
- func (h *Handle) Delete()
- 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) GenlFamilyGet(name string) (*GenlFamily, error)
- func (h *Handle) GenlFamilyList() ([]*GenlFamily, error)
- func (h *Handle) LinkAdd(link Link) 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) LinkList() ([]Link, error)
- func (h *Handle) LinkSetAlias(link Link, name string) 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) 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) LinkSetLearning(link Link, mode bool) error
- func (h *Handle) LinkSetMTU(link Link, mtu int) error
- func (h *Handle) LinkSetMaster(link Link, master *Bridge) error
- func (h *Handle) LinkSetMasterByIndex(link Link, masterIndex int) 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) LinkSetVfHardwareAddr(link Link, vf int, hwaddr net.HardwareAddr) error
- func (h *Handle) LinkSetVfTxRate(link Link, vf, rate int) error
- func (h *Handle) LinkSetVfVlan(link Link, vf, vlan int) 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) NeighProxyList(linkIndex, family int) ([]Neigh, error)
- func (h *Handle) NeighSet(neigh *Neigh) error
- func (h *Handle) RouteAdd(route *Route) error
- func (h *Handle) RouteDel(route *Route) error
- func (h *Handle) RouteGet(destination net.IP) ([]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) 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) SetPromiscOff(link Link) error
- func (h *Handle) SetPromiscOn(link Link) error
- func (h *Handle) SetSocketTimeout(to time.Duration) error
- func (h *Handle) SupportsNetlinkFamily(nlFamily int) bool
- type Htb
- func NewHtb(attrs QdiscAttrs) *Htb
- func (qdisc *Htb) Attrs() *QdiscAttrs
- func (qdisc *Htb) Type() string
- type HtbClass
- func (q *HtbClass) Attrs() *ClassAttrs
- func (q HtbClass) String() string
- func (q *HtbClass) Type() string
- type HtbClassAttrs
- type IPVlan
- type IPVlanMode
- type Ifb
- type InetFamily
- type Ingress
- type Iptun
- type Link
- func LinkByAlias(alias string) (Link, error)
- func LinkByIndex(index int) (Link, error)
- func LinkByName(name string) (Link, error)
- func LinkList() ([]Link, error)
- type LinkAttrs
- type LinkNotFoundError
- type LinkOperState
- type LinkStatistics
- type LinkStatistics32
- type LinkStatistics64
- type LinkXdp
- type Macvlan
- type MacvlanMode
- type Macvtap
- type MatchAll
- type MirredAct
- type MirredAction
- func NewMirredAction(redirIndex int) *MirredAction
- func (action *MirredAction) Attrs() *ActionAttrs
- func (action *MirredAction) Type() string
- type Mode
- type Neigh
- func NeighDeserialize(m []byte) (*Neigh, error)
- func NeighList(linkIndex, family int) ([]Neigh, error)
- func (neigh *Neigh) String() string
- type Netem
- type NetemQdiscAttrs
- type NextHopFlag
- type NexthopInfo
- func (n NexthopInfo) Equal(x NexthopInfo) bool
- func (n *NexthopInfo) ListFlags() []string
- func (n *NexthopInfo) String() string
- type NsFd
- type NsPid
- type PfifoFast
- type Prio
- func NewPrio(attrs QdiscAttrs) *Prio
- func (qdisc *Prio) Attrs() *QdiscAttrs
- func (qdisc *Prio) Type() string
- type Protinfo
- type Proto
- type Qdisc
- type QdiscAttrs
- type Route
- func RouteList(link Link, family int) ([]Route, error)
- func (r *Route) ClearFlag(flag NextHopFlag)
- func (r Route) Equal(x Route) bool
- func (r *Route) ListFlags() []string
- func (r *Route) SetFlag(flag NextHopFlag)
- func (r Route) String() string
- type RouteUpdate
- type Rule
- type Scope
- type Sittun
- type Socket
- type SocketID
- type Tbf
- type TcAct
- type TcPolAct
- type TcU32Key
- type TcU32Sel
- type Tuntap
- type TuntapFlag
- type TuntapMode
- type U32
- type Veth
- type Vlan
- type Vrf
- type Vti
- type Vxlan
- type XfrmMark
- type XfrmPolicy
- type XfrmPolicyTmpl
- type XfrmState
- func XfrmStateList(family int) ([]XfrmState, error)
- func (sa XfrmState) Print(stats bool) string
- func (sa XfrmState) String() string
- type XfrmStateAlgo
- type XfrmStateEncap
- type XfrmStateLimits
- type XfrmStateStats
Constants ¶
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_MASK uint64 = 1 << (1 + iota) BOND_ACTIVE_SLAVE_MASK BOND_MIIMON_MASK BOND_UPDELAY_MASK BOND_DOWNDELAY_MASK BOND_USE_CARRIER_MASK BOND_ARP_INTERVAL_MASK BOND_ARP_VALIDATE_MASK BOND_ARP_ALL_TARGETS_MASK BOND_PRIMARY_MASK BOND_PRIMARY_RESELECT_MASK BOND_FAIL_OVER_MAC_MASK BOND_XMIT_HASH_POLICY_MASK BOND_RESEND_IGMP_MASK BOND_NUM_PEER_NOTIF_MASK BOND_ALL_SLAVES_ACTIVE_MASK BOND_MIN_LINKS_MASK BOND_LP_INTERVAL_MASK BOND_PACKETS_PER_SLAVE_MASK BOND_LACP_RATE_MASK BOND_AD_SELECT_MASK )
Flag mask for bond options. Bond.Flagmask must be set to on for option to work.
const ( HANDLE_NONE = 0 HANDLE_INGRESS = 0xFFFFFFF1 HANDLE_CLSACT = HANDLE_INGRESS HANDLE_ROOT = 0xFFFFFFFF PRIORITY_MAP_LEN = 16 )
const ( HANDLE_MIN_INGRESS = 0xFFFFFFF2 HANDLE_MIN_EGRESS = 0xFFFFFFF3 )
Variables ¶
var ( // ErrAttrHeaderTruncated is returned when a netlink attribute's header is // truncated. ErrAttrHeaderTruncated = errors.New("attribute header truncated") // ErrAttrBodyTruncated is returned when a netlink attribute's body is // truncated. ErrAttrBodyTruncated = errors.New("attribute body truncated") )
var ( // ErrNotImplemented is returned when a requested feature is not implemented. ErrNotImplemented = errors.New("not implemented") )
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 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, }
Functions ¶
func AddrAdd ¶
func AddrDel ¶
func ConntrackDeleteFilter ¶
func ConntrackDeleteFilter(table ConntrackTableType, family InetFamily, filter *ConntrackFilter) (uint, error)
ConntrackDeleteFilter deletes entries on the specified table on the base of the filter conntrack -D [table] parameters Delete conntrack or expectation
func ConntrackTableFlush ¶
func ConntrackTableFlush(table ConntrackTableType) error
ConntrackTableFlush flushes all the flows of a specified table conntrack -F [table] Flush table The flush operation applies to all the family types
func FouAdd ¶
func FouDel ¶
func HandleStr ¶
func LinkAdd ¶
func LinkDel ¶
func LinkSetARPOff ¶
func LinkSetARPOn ¶
func LinkSetAlias ¶
func LinkSetDown ¶
func LinkSetFastLeave ¶
func LinkSetFlood ¶
func LinkSetGuard ¶
func LinkSetHairpin ¶
func LinkSetHardwareAddr ¶
func LinkSetHardwareAddr(link Link, hwaddr net.HardwareAddr) error
func LinkSetLearning ¶
func LinkSetMTU ¶
func LinkSetMaster ¶
func LinkSetMasterByIndex ¶
func LinkSetName ¶
func LinkSetNoMaster ¶
func LinkSetNsFd ¶
func LinkSetNsPid ¶
func LinkSetRootBlock ¶
func LinkSetTxQLen ¶
func LinkSetUp ¶
func LinkSetVfHardwareAddr ¶
func LinkSetVfHardwareAddr(link Link, vf int, hwaddr net.HardwareAddr) error
func LinkSetVfTxRate ¶
func LinkSetVfVlan ¶
func LinkSetXdpFd ¶
func MajorMinor ¶
func MakeHandle ¶
func NeighAdd ¶
func NeighAppend ¶
func NeighDel ¶
func NeighSet ¶
func NewIPNet ¶
NewIPNet generates an IPNet from an ip address using a netmask of 32 or 128.
func ParseIPNet ¶
ParseIPNet parses a string in ip/net format and returns a net.IPNet. This is valuable because addresses in netlink are often IPNets and ParseCIDR returns an IPNet with the IP part set to the base IP of the range.
func Percentage2u32 ¶
func RouteAdd ¶
func RouteDel ¶
func SetFastLeave ¶
func SetFlood ¶
func SetGuard ¶
func SetHairpin ¶
func SetLearning ¶
func SetRootBlock ¶
func XfrmPolicyAdd ¶
func XfrmPolicyAdd(policy *XfrmPolicy) error
func XfrmPolicyDel ¶
func XfrmPolicyDel(policy *XfrmPolicy) error
func XfrmStateAdd ¶
func XfrmStateDel ¶
Types ¶
type Action ¶
type Action interface { Attrs() *ActionAttrs Type() string }
Action represents an action in any supported filter.
type ActionAttrs ¶
func (ActionAttrs) String ¶
func (q ActionAttrs) String() string
type Addr ¶
type Addr struct { *net.IPNet Label string Flags int Scope int Peer *net.IPNet Broadcast net.IP PreferedLft int ValidLft int }
Addr represents an IP address from netlink. Netlink ip addresses include a mask, so it stores the address as a net.IPNet.
func AddrList ¶
func ParseAddr ¶
ParseAddr parses the string representation of an address in the form $ip/$netmask $label. The label portion is optional
func (Addr) Equal ¶
Equal returns true if both Addrs have the same net.IPNet value.
func (Addr) PeerEqual ¶
func (Addr) String ¶
String returns $ip/$netmask $label
type Bond ¶
type Bond struct { LinkAttrs Mode BondMode ActiveSlave int Miimon int UpDelay int DownDelay int UseCarrier int ArpInterval int ArpIpTargets []net.IP ArpValidate BondArpValidate ArpAllTargets BondArpAllTargets Primary int PrimaryReselect BondPrimaryReselect FailOverMac BondFailOverMac XmitHashPolicy BondXmitHashPolicy ResendIgmp int NumPeerNotif int AllSlavesActive int MinLinks int LpInterval int PackersPerSlave int LacpRate BondLacpRate AdSelect BondAdSelect // looking at iproute tool AdInfo can only be retrived. It can't be set. AdInfo *BondAdInfo AdActorSysPrio int AdUserPortKey int AdActorSystem net.HardwareAddr TlbDynamicLb int }
Bond representation
func NewLinkBond ¶
func (*Bond) Attrs ¶
Attrs implementation.
func (*Bond) Type ¶
Type implementation fro Vxlan.
type BondAdInfo ¶
type BondAdInfo struct { AggregatorId int NumPorts int ActorKey int PartnerKey int PartnerMac net.HardwareAddr }
BondAdInfo represents ad info for bond
type BondAdSelect ¶
type BondAdSelect int
BondAdSelect type
const ( BOND_AD_SELECT_STABLE BondAdSelect = iota BOND_AD_SELECT_BANDWIDTH BOND_AD_SELECT_COUNT )
Possible BondAdSelect value
type BondArpAllTargets ¶
type BondArpAllTargets int
BondArpAllTargets type
const ( BOND_ARP_ALL_TARGETS_ANY BondArpAllTargets = iota BOND_ARP_ALL_TARGETS_ALL )
Possible BondArpAllTargets value
type BondArpValidate ¶
type BondArpValidate int
BondArpValidate type
const ( BOND_ARP_VALIDATE_NONE BondArpValidate = iota BOND_ARP_VALIDATE_ACTIVE BOND_ARP_VALIDATE_BACKUP BOND_ARP_VALIDATE_ALL )
Possible BondArpValidate value
type BondFailOverMac ¶
type BondFailOverMac int
BondFailOverMac type
const ( BOND_FAIL_OVER_MAC_NONE BondFailOverMac = iota BOND_FAIL_OVER_MAC_ACTIVE BOND_FAIL_OVER_MAC_FOLLOW )
Possible BondFailOverMac value
type BondLacpRate ¶
type BondLacpRate int
BondLacpRate type
const ( BOND_LACP_RATE_SLOW BondLacpRate = iota BOND_LACP_RATE_FAST BOND_LACP_RATE_UNKNOWN )
Possible BondLacpRate value
func StringToBondLacpRate ¶
func StringToBondLacpRate(s string) BondLacpRate
StringToBondLacpRate returns bond lacp arte, or uknonw is the s is invalid.
func (BondLacpRate) String ¶
func (b BondLacpRate) String() string
type BondMode ¶
type BondMode int
BondMode type
const ( BOND_MODE_BALANCE_RR BondMode = iota BOND_MODE_ACTIVE_BACKUP BOND_MODE_BALANCE_XOR BOND_MODE_BROADCAST BOND_MODE_802_3AD BOND_MODE_BALANCE_TLB BOND_MODE_BALANCE_ALB BOND_MODE_UNKNOWN )
Possible BondMode
func StringToBondMode ¶
StringToBondMode returns bond mode, or uknonw is the s is invalid.
func (BondMode) String ¶
type BondPrimaryReselect ¶
type BondPrimaryReselect int
BondPrimaryReselect type
const ( BOND_PRIMARY_RESELECT_ALWAYS BondPrimaryReselect = iota BOND_PRIMARY_RESELECT_BETTER BOND_PRIMARY_RESELECT_FAILURE )
Possible BondPrimaryReselect value
type BondXmitHashPolicy ¶
type BondXmitHashPolicy int
BondXmitHashPolicy type
const ( BOND_XMIT_HASH_POLICY_LAYER2 BondXmitHashPolicy = iota BOND_XMIT_HASH_POLICY_LAYER3_4 BOND_XMIT_HASH_POLICY_LAYER2_3 BOND_XMIT_HASH_POLICY_ENCAP2_3 BOND_XMIT_HASH_POLICY_ENCAP3_4 BOND_XMIT_HASH_POLICY_UNKNOWN )
Possible BondXmitHashPolicy value
func StringToBondXmitHashPolicy ¶
func StringToBondXmitHashPolicy(s string) BondXmitHashPolicy
StringToBondXmitHashPolicy returns bond lacp arte, or uknonw is the s is invalid.
func (BondXmitHashPolicy) String ¶
func (b BondXmitHashPolicy) String() string
type BpfAction ¶
type BpfAction struct { ActionAttrs Fd int Name string }
func (*BpfAction) Attrs ¶
func (action *BpfAction) Attrs() *ActionAttrs
func (*BpfAction) Type ¶
type BpfFilter ¶
type BpfFilter struct { FilterAttrs ClassId uint32 Fd int Name string DirectAction bool }
func (*BpfFilter) Attrs ¶
func (filter *BpfFilter) Attrs() *FilterAttrs
func (*BpfFilter) Type ¶
type Bridge ¶
Bridge links are simple linux bridges
func (*Bridge) Attrs ¶
func (*Bridge) Type ¶
type Class ¶
type Class interface { Attrs() *ClassAttrs Type() string }
type ClassAttrs ¶
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 a parent == HANDLE_ROOT.
func (ClassAttrs) String ¶
func (q ClassAttrs) String() string
type ConntrackFilter ¶
type ConntrackFilter struct{}
ConntrackFilter placeholder
type ConntrackFlow ¶
type ConntrackFlow struct{}
ConntrackFlow placeholder
func ConntrackTableList ¶
func ConntrackTableList(table ConntrackTableType, family InetFamily) ([]*ConntrackFlow, error)
ConntrackTableList returns the flow list of a table of a specific family conntrack -L [table] [options] List conntrack or expectation table
type ConntrackTableType ¶
type ConntrackTableType uint8
ConntrackTableType Conntrack table for the netlink operation
type Destination ¶
type Destination interface { Family() int Decode([]byte) error Encode() ([]byte, error) String() string Equal(Destination) bool }
type Device ¶
type Device struct { LinkAttrs }
Device links cannot be created via netlink. These links are links created by udev like 'lo' and 'etho0'
func (*Device) Attrs ¶
func (*Device) Type ¶
type Dir ¶
type Dir uint8
Dir is an enum representing an ipsec template direction.
const ( XFRM_DIR_IN Dir = iota XFRM_DIR_OUT XFRM_DIR_FWD XFRM_SOCKET_IN XFRM_SOCKET_OUT XFRM_SOCKET_FWD )
func (Dir) String ¶
type Dummy ¶
type Dummy struct { LinkAttrs }
Dummy links are dummy ethernet devices
func (*Dummy) Attrs ¶
func (*Dummy) Type ¶
type Encap ¶
type Encap interface { Type() int Decode([]byte) error Encode() ([]byte, error) String() string Equal(Encap) bool }
type EncapType ¶
type EncapType uint8
EncapType is an enum representing the optional packet encapsulation.
func (EncapType) String ¶
type Filter ¶
type Filter interface { Attrs() *FilterAttrs Type() string }
type FilterAttrs ¶
type FilterAttrs struct { LinkIndex int Handle uint32 Parent uint32 Priority uint16 // lower is higher priority Protocol uint16 // unix.ETH_P_* }
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 a parent == HANDLE_ROOT.
func (FilterAttrs) String ¶
func (q FilterAttrs) String() string
type FilterFwAttrs ¶
type FilterFwAttrs struct { ClassId uint32 InDev string Mask uint32 Index uint32 Buffer uint32 Mtu uint32 Mpu uint16 Rate uint32 AvRate uint32 PeakRate uint32 Action TcPolAct Overhead uint16 LinkLayer int }
type Fou ¶
func FouList ¶
type Fq ¶
type Fq struct { QdiscAttrs PacketLimit uint32 FlowPacketLimit uint32 // In bytes Quantum uint32 InitialQuantum uint32 // called RateEnable under the hood Pacing uint32 FlowDefaultRate uint32 FlowMaxRate uint32 // called BucketsLog under the hood Buckets uint32 FlowRefillDelay uint32 LowRateThreshold uint32 }
Fq is a classless packet scheduler meant to be mostly used for locally generated traffic.
func NewFq ¶
func NewFq(attrs QdiscAttrs) *Fq
func (*Fq) Attrs ¶
func (qdisc *Fq) Attrs() *QdiscAttrs
func (*Fq) Type ¶
type FqCodel ¶
type FqCodel struct { QdiscAttrs Target uint32 Limit uint32 Interval uint32 ECN uint32 Flows uint32 Quantum uint32 }
FQ_Codel (Fair Queuing Controlled Delay) is queuing discipline that combines Fair Queuing with the CoDel AQM scheme.
func NewFqCodel ¶
func NewFqCodel(attrs QdiscAttrs) *FqCodel
func (*FqCodel) Attrs ¶
func (qdisc *FqCodel) Attrs() *QdiscAttrs
func (*FqCodel) Type ¶
type GTP ¶
func (*GTP) Attrs ¶
func (*GTP) Type ¶
type GenericAction ¶
type GenericAction struct { ActionAttrs }
func (*GenericAction) Attrs ¶
func (action *GenericAction) Attrs() *ActionAttrs
func (*GenericAction) Type ¶
func (action *GenericAction) Type() string
type GenericClass ¶
type GenericClass struct { ClassAttrs ClassType string }
GenericClass classes represent types that are not currently understood by this netlink library.
func (*GenericClass) Attrs ¶
func (class *GenericClass) Attrs() *ClassAttrs
func (*GenericClass) Type ¶
func (class *GenericClass) Type() string
type GenericFilter ¶
type GenericFilter struct { FilterAttrs FilterType string }
GenericFilter filters represent types that are not currently understood by this netlink library.
func (*GenericFilter) Attrs ¶
func (filter *GenericFilter) Attrs() *FilterAttrs
func (*GenericFilter) Type ¶
func (filter *GenericFilter) Type() string
type GenericLink ¶
GenericLink links represent types that are not currently understood by this netlink library.
func (*GenericLink) Attrs ¶
func (generic *GenericLink) Attrs() *LinkAttrs
func (*GenericLink) Type ¶
func (generic *GenericLink) Type() string
type GenericQdisc ¶
type GenericQdisc struct { QdiscAttrs QdiscType string }
GenericQdisc qdiscs represent types that are not currently understood by this netlink library.
func (*GenericQdisc) Attrs ¶
func (qdisc *GenericQdisc) Attrs() *QdiscAttrs
func (*GenericQdisc) Type ¶
func (qdisc *GenericQdisc) Type() string
type GenlFamily ¶
type GenlFamily struct{}
func GenlFamilyGet ¶
func GenlFamilyGet(name string) (*GenlFamily, error)
func GenlFamilyList ¶
func GenlFamilyList() ([]*GenlFamily, error)
type GenlMulticastGroup ¶
type GenlMulticastGroup struct{}
type GenlOp ¶
type GenlOp struct{}
type Gretap ¶
type Gretap struct { LinkAttrs IKey uint32 OKey uint32 EncapSport uint16 EncapDport uint16 Local net.IP Remote net.IP IFlags uint16 OFlags uint16 PMtuDisc uint8 Ttl uint8 Tos uint8 EncapType uint16 EncapFlags uint16 Link uint32 FlowBased bool }
Gretap devices must specify LocalIP and RemoteIP on create
func (*Gretap) Attrs ¶
func (*Gretap) Type ¶
type Gretun ¶
type Gretun struct { LinkAttrs Link uint32 IFlags uint16 OFlags uint16 IKey uint32 OKey uint32 Local net.IP Remote net.IP Ttl uint8 Tos uint8 PMtuDisc uint8 EncapType uint16 EncapFlags uint16 EncapSport uint16 EncapDport uint16 }
func (*Gretun) Attrs ¶
func (*Gretun) Type ¶
type Handle ¶
type Handle struct{}
func NewHandle ¶
func NewHandleAt ¶
func NewHandleAtFrom ¶
func (*Handle) AddrAdd ¶
func (*Handle) AddrDel ¶
func (*Handle) AddrList ¶
func (*Handle) ClassAdd ¶
func (*Handle) ClassChange ¶
func (*Handle) ClassDel ¶
func (*Handle) ClassList ¶
func (*Handle) ClassReplace ¶
func (*Handle) ConntrackDeleteFilter ¶
func (h *Handle) ConntrackDeleteFilter(table ConntrackTableType, family InetFamily, filter *ConntrackFilter) (uint, error)
ConntrackDeleteFilter deletes entries on the specified table on the base of the filter using the netlink handle passed conntrack -D [table] parameters Delete conntrack or expectation
func (*Handle) ConntrackTableFlush ¶
func (h *Handle) ConntrackTableFlush(table ConntrackTableType) error
ConntrackTableFlush flushes all the flows of a specified table using the netlink handle passed conntrack -F [table] Flush table The flush operation applies to all the family types
func (*Handle) ConntrackTableList ¶
func (h *Handle) ConntrackTableList(table ConntrackTableType, family InetFamily) ([]*ConntrackFlow, error)
ConntrackTableList returns the flow list of a table of a specific family using the netlink handle passed conntrack -L [table] [options] List conntrack or expectation table
func (*Handle) Delete ¶
func (h *Handle) Delete()
func (*Handle) FilterAdd ¶
func (*Handle) FilterDel ¶
func (*Handle) FilterList ¶
func (*Handle) GenlFamilyGet ¶
func (h *Handle) GenlFamilyGet(name string) (*GenlFamily, error)
func (*Handle) GenlFamilyList ¶
func (h *Handle) GenlFamilyList() ([]*GenlFamily, error)
func (*Handle) LinkAdd ¶
func (*Handle) LinkByAlias ¶
func (*Handle) LinkByIndex ¶
func (*Handle) LinkByName ¶
func (*Handle) LinkDel ¶
func (*Handle) LinkList ¶
func (*Handle) LinkSetAlias ¶
func (*Handle) LinkSetDown ¶
func (*Handle) LinkSetFastLeave ¶
func (*Handle) LinkSetFlood ¶
func (*Handle) LinkSetGuard ¶
func (*Handle) LinkSetHairpin ¶
func (*Handle) LinkSetHardwareAddr ¶
func (h *Handle) LinkSetHardwareAddr(link Link, hwaddr net.HardwareAddr) error
func (*Handle) LinkSetLearning ¶
func (*Handle) LinkSetMTU ¶
func (*Handle) LinkSetMaster ¶
func (*Handle) LinkSetMasterByIndex ¶
func (*Handle) LinkSetName ¶
func (*Handle) LinkSetNoMaster ¶
func (*Handle) LinkSetNsFd ¶
func (*Handle) LinkSetNsPid ¶
func (*Handle) LinkSetRootBlock ¶
func (*Handle) LinkSetTxQLen ¶
func (*Handle) LinkSetUp ¶
func (*Handle) LinkSetVfHardwareAddr ¶
func (*Handle) LinkSetVfTxRate ¶
func (*Handle) LinkSetVfVlan ¶
func (*Handle) NeighAdd ¶
func (*Handle) NeighAppend ¶
func (*Handle) NeighDel ¶
func (*Handle) NeighList ¶
func (*Handle) NeighProxyList ¶
func (*Handle) NeighSet ¶
func (*Handle) RouteAdd ¶
func (*Handle) RouteDel ¶
func (*Handle) RouteGet ¶
func (*Handle) RouteList ¶
func (*Handle) RouteListFiltered ¶
func (*Handle) RouteReplace ¶
func (*Handle) RuleAdd ¶
func (*Handle) RuleDel ¶
func (*Handle) RuleList ¶
func (*Handle) SetPromiscOff ¶
func (*Handle) SetPromiscOn ¶
func (*Handle) SetSocketTimeout ¶
func (*Handle) SupportsNetlinkFamily ¶
type Htb ¶
type Htb struct { QdiscAttrs Version uint32 Rate2Quantum uint32 Defcls uint32 Debug uint32 DirectPkts uint32 }
Htb is a classful qdisc that rate limits based on tokens
func NewHtb ¶
func NewHtb(attrs QdiscAttrs) *Htb
func (*Htb) Attrs ¶
func (qdisc *Htb) Attrs() *QdiscAttrs
func (*Htb) Type ¶
type HtbClass ¶
type HtbClass struct { ClassAttrs Rate uint64 Ceil uint64 Buffer uint32 Cbuffer uint32 Quantum uint32 Level uint32 Prio uint32 }
HtbClass represents an Htb class
func (*HtbClass) Attrs ¶
func (q *HtbClass) Attrs() *ClassAttrs
func (HtbClass) String ¶
func (*HtbClass) Type ¶
type HtbClassAttrs ¶
type HtbClassAttrs struct { // TODO handle all attributes Rate uint64 Ceil uint64 Buffer uint32 Cbuffer uint32 Quantum uint32 Level uint32 Prio uint32 }
func (HtbClassAttrs) String ¶
func (q HtbClassAttrs) String() string
type IPVlan ¶
type IPVlan struct { LinkAttrs Mode IPVlanMode }
func (*IPVlan) Attrs ¶
func (*IPVlan) Type ¶
type IPVlanMode ¶
type IPVlanMode uint16
const ( IPVLAN_MODE_L2 IPVlanMode = iota IPVLAN_MODE_L3 IPVLAN_MODE_L3S IPVLAN_MODE_MAX )
type Ifb ¶
type Ifb struct { LinkAttrs }
Ifb links are advanced dummy devices for packet filtering
func (*Ifb) Attrs ¶
func (*Ifb) Type ¶
type InetFamily ¶
type InetFamily uint8
InetFamily Family type
type Ingress ¶
type Ingress struct { QdiscAttrs }
Ingress is a qdisc for adding ingress filters
func (*Ingress) Attrs ¶
func (qdisc *Ingress) Attrs() *QdiscAttrs
func (*Ingress) Type ¶
type Iptun ¶
type Iptun struct { LinkAttrs Ttl uint8 Tos uint8 PMtuDisc uint8 Link uint32 Local net.IP Remote net.IP EncapSport uint16 EncapDport uint16 EncapType uint16 EncapFlags uint16 FlowBased bool }
func (*Iptun) Attrs ¶
func (*Iptun) Type ¶
type Link ¶
Link represents a link device from netlink. Shared link attributes like name may be retrieved using the Attrs() method. Unique data can be retrieved by casting the object to the proper type.
func LinkByAlias ¶
func LinkByIndex ¶
func LinkByName ¶
func LinkList ¶
type LinkAttrs ¶
type LinkAttrs struct { Index int MTU int TxQLen int // Transmit Queue Length Name string HardwareAddr net.HardwareAddr Flags net.Flags RawFlags uint32 ParentIndex int // index of the parent link device MasterIndex int // must be the index of a bridge Namespace interface{} // nil | NsPid | NsFd Alias string Statistics *LinkStatistics Promisc int Xdp *LinkXdp EncapType string Protinfo *Protinfo OperState LinkOperState NetNsID int NumTxQueues int NumRxQueues int }
LinkAttrs represents data shared by most link types
func NewLinkAttrs ¶
func NewLinkAttrs() LinkAttrs
NewLinkAttrs returns LinkAttrs structure filled with default values
type LinkNotFoundError ¶
type LinkNotFoundError struct {
// contains filtered or unexported fields
}
LinkNotFoundError wraps the various not found errors when getting/reading links. This is intended for better error handling by dependent code so that "not found error" can be distinguished from other errors
type LinkOperState ¶
type LinkOperState uint8
LinkOperState represents the values of the IFLA_OPERSTATE link attribute, which contains the RFC2863 state of the interface.
func (LinkOperState) String ¶
func (s LinkOperState) String() string
type LinkStatistics ¶
type LinkStatistics LinkStatistics64
type LinkStatistics32 ¶
type LinkStatistics32 struct { RxPackets uint32 TxPackets uint32 RxBytes uint32 TxBytes uint32 RxErrors uint32 TxErrors uint32 RxDropped uint32 TxDropped uint32 Multicast uint32 Collisions uint32 RxLengthErrors uint32 RxOverErrors uint32 RxCrcErrors uint32 RxFrameErrors uint32 RxFifoErrors uint32 RxMissedErrors uint32 TxAbortedErrors uint32 TxCarrierErrors uint32 TxFifoErrors uint32 TxHeartbeatErrors uint32 TxWindowErrors uint32 RxCompressed uint32 TxCompressed uint32 }
Ref: struct rtnl_link_stats {...}
type LinkStatistics64 ¶
type LinkStatistics64 struct { RxPackets uint64 TxPackets uint64 RxBytes uint64 TxBytes uint64 RxErrors uint64 TxErrors uint64 RxDropped uint64 TxDropped uint64 Multicast uint64 Collisions uint64 RxLengthErrors uint64 RxOverErrors uint64 RxCrcErrors uint64 RxFrameErrors uint64 RxFifoErrors uint64 RxMissedErrors uint64 TxAbortedErrors uint64 TxCarrierErrors uint64 TxFifoErrors uint64 TxHeartbeatErrors uint64 TxWindowErrors uint64 RxCompressed uint64 TxCompressed uint64 }
Ref: struct rtnl_link_stats64 {...}
type LinkXdp ¶
type Macvlan ¶
type Macvlan struct { LinkAttrs Mode MacvlanMode // MACAddrs is only populated for Macvlan SOURCE links MACAddrs []net.HardwareAddr }
Macvlan links have ParentIndex set in their Attrs()
func (*Macvlan) Attrs ¶
func (*Macvlan) Type ¶
type MacvlanMode ¶
type MacvlanMode uint16
const ( MACVLAN_MODE_DEFAULT MacvlanMode = iota MACVLAN_MODE_PRIVATE MACVLAN_MODE_VEPA MACVLAN_MODE_BRIDGE MACVLAN_MODE_PASSTHRU MACVLAN_MODE_SOURCE )
type Macvtap ¶
type Macvtap struct { Macvlan }
Macvtap - macvtap is a virtual interfaces based on macvlan
func (Macvtap) Type ¶
type MatchAll ¶
type MatchAll struct { FilterAttrs ClassId uint32 Actions []Action }
MatchAll filters match all packets
func (*MatchAll) Attrs ¶
func (filter *MatchAll) Attrs() *FilterAttrs
func (*MatchAll) Type ¶
type MirredAct ¶
type MirredAct uint8
const ( TCA_EGRESS_REDIR MirredAct = 1 /* packet redirect to EGRESS*/ TCA_EGRESS_MIRROR MirredAct = 2 /* mirror packet to EGRESS */ TCA_INGRESS_REDIR MirredAct = 3 /* packet redirect to INGRESS*/ TCA_INGRESS_MIRROR MirredAct = 4 /* mirror packet to INGRESS */ )
func (MirredAct) String ¶
type MirredAction ¶
type MirredAction struct { ActionAttrs MirredAction MirredAct Ifindex int }
func NewMirredAction ¶
func NewMirredAction(redirIndex int) *MirredAction
func (*MirredAction) Attrs ¶
func (action *MirredAction) Attrs() *ActionAttrs
func (*MirredAction) Type ¶
func (action *MirredAction) Type() string
type Mode ¶
type Mode uint8
Mode is an enum representing an ipsec transport.
const ( XFRM_MODE_TRANSPORT Mode = iota XFRM_MODE_TUNNEL XFRM_MODE_ROUTEOPTIMIZATION XFRM_MODE_IN_TRIGGER XFRM_MODE_BEET XFRM_MODE_MAX )
func (Mode) String ¶
type Neigh ¶
type Neigh struct { LinkIndex int Family int State int Type int Flags int IP net.IP HardwareAddr net.HardwareAddr LLIPAddr net.IP //Used in the case of NHRP Vlan int VNI int }
Neigh represents a link layer neighbor from netlink.
func NeighDeserialize ¶
func NeighList ¶
func (*Neigh) String ¶
String returns $ip/$hwaddr $label
type Netem ¶
type Netem struct { QdiscAttrs Latency uint32 DelayCorr uint32 Limit uint32 Loss uint32 LossCorr uint32 Gap uint32 Duplicate uint32 DuplicateCorr uint32 Jitter uint32 ReorderProb uint32 ReorderCorr uint32 CorruptProb uint32 CorruptCorr uint32 }
func (*Netem) Attrs ¶
func (qdisc *Netem) Attrs() *QdiscAttrs
func (*Netem) Type ¶
type NetemQdiscAttrs ¶
type NetemQdiscAttrs struct { Latency uint32 // in us DelayCorr float32 // in % Limit uint32 Loss float32 // in % LossCorr float32 // in % Gap uint32 Duplicate float32 // in % DuplicateCorr float32 // in % Jitter uint32 // in us ReorderProb float32 // in % ReorderCorr float32 // in % CorruptProb float32 // in % CorruptCorr float32 // in % }
func (NetemQdiscAttrs) String ¶
func (q NetemQdiscAttrs) String() string
type NextHopFlag ¶
type NextHopFlag int
type NexthopInfo ¶
type NexthopInfo struct { LinkIndex int Hops int Gw net.IP Flags int NewDst Destination Encap Encap }
func (NexthopInfo) Equal ¶
func (n NexthopInfo) Equal(x NexthopInfo) bool
func (*NexthopInfo) ListFlags ¶
func (n *NexthopInfo) ListFlags() []string
func (*NexthopInfo) String ¶
func (n *NexthopInfo) String() string
type NsFd ¶
type NsFd int
type NsPid ¶
type NsPid int
type PfifoFast ¶
type PfifoFast struct { QdiscAttrs Bands uint8 PriorityMap [PRIORITY_MAP_LEN]uint8 }
PfifoFast is the default qdisc created by the kernel if one has not been defined for the interface
func (*PfifoFast) Attrs ¶
func (qdisc *PfifoFast) Attrs() *QdiscAttrs
func (*PfifoFast) Type ¶
type Prio ¶
type Prio struct { QdiscAttrs Bands uint8 PriorityMap [PRIORITY_MAP_LEN]uint8 }
Prio is a basic qdisc that works just like PfifoFast
func NewPrio ¶
func NewPrio(attrs QdiscAttrs) *Prio
func (*Prio) Attrs ¶
func (qdisc *Prio) Attrs() *QdiscAttrs
func (*Prio) Type ¶
type Protinfo ¶
type Protinfo struct { Hairpin bool Guard bool FastLeave bool RootBlock bool Learning bool Flood bool ProxyArp bool ProxyArpWiFi bool }
Protinfo represents bridge flags from netlink.
func (*Protinfo) String ¶
String returns a list of enabled flags
type Proto ¶
type Proto uint8
Proto is an enum representing an ipsec protocol.
const ( XFRM_PROTO_ROUTE2 Proto = unix.IPPROTO_ROUTING XFRM_PROTO_ESP Proto = unix.IPPROTO_ESP XFRM_PROTO_AH Proto = unix.IPPROTO_AH XFRM_PROTO_HAO Proto = unix.IPPROTO_DSTOPTS XFRM_PROTO_COMP Proto = 0x6c // NOTE not defined on darwin XFRM_PROTO_IPSEC_ANY Proto = unix.IPPROTO_RAW )
func (Proto) String ¶
type Qdisc ¶
type Qdisc interface { Attrs() *QdiscAttrs Type() string }
type QdiscAttrs ¶
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 should have parent == HANDLE_ROOT.
func (QdiscAttrs) String ¶
func (q QdiscAttrs) String() string
type Route ¶
type Route struct { LinkIndex int ILinkIndex int Scope Scope Dst *net.IPNet Src net.IP Gw net.IP MultiPath []*NexthopInfo Protocol int Priority int Table int Type int Tos int Flags int MPLSDst *int NewDst Destination Encap Encap MTU int AdvMSS int }
Route represents a netlink route.
func RouteList ¶
func (*Route) ClearFlag ¶
func (r *Route) ClearFlag(flag NextHopFlag)
func (Route) Equal ¶
func (*Route) ListFlags ¶
func (*Route) SetFlag ¶
func (r *Route) SetFlag(flag NextHopFlag)
func (Route) String ¶
type RouteUpdate ¶
RouteUpdate is sent when a route changes - type is RTM_NEWROUTE or RTM_DELROUTE
type Rule ¶
type Rule struct { Priority int Family int Table int Mark int Mask int TunID uint Goto int Src *net.IPNet Dst *net.IPNet Flow int IifName string OifName string SuppressIfgroup int SuppressPrefixlen int Invert bool }
Rule represents a netlink rule.
func NewRule ¶
func NewRule() *Rule
NewRule return empty rules.
func (Rule) String ¶
type Scope ¶
type Scope uint8
Scope is an enum representing a route scope.
type Sittun ¶
type Sittun struct { LinkAttrs Link uint32 Local net.IP Remote net.IP Ttl uint8 Tos uint8 PMtuDisc uint8 EncapType uint16 EncapFlags uint16 EncapSport uint16 EncapDport uint16 }
func (*Sittun) Attrs ¶
func (*Sittun) Type ¶
type Socket ¶
type Socket struct { Family uint8 State uint8 Timer uint8 Retrans uint8 ID SocketID Expires uint32 RQueue uint32 WQueue uint32 UID uint32 INode uint32 }
Socket represents a netlink socket.
func SocketGet ¶
type SocketID ¶
type SocketID struct { SourcePort uint16 DestinationPort uint16 Source net.IP Destination net.IP Interface uint32 Cookie [2]uint32 }
SocketID identifies a single socket.
type Tbf ¶
type Tbf struct { QdiscAttrs Rate uint64 Limit uint32 Buffer uint32 Peakrate uint64 Minburst uint32 }
Tbf is a classless qdisc that rate limits based on tokens
func (*Tbf) Attrs ¶
func (qdisc *Tbf) Attrs() *QdiscAttrs
func (*Tbf) Type ¶
type TcAct ¶
type TcAct int32
const ( TC_ACT_UNSPEC TcAct = -1 TC_ACT_OK TcAct = 0 TC_ACT_RECLASSIFY TcAct = 1 TC_ACT_SHOT TcAct = 2 TC_ACT_PIPE TcAct = 3 TC_ACT_STOLEN TcAct = 4 TC_ACT_QUEUED TcAct = 5 TC_ACT_REPEAT TcAct = 6 TC_ACT_REDIRECT TcAct = 7 TC_ACT_JUMP TcAct = 0x10000000 )
func (TcAct) String ¶
type TcPolAct ¶
type TcPolAct int32
const ( TC_POLICE_UNSPEC TcPolAct = TcPolAct(TC_ACT_UNSPEC) TC_POLICE_OK TcPolAct = TcPolAct(TC_ACT_OK) TC_POLICE_RECLASSIFY TcPolAct = TcPolAct(TC_ACT_RECLASSIFY) TC_POLICE_SHOT TcPolAct = TcPolAct(TC_ACT_SHOT) TC_POLICE_PIPE TcPolAct = TcPolAct(TC_ACT_PIPE) )
func (TcPolAct) String ¶
type TcU32Key ¶
TcU32Key contained of Sel in the U32 filters. This is the copy and the frontend representation of nl.TcU32Key. It is serialized into chanonical nl.TcU32Sel with the appropriate endianness.
type TcU32Sel ¶
type TcU32Sel struct { Flags uint8 Offshift uint8 Nkeys uint8 Pad uint8 Offmask uint16 Off uint16 Offoff int16 Hoff int16 Hmask uint32 Keys []TcU32Key }
Sel of the U32 filters that contains multiple TcU32Key. This is the copy and the frontend representation of nl.TcU32Sel. It is serialized into canonical nl.TcU32Sel with the appropriate endianness.
type Tuntap ¶
type Tuntap struct { LinkAttrs Mode TuntapMode Flags TuntapFlag Queues int Fds []*os.File }
Tuntap links created via /dev/tun/tap, but can be destroyed via netlink
func (*Tuntap) Attrs ¶
func (*Tuntap) Type ¶
type TuntapFlag ¶
type TuntapFlag uint16
type TuntapMode ¶
type TuntapMode uint16
type U32 ¶
type U32 struct { FilterAttrs ClassId uint32 RedirIndex int Sel *TcU32Sel Actions []Action }
U32 filters on many packet related properties
func (*U32) Attrs ¶
func (filter *U32) Attrs() *FilterAttrs
func (*U32) Type ¶
type Veth ¶
Veth devices must specify PeerName on create
func (*Veth) Attrs ¶
func (*Veth) Type ¶
type Vlan ¶
Vlan links have ParentIndex set in their Attrs()
func (*Vlan) Attrs ¶
func (*Vlan) Type ¶
type Vrf ¶
func (*Vrf) Attrs ¶
func (*Vrf) Type ¶
type Vti ¶
func (*Vti) Attrs ¶
func (*Vti) Type ¶
type Vxlan ¶
type Vxlan struct { LinkAttrs VxlanId int VtepDevIndex int SrcAddr net.IP Group net.IP TTL int TOS int Learning bool Proxy bool RSC bool L2miss bool L3miss bool UDPCSum bool UDP6ZeroCSumTx bool UDP6ZeroCSumRx bool NoAge bool GBP bool FlowBased bool Age int Limit int Port int PortLow int PortHigh int }
func (*Vxlan) Attrs ¶
func (*Vxlan) Type ¶
type XfrmMark ¶
XfrmMark represents the mark associated to the state or policy
func (*XfrmMark) String ¶
type XfrmPolicy ¶
type XfrmPolicy struct { Dst *net.IPNet Src *net.IPNet Proto Proto DstPort int SrcPort int Dir Dir Priority int Index int Mark *XfrmMark Tmpls []XfrmPolicyTmpl }
XfrmPolicy represents an ipsec policy. It represents the overlay network and has a list of XfrmPolicyTmpls representing the base addresses of the policy.
func XfrmPolicyList ¶
func XfrmPolicyList(family int) ([]XfrmPolicy, error)
func (XfrmPolicy) String ¶
func (p XfrmPolicy) String() string
type XfrmPolicyTmpl ¶
XfrmPolicyTmpl encapsulates a rule for the base addresses of an ipsec policy. These rules are matched with XfrmState to determine encryption and authentication algorithms.
func (XfrmPolicyTmpl) String ¶
func (t XfrmPolicyTmpl) String() string
type XfrmState ¶
type XfrmState struct { Dst net.IP Src net.IP Proto Proto Mode Mode Spi int Reqid int ReplayWindow int Limits XfrmStateLimits Statistics XfrmStateStats Mark *XfrmMark Auth *XfrmStateAlgo Crypt *XfrmStateAlgo Aead *XfrmStateAlgo Encap *XfrmStateEncap ESN bool }
XfrmState represents the state of an ipsec policy. It optionally contains an XfrmStateAlgo for encryption and one for authentication.
func XfrmStateList ¶
func (XfrmState) Print ¶
func (XfrmState) String ¶
type XfrmStateAlgo ¶
type XfrmStateAlgo struct { Name string Key []byte TruncateLen int // Auth only ICVLen int // AEAD only }
XfrmStateAlgo represents the algorithm to use for the ipsec encryption.
func (XfrmStateAlgo) String ¶
func (a XfrmStateAlgo) String() string
type XfrmStateEncap ¶
XfrmStateEncap represents the encapsulation to use for the ipsec encryption.
func (XfrmStateEncap) String ¶
func (e XfrmStateEncap) String() string
type XfrmStateLimits ¶
type XfrmStateLimits struct { ByteSoft uint64 ByteHard uint64 PacketSoft uint64 PacketHard uint64 TimeSoft uint64 TimeHard uint64 TimeUseSoft uint64 TimeUseHard uint64 }
XfrmStateLimits represents the configured limits for the state.
type XfrmStateStats ¶
type XfrmStateStats struct { ReplayWindow uint32 Replay uint32 Failed uint32 Bytes uint64 Packets uint64 AddTime uint64 UseTime uint64 }
XfrmStateStats represents the current number of bytes/packets processed by this State, the State's installation and first use time and the replay window counters.
Source Files ¶
addr.go class.go conntrack_unspecified.go filter.go fou.go fou_unspecified.go genetlink_unspecified.go handle_unspecified.go link.go neigh.go netlink.go netlink_unspecified.go order.go protinfo.go qdisc.go route.go route_unspecified.go rule.go socket.go xfrm.go xfrm_policy.go xfrm_state.go
Directories ¶
Path | Synopsis |
---|---|
nl |
- Version
- v1.0.0
- Published
- Mar 16, 2018
- Platform
- darwin/amd64
- Imports
- 11 packages
- Last checked
- now –
Tools for package owners.