Documentation
¶
Overview ¶
Package egress runs backd's egress role: the only way a function process reaches the network. It is an HTTP forward/CONNECT proxy that resolves every target itself and refuses loopback, private, link-local (metadata), CGNAT, multicast and unspecified addresses, with backd's callback listener as its only exception. Each function process authenticates with a token scoped to its own invocation, naming the hosts it may reach, so the proxy enforces that allowlist too, in addition to the per-process --allow-net the executor already sets.
Index ¶
Constants ¶
const TokenPrefix = "bdg_"
TokenPrefix starts every egress credential.
Variables ¶
var ErrInvalidToken = errors.New("invalid or expired egress token")
ErrInvalidToken means an egress token is malformed, forged or expired.
Functions ¶
Types ¶
type Claims ¶
Claims are what an egress token carries: the hosts (as function.yaml's network list, plus backd's callback address) the process may reach through the proxy, and when the token expires.
type Proxy ¶
type Proxy struct {
Key []byte
AllowPrivate []string // host:port exceptions to the private-address block
Log *slog.Logger
Now func() time.Time // for tests; defaults to time.Now
Metrics *metrics.Metrics // counts decisions; nil turns it off
}
Proxy is backd's egress role. Every function process is given its own token (Sign), naming the hosts it may reach; the proxy checks that, and separately resolves each target itself and refuses the addresses blocked reports, except the hosts listed in AllowPrivate (backd's callback listener).