iface

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2021 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 Route2String

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

func String2Route

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

Types

type Bridge

type Bridge struct {
	// contains filtered or unexported fields
}

func NewBridge

func NewBridge(name string) *Bridge

func (*Bridge) Addr

func (br *Bridge) Addr() []netlink.Addr

func (*Bridge) ClearAddr

func (br *Bridge) ClearAddr() error

func (*Bridge) Ensure

func (br *Bridge) Ensure() error

Ensure bridge set promiscuous mod default

func (*Bridge) Fetch

func (br *Bridge) Fetch() error

func (*Bridge) Index

func (br *Bridge) Index() int

func (*Bridge) LinkAttrs

func (br *Bridge) LinkAttrs() *netlink.LinkAttrs

func (*Bridge) Name

func (br *Bridge) Name() string

func (*Bridge) Routes

func (br *Bridge) Routes() []netlink.Route

func (*Bridge) SyncIPv4Addr

func (br *Bridge) SyncIPv4Addr(slave IFace) error

Keep the bridge's IPv4 addresses are the same with the slave

func (br *Bridge) ToLink() *Link

func (*Bridge) Type

func (br *Bridge) Type() string

type IFace

type IFace interface {
	Index() int
	Name() string
	Type() string
	LinkAttrs() *netlink.LinkAttrs
	Addr() []netlink.Addr
	Routes() []netlink.Route
}
type Link struct {
	// contains filtered or unexported fields
}

func GetLinkByIndex added in v0.1.7

func GetLinkByIndex(index int) (*Link, error)

func GetLinkByName added in v0.1.7

func GetLinkByName(name string) (*Link, error)
func ListLinks(typeSelector map[string]bool) ([]*Link, error)

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) AddRoutes

func (l *Link) AddRoutes(link IFace) error

func (*Link) Addr

func (l *Link) Addr() []netlink.Addr

func (*Link) DelBridgeVlan

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

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

func (*Link) DeleteIptForward added in v0.1.8

func (l *Link) DeleteIptForward() error

func (*Link) DeleteRoutes

func (l *Link) DeleteRoutes() error

func (*Link) EnsureIptForward added in v0.1.8

func (l *Link) EnsureIptForward() error

func (*Link) Fetch

func (l *Link) Fetch() error

func (*Link) Index

func (l *Link) Index() int

func (*Link) LinkAttrs

func (l *Link) LinkAttrs() *netlink.LinkAttrs

func (*Link) Name

func (l *Link) Name() string

func (*Link) Routes

func (l *Link) Routes() []netlink.Route

func (*Link) SetMaster

func (l *Link) SetMaster(br *Bridge, vids []uint16) error

func (*Link) SetNoMaster

func (l *Link) SetNoMaster() error

func (*Link) Type

func (l *Link) Type() string

Jump to

Keyboard shortcuts

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