nlalib

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2019 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	INVALID_HARDWAREADDR = "00:00:00:00:00:00"
	EMPTY_HARDWAREADDR   = ""
)
View Source
const COUNTERS_MAX = 256
View Source
const (
	FDB_SYSFS_CLASS_NET = "/sys/class/net"
)
View Source
const (
	QUEUE_INVALID = -1
)

Variables

This section is empty.

Functions

func AddIFAddr

func AddIFAddr(addr *net.IPNet, ifname string) error

func DelDummyRoute

func DelDummyRoute(dst *net.IPNet, ifname string) error

func DelIFAddr

func DelIFAddr(addr *net.IPNet, ifname string) error

func FdbSysfsPath added in v0.2.0

func FdbSysfsPath(ifname string) string

func GetNetlinkAddrs

func GetNetlinkAddrs() ([][]byte, error)
func GetNetlinkLinks() ([][]byte, error)

func GetNetlinkNeighs

func GetNetlinkNeighs() ([][]byte, error)

func GetNetlinkRoutes

func GetNetlinkRoutes() ([][]byte, error)

func HexSlice

func HexSlice(bs []byte) []string

func Hexdump

func Hexdump(bs []byte) string

func IpToString added in v0.2.0

func IpToString(ip net.IP) string

func IsInvalidHardwareAddr

func IsInvalidHardwareAddr(hwaddr net.HardwareAddr) bool

func NewClientConn

func NewClientConn(addr string, ch chan<- *ConnInfo) (*grpc.ClientConn, error)

func NewConnStatsHandler

func NewConnStatsHandler(ch chan<- *ConnInfo) stats.Handler

func NewDummyRoute

func NewDummyRoute(dst *net.IPNet, ifname string) (*netlink.Route, error)

func NewFDBEntry added in v0.4.0

func NewFDBEntry(hwaddr net.HardwareAddr, index int, vid uint16, flags int, state int) *netlink.Neigh

func NewIPNetFromIP

func NewIPNetFromIP(ip net.IP) *net.IPNet

func NewLinkAndAddr

func NewLinkAndAddr(addr *net.IPNet, ifname string) (netlink.Link, *netlink.Addr, error)

func NewNetlinkMessage

func NewNetlinkMessage(t uint16, data []byte) *syscall.NetlinkMessage

func NewNlMsghdr

func NewNlMsghdr(t uint16, length uint32) syscall.NlMsghdr

func NewNodeIdFromIF added in v0.2.0

func NewNodeIdFromIF(ifname string) (uint8, error)

func NewNodeIdFromIP added in v0.2.0

func NewNodeIdFromIP(ip net.IP) uint8

func ParseBridgeVlanInfoFlags added in v0.4.0

func ParseBridgeVlanInfoFlags(s string) (uint16, error)

func SetDummyRoute

func SetDummyRoute(dst *net.IPNet, ifname string) error

func StringBridgeVlanInfoFlags added in v0.4.0

func StringBridgeVlanInfoFlags(flags uint16) string

Types

type ConnInfo

type ConnInfo struct {
	LocalAddr  net.IP
	RemoteAddr net.IP
}

func NewConnInfo

func NewConnInfo(local net.IP, remote net.IP) *ConnInfo

type ConnStatsHandler

type ConnStatsHandler struct {
	// contains filtered or unexported fields
}

func (*ConnStatsHandler) HandleConn

func (h *ConnStatsHandler) HandleConn(ctxt context.Context, st stats.ConnStats)

func (*ConnStatsHandler) HandleRPC

func (h *ConnStatsHandler) HandleRPC(ctxt context.Context, st stats.RPCStats)

func (*ConnStatsHandler) TagConn

func (*ConnStatsHandler) TagRPC

type Counter16

type Counter16 struct {
	Count uint32
}

Counter(uint16)

func (*Counter16) Next

func (c *Counter16) Next() uint16

type Counter32

type Counter32 struct {
	Count uint32
}

Counter(uint32)

func (*Counter32) Next

func (c *Counter32) Next() uint32

type Counters16

type Counters16 struct {
	Counters [COUNTERS_MAX]Counter16
}

func NewCounters16

func NewCounters16() *Counters16

func (*Counters16) Next

func (c *Counters16) Next(index uint8) uint16

type Counters32

type Counters32 struct {
	Counters [COUNTERS_MAX]Counter32
}

func NewCounters32

func NewCounters32() *Counters32

func (*Counters32) Next

func (c *Counters32) Next(index uint8) uint32

type FdbEntry added in v0.2.0

type FdbEntry struct {
	MacAddr     [6]byte
	PortNo      uint8
	Local       uint8
	AgeingTimer uint32
	PortHi      uint8
	Pad0        uint8
	Unused      uint16
}

func ReadFdb added in v0.2.0

func ReadFdb(ifname string) ([]*FdbEntry, error)

func (*FdbEntry) HardwareAddr added in v0.2.0

func (e *FdbEntry) HardwareAddr() net.HardwareAddr

func (*FdbEntry) IsLocal added in v0.2.0

func (e *FdbEntry) IsLocal() bool

func (*FdbEntry) Port added in v0.2.0

func (e *FdbEntry) Port() uint16

func (*FdbEntry) String added in v0.2.0

func (e *FdbEntry) String() string

type Queue added in v0.3.1

type Queue struct {
	// contains filtered or unexported fields
}

func NewQueue added in v0.3.1

func NewQueue(maxSize int) *Queue

func (*Queue) Close added in v0.3.1

func (q *Queue) Close()

func (*Queue) Pop added in v0.3.1

func (q *Queue) Pop() (v interface{}, err error)

func (*Queue) Push added in v0.3.1

func (q *Queue) Push(v interface{}) error

Jump to

Keyboard shortcuts

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