silk/http_proxy
Profiles: aarch64-apple-darwin, aarch64-unknown-linux-gnu, aarch64-unknown-linux-gnu-no-libc, wasm32-unknown-unknown, x86_64-unknown-linux-gnu, x86_64-unknown-linux-gnu-no-libc.
Bounded HTTP proxy policy, pure route selection, and owned CONNECT rejection metadata.
Details
Proxy policy owns its prepared authentication token and exact-origin bypass entries. Selection does not allocate or use the network. A selected route supplies its configured authentication only through bounded output. CONNECT rejection copies have fixed field and owned-byte limits.
Import as ProxyConfig with import silk.http_proxy { ProxyConfig }.
Public declarations: 15.
ProxyComponent
pub enum ProxyComponentThe proxy value rejected during admission.
ProxyUri
ProxyUri = 0The proxy URI text.
ProxyEndpoint
ProxyEndpoint = 1The programmatic proxy endpoint.
Authentication
Authentication = 2The prepared authentication token.
Bypass
Bypass = 3The exact-origin bypass policy.
Configuration
Configuration = 4The complete proxy configuration.
Route
Route = 5A selected route used by the wrong operation or with a different origin.
ProxyLimit
pub enum ProxyLimitA bounded proxy configuration resource.
AuthenticationBytes
AuthenticationBytes = 0The maximum encoded authentication-token byte count.
BypassOrigins
BypassOrigins = 1The maximum exact-origin bypass-entry count.
OwnedConfigurationBytes
OwnedConfigurationBytes = 2The maximum total owned configuration byte count.
ProxyReason
pub union ProxyReasonThe reason proxy policy admission failed.
InvalidProxyUri
ProxyReason.InvalidProxyUri: ProxyReasonThe proxy URI has invalid syntax or a prohibited URI component.
InvalidProxyPort
ProxyReason.InvalidProxyPort: ProxyReasonThe programmatic proxy endpoint has port zero.
InvalidAuthentication
ProxyReason.InvalidAuthentication: ProxyReasonThe prepared Basic token is empty or is not canonical strict Base64.
SizeOverflow
ProxyReason.SizeOverflow: ProxyReasonThe required owned byte count does not fit in usize.
LimitExceeded
ProxyReason.LimitExceeded { limit: ProxyLimit, allowed: usize, attempted: usize }: ProxyReasonA resource exceeds its admitted maximum.
Field limit
pub limit: ProxyLimitThe resource that exceeds its limit.
Field allowed
pub allowed: usizeThe inclusive admitted maximum.
Field attempted
pub attempted: usizeThe rejected resource value.
UnsupportedProxyTransport
ProxyReason.UnsupportedProxyTransport: ProxyReasonThe proxy URI uses the unsupported https scheme.
InvalidRoute
ProxyReason.InvalidRoute: ProxyReasonThe selected route mode or original origin is incompatible with the requested operation.
ProxyAdmissionError
pub struct ProxyAdmissionErrorA copyable proxy-policy admission failure containing no identity or credential bytes.
Field component
pub component: ProxyComponentThe proxy value that failed admission.
Field reason
pub reason: ProxyReasonThe admission rule that failed.
ProxyError
pub union ProxyErrorA typed proxy failure whose response variants own only bounded, nonsecret metadata.
Admission
ProxyError.Admission { error: ProxyAdmissionError }: ProxyErrorConfiguration, route, or credential admission failed without retaining input bytes.
Field error
pub error: ProxyAdmissionErrorThe structured copyable admission failure.
ProxyMetadataLimit
ProxyError.ProxyMetadataLimit: ProxyErrorA complete CONNECT response exceeded the fixed owned-metadata budget.
ProxyAuthenticationRequired
ProxyError.ProxyAuthenticationRequired { response: OwnedResponseHead }: ProxyErrorA 407 response retaining status, reason, and ordered Proxy-Authenticate fields only.
Field response
pub response: OwnedResponseHeadThe bounded independently owned response metadata.
ProxyRejected
ProxyError.ProxyRejected { response: OwnedResponseHead }: ProxyErrorAnother final non-2xx response retaining status, reason, and all ordered fields.
Field response
pub response: OwnedResponseHeadThe bounded independently owned response metadata.
InvalidConnectResponse
ProxyError.InvalidConnectResponse: ProxyErrorResponse classification was attempted before a final CONNECT response existed.
Associated function ProxyError.invalidRoute
pub fn invalidRoute() -> ProxyErrorReturns the credential-free failure for an incompatible sealed route.
ProxyConfigId
pub struct ProxyConfigIdAn opaque configuration identity made from a caller-supplied nonsecret u64.
Associated function ProxyConfigId.make
pub fn make(value: u64) -> ProxyConfigIdPreserves a caller-supplied nonsecret identity payload opaquely.
Method ProxyConfigId.equals
pub fn equals<'life0, 'life1>(self: &'life0 ProxyConfigId, other: &'life1 ProxyConfigId) -> boolReports exact caller-payload equality without exposing the payload.
ProxyAuthContextId
pub struct ProxyAuthContextIdAn opaque authentication-context identity made from a caller-supplied nonsecret u64.
Associated function ProxyAuthContextId.make
pub fn make(value: u64) -> ProxyAuthContextIdPreserves a caller-supplied nonsecret identity payload opaquely.
Method ProxyAuthContextId.equals
pub fn equals<'life0, 'life1>(self: &'life0 ProxyAuthContextId, other: &'life1 ProxyAuthContextId) -> boolReports exact caller-payload equality without exposing the payload.
ProxyAuth
pub union ProxyAuthPrepared proxy authentication owned by a proxy configuration.
None
ProxyAuth.None { contextIdValue: ProxyAuthContextId }: ProxyAuthAn authentication context that has no credential token.
Basic
ProxyAuth.Basic { contextIdValue: ProxyAuthContextId, tokenValue: Bytes }: ProxyAuthAn authentication context that owns a prepared Basic token.
Associated function ProxyAuth.none
pub fn none(contextId: ProxyAuthContextId) -> ProxyAuthCreates an authentication context with no credential bytes.
Associated function ProxyAuth.preparedBasic
pub effect<'life0> fn preparedBasic<'life0>(contextId: ProxyAuthContextId, token: &'life0 [u8]) -> silk/result.Result<silk/http_proxy.ProxyAuth, silk/http_proxy.ProxyError> ! OutOfMemoryError ? &mut AllocatorStrictly validates and copies one nonempty prepared Basic token.
Method ProxyAuth.contextId
pub fn contextId<'life0>(self: &'life0 ProxyAuth) -> ProxyAuthContextIdReturns the caller-supplied authentication-context identity.
Method ProxyAuth.ownedBytes
pub fn ownedBytes<'life0>(self: &'life0 ProxyAuth) -> usizeReturns retained credential bytes without exposing them.
BypassPolicy
pub struct BypassPolicyA bounded list of exact normalized origins that bypass the proxy.
Associated function BypassPolicy.copy
pub effect<'life0> fn copy<'life0>(origins: &'life0 [silk/http_origin.Origin]) -> silk/result.Result<silk/http_proxy.BypassPolicy, silk/http_proxy.ProxyError> ! OutOfMemoryError ? &mut AllocatorCopies at most 64 exact normalized HTTP origins into immutable owned policy.
Method BypassPolicy.contains
pub fn contains<'life0, 'life1>(self: &'life0 BypassPolicy, origin: &'life1 silk/http_origin.Origin) -> boolReports exact scheme, normalized-host, and effective-port membership.
Method BypassPolicy.ownedBytes
pub fn ownedBytes<'life0>(self: &'life0 BypassPolicy) -> usizeReturns copied bypass-entry storage size.
ProxyConfig
pub struct ProxyConfigImmutable owned proxy configuration.
Associated function ProxyConfig.make
pub fn make(id: ProxyConfigId, proxyHost: Host, proxyPort: Port, authentication: ProxyAuth, bypass: BypassPolicy, maxOwnedConfigBytes: usize) -> silk/result.Result<silk/http_proxy.ProxyConfig, silk/http_proxy.ProxyError>Admits a plain programmatic proxy endpoint under a total owned-byte budget.
Associated function ProxyConfig.fromUri
pub fn fromUri<'text>(id: ProxyConfigId, text: string<'text>, authentication: ProxyAuth, bypass: BypassPolicy, maxOwnedConfigBytes: usize) -> silk/result.Result<silk/http_proxy.ProxyConfig, silk/http_proxy.ProxyError>Parses only a plain http authority with no userinfo, path, query, or fragment.
Method ProxyConfig.id
pub fn id<'life0>(self: &'life0 ProxyConfig) -> ProxyConfigIdReturns the caller-supplied configuration identity.
Method ProxyConfig.authContextId
pub fn authContextId<'life0>(self: &'life0 ProxyConfig) -> ProxyAuthContextIdReturns the caller-supplied authentication-context identity.
Method ProxyConfig.proxyHost
pub fn proxyHost<'life0>(self: &'life0 ProxyConfig) -> HostReturns the checked proxy host.
Method ProxyConfig.proxyPort
pub fn proxyPort<'life0>(self: &'life0 ProxyConfig) -> PortReturns the checked nonzero proxy port.
Method ProxyConfig.ownedBytes
pub fn ownedBytes<'life0>(self: &'life0 ProxyConfig) -> usizeReturns the copied host, token, and bypass-entry byte count.
RouteMode
pub enum RouteModeThe route mode selected for one origin.
Direct
Direct = 0Contact the origin directly.
Forward
Forward = 1Contact the proxy and use an absolute-form HTTP request.
Tunnel
Tunnel = 2Contact the proxy and use CONNECT before origin TLS.
Route
pub union Route<'configuration>The pure route selected for one original HTTP origin.
Direct
Route<'configuration>.Direct { identity: RouteIdentity, configuration: &'configuration silk/http_proxy.ProxyConfig, origin: Origin }: Route<'configuration>A route that contacts an exact bypass origin directly.
Field origin
pub origin: OriginThe original origin that matched bypass policy.
Forward
Route<'configuration>.Forward { identity: RouteIdentity, configuration: &'configuration silk/http_proxy.ProxyConfig, origin: Origin }: Route<'configuration>A route that sends plaintext HTTP through the proxy.
Field origin
pub origin: OriginThe original plaintext HTTP origin.
Tunnel
Route<'configuration>.Tunnel { identity: RouteIdentity, configuration: &'configuration silk/http_proxy.ProxyConfig, origin: Origin }: Route<'configuration>A route that establishes a proxy tunnel for origin TLS.
Field origin
pub origin: OriginThe original HTTPS origin for TLS authentication.
Method Route.mode
pub fn mode<'configuration, 'life1>(self: &'life1 Route<'configuration>) -> RouteModeReturns the selected route mode.
Method Route.originalOrigin
pub fn originalOrigin<'configuration, 'life1>(self: &'life1 Route<'configuration>) -> OriginReturns the original origin that policy evaluated.
Method Route.proxyHost
pub fn proxyHost<'configuration, 'life1>(self: &'life1 Route<'configuration>) -> HostReturns the proxy host retained when policy selected the route.
Method Route.proxyPort
pub fn proxyPort<'configuration, 'life1>(self: &'life1 Route<'configuration>) -> PortReturns the proxy port retained when policy selected the route.
Method Route.physicalPeer
pub fn physicalPeer<'configuration, 'life1>(self: &'life1 Route<'configuration>) -> silk/result.Result<silk/http_origin.Origin, silk/http_origin.OriginError>Returns the plaintext proxy peer retained by the sealed route.
Method Route.proxyAuthorizationLength
pub fn proxyAuthorizationLength<'configuration, 'life1>(self: &'life1 Route<'configuration>) -> usizeReturns the complete configured Proxy-Authorization value length, or zero when absent.
Details
The prepared token remains private; possessing a policy-selected route is the capability to request its bounded wire representation.
Method Route.writeProxyAuthorizationInto
pub fn writeProxyAuthorizationInto<'configuration, 'life1, 'life2>(self: &'life1 Route<'configuration>, output: &'life2 mut [u8]) -> silk/option.Option<usize>Writes the complete configured Proxy-Authorization value without exposing token storage.
Returns None without changing output when it is too small.
Method Route.configId
pub fn configId<'configuration, 'life1>(self: &'life1 Route<'configuration>) -> ProxyConfigIdReturns the configuration identity retained when policy selected the route.
Method Route.authContextId
pub fn authContextId<'configuration, 'life1>(self: &'life1 Route<'configuration>) -> ProxyAuthContextIdReturns the authentication-context identity retained when policy selected the route.
Method Route.key
pub fn key<'configuration, 'life1>(self: &'life1 Route<'configuration>) -> RouteKeyReturns a stable key without reading or formatting authentication bytes.
Method Route.recompute
pub fn recompute<'configuration, 'life1>(self: &'life1 Route<'configuration>, origin: Origin) -> silk/http_proxy.Route<'configuration>Recomputes policy for a new origin under the current immutable configuration.
RouteKey
pub struct RouteKeyStable route identity for later pooling and redirect recomputation.
Method RouteKey.originalOrigin
pub fn originalOrigin<'life0>(self: &'life0 RouteKey) -> OriginReturns the normalized original origin retained by this sealed route identity.
Method RouteKey.mode
pub fn mode<'life0>(self: &'life0 RouteKey) -> RouteModeReturns the selected route mode without exposing proxy configuration or credential bytes.
Method RouteKey.equals
pub fn equals<'life0, 'life1>(self: &'life0 RouteKey, other: &'life1 RouteKey) -> boolCompares route mode, original origin, proxy endpoint, and both opaque identities.
Implementation Copy for ProxyReason
impl Copy for ProxyReasonImplementation Copy for ProxyAdmissionError
impl Copy for ProxyAdmissionErrorImplementation Copy for ProxyConfigId
impl Copy for ProxyConfigIdImplementation Copy for ProxyAuthContextId
impl Copy for ProxyAuthContextIdImplementation Copy for silk/http_proxy.Route<'configuration>
impl Copy for silk/http_proxy.Route<'configuration>Implementation Copy for RouteKey
impl Copy for RouteKeyselectRoute
pub fn selectRoute<'configuration>(configuration: &'configuration silk/http_proxy.ProxyConfig, origin: Origin) -> silk/http_proxy.Route<'configuration>Purely selects Direct, Forward, or Tunnel for one original origin.
classifyConnect
pub effect<'env> fn classifyConnect<'life0: 'env, 'life1: 'env, 'env>(head: &'life0 silk/http_head.ResponseHead<'life1>) -> () ! ProxyError | OutOfMemoryError ? &mut AllocatorClassifies a complete final CONNECT response into success or bounded rejection metadata.
Details
Any 2xx response is accepted. A 407 retains status, reason, and ordered duplicate
Proxy-Authenticate fields only; other final non-2xx responses retain all ordered fields.
Complete-head copy failures map to ProxyMetadataLimit, while allocation failure remains
OutOfMemoryError. Call this only after the shared client's parser has returned a final head.