xnet

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2025 License: Apache-2.0 Imports: 9 Imported by: 13

Documentation

Index

Constants

View Source
const StaticLocalIP = "127.0.0.1"
View Source
const StaticLocalMac = "00:1A:2B:3C:4D:5E"

Variables

View Source
var (
	RetryTimes int           = 10
	Interval   time.Duration = time.Second * 5
)
View Source
var GetInterfaces = defaultGetInterfaces

Functions

func ExtractHostPort added in v0.1.1

func ExtractHostPort(addr string) (host string, port uint64, err error)

ExtractHostPort from address

func GetAvaliableAddr added in v0.1.25

func GetAvaliableAddr(logger xlog.Logger, localIp string, addr string) (newAddr string, err error)

:8080 [2000,30000) [2000,30000):rand [2000,30000):seq:5

func GetLocalIP

func GetLocalIP(masks ...string) string

GetLocalIP 获取IP地址

func GetLocalMac added in v0.2.6

func GetLocalMac(masks ...string) string

func IsLocalIPv4

func IsLocalIPv4(ip net.IP) bool

ipv4:IsLocalIP 检测IP地址是否内网

func IsLocalIPv4Addr

func IsLocalIPv4Addr(ip string) bool

ipv4: IsLocalIP 检测IP地址是否内网

func IsValidIP added in v0.1.1

func IsValidIP(addr string) bool

func Parse

func Parse(addr string) (proto, name string, err error)

解析协议信息(proto://name)

func ScanPort added in v0.1.25

func ScanPort(protocol string, hostname string, port int64) bool

Types

type PortPicker added in v0.1.25

type PortPicker func(logger xlog.Logger, localIp string, begin, end, step int64) int64

Jump to

Keyboard shortcuts

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