net

package
v1.9.3 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultBridgeInterface = "sandal0"
)
View Source
const (
	LinkTypeVeth = "veth"
)

Variables

This section is empty.

Functions

func CreateDefaultBridge

func CreateDefaultBridge() (netlink.Link, error)

Expected to run once In case of existence, returns error instead of nil to prevent any multi ip configuration at deamonless execution

func HasRoute

func HasRoute(ip net.IP) ([]netlink.Route, bool, error)

func Ipv4DefaultGatewayTestIp

func Ipv4DefaultGatewayTestIp() net.IP

test ips for getting default gateway

func Ipv6DefaultGatewayTestIp

func Ipv6DefaultGatewayTestIp() net.IP

Types

type Addr

type Addr struct {
	IP    net.IP
	IPNet *net.IPNet
}

func (Addr) Add

func (a Addr) Add(link netlink.Link) error

type Addrs

type Addrs []Addr

func GetAddrsByName

func GetAddrsByName(InterfaceName string) (addrs Addrs, err error)

func (Addrs) Add

func (a Addrs) Add(link netlink.Link) error
type Link struct {
	Mtu    int
	Id     string
	Master string
	Type   string
	Name   string
	Ether  net.HardwareAddr

	Addr  Addrs
	Route Addrs
}

func (Link) Configure

func (l Link) Configure() error

Assign Ip addresses and set interface up

func (Link) Create

func (l Link) Create() error

func (Link) SetNsPid

func (l Link) SetNsPid(pid int) error

func (Link) WaitUntilCreated

func (l Link) WaitUntilCreated(second uint) (link netlink.Link, err error)
type Links []Link

func ParseFlag

func ParseFlag(flags []string, conts []*config.Config, cont *config.Config) (Links, error)
func ToLinks(d *any) (*Links, error)

func (*Links) Append

func (links *Links) Append(link Link)
func (links Links) FinalizeLinks() error

func (Links) FindGateways

func (l Links) FindGateways() (IPv4 Addr, IPv6 Addr)

func (Links) WaitUntilCreated

func (l Links) WaitUntilCreated(second uint) (links []netlink.Link, err error)

Jump to

Keyboard shortcuts

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