netroute

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IntToIP

func IntToIP(i *big.Int) net.IP

func IpToInt

func IpToInt(ip net.IP) *big.Int

Types

type Interface

type Interface interface {
	// Get all net routes on the host
	GetNetRoutesAll() ([]Route, error)

	// Get net routes by link and destination subnet
	GetNetRoutes(linkIndex int, destinationSubnet *net.IPNet) ([]Route, error)

	// Create a new route
	NewNetRoute(linkIndex int, destinationSubnet *net.IPNet, gatewayAddress net.IP) error

	// Remove an existing route
	RemoveNetRoute(linkIndex int, destinationSubnet *net.IPNet, gatewayAddress net.IP) error

	// exit the shell
	Exit()
}

Interface is an injectable interface for running MSFT_NetRoute commands. Implementations must be goroutine-safe.

func New

func New() Interface

type Route

type Route struct {
	LinkIndex         int
	DestinationSubnet *net.IPNet
	GatewayAddress    net.IP
	RouteMetric       int
	IfMetric          int
}

func (*Route) Equal

func (r *Route) Equal(route Route) bool

Jump to

Keyboard shortcuts

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