transparentfirewall

package
v0.16.1 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2026 License: BSD-3-Clause, GPL-3.0 Imports: 16 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

Overview

Package transparentfirewall places explicitly configured TCP message gateways on a routed service path. Gateways must already run in the target namespace.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Install

func Install(ctx context.Context, c Config) (cleanup func() error, result error)

Install probes an existing listener in the pinned target namespace before atomically creating scoped prerouting DNAT rules. It never launches a process, changes routes/sysctls, or installs an output hook. Gateway upstream sockets must be created by a gateway process already running in that namespace. DNAT targets the first ready unicast ingress address of the service family; the gateway must bind that address or a matching wildcard listener. The TCP probe checks reachability, not gateway policy or TLS configuration. NAT applies to new connections; existing conntrack mappings persist until the corresponding sessions close or expire. Cleanup does not flush conntrack.

The returned cleanup is idempotent and uses its own timeout. Call it after ctx cancellation; ctx only bounds installation. Cleanup errors retain the lock and descriptors for retry. A process crash leaves the owned table in place; subsequent installation refuses stale tables rather than silently adopting one. A non-nil cleanup may accompany an installation error if rollback failed. Cooperating installers must share /run for namespace/table flock ownership.

Types

type Config

type Config struct {
	NetworkNamespace string
	IngressInterface string
	// OriginalService accepts one unicast IP or CIDR. A prefix still routes to
	// one gateway with a fixed upstream, not an automatic original-destination proxy.
	OriginalService           string
	OriginalPort, GatewayPort int
	ManagementPeers           []string // CIDRs exempt in both directions
	Protocol                  string   // explicit TCP gateway protocol
	// TLSMode must explicitly be plaintext or terminated. The caller owns TLS
	// certificates and gateway configuration; opaque pass-through is unsupported.
	TLSMode string
}

Jump to

Keyboard shortcuts

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