rtnlroute

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2022 License: MIT Imports: 5 Imported by: 0

README

go-rtnlroute

go-rtnlroute provides a rtnetlink library about network route for Go.

License

This software is released under the MIT License, see LICENSE

Documentation

Index

Constants

View Source
const (
	RTA_PREF = 20
)
View Source
const (
	SizeofHeader = 12
)

Variables

This section is empty.

Functions

func Create

func Create(c *nl.Client, r *Request) error

func NativeEndian

func NativeEndian() binary.ByteOrder

func Remove

func Remove(c *nl.Client, r *Request) error

Types

type Cacheinfo

type Cacheinfo struct {
	Clntref uint32
	Lastuse uint32
	Expires uint32
	Error   uint32
	Used    uint32
	ID      uint32
	Ts      uint32
	Tsage   uint32
}

func DecodeCacheinfo

func DecodeCacheinfo(b []byte) (*Cacheinfo, error)
type Header struct {
	Family   uint8
	Dstlen   uint8
	Srclen   uint8
	Tos      uint8
	Table    uint8
	Protocol uint8
	Scope    uint8
	Type     uint8
	Flags    uint32
}

func DecodeHeader

func DecodeHeader(b []byte) (Header, error)

func (Header) Encode

func (h Header) Encode(b []byte) (int, error)

func (Header) Len

func (h Header) Len() int

type Request

type Request struct {
	Header Header
	Attrs  nl.AttrList
}

func (*Request) AddDst

func (r *Request) AddDst(dst *net.IPNet) error

func (*Request) AddIfName

func (r *Request) AddIfName(ifname string) error

type Route

type Route struct {
	Header  Header
	Table   uint32
	Pref    uint8
	Dst     net.IP
	Gw      net.IP
	Prefsrc net.IP
	Oif     uint32
	Prio    uint32
	Cache   *Cacheinfo
}

TODO:

func DecodeRoute

func DecodeRoute(b []byte) (*Route, error)

func GetAll

func GetAll(c *nl.Client, r *Request) ([]Route, error)

Jump to

Keyboard shortcuts

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