iface

package
v1.9.10 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Rendered for windows/amd64

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigureInterface

func ConfigureInterface(ifaceIndex int, family AddressFamily, options ConfigurationOptions) error

ConfigureInterface configures the given network interface with the given configuration options.

func DisableDhcpForInterface

func DisableDhcpForInterface(ifaceIndex int, family AddressFamily) error

DisableDhcpForInterface disables hcp for given network interface.

func DisableForwardingForInterface

func DisableForwardingForInterface(ifaceIndex int, family AddressFamily) error

DisableForwardingForInterface disables forwarding for given network interface.

func EnableDhcpForInterface

func EnableDhcpForInterface(ifaceIndex int, family AddressFamily) error

EnableDhcpForInterface enables dhcp for given network interface.

func EnableForwardingForInterface

func EnableForwardingForInterface(ifaceIndex int, family AddressFamily) error

EnableForwardingForInterface enables forwarding for given network interface.

func GetDNSConfigurationByMAC

func GetDNSConfigurationByMAC(search string, family AddressFamily) (types.DNS, error)

GetDNSConfigurationByMAC returns dns configuration for given network interface.

func GetInterfaceIndexByIP

func GetInterfaceIndexByIP(search net.IP) (int, error)

GetInterfaceIndexByIP tries to get the network interface index with the given ip address.

func IsDhcpEnabledForInterface

func IsDhcpEnabledForInterface(ifaceIndex int, family AddressFamily) (bool, error)

IsDhcpEnabledForInterface returns true if the given network interface is enabling dhcp.

func IsForwardingEnabledForInterface

func IsForwardingEnabledForInterface(ifaceIndex int, family AddressFamily) (bool, error)

IsForwardingEnabledForInterface returns true if the given network interface is enabling forwarding.

func SetMTUForInterface

func SetMTUForInterface(ifaceIndex int, family AddressFamily, mtu int) error

SetMTUForInterface configures the MTU for given network interface.

Types

type AddressFamily

type AddressFamily string
const (
	IPv4 AddressFamily = "IPv4"
	IPv6 AddressFamily = "IPv6"
	Dual AddressFamily = ""
)

type ConfigurationOptions

type ConfigurationOptions struct {
	Forwarding *bool
	Dhcp       *bool
	Mtu        int
}

ConfigurationOptions specifies the options to configure.

type Interface

type Interface struct {
	Index      int    `json:"InterfaceIndex"`
	Alias      string `json:"InterfaceAlias"`
	Name       string `json:"InterfaceName"`
	Desc       string `json:"InterfaceDescription"`
	MTU        int    `json:"MtuSize"`
	Virtual    bool   `json:"Virtual"`
	MacAddress string `json:"MacAddress"`
}

func GetDefaultGatewayInterface

func GetDefaultGatewayInterface() (*Interface, error)

GetDefaultGatewayInterface returns the first network interface found with a default gateway set.

func GetInterfaceByIndex

func GetInterfaceByIndex(search int) (*Interface, error)

GetInterfaceByIndex tries to get the network interface with the given index.

func GetInterfaceByMAC

func GetInterfaceByMAC(search string, isPhysical bool) (*Interface, error)

GetInterfaceByMAC tries to get the network interface with the given mac address.

func (*Interface) ToNetInterface

func (i *Interface) ToNetInterface() *net.Interface

Jump to

Keyboard shortcuts

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