netinfo

package
v0.0.0-...-be1852b Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ROUTEPATH = "/proc/net/route"

Functions

func B2ip

func B2ip(bs []byte) (uint32, error)

bs -> uint32

func GetSrcIpForDst

func GetSrcIpForDst(ip uint32) (uint32, error)

func Ip2s

func Ip2s(ip uint32) string

func S2ip

func S2ip(s string) (uint32, error)

127.0.0.1 -> uint32

Types

type Local

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

func NewLocal

func NewLocal() (*Local, error)

func (*Local) GetInterfaceByIp

func (l *Local) GetInterfaceByIp(ip uint32) (*LocalInterface, error)

func (*Local) GetInterfaceByName

func (l *Local) GetInterfaceByName(name string) (*LocalInterface, error)

func (*Local) String

func (l *Local) String() string

type LocalInterface

type LocalInterface struct {
	Ip     uint32
	Device string
	Mask   uint32
}

func (*LocalInterface) String

func (li *LocalInterface) String() string

type Route

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

func NewRoute

func NewRoute() (*Route, error)

func (*Route) GetDevice

func (r *Route) GetDevice(dst uint32) (string, error)

func (*Route) Load

func (r *Route) Load(fname string) error

func (*Route) String

func (r *Route) String() string

type RouteItem

type RouteItem struct {
	Dest    uint32
	Gateway uint32
	Mask    uint32
	Device  string
}

func (*RouteItem) String

func (ri *RouteItem) String() string

Jump to

Keyboard shortcuts

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