port

package
v0.0.0-...-9a2cfe9 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2021 License: Apache-2.0, MIT Imports: 4 Imported by: 0

Documentation

Overview

Package port provides port ID allocation for netlink sockets.

A netlink port is any int32 value. Positive ports are typically equivalent to the PID of the binding process. If that port is unavailable, negative ports are searched to find a free port that will not conflict with other PIDS.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager allocates netlink port IDs.

+stateify savable

func New

func New() *Manager

New creates a new Manager.

func (*Manager) Allocate

func (m *Manager) Allocate(protocol int, hint int32) (int32, bool)

Allocate reserves a new port ID for protocol. hint will be taken if available.

func (*Manager) Release

func (m *Manager) Release(protocol int, port int32)

Release frees the specified port for protocol.

Preconditions: port is already allocated.

Jump to

Keyboard shortcuts

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