routewrapper

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RTF_PROTO1    = '1'
	RTF_PROTO2    = '2'
	RTF_PROTO3    = '3'
	RTF_BLACKHOLE = 'B'
	RTF_BROADCAST = 'b'
	RTF_CLONING   = 'C'
	RTF_PRCLONING = 'c'
	RTF_DYNAMIC   = 'D'
	RTF_GATEWAY   = 'G'
	RTF_HOST      = 'H'
	RTF_IFSCOPE   = 'I'
	RTF_IFREF     = 'i'
	RTF_LLINFO    = 'L'
	RTF_MODIFIED  = 'M'
	RTF_MULTICAST = 'm'
	RTF_REJECT    = 'R'
	RTF_ROUTER    = 'r'
	RTF_STATIC    = 'S'
	RTF_UP        = 'U'
	RTF_WASCLONED = 'W'
	RTF_XRESOLVE  = 'X'
	RTF_PROXY     = 'Y'
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BSDRouteWrapper

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

func NewBSDRouteWrapper

func NewBSDRouteWrapper(netstatCommand string, routeCommand string) (*BSDRouteWrapper, error)

func (*BSDRouteWrapper) AddRoute

func (wrapper *BSDRouteWrapper) AddRoute(route Route) error

func (*BSDRouteWrapper) DefaultRoutes

func (wrapper *BSDRouteWrapper) DefaultRoutes() ([]Route, error)

func (*BSDRouteWrapper) GetInterface

func (wrapper *BSDRouteWrapper) GetInterface(name string) (*net.Interface, error)

func (*BSDRouteWrapper) Routes

func (wrapper *BSDRouteWrapper) Routes() ([]Route, error)

type CommandExecError

type CommandExecError struct {
	Cause   error
	Message string
}

func (*CommandExecError) Error

func (err *CommandExecError) Error() (retval string)

type CommandSpec

type CommandSpec struct {
	Name string
	Args []string
}

func (CommandSpec) Clone

func (cmd CommandSpec) Clone() CommandSpec

func (CommandSpec) Run

func (cmd CommandSpec) Run() ([]byte, []byte, error)

type LinuxRouteWrapper

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

func NewLinuxRouteWrapper

func NewLinuxRouteWrapper(ipCommand string) (*LinuxRouteWrapper, error)

func (*LinuxRouteWrapper) AddRoute

func (wrapper *LinuxRouteWrapper) AddRoute(route Route) error

func (*LinuxRouteWrapper) DefaultRoutes

func (wrapper *LinuxRouteWrapper) DefaultRoutes() ([]Route, error)

func (*LinuxRouteWrapper) GetInterface

func (wrapper *LinuxRouteWrapper) GetInterface(name string) (*net.Interface, error)

func (*LinuxRouteWrapper) Routes

func (wrapper *LinuxRouteWrapper) Routes() ([]Route, error)

type Route

type Route struct {
	Destination net.IPNet
	Gateway     net.IP
	Interface   *net.Interface
	Flags       map[string]string
	Expire      int
	Metric      int
}

func (*Route) DestinationIsNetwork

func (route *Route) DestinationIsNetwork() bool

func (*Route) IsDefaultRoute

func (route *Route) IsDefaultRoute() bool

type Routing

type Routing interface {
	Routes() ([]Route, error)
	DefaultRoutes() ([]Route, error)
	AddRoute(Route) error
	GetInterface(name string) (*net.Interface, error)
}

func NewRouteWrapper

func NewRouteWrapper() (Routing, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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