network

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: May 22, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxChannelSize = 1024
)

Variables

This section is empty.

Functions

func AcquireLinks(n *Network) error

func ConfigureNetwork

func ConfigureNetwork(link string, n *Network) error

func GetDefaultIpv4Gateway

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

func GetIpv4Gateway

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

func WatchNetwork

func WatchNetwork(n *Network)

Types

type Network

type Network struct {
	LinksByName  map[string]int
	LinksByIndex map[int]string

	RoutesByIndex             map[int]*Route
	RoutingRulesByAddressFrom map[string]*RoutingRule
	RoutingRulesByAddressTo   map[string]*RoutingRule

	Mutex *sync.Mutex
}

func New

func New() *Network

type Route

type Route struct {
	Table   int
	IfIndex int
	Gw      string
}

func (*Route) RouteAdd

func (route *Route) RouteAdd() error

func (*Route) RouteRemove

func (route *Route) RouteRemove() error

type RoutingRule

type RoutingRule struct {
	From  string
	To    string
	Table int
}

func (*RoutingRule) RoutingPolicyRuleAdd

func (rule *RoutingRule) RoutingPolicyRuleAdd() error

func (*RoutingRule) RoutingPolicyRuleRemove

func (rule *RoutingRule) RoutingPolicyRuleRemove() error

Jump to

Keyboard shortcuts

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