Struct worker::Cf

source ·
pub struct Cf { /* private fields */ }
Expand description

In addition to the methods on the Request struct, the Cf struct on an inbound Request contains information about the request provided by Cloudflare’s edge.

Details

Implementations§

source§

impl Cf

source

pub fn colo(&self) -> String

The three-letter airport code (e.g. ATX, LUX) representing the colocation which processed the request

source

pub fn asn(&self) -> u32

The Autonomous System Number (ASN) of the request, e.g. 395747

source

pub fn country(&self) -> Option<String>

The two-letter country code of origin for the request. This is the same value as that provided in the CF-IPCountry header, e.g. "US"

source

pub fn http_protocol(&self) -> String

The HTTP Protocol (e.g. “HTTP/2”) used by the request

source

pub fn request_priority(&self) -> Option<RequestPriority>

The browser-requested prioritization information in the request object,

See this blog post for details.

source

pub fn tls_cipher(&self) -> String

The cipher for the connection to Cloudflare, e.g. “AEAD-AES128-GCM-SHA256”.

source

pub fn tls_client_auth(&self) -> Option<TlsClientAuth>

Information about the client’s authorization. Only set when using Cloudflare Access or API Shield.

source

pub fn tls_version(&self) -> String

The TLS version of the connection to Cloudflare, e.g. TLSv1.3.

source

pub fn city(&self) -> Option<String>

City of the incoming request, e.g. “Austin”.

source

pub fn continent(&self) -> Option<String>

Continent of the incoming request, e.g. “NA”

source

pub fn coordinates(&self) -> Option<(f32, f32)>

Latitude and longitude of the incoming request, e.g. (30.27130, -97.74260)

source

pub fn postal_code(&self) -> Option<String>

Postal code of the incoming request, e.g. “78701”

source

pub fn metro_code(&self) -> Option<String>

Metro code (DMA) of the incoming request, e.g. “635”

source

pub fn region(&self) -> Option<String>

If known, the ISO 3166-2 name for the first level region associated with the IP address of the incoming request, e.g. “Texas”.

source

pub fn region_code(&self) -> Option<String>

If known, the ISO 3166-2 code for the first level region associated with the IP address of the incoming request, e.g. “TX”.

source

pub fn timezone(&self) -> impl TimeZone

Timezone of the incoming request

source

pub fn timezone_name(&self) -> String

Timezone name of the incoming request

source

pub fn is_eu_country(&self) -> bool

Whether the country of the incoming request is in the EU

Trait Implementations§

source§

impl Debug for Cf

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<IncomingRequestCfProperties> for Cf

source§

fn from(inner: IncomingRequestCfProperties) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl RefUnwindSafe for Cf

§

impl !Send for Cf

§

impl !Sync for Cf

§

impl Unpin for Cf

§

impl UnwindSafe for Cf

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.