{"modulePath":"github.com/hyperhq/hyper","version":"v0.5.0","isLatest":false,"isStandardLibrary":false,"goos":"linux","goarch":"amd64","docs":"# package portallocator\n\n## Constants\n\n```go\nconst (\n\tDefaultPortRangeStart = 49153\n\tDefaultPortRangeEnd   = 65535\n)\n```\n\n## Variables\n\n```go\nvar (\n\tErrAllPortsAllocated = errors.New(\"all ports are allocated\")\n\tErrUnknownProtocol   = errors.New(\"unknown protocol\")\n)\n```\n\n```go\nvar (\n\tDefaultPortAllocator = New()\n\tRequestPort          = DefaultPortAllocator.RequestPort\n\tReleasePort          = DefaultPortAllocator.ReleasePort\n\tReleaseAll           = DefaultPortAllocator.ReleaseAll\n)\n```\n\n## Functions\n\n```go\nfunc PortRange() (int, int)\n```\n\n## Types\n\n```go\ntype ErrPortAlreadyAllocated struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc NewErrPortAlreadyAllocated(ip string, port int) ErrPortAlreadyAllocated\n```\n\n```go\nfunc (e ErrPortAlreadyAllocated) Error() string\n```\n\n```go\nfunc (e ErrPortAlreadyAllocated) IP() string\n```\n\n```go\nfunc (e ErrPortAlreadyAllocated) IPPort() string\n```\n\n```go\nfunc (e ErrPortAlreadyAllocated) Port() int\n```\n\n```go\ntype PortAllocator struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc New() *PortAllocator\n```\n\n```go\nfunc (p *PortAllocator) ReleaseAll() error\n```\nReleaseAll releases all ports for all ips.\n\n```go\nfunc (p *PortAllocator) ReleasePort(ip net.IP, proto string, port int) error\n```\nReleasePort releases port from global ports pool for specified ip and proto.\n\n```go\nfunc (p *PortAllocator) RequestPort(ip net.IP, proto string, port int) (int, error)\n```\nRequestPort requests new port from global ports pool for specified ip and proto. If port is 0 it returns first free port. Otherwise it cheks port availability in pool and return that port or error if port is already busy.\n\n","path":"github.com/hyperhq/hyper/lib/portallocator","name":"portallocator","synopsis":"","isRedistributable":true}
