nethelpers

package
v0.14.2 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2022 License: MPL-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package nethelpers provides types and type wrappers to support network resources.

Index

Constants

RouteFlagsMask is a supported set of flags to manage.

Variables

This section is empty.

Functions

This section is empty.

Types

type ADSelect

type ADSelect uint8

ADSelect is ADSelect.

const (
	ADSelectStable    ADSelect = iota // stable
	ADSelectBandwidth                 // bandwidth
	ADSelectCount                     // count
)

ADSelect constants.

func ADSelectByName

func ADSelectByName(sel string) (ADSelect, error)

ADSelectByName parses ADSelect.

func (ADSelect) MarshalYAML

func (v ADSelect) MarshalYAML() (interface{}, error)

MarshalYAML implements yaml.Marshaler.

func (ADSelect) String

func (i ADSelect) String() string

type ARPAllTargets

type ARPAllTargets uint32

ARPAllTargets is an ARP targets mode.

const (
	ARPAllTargetsAny ARPAllTargets = iota // any
	ARPAllTargetsAll                      // all
)

ARPAllTargets contants.

func ARPAllTargetsByName

func ARPAllTargetsByName(a string) (ARPAllTargets, error)

ARPAllTargetsByName parses ARPAllTargets.

func (ARPAllTargets) MarshalYAML

func (v ARPAllTargets) MarshalYAML() (interface{}, error)

MarshalYAML implements yaml.Marshaler.

func (ARPAllTargets) String

func (i ARPAllTargets) String() string

type ARPValidate

type ARPValidate uint32

ARPValidate is an ARP Validation mode.

const (
	ARPValidateNone   ARPValidate = iota // none
	ARPValidateActive                    // active
	ARPValidateBackup                    // backup
	ARPValidateAll                       // all
)

ARPValidate constants.

func ARPValidateByName

func ARPValidateByName(a string) (ARPValidate, error)

ARPValidateByName parses ARPValidate.

func (ARPValidate) MarshalYAML

func (v ARPValidate) MarshalYAML() (interface{}, error)

MarshalYAML implements yaml.Marshaler.

func (ARPValidate) String

func (i ARPValidate) String() string

type AddressFlag

type AddressFlag uint32

AddressFlag wraps IFF_* constants.

const (
	AddressTemporary      AddressFlag = 1 << iota // temporary
	AddressNoDAD                                  // nodad
	AddressOptimistic                             // optimistic
	AddressDADFailed                              // dadfailed
	AddressHome                                   // homeaddress
	AddressDeprecated                             // deprecated
	AddressTentative                              // tentative
	AddressPermanent                              // permanent
	AddressManagementTemp                         // mngmtmpaddr
	AddressNoPrefixRoute                          // noprefixroute
	AddressMCAutoJoin                             // mcautojoin
	AddressStablePrivacy                          // stableprivacy
)

AddressFlag constants.

func (AddressFlag) String

func (i AddressFlag) String() string

type AddressFlags

type AddressFlags uint32

AddressFlags is a bitmask of AddressFlag.

func (AddressFlags) MarshalYAML

func (flags AddressFlags) MarshalYAML() (interface{}, error)

MarshalYAML implements yaml.Marshaler.

func (AddressFlags) String

func (flags AddressFlags) String() string

type BondMode

type BondMode uint8

BondMode is a bond mode.

const (
	BondModeRoundrobin   BondMode = iota // balance-rr
	BondModeActiveBackup                 // active-backup
	BondModeXOR                          // balance-xor
	BondModeBroadcast                    // broadcast
	BondMode8023AD                       // 802.3ad
	BondModeTLB                          // balance-tlb
	BondModeALB                          // balance-alb
)

BondMode constants.

See linux/if_bonding.h.

func BondModeByName

func BondModeByName(mode string) (bm BondMode, err error)

BondModeByName converts string bond mode into a constant.

func (BondMode) MarshalYAML

func (bm BondMode) MarshalYAML() (interface{}, error)

MarshalYAML implements yaml.Marshaler.

func (BondMode) String

func (i BondMode) String() string

type BondXmitHashPolicy

type BondXmitHashPolicy uint8

BondXmitHashPolicy is a bond hash policy.

const (
	BondXmitPolicyLayer2  BondXmitHashPolicy = iota // layer2
	BondXmitPolicyLayer34                           // layer3+4
	BondXmitPolicyLayer23                           // layer2+3
	BondXmitPolicyEncap23                           // encap2+3
	BondXmitPolicyEncap34                           // encap3+4
)

Bond hash policy constants.

func BondXmitHashPolicyByName

func BondXmitHashPolicyByName(policy string) (BondXmitHashPolicy, error)

BondXmitHashPolicyByName parses bond hash policy.

func (BondXmitHashPolicy) MarshalYAML

