gxnet

package
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: May 21, 2023 License: Apache-2.0 Imports: 8 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 ConnCheck added in v1.12.3

func ConnCheck(conn net.Conn) error

func GetLocalIP

func GetLocalIP() (string, error)

GetLocalIP get local ip

func HostAddress added in v1.11.23

func HostAddress(host string, port int) string

HostAddress composes an ip:port style address. It's opposite function is net.SplitHostPort.

func HostAddress2 added in v1.11.23

func HostAddress2(host string, port string) string

HostAddress2 return a hostAddress

func HostPort added in v1.11.23

func HostPort(addr string) (string, string, error)

HostPort return host, port, err

func IsSameAddr added in v1.5.2

func IsSameAddr(addr1, addr2 net.Addr) bool

IsSameAddr 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 an 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

func WSHostAddress added in v1.11.23

func WSHostAddress(host string, port int, path string) string

WSHostAddress return a ws hostAddress

func WSHostAddress2 added in v1.11.23

func WSHostAddress2(host string, port string, path string) string

WSHostAddress2 return a ws hostAddress

func WSSHostAddress added in v1.11.23

func WSSHostAddress(host string, port int, path string) string

WSSHostAddress return a wss hostAddress

func WSSHostAddress2 added in v1.11.23

func WSSHostAddress2(host string, port string, path string) string

WSSHostAddress2 return a wss hostAddress

Types

This section is empty.

Jump to

Keyboard shortcuts

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