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 ¶
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
}