Struct NoProxyEnvLayer
pub struct NoProxyEnvLayer { /* private fields */ }net only.Expand description
Lazily apply conventional NO_PROXY bypass rules.
Lowercase no_proxy takes precedence over uppercase NO_PROXY. Entries
are comma-separated. As in curl, wget, Go and Python, a plain domain such as
example.com matches its apex and descendants. Leading-dot and *. forms
have the same subtree behavior. Rama additionally accepts arbitrary host
globs; a single * matches every host, and IP addresses and CIDR networks
use typed address matching. When a rule matches, the layer inserts
ProxyRoute::Direct.
Place this layer before explicit, environment, and system proxy layers to give bypass rules priority without enabling route overwrites.
The environment-variable names and core matching behavior follow curl’s proxy environment variable documentation. Rama’s arbitrary glob support is a backwards-compatible extension of that shared convention.
Implementations§
§impl NoProxyEnvLayer
impl NoProxyEnvLayer
pub fn new() -> NoProxyEnvLayer
pub fn new() -> NoProxyEnvLayer
Create a lazy layer backed by the process environment.
pub fn new_with_reader<F>(reader: F) -> NoProxyEnvLayer
pub fn new_with_reader<F>(reader: F) -> NoProxyEnvLayer
Create a lazy layer backed by a custom environment reader.
The reader runs synchronously during the first request and should avoid blocking I/O; concurrent callers await the same cached initialization.
pub fn with_no_proxy_env_vars(
self,
names: impl IntoIterator<Item = impl Into<Box<str>>>,
) -> NoProxyEnvLayer
pub fn with_no_proxy_env_vars( self, names: impl IntoIterator<Item = impl Into<Box<str>>>, ) -> NoProxyEnvLayer
Replace the ordered no-proxy environment-variable names.
The default is no_proxy, then NO_PROXY. Supplying no names
disables environment bypass rules.
pub fn set_no_proxy_env_vars(
&mut self,
names: impl IntoIterator<Item = impl Into<Box<str>>>,
) -> &mut NoProxyEnvLayer
pub fn set_no_proxy_env_vars( &mut self, names: impl IntoIterator<Item = impl Into<Box<str>>>, ) -> &mut NoProxyEnvLayer
Replace the ordered no-proxy environment-variable names.
The default is no_proxy, then NO_PROXY. Supplying no names
disables environment bypass rules.
pub fn with_load_error_sink(self, sink: impl ErrorSink) -> NoProxyEnvLayer
pub fn with_load_error_sink(self, sink: impl ErrorSink) -> NoProxyEnvLayer
Send invalid rules or environment-read errors to an ErrorSink.
Invalid individual rules are omitted while valid rules remain in
effect. By default any such error rejects the request.
pub fn set_load_error_sink(
&mut self,
sink: impl ErrorSink,
) -> &mut NoProxyEnvLayer
pub fn set_load_error_sink( &mut self, sink: impl ErrorSink, ) -> &mut NoProxyEnvLayer
Send invalid rules or environment-read errors to an ErrorSink.
Invalid individual rules are omitted while valid rules remain in
effect. By default any such error rejects the request.
pub fn with_overwrite(self, overwrite: bool) -> NoProxyEnvLayer
pub fn with_overwrite(self, overwrite: bool) -> NoProxyEnvLayer
Replace an existing ProxyRoute or
ProxyRoutes decision with a direct
route when a no-proxy rule matches.
pub fn set_overwrite(&mut self, overwrite: bool) -> &mut NoProxyEnvLayer
pub fn set_overwrite(&mut self, overwrite: bool) -> &mut NoProxyEnvLayer
Replace an existing ProxyRoute or
ProxyRoutes decision with a direct
route when a no-proxy rule matches.
Trait Implementations§
§impl Clone for NoProxyEnvLayer
impl Clone for NoProxyEnvLayer
§fn clone(&self) -> NoProxyEnvLayer
fn clone(&self) -> NoProxyEnvLayer
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 NoProxyEnvLayer
impl Debug for NoProxyEnvLayer
§impl Default for NoProxyEnvLayer
impl Default for NoProxyEnvLayer
§fn default() -> NoProxyEnvLayer
fn default() -> NoProxyEnvLayer
§impl<S> Layer<S> for NoProxyEnvLayer
impl<S> Layer<S> for NoProxyEnvLayer
§type Service = NoProxyEnvService<S>
type Service = NoProxyEnvService<S>
§fn layer(&self, inner: S) -> <NoProxyEnvLayer as Layer<S>>::Service
fn layer(&self, inner: S) -> <NoProxyEnvLayer as Layer<S>>::Service
§fn into_layer(self, inner: S) -> <NoProxyEnvLayer as Layer<S>>::Service
fn into_layer(self, inner: S) -> <NoProxyEnvLayer as Layer<S>>::Service
layer but consuming self after the service was created. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for NoProxyEnvLayer
impl !UnwindSafe for NoProxyEnvLayer
impl Forget for NoProxyEnvLayer
impl Freeze for NoProxyEnvLayerwhere
*const ArcInner<[Box<str>]> is !null: Freeze,
PhantomData<ArcInner<[Box<str>]>>: Freeze,
*const ArcInner<dyn Fn(&str) -> Result<Option<String>, Box<dyn Error + Sync + Send>> + Sync + Send> is !null: Freeze,
PhantomData<ArcInner<dyn Fn(&str) -> Result<Option<String>, Box<dyn Error + Sync + Send>> + Sync + Send>>: Freeze,
*const ArcInner<OnceCell<Result<BypassRules, CachedLoadError>>> is !null: Freeze,
PhantomData<ArcInner<OnceCell<Result<BypassRules, CachedLoadError>>>>: Freeze,
*const ArcInner<dyn ErrorSink> is !null: Freeze,
PhantomData<ArcInner<dyn ErrorSink>>: Freeze,
impl Move for NoProxyEnvLayer
impl Send for NoProxyEnvLayer
impl Sync for NoProxyEnvLayer
impl Unpin for NoProxyEnvLayer
impl UnsafeUnpin for NoProxyEnvLayerwhere
*const ArcInner<[Box<str>]> is !null: UnsafeUnpin,
PhantomData<ArcInner<[Box<str>]>>: UnsafeUnpin,
*const ArcInner<dyn Fn(&str) -> Result<Option<String>, Box<dyn Error + Sync + Send>> + Sync + Send> is !null: UnsafeUnpin,
PhantomData<ArcInner<dyn Fn(&str) -> Result<Option<String>, Box<dyn Error + Sync + Send>> + Sync + Send>>: UnsafeUnpin,
*const ArcInner<OnceCell<Result<BypassRules, CachedLoadError>>> is !null: UnsafeUnpin,
PhantomData<ArcInner<OnceCell<Result<BypassRules, CachedLoadError>>>>: UnsafeUnpin,
*const ArcInner<dyn ErrorSink> is !null: UnsafeUnpin,
PhantomData<ArcInner<dyn ErrorSink>>: UnsafeUnpin,
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