Documentation ¶
Index ¶
- type Port
- func GetFreePort(address string, protocol Protocol) (*Port, error)
- func GetFreePortInRange(address string, protocol Protocol, minPort, maxPort int) (*Port, error)
- func GetFreePortOnInterface(interfaceName string, protocol Protocol) (*Port, error)
- func GetFreePorts(address string, protocol Protocol, count int) ([]*Port, error)
- func GetFreeTCPPort(address string) (*Port, error)
- func GetFreeUDPPort(address string) (*Port, error)
- func GetPort(protocol Protocol, address string, port int) (*Port, error)
- func MustGetFreeTCPPort(address string) *Port
- func MustGetFreeUDPPort(address string) *Port
- type Protocol
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Port ¶
type Port struct { // Address is the address of the port (e.g. 127.0.0.1) Address string // Port is the port number Port int // Protocol is the protocol of the port (TCP or UDP) Protocol Protocol // Raw is the full OS listenable address (directly usable for net.Listen) NetListenAddress string }
Port obtained from the kernel
func GetFreePort ¶
GetFreePort from ip address and protocol
func GetFreePortInRange ¶
GetFreePortInRange for protocol within a port range
func GetFreePortOnInterface ¶
GetFreePortOnInterface by name and protocol
func GetFreePorts ¶
GetFreePorts collects "count" free ports of specific protocol
func GetFreeTCPPort ¶
GetFreeTCPPort gets a free tcp port on address
func GetFreeUDPPort ¶
GetFreeUDPPort gets a free udp port on address
func MustGetFreeTCPPort ¶
MustGetFreeTCPPort get a free tcp port for address or panic
func MustGetFreeUDPPort ¶
MustGetFreeUDPPort get a free udp port for address or panic
Click to show internal directories.
Click to hide internal directories.