gxnet

package
v1.11.8 Latest Latest
Warning

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

Go to latest
Published: May 4, 2021 License: Apache-2.0 Imports: 5 Imported by: 53

Documentation

Index

Constants

View Source
const (
	// Ipv4SplitCharacter use for slipt Ipv4
	Ipv4SplitCharacter = "."
	// Ipv6SplitCharacter use for slipt Ipv6
	Ipv6SplitCharacter = ":"
)

Variables

This section is empty.

Functions

func GetLocalIP

func GetLocalIP() (string, error)

GetLocalIP get local ip

func IsSameAddr added in v1.5.2

func IsSameAddr(addr1, addr2 net.Addr) bool

refer from https://github.com/facebookarchive/grace/blob/master/gracenet/net.go#L180

func ListenOnTCPRandomPort added in v1.9.0

func ListenOnTCPRandomPort(ip string) (*net.TCPListener, error)

ListenOnTCPRandomPort a tcp server listening on a random port by tcp protocol

func ListenOnUDPRandomPort added in v1.9.0

func ListenOnUDPRandomPort(ip string) (*net.UDPConn, error)

ListenOnUDPRandomPort a udp endpoint listening on a random port

func MatchIP added in v1.9.1

func MatchIP(pattern, host, port string) bool

MatchIP is used to determine whether @pattern and @host:@port match, It's supports subnet/range

Types

This section is empty.

Jump to

Keyboard shortcuts

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