func (bp BondXmitHashPolicy) MarshalYAML() (interface{}, error)

MarshalYAML implements yaml.Marshaler.

func (BondXmitHashPolicy) String

func (i BondXmitHashPolicy) String() string

type Duplex

type Duplex ethtool.Duplex

Duplex wraps ethtool.Duplex for YAML marshaling.

func (Duplex) MarshalYAML

func (duplex Duplex) MarshalYAML() (interface{}, error)

MarshalYAML implements yaml.Marshaler interface.

type FailOverMAC

type FailOverMAC uint8

FailOverMAC is a MAC failover mode.

const (
	FailOverMACNone   FailOverMAC = iota // none
	FailOverMACActive                    // active
	FailOverMACFollow                    // follow
)

FailOverMAC constants.

func FailOverMACByName

func FailOverMACByName(f string) (FailOverMAC, error)

FailOverMACByName parses FailOverMac.

func (FailOverMAC) MarshalYAML

func (v FailOverMAC) MarshalYAML() (interface{}, error)

MarshalYAML implements yaml.Marshaler.

func (FailOverMAC) String

func (i FailOverMAC) String() string

type Family

type Family uint8

Family is a network family.

const (
	FamilyInet4 Family = 2  // inet4
	FamilyInet6 Family = 10 // inet6
)

Family constants.

func (Family) MarshalYAML

func (family Family) MarshalYAML() (interface{}, error)

MarshalYAML implements yaml.Marshaler.

func (Family) String

func (i Family) String() string

type HardwareAddr

type HardwareAddr net.HardwareAddr

HardwareAddr wraps net.HardwareAddr for YAML marshaling.

func (HardwareAddr) MarshalYAML

func (addr HardwareAddr) MarshalYAML() (interface{}, error)

MarshalYAML implements yaml.Marshaler interface.

func (HardwareAddr) String added in v0.13.0

func (addr HardwareAddr) String() string

type LACPRate

type LACPRate uint8

LACPRate is a LACP rate.

const (
	LACPRateSlow LACPRate = iota // slow
	LACPRateFast                 // fast
)

LACP rate constants.

func LACPRateByName

func LACPRateByName(mode string) (LACPRate, error)

LACPRateByName parses LACPRate.

func (LACPRate) MarshalYAML

func (v LACPRate) MarshalYAML() (interface{}, error)

MarshalYAML implements yaml.Marshaler.

func (LACPRate) String

func (i LACPRate) String() string

type LinkFlag

type LinkFlag uint32

LinkFlag wraps IFF_* constants.

const (
	LinkUp           LinkFlag = 1 << iota // UP
	LinkBroadcast                         // BROADCAST
	LinkDebug                             // DEBUG
	LinkLoopback                          // LOOPBACK
	LinkPointToPoint                      // POINTTOPOINT
	LinkNoTrailers                        // NOTRAILERS
	LinkRunning                           // RUNNING
	LinkNoArp                             // NOARP
	LinkPromisc                           // PROMISC
	LinkAllMulti                          // ALLMULTI
	LinkMaster                            // MASTER
	LinkSlave                             // SLAVE
	LinkMulticase                         // MULTICAST
	LinkPortsel                           // PORTSEL
	LinKAutoMedia                         // AUTOMEDIA
	LinkDynamic                           // DYNAMIC
	LinkLowerUp                           // LOWER_UP
	LinkDormant                           // DORMANT
	LinkEcho                              // ECHO
)

LinkFlag constants.

func (LinkFlag) String

func (i LinkFlag) String() string

type LinkFlags

type LinkFlags uint32

LinkFlags is a bitmask of LinkFlags.

func (LinkFlags) MarshalYAML

func (flags LinkFlags) MarshalYAML() (interface{}, error)

MarshalYAML implements yaml.Marshaler.

func (LinkFlags) String

func (flags LinkFlags) String() string

type LinkType

type LinkType uint16

LinkType is a link type.

