netif

package
v0.0.0-...-d79a36e Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2018 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SocketClose

func SocketClose(fd uintptr)

SocketClose is a convenience method to clean up a socket file descriptor after use. It's implied that this call cannot fail, and if the OS disagrees, we panic.

func SocketFd

func SocketFd() (fd uintptr)

SocketFd is a convenience method to get a socket file descriptor on which to execute ioctls. It's implied that this call cannot fail, and if the OS disagrees, we panic. A fd returned in this way must be closed by SocketClose().

Types

type NetIf

type NetIf [unix.IFNAMSIZ]byte

NetIf represents a network interface.

func (NetIf) Down

func (n NetIf) Down() (err error)

Down clears the interface flags "UP" and "RUNNING"

func (NetIf) GetHWAddress

func (n NetIf) GetHWAddress() (hwa net.HardwareAddr, err error)

GetHWAddress returns the MAC of the interface.

func (NetIf) Index

func (n NetIf) Index() (idx int32, err error)

Index gets the index of the interface.

func (NetIf) SetHWAddress

func (n NetIf) SetHWAddress(hwa net.HardwareAddr) (err error)

SetHWAddress changes the MAC of the interface.

func (NetIf) Up

func (n NetIf) Up() (err error)

Up sets the interface flags "UP" and "RUNNING"

type NetIf_Flags

type NetIf_Flags struct {
	Name  [unix.IFNAMSIZ]byte
	Flags int16
}

NetIf_Flags is a decomposed type, representing one identity of `struct ifreq` (which is a C union type - cannot be represented in Go). See `man 7 netdevice`

type NetIf_Index

type NetIf_Index struct {
	Name  [unix.IFNAMSIZ]byte
	Index int32
}

NetIf_Index is a decomposed type, representing one identity of `struct ifreq` (which is a C union type - cannot be represented in Go). See `man 7 netdevice`

func GetByIndex

func GetByIndex(i int32) (r *NetIf_Index, err error)

GetByIndex returns a completed NetIf_Index struct for the interface at the specified index.

func GetByName

func GetByName(n string) (r *NetIf_Index, err error)

GetByName returns a completed NetIf_Index struct for the interface with the specified name.

type NetIf_Sockaddr

type NetIf_Sockaddr struct {
	Name     [unix.IFNAMSIZ]byte
	SockAddr unix.RawSockaddr
}

NetIf_Sockaddr is a decomposed type, representing one identity of struct ireq (which is a C union type - cannot be represented in Go). See man 7 netdevice

Jump to

Keyboard shortcuts

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