Documentation ¶
Overview ¶
Package nic provides a way to describe and configure a network interface.
nolint: golint,stylecheck
Index ¶
- Constants
- type ADSelect
- type ARPAllTargets
- type ARPValidate
- type BondMode
- type BondSetting
- type BondXmitHashPolicy
- type FailOverMAC
- type LACPRate
- type NetworkInterface
- func (n *NetworkInterface) Addressing() error
- func (n *NetworkInterface) AddressingSub() error
- func (n *NetworkInterface) Configure() (err error)
- func (n *NetworkInterface) Create() error
- func (n *NetworkInterface) CreateSub() error
- func (n *NetworkInterface) IsIgnored() bool
- func (n *NetworkInterface) Renew()
- func (n *NetworkInterface) Reset()
- type Option
- func WithADActorSysPrio(o uint16) Option
- func WithADSelect(o string) Option
- func WithADUserPortKey(o uint16) Option
- func WithARPAllTargets(o string) Option
- func WithARPInterval(o uint32) Option
- func WithARPValidate(o string) Option
- func WithAddressing(a address.Addressing) Option
- func WithAllSlavesActive(o uint8) Option
- func WithBond(o bool) Option
- func WithBondMode(o string) Option
- func WithDownDelay(o uint32) Option
- func WithDummy() Option
- func WithFailOverMAC(o string) Option
- func WithHashPolicy(o string) Option
- func WithIgnore() Option
- func WithLACPRate(o string) Option
- func WithLPInterval(o uint32) Option
- func WithMIIMon(o uint32) Option
- func WithMinLinks(o uint32) Option
- func WithName(o string) Option
- func WithNoAddressing() Option
- func WithNumPeerNotif(o uint8) Option
- func WithPacketsPerSlave(o uint32) Option
- func WithPeerNotifyDelay(o uint32) Option
- func WithPrimary(o string) Option
- func WithPrimaryReselect(o string) Option
- func WithResendIGMP(o uint32) Option
- func WithSubInterface(o ...string) Option
- func WithTLBDynamicLB(o uint8) Option
- func WithUpDelay(o uint32) Option
- func WithUseCarrier(o bool) Option
- func WithVlan(id uint16) Option
- func WithVlanCIDR(id uint16, cidr string, routeList []config.Route) Option
- func WithVlanDhcp(id uint16) Option
- type PrimaryReselect
- type Vlan
Constants ¶
const ( // MinimumMTU is the lowest allowed MTU for an interface MinimumMTU = 68 // MaximumMTU is the highest allowed MTU for an interface MaximumMTU = 65536 )
const ( IFLA_VLAN_UNSPEC = iota IFLA_VLAN_ID IFLA_VLAN_FLAGS IFLA_VLAN_EGRESS_QOS IFLA_VLAN_INGRESS_QOS IFLA_VLAN_PROTOCOL IFLA_VLAN_MAX = IFLA_VLAN_PROTOCOL )
const ( VLAN_PROTOCOL_UNKNOWN = 0 VLAN_PROTOCOL_8021Q = 0x8100 VLAN_PROTOCOL_8021AD = 0x88A8 )
VlanProtocol possible values.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ARPAllTargets ¶ added in v0.3.0
type ARPAllTargets uint32
const ( ARP_ALL_TARGETS_ANY ARPAllTargets = iota ARP_ALL_TARGETS_ALL )
func ARPAllTargetsByName ¶ added in v0.3.0
func ARPAllTargetsByName(a string) (arpa ARPAllTargets, err error)
func (ARPAllTargets) String ¶ added in v0.3.0
func (a ARPAllTargets) String() string
type ARPValidate ¶ added in v0.3.0
type ARPValidate uint32
const ( ARP_VALIDATE_NONE ARPValidate = iota ARP_VALIDATE_ACTIVE ARP_VALIDATE_BACKUP ARP_VALIDATE_ALL )
func ARPValidateByName ¶ added in v0.3.0
func ARPValidateByName(a string) (arpv ARPValidate, err error)
func (ARPValidate) String ¶ added in v0.3.0
func (a ARPValidate) String() string
type BondMode ¶ added in v0.3.0
type BondMode uint8
https://elixir.bootlin.com/linux/latest/source/include/uapi/linux/if_bonding.h
func BondModeByName ¶ added in v0.3.0
type BondSetting ¶ added in v0.3.0
type BondSetting uint16
https://elixir.bootlin.com/linux/latest/source/include/uapi/linux/if_link.h#L608
const ( IFLA_BOND_UNSPEC BondSetting = iota IFLA_BOND_MODE IFLA_BOND_ACTIVE_SLAVE IFLA_BOND_MIIMON IFLA_BOND_UPDELAY IFLA_BOND_DOWNDELAY IFLA_BOND_USE_CARRIER IFLA_BOND_ARP_INTERVAL IFLA_BOND_ARP_IP_TARGET IFLA_BOND_ARP_VALIDATE IFLA_BOND_ARP_ALL_TARGETS IFLA_BOND_PRIMARY IFLA_BOND_PRIMARY_RESELECT IFLA_BOND_FAIL_OVER_MAC IFLA_BOND_XMIT_HASH_POLICY IFLA_BOND_RESEND_IGMP IFLA_BOND_NUM_PEER_NOTIF IFLA_BOND_ALL_SLAVES_ACTIVE IFLA_BOND_MIN_LINKS IFLA_BOND_LP_INTERVAL IFLA_BOND_PACKETS_PER_SLAVE IFLA_BOND_AD_LACP_RATE IFLA_BOND_AD_SELECT IFLA_BOND_AD_INFO IFLA_BOND_AD_ACTOR_SYS_PRIO IFLA_BOND_AD_USER_PORT_KEY IFLA_BOND_AD_ACTOR_SYSTEM IFLA_BOND_TLB_DYNAMIC_LB IFLA_BOND_PEER_NOTIF_DELAY )
func (BondSetting) String ¶ added in v0.3.0
func (b BondSetting) String() string
type BondXmitHashPolicy ¶ added in v0.3.0
type BondXmitHashPolicy uint8
const ( BOND_XMIT_POLICY_LAYER2 BondXmitHashPolicy = iota BOND_XMIT_POLICY_LAYER34 BOND_XMIT_POLICY_LAYER23 BOND_XMIT_POLICY_ENCAP23 BOND_XMIT_POLICY_ENCAP34 )
func BondXmitHashPolicyByName ¶ added in v0.3.0
func BondXmitHashPolicyByName(policy string) (xmit BondXmitHashPolicy, err error)
func (BondXmitHashPolicy) String ¶ added in v0.3.0
func (b BondXmitHashPolicy) String() string
type FailOverMAC ¶ added in v0.3.0
type FailOverMAC uint8
const ( FAIL_OVER_MAC_NONE FailOverMAC = iota FAIL_OVER_MAC_ACTIVE FAIL_OVER_MAC_FOLLOW )
func FailOverMACByName ¶ added in v0.3.0
func FailOverMACByName(f string) (fo FailOverMAC, err error)
type NetworkInterface ¶
type NetworkInterface struct { Name string Type int Ignore bool Dummy bool Bonded bool MTU uint32 Link *net.Interface SubInterfaces []*net.Interface AddressMethod []address.Addressing BondSettings *netlink.AttributeEncoder Vlans []*Vlan // contains filtered or unexported fields }
NetworkInterface provides an abstract configuration representation for a network interface.
func New ¶ added in v0.3.0
func New(setters ...Option) (*NetworkInterface, error)
New returns a NetworkInterface with all of the given setter options applied.
func (*NetworkInterface) Addressing ¶ added in v0.3.0
func (n *NetworkInterface) Addressing() error
Addressing handles the address method for a configured interface ( dhcp/static ). This is inclusive of the address itself as well as any defined routes.
func (*NetworkInterface) AddressingSub ¶ added in v0.4.0
func (n *NetworkInterface) AddressingSub() error
AddressingSub handles the address method for a configured sub interface ( dhcp/static ). This is inclusive of the address itself as well as any defined routes.
func (*NetworkInterface) Configure ¶ added in v0.3.0
func (n *NetworkInterface) Configure() (err error)
Configure is used to set the link state and configure any necessary bond settings ( ex, mode ).
func (*NetworkInterface) Create ¶ added in v0.3.0
func (n *NetworkInterface) Create() error
Create creates the underlying link if it does not already exist.
func (*NetworkInterface) CreateSub ¶ added in v0.4.0
func (n *NetworkInterface) CreateSub() error
CreateSub create VLAN devices that belongs to a master device.
func (*NetworkInterface) IsIgnored ¶
func (n *NetworkInterface) IsIgnored() bool
IsIgnored checks the network interface to see if it should be ignored and not configured.
func (*NetworkInterface) Renew ¶ added in v0.3.0
func (n *NetworkInterface) Renew()
Renew is the mechanism for keeping a dhcp lease active.
func (*NetworkInterface) Reset ¶ added in v0.3.0
func (n *NetworkInterface) Reset()
Reset removes addressing configuration from a given link.
type Option ¶
type Option func(*NetworkInterface) error
Option is the functional option func.
func WithADActorSysPrio ¶ added in v0.3.0
WithADActorSysPrio in an AD system, this specifies the system priority.
func WithADSelect ¶ added in v0.3.0
WithADSelect specifies the 802.3ad aggregation selection logic to use.
func WithADUserPortKey ¶ added in v0.3.0
WithADUserPortKey specifies the upper 10 bits of the port key.
func WithARPAllTargets ¶ added in v0.3.0
WithARPAllTargets specifies the quantity of arp_ip_targets that must be reachable in order for the ARP monitor to consider a slave as being up.
func WithARPInterval ¶ added in v0.3.0
WithARPInterval specifies the ARP link monitoring frequency in milliseconds.
func WithARPValidate ¶ added in v0.3.0
WithARPValidate specifies whether or not ARP probes and replies should be validated.
func WithAddressing ¶
func WithAddressing(a address.Addressing) Option
WithAddressing defines how the addressing for a given interface should be configured.
func WithAllSlavesActive ¶ added in v0.3.0
WithAllSlavesActive specifies that duplicate frames (received on inactive ports) should be dropped (0) or delivered (1).
func WithBondMode ¶ added in v0.3.0
WithBondMode sets the mode the bond should operate in.
func WithDownDelay ¶ added in v0.3.0
WithDownDelay configures the down delay for interfaces that makes up a bond. The value is given in ms.
func WithDummy ¶ added in v0.6.0
func WithDummy() Option
WithDummy indicates that the interface should be a virtual, dummy interface.
func WithFailOverMAC ¶ added in v0.3.0
WithFailOverMAC specifies whether active-backup mode should set all slaves to the same MAC address.
func WithHashPolicy ¶ added in v0.3.0
WithHashPolicy configures the transmit hash policy for the bonded interface.
func WithIgnore ¶
func WithIgnore() Option
WithIgnore indicates that the interface should not be processed by talos.
func WithLACPRate ¶ added in v0.3.0
WithLACPRate configures the bond LACP rate.
func WithLPInterval ¶ added in v0.3.0
WithLPInterval specifies the number of seconds between instances where the bonding driver sends learning packets to each slaves peer switch.
func WithMIIMon ¶ added in v0.3.0
WithMIIMon configures the miimon interval for a bond. The value is given in ms.
func WithMinLinks ¶ added in v0.3.0
WithMinLinks specifies the minimum number of links that must be active before asserting carrier.
func WithNoAddressing ¶ added in v0.4.0
func WithNoAddressing() Option
WithNoAddressing defines how the addressing for a given interface should be configured.
func WithNumPeerNotif ¶ added in v0.3.0
WithNumPeerNotif specifies the number of peer notifications (gratuitous ARPs and unsolicited IPv6 Neighbor Advertisements) to be issued after a failover event.
func WithPacketsPerSlave ¶ added in v0.3.0
WithPacketsPerSlave specify the number of packets to transmit through a slave before moving to the next one.
func WithPeerNotifyDelay ¶ added in v0.3.0
WithPeerNotifyDelay specifies the delay between each peer notification (gratuitous ARP and unsolicited IPv6 Neighbor Advertisement) when they are issued after a failover event. The value is given in ms.
func WithPrimary ¶ added in v0.3.0
WithPrimary specifies which slave is the primary device.
func WithPrimaryReselect ¶ added in v0.3.0
WithPrimaryReselect specifies the reselection policy for the primary slave.
func WithResendIGMP ¶ added in v0.3.0
WithResendIGMP specifies the number of IGMP membership reports to be issued after a failover event.
func WithSubInterface ¶
WithSubInterface defines which interfaces make up the bond.
func WithTLBDynamicLB ¶ added in v0.3.0
WithTLBDynamicLB specifies if dynamic shuffling of flows is enabled in tlb mode.
func WithUpDelay ¶ added in v0.3.0
WithUpDelay configures the up delay for interfaces that makes up a bond. The value is given in ms.
func WithUseCarrier ¶ added in v0.3.0
WithUseCarrier configures how miimon will determine the link status.
func WithVlanCIDR ¶ added in v0.4.0
WithVlanCIDR defines if the interface have static CIDRs added.
func WithVlanDhcp ¶ added in v0.4.0
WithVlanDhcp sets a VLAN device with DHCP.
type PrimaryReselect ¶ added in v0.3.0
type PrimaryReselect uint8
const ( PRIMARY_RESELECT_ALWAYS PrimaryReselect = iota PRIMARY_RESELECT_BETTER PRIMARY_RESELECT_FAILURE )
func PrimaryReselectByName ¶ added in v0.3.0
func PrimaryReselectByName(p string) (pr PrimaryReselect, err error)
func (PrimaryReselect) String ¶ added in v0.3.0
func (p PrimaryReselect) String() string
type Vlan ¶ added in v0.4.0
type Vlan struct { Parent string ID uint16 Link *net.Interface VlanSettings *netlink.AttributeEncoder AddressMethod []address.Addressing }
Vlan contins interface related parameters to a VLAN device.