const (
	LinkNetrom            LinkType = 0                 // netrom
	LinkEther             LinkType = 1                 // ether
	LinkEether            LinkType = 2                 // eether
	LinkAx25              LinkType = 3                 // ax25
	LinkPronet            LinkType = 4                 // pronet
	LinkChaos             LinkType = 5                 // chaos
	LinkIee802            LinkType = 6                 // ieee802
	LinkArcnet            LinkType = 7                 // arcnet
	LinkAtalk             LinkType = 8                 // atalk
	LinkDlci              LinkType = 15                // dlci
	LinkAtm               LinkType = 19                // atm
	LinkMetricom          LinkType = 23                // metricom
	LinkIeee1394          LinkType = 24                // ieee1394
	LinkEui64             LinkType = 27                // eui64
	LinkInfiniband        LinkType = 32                // infiniband
	LinkSlip              LinkType = 256               // slip
	LinkCslip             LinkType = 257               // cslip
	LinkSlip6             LinkType = 258               // slip6
	LinkCslip6            LinkType = 259               // cslip6
	LinkRsrvd             LinkType = 260               // rsrvd
	LinkAdapt             LinkType = 264               // adapt
	LinkRose              LinkType = 270               // rose
	LinkX25               LinkType = 271               // x25
	LinkHwx25             LinkType = 272               // hwx25
	LinkCan               LinkType = 280               // can
	LinkPpp               LinkType = 512               // ppp
	LinkCisco             LinkType = 513               // cisco
	LinkHdlc              LinkType = 513               // hdlc
	LinkLapb              LinkType = 516               // lapb
	LinkDdcmp             LinkType = 517               // ddcmp
	LinkRawhdlc           LinkType = 518               // rawhdlc
	LinkTunnel            LinkType = 768               // ipip
	LinkTunnel6           LinkType = 769               // tunnel6
	LinkFrad              LinkType = 770               // frad
	LinkSkip              LinkType = 771               // skip
	LinkLoopbck           LinkType = 772               // loopback
	LinkLocaltlk          LinkType = 773               // localtlk
	LinkFddi              LinkType = 774               // fddi
	LinkBif               LinkType = 775               // bif
	LinkSit               LinkType = 776               // sit
	LinkIpddp             LinkType = 777               // ip/ddp
	LinkIpgre             LinkType = 778               // gre
	LinkPimreg            LinkType = 779               // pimreg
	LinkHippi             LinkType = 780               // hippi
	LinkAsh               LinkType = 781               // ash
	LinkEconet            LinkType = 782               // econet
	LinkIrda              LinkType = 783               // irda
	LinkFcpp              LinkType = 784               // fcpp
	LinkFcal              LinkType = 785               // fcal
	LinkFcpl              LinkType = 786               // fcpl
	LinkFcfabric          LinkType = 787               // fcfb_0
	LinkFcfabric1         LinkType = LinkFcfabric + 1  // fcfb_1
	LinkFcfabric2         LinkType = LinkFcfabric + 2  // fcfb_2
	LinkFcfabric3         LinkType = LinkFcfabric + 3  // fcfb_3
	LinkFcfabric4         LinkType = LinkFcfabric + 4  // fcfb_4
	LinkFcfabric5         LinkType = LinkFcfabric + 5  // fcfb_5
	LinkFcfabric6         LinkType = LinkFcfabric + 6  // fcfb_6
	LinkFcfabric7         LinkType = LinkFcfabric + 7  // fcfb_7
	LinkFcfabric8         LinkType = LinkFcfabric + 8  // fcfb_8
	LinkFcfabric9         LinkType = LinkFcfabric + 9  // fcfb_9
	LinkFcfabric10        LinkType = LinkFcfabric + 10 // fcfb_10
	LinkFcfabric11        LinkType = LinkFcfabric + 11 // fcfb_11
	LinkFcfabric12        LinkType = LinkFcfabric + 12 // fcfb_12
	LinkIee802tr          LinkType = 800               // tr
	LinkIee80211          LinkType = 801               // ieee802.11
	LinkIee80211prism     LinkType = 802               // ieee802.11_prism
	LinkIee80211Radiotap  LinkType = 803               // ieee802.11_radiotap
	LinkIee8021154        LinkType = 804               // ieee802.15.4
	LinkIee8021154monitor LinkType = 805               // ieee802.15.4_monitor
	LinkPhonet            LinkType = 820               // phonet
	LinkPhonetpipe        LinkType = 821               // phonet_pipe
	LinkCaif              LinkType = 822               // caif
	LinkIP6gre            LinkType = 823               // ip6gre
	LinkNetlink           LinkType = 824               // netlink
	Link6Lowpan           LinkType = 825               // 6lowpan
	LinkVoid              LinkType = 65535             // void
	LinkNone              LinkType = 65534             // nohdr
)

LinkType constants.

func (LinkType) MarshalYAML

func (typ LinkType) MarshalYAML() (interface{}, error)

MarshalYAML implements yaml.Marshaler.

func (LinkType) String

func (i LinkType) String() string

type OperationalState

type OperationalState uint8

OperationalState wraps rtnetlink.OperationalState for YAML marshaling.

Constants copied from rtnetlink to provide Stringer interface.

func (OperationalState) MarshalYAML

func (state OperationalState) MarshalYAML() (interface{}, error)

MarshalYAML implements yaml.Marshaler interface.

func (OperationalState) String

func (i OperationalState) String() string

type Port

type Port ethtool.Port

Port wraps ethtool.Port for YAML marshaling.

func (Port) MarshalYAML

func (port Port) MarshalYAML() (interface{}, error)

