route

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RTA_OIF     = RtAttrType(4)
	RTA_GATEWAY = RtAttrType(5)
)

https://elixir.bootlin.com/linux/v5.10.46/source/include/uapi/linux/rtnetlink.h#L336

View Source
const (
	AF_INET  = RtmFamily(2)  /* Internet IP Protocol */
	AF_INET6 = RtmFamily(10) /* IP version 6 */
)

RtMsg.Family https://elixir.bootlin.com/linux/v5.10.46/source/include/linux/socket.h#L179

View Source
const (
	RT_TABLE_MAIN = RtmTable(254)
)

RtMsg.Table https://elixir.bootlin.com/linux/v5.10.46/source/include/uapi/linux/rtnetlink.h#L325

Variables

View Source
var ErrDefaultRouteNotFound = errors.New("default route not found")
View Source
var RtAttrSizeof = nlmsgAlign(int64(unsafe.Sizeof(RtAttr{})))

Functions

This section is empty.

Types

type Info

type Info struct {
	Gateway net.IP
	IfIndex int
	IfName  string
}

func GetDefaultRoute

func GetDefaultRoute() (*Info, error)

type RtAttr

type RtAttr struct {
	Len  uint16
	Type RtAttrType
}

type RtAttrType

type RtAttrType = uint16

type RtMsg

type RtMsg struct {
	Family RtmFamily
	DstLen uint8
	SrcLen uint8
	Tos    uint8

	Table    RtmTable
	Protocol RtmProtocol
	Scope    RtmScope
	Type     RtmType

	Flags RtmFlag
}

RtMsg see: https://elixir.bootlin.com/linux/v5.10.46/source/include/uapi/linux/rtnetlink.h#L221

type RtmFamily

type RtmFamily = uint8

type RtmFlag

type RtmFlag = uint32

type RtmProtocol

type RtmProtocol = uint8

type RtmScope

type RtmScope = uint8

type RtmTable

type RtmTable = uint8

type RtmType

type RtmType = uint8

Jump to

Keyboard shortcuts

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