iface

package
v1.8.0-dev.0 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeLoopback = "loopback"
	TypeDevice   = "device"
	TypeBond     = "bond"
)

Variables

This section is empty.

Functions

func DeleteRouteViaGateway added in v0.2.3

func DeleteRouteViaGateway(cidr string) error

func DisableBridgeNF added in v0.4.2

func DisableBridgeNF() error

func EnsureRouteViaGateway added in v0.2.3

func EnsureRouteViaGateway(cidr string) error

EnsureRouteViaGateway will add the route via gateway if not existing

func GetManuallyConfiguredVlans added in v1.7.0

func GetManuallyConfiguredVlans(cnName string) ([]uint16, error)

user might configure sub vlan interface on a bridge directly, should always keep them

func GetMgmtInterface added in v1.8.0

func GetMgmtInterface() (vlanSubInterface string, err error)

func Route2String

func Route2String(route netlink.Route) (string, error)

func String2Route

func String2Route(route string) (*netlink.Route, error)

Types

type Bond added in v0.3.0

type Bond struct {
	*netlink.Bond
	// contains filtered or unexported fields
}

func NewBond added in v0.3.0

func NewBond(bond *netlink.Bond, slaves []string) *Bond

func (*Bond) EnsureBond added in v0.3.0

func (b *Bond) EnsureBond() error

EnsureBond cares about the bond attributes excluding the master index and the slaves

type Bridge

type Bridge struct {
	*netlink.Bridge
}

func NewBridge

func NewBridge(name string) *Bridge

func (*Bridge) Ensure

func (br *Bridge) Ensure() error

Ensure bridge set promiscuous mod default

func (*Bridge) Fetch

func (br *Bridge) Fetch() error
type Link struct {
	netlink.Link
}
func ListLinks(typeSelector map[string]bool) ([]*Link, error)
func NewLink(l netlink.Link) *Link

func (*Link) AddBridgeVlan

func (l *Link) AddBridgeVlan(vid uint16) error

AddBridgeVlan adds a new vlan filter entry Equivalent to: `bridge vlan add dev DEV vid VID master`

func (*Link) AddBridgeVlanSelf added in v1.8.0

func (l *Link) AddBridgeVlanSelf(vid uint16) error

AddBridgeVlanSelf adds a new vlan filter entry to -br interface Equivalent to: `bridge vlan add dev DEV vid VID self`

func (*Link) CreateVlanSubInterface added in v1.8.0

func (l *Link) CreateVlanSubInterface(vid uint16) error

CreateVlanSubInterface creates a new vlan sub-interface Equivalent to: `ip link add link <bridge-link-br> name <vlansubintf-name> type vlan id <vlan-id>.` `ip link set dev <vlansubintf-name> up`

func (*Link) DelBridgeVlan

func (l *Link) DelBridgeVlan(vid uint16) error

DelBridgeVlan dels the vlan filter entry Equivalent to: `bridge vlan del dev DEV vid VID master`

func (*Link) DelBridgeVlanSelf added in v1.8.0

func (l *Link) DelBridgeVlanSelf(vid uint16) error

DelBridgeVlan deletes a vlan filter entry from -br interface Equivalent to: `bridge vlan del dev DEV vid VID self`

func (*Link) DelVlanSubInterface added in v1.8.0

func (l *Link) DelVlanSubInterface(vid uint16) error

DelVlanSubInterface deletes a vlan sub-interface Equivalent to: `ip link del dev <vlansubintf-name>`

func (*Link) DeleteIptForward added in v0.1.8

func (l *Link) DeleteIptForward() error

func (*Link) EnsureIptForward added in v0.1.8

func (l *Link) EnsureIptForward() error

func (*Link) Fetch

func (l *Link) Fetch() error

func (*Link) GetVlanSubInterfaceAndOperState added in v1.8.0

func (l *Link) GetVlanSubInterfaceAndOperState(vid uint16) (netlink.Link, bool, error)

func (*Link) ListBridgeVlan added in v0.3.0

func (l *Link) ListBridgeVlan() ([]uint16, error)

func (*Link) Remove added in v0.3.0

func (l *Link) Remove() error

func (*Link) SetIPAddress added in v1.8.0

func (l *Link) SetIPAddress(cidr string, vid uint16) error

func (*Link) SetMaster

func (l *Link) SetMaster(br *Bridge) error

func (*Link) SetNoMaster

func (l *Link) SetNoMaster() error

func (*Link) ToVlanIDSet added in v1.7.0

func (l *Link) ToVlanIDSet() (*utils.VlanIDSet, error)

Jump to

Keyboard shortcuts

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