bookclerk_workerd::egress

Development These docs follow the development version and change with every merge.

Last updated View as Markdown

Host egress policy for workerd guests (wraps shared EgressPolicy).

Structs

EgressProxy

pub struct EgressProxy {
    /* private fields */
}

Initial-host allowlist with redirect-follow semantics.

Thin wrapper kept for call sites; core matching lives in bookclerk_plugin_manifest::EgressPolicy.

EgressProxy::from_manifest

pub fn from_manifest(manifest: &PluginManifest) -> Self

Builds egress constraints from a plugin manifest network section.

Arguments
  • manifest - Parsed plugin manifest.
Returns

Updated Self for chaining.

EgressProxy::from_policy

pub fn from_policy(inner: EgressPolicy) -> Self

Builds egress constraints from an already-approved host policy.

Arguments
  • inner - inner input for this call.
Returns

Updated Self for chaining.

EgressProxy::with_relay

pub fn with_relay(self, addr: impl Into<String>) -> Self

Routes the isolate's egress through the launcher's relay.

Arguments
  • addr - Workerd external address the relay listens on.
Returns

Updated Self for chaining.

EgressProxy::relay

pub fn relay(&self) -> Option<&str>

Workerd external address of the egress relay, when one is set.

EgressProxy::policy

pub fn policy(&self) -> &EgressPolicy

Returns the underlying egress policy for inspection / logging.

EgressProxy::mode

pub fn mode(&self) -> NetworkMode

Network mode from the plugin manifest.

EgressProxy::max_redirects

pub fn max_redirects(&self) -> u32

Maximum redirect hops after an allowed initial request.

EgressProxy::allowed_initial_hosts

pub fn allowed_initial_hosts(&self) -> &[String]

domains entries the guest may fetch before redirects: a host pattern with an optional :port (no port grants 80 and 443).

EgressProxy::allows_initial_host

pub fn allows_initial_host(&self, host: &str) -> bool

Whether a direct (non-redirect) request host is permitted.

Arguments
  • host - Hostname being checked for egress.
Returns

true when the predicate holds.

EgressProxy::allows_redirect_hop

pub fn allows_redirect_hop(&self, host: &str, hop_index: u32) -> bool

Redirect hops must stay in the fetch allowlist unless allowUndeclaredPublicRedirects is set. Address-space policy still applies (loopback / RFC1918 / link-local / metadata stay denied).

Arguments
  • host - Redirect target hostname.
  • hop_index - Numeric hop index after the initial request.
Returns

true when the predicate holds.

Implements: Clone, Debug

Generated from crates/bookclerk-workerd at main · View as Markdown