gateway

package
v1.9.1-rc5 Latest Latest
Warning

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

Go to latest
Published: May 4, 2026 License: AGPL-3.0 Imports: 9 Imported by: 0 modules, 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

Index

Constants

This section is empty.

Variables

View Source
var DefaultPorts = []uint16{80, 443, 1000, 1001, 1002, 7, 8080, 8443}

DefaultPorts is the default set of ports the gateway proxies.

Functions

This section is empty.

Types

type Config

type Config struct {
	Subnet     string   // CIDR subnet for local IPs (default: "10.4.0.0/16")
	SocketPath string   // Daemon socket path
	Ports      []uint16 // Ports to proxy (default: DefaultPorts)
}

Config configures the gateway.

type Gateway

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

Gateway bridges standard IP/TCP traffic to the Pilot Protocol overlay. In proxy mode, it listens on mapped local IPs and forwards TCP connections through Pilot Protocol streams.

func New

func New(cfg Config) (*Gateway, error)

New creates a new Gateway.

func (*Gateway) Map

func (gw *Gateway) Map(pilotAddr protocol.Addr, localIP string) (net.IP, error)

Map registers a Pilot address and starts proxying for it. If localIP is empty, one is auto-assigned from the subnet.

func (*Gateway) Mappings

func (gw *Gateway) Mappings() *MappingTable

Mappings returns the mapping table for external use.

func (*Gateway) Start

func (gw *Gateway) Start() error

Start connects to the daemon and begins proxying.

func (*Gateway) Stop

func (gw *Gateway) Stop()

Stop shuts down the gateway and cleans up loopback aliases. Safe to call multiple times (M17 fix).

func (*Gateway) Unmap

func (gw *Gateway) Unmap(localIP string) error

Unmap removes a mapping and stops proxying.

type Mapping

type Mapping struct {
	LocalIP   net.IP
	PilotAddr protocol.Addr
}

All returns all current mappings as (localIP, pilotAddr) pairs.

type MappingTable

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

MappingTable maps local IPs to Pilot addresses and vice versa.

func NewMappingTable

func NewMappingTable(cidr string) (*MappingTable, error)

NewMappingTable creates a mapping table for the given subnet (e.g. "10.4.0.0/16").

func (*MappingTable) All

func (mt *MappingTable) All() []Mapping

func (*MappingTable) Lookup

func (mt *MappingTable) Lookup(localIP net.IP) (protocol.Addr, bool)

Lookup returns the Pilot address for a local IP.

func (*MappingTable) Map

func (mt *MappingTable) Map(pilotAddr protocol.Addr, localIP net.IP) (net.IP, error)

Map registers a mapping between a Pilot address and a local IP. If localIP is nil, the next available IP in the subnet is assigned.

func (*MappingTable) ReverseLookup

func (mt *MappingTable) ReverseLookup(addr protocol.Addr) (net.IP, bool)

ReverseLookup returns the local IP for a Pilot address.

func (*MappingTable) Unmap

func (mt *MappingTable) Unmap(localIP net.IP) error

Unmap removes a mapping by local IP.

Jump to

Keyboard shortcuts

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