netx

package
v1.9.1 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2021 License: BSD-2-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DialTCP added in v1.8.2

func DialTCP(address string) (*net.TCPConn, error)

DialTCP dial to a address using tcp

func DialTCPContext added in v1.8.2

func DialTCPContext(ctx context.Context, address string) (*net.TCPConn, error)

DialTCPContext dial to a address using tcp with a context

func DialTCPTimeout added in v1.8.2

func DialTCPTimeout(address string, timeout time.Duration) (*net.TCPConn, error)

DialTCPTimeout dial to a address using tcp with a timeout

func DialTCPWithDialer added in v1.8.2

func DialTCPWithDialer(dialer net.Dialer, address string) (*net.TCPConn, error)

DialTCPWithDialer dial to a address using tcp

func JoinHostPort

func JoinHostPort(host string, port uint16) string

JoinHostPort combines host and port into a network address of the form "host:port". If host contains a colon, as found in literal IPv6 addresses, then JoinHostPort returns "[host]:port".

func SplitHostPort

func SplitHostPort(str string) (string, uint16, error)

SplitHostPort splits a network address of the form "host:port", "host%zone:port", "[host]:port" or "[host%zone]:port" into host or host%zone and port. If port part not exists, or is not a valid port, return an error.

Types

type HostType

type HostType int8

HostType is an enum to distinct host type, can be domain, ipv4, or ipv6

const (
	//ILLEGAL Not a host
	ILLEGAL HostType = -1
	//DOMAIN domain host
	DOMAIN HostType = 0
	//IPv4 ipv4 address host
	IPv4 HostType = 1
	//IPv6 ipv6 address host
	IPv6 HostType = 2
)

func GetHostType

func GetHostType(host string) HostType

GetHostType return type for this host

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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