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
impl CloudIpTable
Sourcepub fn set_provider_ranges(
&self,
provider: &str,
entries: Vec<(String, Option<String>)>,
) -> Result<(), (String, CloudRangeError)>
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.
Sourcepub fn clear_provider(&self, provider: &str)
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).
Sourcepub fn provider_is_ready(&self, provider: &str) -> bool
pub fn provider_is_ready(&self, provider: &str) -> bool
Whether a provider has any ranges loaded (the reference
get_status’s ready flag).
Sourcepub fn provider_status(&self, provider: &str) -> ProviderStatus
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.
Sourcepub fn is_cloud_ip(&self, ip: IpAddr, selectors: &CloudSelectors) -> bool
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.
Sourcepub fn provider_details(
&self,
ip: IpAddr,
selectors: &CloudSelectors,
) -> Option<(String, String)>
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.