adapter

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnableForwardingByIndex

func EnableForwardingByIndex(idx int) (err error)

EnableForwardingByIndex enables the interface forwarding by index

func EnableForwardingByName

func EnableForwardingByName(name string) error

EnableForwardingByName enables the interface forwarding by name

func GetDefaultGatewayIfaceIndex

func GetDefaultGatewayIfaceIndex() (ifaceIdx int, err error)

GetDefaultGatewayIfaceIndex get the interface index that has the default gateway

func GetDefaultGatewayIfaceName

func GetDefaultGatewayIfaceName() (string, error)

GetDefaultGatewayIfaceName get the interface name that has the default gateway

Types

type Ipv4Interface

type Ipv4Interface struct {
	Idx                   int
	Name                  string
	Description           string
	IpAddress             string
	IpMask                string
	DefaultGatewayAddress string
	DhcpEnabled           bool
}

func GetInterfaceByIP

func GetInterfaceByIP(ipAddr string) (Ipv4Interface, error)

GetInterfaceByIP gets an interface by ip address in the format a.b.c.d

func GetInterfaceByIndex

func GetInterfaceByIndex(idx int) (Ipv4Interface, error)

GetInterfaceByIndex gets an interface by index

func GetInterfaceByName

func GetInterfaceByName(name string) (Ipv4Interface, error)

GetInterfaceByName gets an interface by name

func GetInterfaces

func GetInterfaces() (ifaces []Ipv4Interface, err error)

GetInterfaces gets a list of interfaces and addresses

func (*Ipv4Interface) GetSubnet

func (i *Ipv4Interface) GetSubnet() *net.IPNet

func (Ipv4Interface) String

func (i Ipv4Interface) String() string

Jump to

Keyboard shortcuts

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