netlink

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2024 License: Apache-2.0 Imports: 5 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddrAdd added in v0.0.3

func AddrAdd(name string, addr string) error

添加网卡ip

func AddrDel added in v0.0.3

func AddrDel(name string, addr string) error

删除网卡ip

func GetAllIps added in v0.0.3

func GetAllIps() (cidrs []*net.IPNet, err error)

获取本地所有IP

func GetInterface added in v0.0.3

func GetInterface(name string) (iface net.Interface, err error)

获取本地网卡

func GetIps added in v0.0.3

func GetIps(name string) (cidrs []*net.IPNet, err error)

获取网卡所有IP

func GetLocalInterface

func GetLocalInterface(ifname string) (ip net.IP, mask net.IPMask, mac net.HardwareAddr, err error)

根据网卡名,获取网卡的ip、mask、mac。其中ip、mask默认只获取第一个。

func GetMac added in v0.0.2

func GetMac(ifname string) (mac net.HardwareAddr, err error)

根据网卡名,获取网卡的mac。

func LinkDel added in v0.0.3

func LinkDel(name string) error

删除网卡

func LinkSetHardwareAddr added in v0.0.3

func LinkSetHardwareAddr(name string, mac net.HardwareAddr) error

修改网卡mac

func LinkSetUp added in v0.0.3

func LinkSetUp(name string) error

启用网卡

func LoAddrClear added in v0.0.3

func LoAddrClear() error

清空lo上的其他IP

func RandAddrAdd added in v0.0.3

func RandAddrAdd(iface string) (out *net.IPNet, err error)

给网卡添加一个随机的cidr

func RandomCIDR added in v0.0.3

func RandomCIDR() (cidr *net.IPNet, err error)

随机生成cidr

Types

This section is empty.

Jump to

Keyboard shortcuts

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