freeport

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: May 18, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Port

type Port struct {
	Address  string
	Port     int
	Protocol Protocol
}

Port obtained from the kernel

func GetFreePort

func GetFreePort(address string, protocol Protocol) (*Port, error)

GetFreePort from ip address and protocol

func GetFreePortInRange

func GetFreePortInRange(address string, protocol Protocol, minPort, maxPort int) (*Port, error)

GetFreePortInRange for protocol within a port range

func GetFreePortOnInterface

func GetFreePortOnInterface(interfaceName string, protocol Protocol) (*Port, error)

GetFreePortOnInterface by name and protocol

func GetFreePorts

func GetFreePorts(address string, protocol Protocol, count int) ([]*Port, error)

GetFreePorts collects "count" free ports of specific protocol

func GetFreeTCPPort

func GetFreeTCPPort(address string) (*Port, error)

GetFreeTCPPort gets a free tcp port on address

func GetFreeUDPPort

func GetFreeUDPPort(address string) (*Port, error)

GetFreeUDPPort gets a free udp port on address

func GetPort

func GetPort(protocol Protocol, address string, port int) (*Port, error)

GetPort for protocol is the specific port is free

func MustGetFreeTCPPort

func MustGetFreeTCPPort(address string) *Port

MustGetFreeTCPPort get a free tcp port for address or panic

func MustGetFreeUDPPort

func MustGetFreeUDPPort(address string) *Port

MustGetFreeUDPPort get a free udp port for address or panic

type Protocol

type Protocol uint8

Protocol represents the supported protocol type

const (
	TCP Protocol = iota
	UDP
)

Jump to

Keyboard shortcuts

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