Documentation
¶
Index ¶
Constants ¶
const Any = ""
Network address which represent any address. This is the default that we should use when checking if port is free.
const Loopback = "0.0.0.0"
Loopback network address. octopus should not bind to 0.0.0.0 unless we really want to expose something to the network.
Variables ¶
This section is empty.
Functions ¶
func AllocatePort ¶
AllocatePort looks for a port close to desiredPort, using the provided implementation of isPortAvailable to determine what ports can be used. We deal with wrapping and avoid allocating ports < 1024 TODO(nkubala)09/14/21: plumb through context from callers
func GetAvailablePort ¶
GetAvailablePort returns an available port that is near the requested port when possible. First, check if the provided port is available on the specified address and INADDR_ANY. If so, use it. If not, check if any of the next 10 subsequent ports are available. If not, check if any of ports 4503-4533 are available. If not, return a random port, which hopefully won't collide with any future containers
See https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.txt