egressproxy

package
v0.0.0-...-804b954 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package egressproxy provides an exact-target forward proxy for trust-scoped workloads.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsPublicAddress

func IsPublicAddress(address net.IP) bool

IsPublicAddress reports whether an IP is globally routable under the proxy's reviewed special-use denylist. It is shared by sandbox command egress authorization; callers still must resolve and pin each connection themselves.

Types

type Config

type Config struct {
	// AllowedTargets is the finite exact host/port allowlist.
	AllowedTargets []Target
	// DialContext establishes one already-authorized target connection. Nil uses a standard dialer.
	DialContext func(context.Context, string, string) (net.Conn, error)
	// Resolve resolves a declared DNS host before dialing. Nil uses the system resolver.
	Resolve func(context.Context, string) ([]net.IPAddr, error)
}

Config declares the complete egress authority for one proxy process.

type Proxy

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

Proxy is a validated HTTP proxy with no ambient target authority.

func New

func New(config Config) (Proxy, error)

New validates the complete finite target allowlist.

func (Proxy) ActiveTunnelCount

func (proxy Proxy) ActiveTunnelCount() int

ActiveTunnelCount reports the number of hijacked CONNECT tunnels that have not yet drained. It is intended for process shutdown accounting.

func (Proxy) CloseActiveTunnels

func (proxy Proxy) CloseActiveTunnels() int

CloseActiveTunnels force-closes each active CONNECT tunnel and returns the number of tunnel pairs that received the shutdown signal.

func (Proxy) ServeHTTP

func (proxy Proxy) ServeHTTP(writer http.ResponseWriter, request *http.Request)

ServeHTTP handles absolute-form HTTP and HTTPS CONNECT proxy requests only to allowlisted targets.

func (Proxy) Targets

func (proxy Proxy) Targets() []string

Targets returns a sorted copy of the configured target inventory for authorized diagnostics.

func (Proxy) WaitForTunnels

func (proxy Proxy) WaitForTunnels(ctx context.Context) error

WaitForTunnels waits until every active CONNECT tunnel has drained or the supplied shutdown context expires.

type Target

type Target struct {
	// Host is an exact public DNS name without wildcards.
	Host string
	// Port is the exact permitted TCP port.
	Port int
}

Target is one exact DNS host and TCP port allowed through the proxy.

func ParseTargets

func ParseTargets(input []Target) ([]Target, error)

ParseTargets validates a finite exact-target inventory for composition roots.

Jump to

Keyboard shortcuts

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