Skip to content

Commit 104afa3

Browse files
committed
Add cf.as_organization function
1 parent 4663a8a commit 104afa3

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

worker-sys/src/types/incoming_request_cf_properties.rs

+3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ extern "C" {
1414
#[wasm_bindgen(method, getter)]
1515
pub fn asn(this: &IncomingRequestCfProperties) -> u32;
1616

17+
#[wasm_bindgen(method, getter, js_name=asOrganization)]
18+
pub fn as_organization(this: &IncomingRequestCfProperties) -> String;
19+
1720
#[wasm_bindgen(method, getter)]
1821
pub fn country(this: &IncomingRequestCfProperties) -> Option<String>;
1922

worker/src/cf.rs

+5
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ impl Cf {
1818
self.inner.asn()
1919
}
2020

21+
/// The Autonomous System organization name of the request, e.g. `Cloudflare, Inc.`
22+
pub fn as_organization(&self) -> String {
23+
self.inner.as_organization()
24+
}
25+
2126
/// The two-letter country code of origin for the request.
2227
/// This is the same value as that provided in the CF-IPCountry header, e.g. `"US"`
2328
pub fn country(&self) -> Option<String> {

0 commit comments

Comments
 (0)