Skip to main content

Module pac

Module pac 

Source
Available on crate feature pac only.
Expand description

PAC evaluation (pac feature, off by default): script → Vec<ProxyStep> like resolve.

No in-crate fetch: pass body to evaluate. Untrusted code: PacPolicy defaults block DNS, fake local IP, 5 s budget. pac-quickjs to run. Bypass lists do not apply.

Structs§

AndroidPacResolverAndroid and pac-android-native
Resolves the Pac configuration ConnectivityManager reports by asking ProxySelector.getDefault().select(uri).
PacPolicy
Safety envelope for PAC evaluation (pac-quickjs and pac-subprocess; ignored by the native resolvers, which hand the script to the OS).
PacResolver
Routes a whole ProxyConfig to whichever PAC engine answers its mode.
PacScript
PAC script body (newtype so “this is JS that will run” stays visible in signatures).
SubprocessEvaluatorpac-subprocess
PacEvaluator that runs each evaluation in a fresh worker process and kills it at the deadline.

Enums§

PacRequirement
What requirement says a ProxyMode needs before routing.

Constants§

DEFAULT_PAC_TIMEOUT
The default evaluation timeout, five seconds.
QUICKJS_AVAILABLE
Whether this build carries QuickJS, so that evaluate runs a script rather than answering Error::PacEngineUnavailable: pac-quickjs on a target other than Android and iOS. Lets a caller pick an engine before calling, without its own cfg.

Traits§

PacEvaluator
A replaceable engine that evaluates a PAC script for one URL.

Functions§

evaluate
Evaluate script for url under policy (sanitize_url first).
evaluate_with_host
Like evaluate, but the caller chooses host (url is still sanitized).
parse_find_proxy_result
Parse a FindProxyForURL return string into an ordered fallback chain.
requirement
What mode needs before evaluate can be called for it.
sanitize_url
Chromium SanitizeUrl: strip userinfo and fragment always, and path and query only for https/wss. Not a PacPolicy knob. Custom PacEvaluator impls should still sanitize.

Type Aliases§

NativePacResolverAndroid and pac-android-native
The native PAC resolver this target has: AndroidPacResolver.