#[non_exhaustive]pub struct ClientAddressConfig {
pub trusted_proxies: Vec<String>,
pub header: ForwardingHeader,
pub required: bool,
pub forward: ForwardConfig,
}Expand description
How the client’s address is resolved, for every consumer of it at once (the rate limits, the hooks, the fallback, the upstream), and what the upstream receives of it.
client_address:
trusted_proxies: ["10.0.0.0/8", "192.0.2.10"]
header: x_forwarded_for
required: false
forward:
x_forwarded_for: verified
client_header: x-real-ip
audit_header: nullThe connection’s peer is the client unless it is a trusted proxy; only
then is header read, so an address a client asserts itself never
counts. The defaults trust no proxy: the right setting for a proxy that
faces its clients directly. Resolution and forward are
independent: the rate limits and the hooks always use the resolved
address, whatever is forwarded.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.trusted_proxies: Vec<String>Proxies trusted to report the client’s address: CIDR ranges, or bare
addresses for one host. An IPv4-mapped IPv6 peer (::ffff:10.0.0.1)
matches its IPv4 range. An entry that is neither stops the proxy at
startup.
header: ForwardingHeaderThe header trusted proxies report the client’s address in.
required: boolRefuse a request whose client address cannot be resolved: no
connection information (INTERNAL, 500), or a trusted proxy’s report
that cannot be read (INVALID_ARGUMENT, 400). Off: such a request
goes on with no address.
forward: ForwardConfigWhat the upstream receives of the client’s address.
Trait Implementations§
Source§impl Clone for ClientAddressConfig
impl Clone for ClientAddressConfig
Source§impl Debug for ClientAddressConfig
impl Debug for ClientAddressConfig
Source§impl Default for ClientAddressConfig
impl Default for ClientAddressConfig
Source§impl<'de> Deserialize<'de> for ClientAddressConfig
impl<'de> Deserialize<'de> for ClientAddressConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for ClientAddressConfig
impl RefUnwindSafe for ClientAddressConfig
impl Send for ClientAddressConfig
impl Sync for ClientAddressConfig
impl Unpin for ClientAddressConfig
impl UnsafeUnpin for ClientAddressConfig
impl UnwindSafe for ClientAddressConfig
Blanket Implementations§
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> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request