#[non_exhaustive]pub struct ClientContext {
pub ip: IpAddr,
pub user_agent: Option<String>,
pub ch_platform: Option<String>,
pub ch_mobile: Option<bool>,
pub accept_language: Option<String>,
pub tls_fingerprint: Option<String>,
}Expand description
Request attributes used for fingerprinting. Build it with
Guard::client_context from headers, or by hand with
ClientContext::new and the with_* methods.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.ip: IpAddrClient IP after proxy resolution.
user_agent: Option<String>User-Agent.
ch_platform: Option<String>Sec-CH-UA-Platform, without quotes.
ch_mobile: Option<bool>Sec-CH-UA-Mobile: ?1 is true, ?0 is false.
accept_language: Option<String>Accept-Language.
tls_fingerprint: Option<String>TLS fingerprint from the configured proxy header.
Implementations§
Source§impl ClientContext
impl ClientContext
Sourcepub fn with_user_agent(self, ua: impl Into<String>) -> Self
pub fn with_user_agent(self, ua: impl Into<String>) -> Self
Sets the User-Agent.
Sourcepub fn with_ch_platform(self, platform: impl AsRef<str>) -> Self
pub fn with_ch_platform(self, platform: impl AsRef<str>) -> Self
Sets the platform client hint (quotes are trimmed).
Sourcepub fn with_ch_mobile(self, mobile: bool) -> Self
pub fn with_ch_mobile(self, mobile: bool) -> Self
Sets the mobile client hint.
Sourcepub fn with_accept_language(self, value: impl Into<String>) -> Self
pub fn with_accept_language(self, value: impl Into<String>) -> Self
Sets Accept-Language.
Sourcepub fn with_tls_fingerprint(self, value: impl Into<String>) -> Self
pub fn with_tls_fingerprint(self, value: impl Into<String>) -> Self
Sets the TLS fingerprint.
Trait Implementations§
Source§impl Clone for ClientContext
impl Clone for ClientContext
Source§impl Debug for ClientContext
impl Debug for ClientContext
impl Eq for ClientContext
Source§impl PartialEq for ClientContext
impl PartialEq for ClientContext
impl StructuralPartialEq for ClientContext
Auto Trait Implementations§
impl Freeze for ClientContext
impl RefUnwindSafe for ClientContext
impl Send for ClientContext
impl Sync for ClientContext
impl Unpin for ClientContext
impl UnsafeUnpin for ClientContext
impl UnwindSafe for ClientContext
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.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> 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> ⓘ
Converts
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> ⓘ
Converts
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