Struct ProxyAddressLayer
pub struct ProxyAddressLayer { /* private fields */ }net only.Expand description
Apply one fixed proxy address to any service input with extensions.
This layer reads application environment variables only when constructed
with try_from_env. It does not inspect operating
system proxy settings; use SystemProxyLayer for those. When the layers
are chained, existing route decisions are preserved by default. Opt into
overwriting only when this address is authoritative. Use
LazyProxyAddressLayer when environment lookup should happen only if
no higher-priority route has already been selected.
See ProxyAddressService for more information.
Implementations§
§impl ProxyAddressLayer
impl ProxyAddressLayer
pub fn new(address: ProxyAddress) -> ProxyAddressLayer
pub fn new(address: ProxyAddress) -> ProxyAddressLayer
Create a new ProxyAddressLayer that will create
a service to set the given ProxyAddress as a proxied ProxyRoute.
pub fn maybe(address: Option<ProxyAddress>) -> ProxyAddressLayer
pub fn maybe(address: Option<ProxyAddress>) -> ProxyAddressLayer
Create a new ProxyAddressLayer which will create
a service that will set the given ProxyAddress as a proxied ProxyRoute if it is not
None.
pub const fn proxy_address(&self) -> Option<&ProxyAddress>
pub const fn proxy_address(&self) -> Option<&ProxyAddress>
Return the configured proxy address, when this layer has one.
pub fn try_from_env_default() -> Result<ProxyAddressLayer, Box<dyn Error + Sync + Send>>
pub fn try_from_env_default() -> Result<ProxyAddressLayer, Box<dyn Error + Sync + Send>>
Try to create a new ProxyAddressLayer which will establish
a proxy connection over the environment variable http_proxy.
Uppercase HTTP_PROXY is deliberately not accepted by default because
CGI derives it from an incoming Proxy header. Use
ProxyEnvLayer for curl-compatible HTTP, HTTPS, and all-protocol
environment selection.
pub fn try_from_env(
key: impl AsRef<str>,
) -> Result<ProxyAddressLayer, Box<dyn Error + Sync + Send>>
pub fn try_from_env( key: impl AsRef<str>, ) -> Result<ProxyAddressLayer, Box<dyn Error + Sync + Send>>
Try to create a new ProxyAddressLayer which will establish
a proxy connection over the given environment variable.
pub fn with_overwrite(self, overwrite: bool) -> ProxyAddressLayer
pub fn with_overwrite(self, overwrite: bool) -> ProxyAddressLayer
Replace an existing ProxyRoute or ProxyRoutes decision.
Existing routes are preserved by default.
pub fn set_overwrite(&mut self, overwrite: bool) -> &mut ProxyAddressLayer
pub fn set_overwrite(&mut self, overwrite: bool) -> &mut ProxyAddressLayer
Replace an existing ProxyRoute or ProxyRoutes decision.
Existing routes are preserved by default.
Trait Implementations§
§impl Clone for ProxyAddressLayer
impl Clone for ProxyAddressLayer
§fn clone(&self) -> ProxyAddressLayer
fn clone(&self) -> ProxyAddressLayer
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 ProxyAddressLayer
impl Debug for ProxyAddressLayer
§impl Default for ProxyAddressLayer
impl Default for ProxyAddressLayer
§fn default() -> ProxyAddressLayer
fn default() -> ProxyAddressLayer
§impl<S> Layer<S> for ProxyAddressLayer
impl<S> Layer<S> for ProxyAddressLayer
§type Service = ProxyAddressService<S>
type Service = ProxyAddressService<S>
§fn layer(&self, inner: S) -> <ProxyAddressLayer as Layer<S>>::Service
fn layer(&self, inner: S) -> <ProxyAddressLayer as Layer<S>>::Service
§fn into_layer(self, inner: S) -> <ProxyAddressLayer as Layer<S>>::Service
fn into_layer(self, inner: S) -> <ProxyAddressLayer as Layer<S>>::Service
layer but consuming self after the service was created. Read moreAuto Trait Implementations§
impl !Freeze for ProxyAddressLayer
impl RefUnwindSafe for ProxyAddressLayer
impl Send for ProxyAddressLayer
impl Sync for ProxyAddressLayer
impl Unpin for ProxyAddressLayer
impl UnsafeUnpin for ProxyAddressLayer
impl UnwindSafe for ProxyAddressLayer
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