pub enum IpClass {
Mobile,
Isp,
Residential,
Datacenter,
Unknown,
}Expand description
IP trust class for a proxy egress.
Encodes the four-tier IP trust hierarchy cited by the 2026 scraping
guide: mobile carriers > static ISP allocations > rotating residential
pools > datacenter ranges. The 5th variant, Unknown,
is the fail-secure default for any proxy whose provider did not declare
its class.
Copy + Eq + Hash so IpClass can be used as a BTreeMap key and
embedded in Copy structs without an extra allocation.
§Example
use stygian_proxy::types::IpClass;
assert!(IpClass::Mobile.rank() > IpClass::Isp.rank());
assert!(IpClass::Isp.rank() > IpClass::Residential.rank());
assert!(IpClass::Residential.rank() > IpClass::Datacenter.rank());
assert_eq!(IpClass::default(), IpClass::Unknown);Variants§
Mobile
Mobile-carrier (3G/4G/5G) egress.
Isp
Static ISP allocation.
Residential
Rotating residential pool.
Datacenter
Datacenter / VPS / bare-metal egress.
Unknown
Provider did not tag the egress. Fail-secure default.
Implementations§
Source§impl IpClass
impl IpClass
Sourcepub const fn rank(self) -> u8
pub const fn rank(self) -> u8
Rank used to express “at least this tier” requirements.
Higher rank = higher trust. Mobile (4) outranks ISP (3) which
outranks Residential (2) which outranks Datacenter (1); Unknown
is the lowest (0) so a proxy that does not declare its class
never satisfies a non-empty IpClassRequirement.
§Example
use stygian_proxy::types::IpClass;
assert_eq!(IpClass::Mobile.rank(), 4);
assert_eq!(IpClass::Isp.rank(), 3);
assert_eq!(IpClass::Residential.rank(), 2);
assert_eq!(IpClass::Datacenter.rank(), 1);
assert_eq!(IpClass::Unknown.rank(), 0);Sourcepub fn from_label(label: &str) -> Option<Self>
pub fn from_label(label: &str) -> Option<Self>
Parse an IpClass from its label snake_case string.
Mirrors VendorId::from_label so MCP and external configs can use
the same string vocabulary.
§Example
use stygian_proxy::types::IpClass;
assert_eq!(IpClass::from_label("mobile"), Some(IpClass::Mobile));
assert_eq!(IpClass::from_label("datacenter"), Some(IpClass::Datacenter));
assert_eq!(IpClass::from_label("nope"), None);Trait Implementations§
impl Copy for IpClass
Source§impl<'de> Deserialize<'de> for IpClass
impl<'de> Deserialize<'de> for IpClass
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for IpClass
Source§impl Ord for IpClass
impl Ord for IpClass
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for IpClass
impl PartialOrd for IpClass
impl StructuralPartialEq for IpClass
Auto Trait Implementations§
impl Freeze for IpClass
impl RefUnwindSafe for IpClass
impl Send for IpClass
impl Sync for IpClass
impl Unpin for IpClass
impl UnsafeUnpin for IpClass
impl UnwindSafe for IpClass
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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
key and return true if they are equal.