Untrusted
The policy for a URL a third party supplied. Per hop it refuses a lenient or malformed host form, a single-label name, a reserved name, a denied IP literal and a port outside allowedPorts; for every resolved address and every connect it refuses a denied address; it never uses a proxy; and it refuses a request that carries a sensitive header (Authorization, Proxy-Authorization, Cookie, Set-Cookie or any header added as sensitive).
Stable Core. No parameter admits an address or name the built-in tables deny (the special-purpose address table and the reserved names): extraDeniedRanges and extraDeniedHostSuffixes add denials, allowedPorts sets the port list (null admits any port), and mixedAnswers chooses between refusing a mixed answer and using its allowed addresses. Equality is on every property. toString() prints the port set and the number of denied ranges and suffixes, never their values.
Types
Collects the properties of an Untrusted. Not thread-safe; use it only inside the factory's lambda. Extend a set with += (extraDeniedRanges += block).
Properties
The ports a hop may use; null means any port. The default is 80, 443, 8080 and 8443.
Host-name suffixes refused as a reserved name, canonical (lower-case): the name itself and its subdomains.
Address blocks denied in addition to the built-in table. An IPv4 block also matches the IPv4 address embedded in an IPv4-mapped or NAT64 well-known (64:ff9b::/96) address; an IPv6 block matches IPv6 addresses. A deployment behind its own NAT64 prefix, or with an internal service on a public address, adds it here: neither is knowable to a library.
How a resolver answer with both allowed and denied addresses is treated; Reject by default.
The caps, timeouts and concurrency limits that go with this policy.
Functions
Two Untrusted policies are equal when their allowedPorts, extraDeniedRanges, extraDeniedHostSuffixes, mixedAnswers and settings are equal.
A diagnostic string for logs: the allowedPorts, the numbers of extraDeniedRanges and extraDeniedHostSuffixes, never their values, mixedAnswers and settings. Its format is not part of the API and may change.