Struct ProxyEnvLayer
pub struct ProxyEnvLayer { /* private fields */ }net only.Expand description
Lazily select a proxy from curl-compatible environment variables.
HTTP requests use lowercase http_proxy; uppercase HTTP_PROXY is never
read because CGI turns an incoming Proxy header into that variable.
Every request first tries its URL scheme’s lowercase and uppercase proxy
variables, then all_proxy and ALL_PROXY. HTTP is the security-sensitive
exception: only lowercase http_proxy is accepted. For example, WebSocket
requests use ws_proxy / WS_PROXY, not http_proxy.
Every variable group has an independent, shared cache. A request only reads
the group it needs, and ALL_PROXY is not read when a scheme-specific proxy
exists. Empty name lists disable the corresponding group.
See curl’s proxy environment variable documentation for the interoperability rules this layer follows.
Implementations§
§impl ProxyEnvLayer
impl ProxyEnvLayer
pub fn new() -> ProxyEnvLayer
pub fn new() -> ProxyEnvLayer
Create a lazy layer backed by the process environment.
pub fn new_with_reader<F>(reader: F) -> ProxyEnvLayer
pub fn new_with_reader<F>(reader: F) -> ProxyEnvLayer
Create a lazy layer backed by a custom environment reader.
This is useful for applications which virtualize their environment and
for deterministic tests. Ok(None) means that the name is not defined.
The reader runs synchronously during the first request for a variable
group and should therefore avoid blocking I/O; concurrent callers await
the same cached initialization.
pub fn with_http_proxy_env_vars(
self,
names: impl IntoIterator<Item = impl Into<Box<str>>>,
) -> ProxyEnvLayer
pub fn with_http_proxy_env_vars( self, names: impl IntoIterator<Item = impl Into<Box<str>>>, ) -> ProxyEnvLayer
Replace the ordered HTTP proxy environment-variable names.
The default is only http_proxy. Supplying no names disables this
scheme-specific lookup.
pub fn set_http_proxy_env_vars(
&mut self,
names: impl IntoIterator<Item = impl Into<Box<str>>>,
) -> &mut ProxyEnvLayer
pub fn set_http_proxy_env_vars( &mut self, names: impl IntoIterator<Item = impl Into<Box<str>>>, ) -> &mut ProxyEnvLayer
Replace the ordered HTTP proxy environment-variable names.
The default is only http_proxy. Supplying no names disables this
scheme-specific lookup.
pub fn with_https_proxy_env_vars(
self,
names: impl IntoIterator<Item = impl Into<Box<str>>>,
) -> ProxyEnvLayer
pub fn with_https_proxy_env_vars( self, names: impl IntoIterator<Item = impl Into<Box<str>>>, ) -> ProxyEnvLayer
Replace the ordered HTTPS proxy environment-variable names.
The default is https_proxy, then HTTPS_PROXY. Supplying no names
disables this scheme-specific lookup.
pub fn set_https_proxy_env_vars(
&mut self,
names: impl IntoIterator<Item = impl Into<Box<str>>>,
) -> &mut ProxyEnvLayer
pub fn set_https_proxy_env_vars( &mut self, names: impl IntoIterator<Item = impl Into<Box<str>>>, ) -> &mut ProxyEnvLayer
Replace the ordered HTTPS proxy environment-variable names.
The default is https_proxy, then HTTPS_PROXY. Supplying no names
disables this scheme-specific lookup.
pub fn with_protocol_proxy_env_vars(
self,
protocol: Protocol,
names: impl IntoIterator<Item = impl Into<Box<str>>>,
) -> ProxyEnvLayer
pub fn with_protocol_proxy_env_vars( self, protocol: Protocol, names: impl IntoIterator<Item = impl Into<Box<str>>>, ) -> ProxyEnvLayer
Replace the ordered proxy environment-variable names for one URL protocol. Supplying no names disables its scheme-specific lookup.
pub fn set_protocol_proxy_env_vars(
&mut self,
protocol: Protocol,
names: impl IntoIterator<Item = impl Into<Box<str>>>,
) -> &mut ProxyEnvLayer
pub fn set_protocol_proxy_env_vars( &mut self, protocol: Protocol, names: impl IntoIterator<Item = impl Into<Box<str>>>, ) -> &mut ProxyEnvLayer
Replace the ordered proxy environment-variable names for one URL protocol. Supplying no names disables its scheme-specific lookup.
pub fn with_all_proxy_env_vars(
self,
names: impl IntoIterator<Item = impl Into<Box<str>>>,
) -> ProxyEnvLayer
pub fn with_all_proxy_env_vars( self, names: impl IntoIterator<Item = impl Into<Box<str>>>, ) -> ProxyEnvLayer
Replace the ordered all-protocol proxy environment-variable names.
The default is all_proxy, then ALL_PROXY. Supplying no names
disables the fallback entirely.
pub fn set_all_proxy_env_vars(
&mut self,
names: impl IntoIterator<Item = impl Into<Box<str>>>,
) -> &mut ProxyEnvLayer
pub fn set_all_proxy_env_vars( &mut self, names: impl IntoIterator<Item = impl Into<Box<str>>>, ) -> &mut ProxyEnvLayer
Replace the ordered all-protocol proxy environment-variable names.
The default is all_proxy, then ALL_PROXY. Supplying no names
disables the fallback entirely.
pub fn with_load_error_sink(self, sink: impl ErrorSink) -> ProxyEnvLayer
pub fn with_load_error_sink(self, sink: impl ErrorSink) -> ProxyEnvLayer
Handle each lazy load error through an ErrorSink and treat that
variable group as absent. By default errors reject the request.
The handled result is cached, so a sink is called at most once for each variable group.
pub fn set_load_error_sink(
&mut self,
sink: impl ErrorSink,
) -> &mut ProxyEnvLayer
pub fn set_load_error_sink( &mut self, sink: impl ErrorSink, ) -> &mut ProxyEnvLayer
Handle each lazy load error through an ErrorSink and treat that
variable group as absent. By default errors reject the request.
The handled result is cached, so a sink is called at most once for each variable group.
pub fn with_overwrite(self, overwrite: bool) -> ProxyEnvLayer
pub fn with_overwrite(self, overwrite: bool) -> ProxyEnvLayer
Replace an existing ProxyRoute or
ProxyRoutes decision.
pub fn set_overwrite(&mut self, overwrite: bool) -> &mut ProxyEnvLayer
pub fn set_overwrite(&mut self, overwrite: bool) -> &mut ProxyEnvLayer
Replace an existing ProxyRoute or
ProxyRoutes decision.
Trait Implementations§
§impl Clone for ProxyEnvLayer
impl Clone for ProxyEnvLayer
§fn clone(&self) -> ProxyEnvLayer
fn clone(&self) -> ProxyEnvLayer
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for ProxyEnvLayer
impl Debug for ProxyEnvLayer
§impl Default for ProxyEnvLayer
impl Default for ProxyEnvLayer
§fn default() -> ProxyEnvLayer
fn default() -> ProxyEnvLayer
§impl<S> Layer<S> for ProxyEnvLayer
impl<S> Layer<S> for ProxyEnvLayer
§type Service = ProxyEnvService<S>
type Service = ProxyEnvService<S>
§fn layer(&self, inner: S) -> <ProxyEnvLayer as Layer<S>>::Service
fn layer(&self, inner: S) -> <ProxyEnvLayer as Layer<S>>::Service
§fn into_layer(self, inner: S) -> <ProxyEnvLayer as Layer<S>>::Service
fn into_layer(self, inner: S) -> <ProxyEnvLayer as Layer<S>>::Service
layer but consuming self after the service was created. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for ProxyEnvLayer
impl !UnwindSafe for ProxyEnvLayer
impl Freeze for ProxyEnvLayer
impl Send for ProxyEnvLayer
impl Sync for ProxyEnvLayer
impl Unpin for ProxyEnvLayer
impl UnsafeUnpin for ProxyEnvLayer
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a rama_grpc::Request§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§fn and<P, B, E>(self, other: P) -> And<T, P>
fn and<P, B, E>(self, other: P) -> And<T, P>
Policy that returns Action::Follow only if self and other return
Action::Follow. Read more