Documentation ¶
Index ¶
- Constants
- func GetLocalIP() (string, error)
- func HostAddress(host string, port int) string
- func HostAddress2(host string, port string) string
- func HostPort(addr string) (string, string, error)
- func IsSameAddr(addr1, addr2 net.Addr) bool
- func ListenOnTCPRandomPort(ip string) (*net.TCPListener, error)
- func ListenOnUDPRandomPort(ip string) (*net.UDPConn, error)
- func MatchIP(pattern, host, port string) bool
- func WSHostAddress(host string, port int, path string) string
- func WSHostAddress2(host string, port string, path string) string
- func WSSHostAddress(host string, port int, path string) string
- func WSSHostAddress2(host string, port string, path string) string
Constants ¶
View Source
const ( // Ipv4SplitCharacter use for slipt Ipv4 Ipv4SplitCharacter = "." // Ipv6SplitCharacter use for slipt Ipv6 Ipv6SplitCharacter = ":" )
Variables ¶
This section is empty.
Functions ¶
func HostAddress ¶ added in v1.11.23
HostAddress composes an ip:port style address. It's opposite function is net.SplitHostPort.
func HostAddress2 ¶ added in v1.11.23
HostAddress2 return a hostAddress
func IsSameAddr ¶ added in v1.5.2
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
ListenOnUDPRandomPort an udp endpoint listening on a random port
func MatchIP ¶ added in v1.9.1
MatchIP is used to determine whether @pattern and @host:@port match, It's supports subnet/range
func WSHostAddress ¶ added in v1.11.23
WSHostAddress return a ws hostAddress
func WSHostAddress2 ¶ added in v1.11.23
WSHostAddress2 return a ws hostAddress
func WSSHostAddress ¶ added in v1.11.23
WSSHostAddress return a wss hostAddress
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.