network

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ROUTE_TABLE_BASE = 9999
)

Variables

This section is empty.

Functions

func AddressAddress

func AddressAddress(ifIndex int, address string) error

func AddressRemove

func AddressRemove(ifName string, address string) error

func AddressSet

func AddressSet(name string, address string) error

func ConfigureByIndex

func ConfigureByIndex(ifIndex int) error
func ConfigureSupplementaryLinks(s string) error

When both links in same subnet

func GetDefaultIpv4Gateway

func GetDefaultIpv4Gateway() (string, error)
func GetDefaultIpv4GatewayByLink(ifIndex int) (string, error)

func GetIPv4Addresses

func GetIPv4Addresses(ifName string) (map[string]bool, error)

func GetIpv4Gateway

func GetIpv4Gateway(ifIndex int) (string, error)
func GetIpv4GatewayByLink(ifIndex int) (string, error)

func GetLinkMacByIndex

func GetLinkMacByIndex(links *Links, ifIndex int) (string, error)

func LinkSetMtu

func LinkSetMtu(ifIndex int, mtu int) error

func LinkSetOperStateUp

func LinkSetOperStateUp(ifIndex int) error

func RouteAdd

func RouteAdd(route *Route) error

func RouteRemove

func RouteRemove(route *Route) error

func RoutingPolicyRuleAdd

func RoutingPolicyRuleAdd(rule *RoutingPolicyRule) error

func RoutingPolicyRuleRemove

func RoutingPolicyRuleRemove(rule *RoutingPolicyRule) error

Types

type Link struct {
	Name      string
	Ifindex   int
	OperState string
	Mac       string
	MTU       int
	Addresses *map[string]bool
}
type Links struct {
	LinksByMAC map[string]Link
}
func AcquireLinks() (Links, error)

type Route

type Route struct {
	Table   int
	IfIndex int
	Gw      string
}

type RoutingPolicyRule

type RoutingPolicyRule struct {
	From  string
	To    string
	Table int
}

Jump to

Keyboard shortcuts

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