MarshalYAML implements yaml.Marshaler interface.

type PrimaryReselect

type PrimaryReselect uint8

PrimaryReselect is an ARP targets mode.

const (
	PrimaryReselectAlways  PrimaryReselect = iota // always
	PrimaryReselectBetter                         // better
	PrimaryReselectFailure                        // failure
)

PrimaryReslect constants.

func PrimaryReselectByName

func PrimaryReselectByName(p string) (PrimaryReselect, error)

PrimaryReselectByName parses PrimaryReselect.

func (PrimaryReselect) MarshalYAML

func (v PrimaryReselect) MarshalYAML() (interface{}, error)

MarshalYAML implements yaml.Marshaler.

func (PrimaryReselect) String

func (i PrimaryReselect) String() string

type RouteFlag

type RouteFlag uint32

RouteFlag wraps RTM_F_* constants.

const (
	RouteNotify      RouteFlag = 256 << iota // notify
	RouteCloned                              // cloned
	RouteEqualize                            // equalize
	RoutePrefix                              // prefix
	RouteLookupTable                         // lookup_table
	RouteFIBMatch                            // fib_match
	RouteOffload                             // offload
	RouteTrap                                // trap
)

RouteFlag constants.

func (RouteFlag) String

func (i RouteFlag) String() string

type RouteFlags

type RouteFlags uint32

RouteFlags is a bitmask of RouteFlag.

func (RouteFlags) Equal

func (flags RouteFlags) Equal(other RouteFlags) bool

Equal tests for RouteFlags equality ignoring flags not managed by this implementation.

func (RouteFlags) MarshalYAML

func (flags RouteFlags) MarshalYAML() (interface{}, error)

MarshalYAML implements yaml.Marshaler.

func (RouteFlags) String

func (flags RouteFlags) String() string

type RouteProtocol

type RouteProtocol uint8

RouteProtocol is a routing protocol.

const (
	ProtocolUnspec   RouteProtocol = iota // unspec
	ProtocolRedirect                      // redirect
	ProtocolKernel                        // kernel
	ProtocolBoot                          // boot
	ProtocolStatic                        // static
)

RouteType constants.

func (RouteProtocol) MarshalYAML

func (rp RouteProtocol) MarshalYAML() (interface{}, error)

MarshalYAML implements yaml.Marshaler.

func (RouteProtocol) String

func (i RouteProtocol) String() string

type RouteType

type RouteType uint8

RouteType is a route type.

const (
	TypeUnspec      RouteType = iota // unspec
	TypeUnicast                      // unicast
	TypeLocal                        // local
	TypeBroadcast                    // broadcast
	TypeAnycast                      // anycast
	TypeMulticast                    // multicast
	TypeBlackhole                    // blackhole
	TypeUnreachable                  // unreachable
	TypeProhibit                     // prohibit
	TypeThrow                        // throw
	TypeNAT                          // nat
	TypeXResolve                     // xresolve
)

RouteType constants.

func (RouteType) MarshalYAML

func (rt RouteType) MarshalYAML() (interface{}, error)

MarshalYAML implements yaml.Marshaler.

func (RouteType) String

func (i RouteType) String() string

type RoutingTable

type RoutingTable uint32

RoutingTable is a routing table ID.

const (
	TableUnspec  RoutingTable = 0   // unspec
	TableDefault RoutingTable = 253 // default
	TableMain    RoutingTable = 254 // main
	TableLocal   RoutingTable = 255 // local
)

RoutingTable constants.

func (RoutingTable) MarshalYAML

func (table RoutingTable) MarshalYAML() (interface{}, error)

MarshalYAML implements yaml.Marshaler.

func (RoutingTable) String

func (i RoutingTable) String() string

type Scope

type Scope uint8

Scope is an address scope.

const (
	ScopeGlobal  Scope = 0   // global
	ScopeSite    Scope = 200 // site
	ScopeLink    Scope = 253 // link
	ScopeHost    Scope = 254 // host
	ScopeNowhere Scope = 255 // nowhere
)

Scope constants.

func (Scope) MarshalYAML

func (scope Scope) MarshalYAML() (interface{}, error)

MarshalYAML implements yaml.Marshaler.

func (Scope) String

func (i Scope) String() string

type VLANProtocol

type VLANProtocol uint16

VLANProtocol is a VLAN protocol.

const (
	VLANProtocol8021Q  VLANProtocol = 33024 // 802.1q
	VLANProtocol8021AD VLANProtocol = 34984 // 802.1ad
)

VLANProtocol constants.

func (VLANProtocol) MarshalYAML

func (proto VLANProtocol) MarshalYAML() (interface{}, error)

MarshalYAML implements yaml.Marshaler.

func (VLANProtocol) String

func (i VLANProtocol) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL