ports

package
v0.35.2 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2026 License: GPL-3.0 Imports: 4 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package ports checks and picks the ports that tunnels listen on, within the ports the server config allows.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Allowed

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

Allowed is the set of ports tunnels may listen on. The zero value allows every port.

func ParseAllowed

func ParseAllowed(spec string) Allowed

ParseAllowed returns the ports of spec, the allow_ports setting: ports and ranges such as "8000-9000,9999". An empty spec allows every port.

func (Allowed) GenerateServerPort

func (a Allowed) GenerateServerPort(m string) int

GenerateServerPort picks a free allowed port for a listener of mode m, or 0 when there is none.

func (Allowed) GenerateTunnelPort

func (a Allowed) GenerateTunnelPort(t *model.Tunnel) int

GenerateTunnelPort picks a free allowed port for the listeners of t, or 0 when there is none.

func (Allowed) TestServerPort

func (a Allowed) TestServerPort(p int, m string) (b bool)

TestServerPort reports whether a listener of mode m can open on port p.

func (Allowed) TestTunnelPort

func (a Allowed) TestTunnelPort(t *model.Tunnel) bool

TestTunnelPort reports whether the listeners of t can open on its port.

Jump to

Keyboard shortcuts

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