Skip to main content

CloudIpTable

Struct CloudIpTable 

Source
pub struct CloudIpTable { /* private fields */ }
Expand description

The provider ranges the block check consults.

The default table is empty: every provider is unloaded and CloudIpTable::is_cloud_ip blocks nothing until the adapter feeds ranges. Clones share the store (the reference module-singleton semantics), so a background refresher can swap ranges under an installed stage.

Implementations§

Source§

impl CloudIpTable

Source

pub fn set_provider_ranges( &self, provider: &str, entries: Vec<(String, Option<String>)>, ) -> Result<(), (String, CloudRangeError)>

Load (or replace) one provider’s ranges: (cidr, region) pairs, the region absent for providers that publish none.

§Errors

Returns (cidr, error) for the first entry that is neither a CIDR range nor a bare address - the reference fetchers only produce valid networks, so this port fails loudly instead of silently dropping an entry.

Source

pub fn clear_provider(&self, provider: &str)

Drop one provider’s ranges (the reference’s failed-refresh shape: an unloaded provider is skipped, not blocked).

Source

pub fn provider_is_ready(&self, provider: &str) -> bool

Whether a provider has any ranges loaded (the reference get_status’s ready flag).

Source

pub fn provider_status(&self, provider: &str) -> ProviderStatus

One provider’s status row (the reference get_status payload shape): ready, the last_refreshed stamp (None = the reference’s null), and the entries count. An unloaded provider answers ready:false, None, 0.

Source

pub fn is_cloud_ip(&self, ip: IpAddr, selectors: &CloudSelectors) -> bool

The reference is_cloud_ip: whether ip falls inside a blocked provider’s network, honoring the region carve-outs.

Source

pub fn provider_details( &self, ip: IpAddr, selectors: &CloudSelectors, ) -> Option<(String, String)>

The reference get_cloud_provider_details: the first (provider, network) pair (in selector order) whose ranges contain ip.

Trait Implementations§

Source§

impl Clone for CloudIpTable

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CloudIpTable

Source§

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

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

impl Default for CloudIpTable

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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 T
where 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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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.