pub enum AddressType {
Wildcard,
IPv4,
IPv6,
}Expand description
The type of address in an exit policy rule.
This enum categorizes the address specification in an exit policy rule, determining how address matching is performed.
§Variants
Wildcard: Matches any address (IPv4 or IPv6)IPv4: Matches only IPv4 addressesIPv6: Matches only IPv6 addresses
§Example
use stem_rs::exit_policy::{ExitPolicyRule, AddressType};
let rule = ExitPolicyRule::parse("accept *:80").unwrap();
assert_eq!(rule.get_address_type(), AddressType::Wildcard);
let rule = ExitPolicyRule::parse("accept 192.168.1.1:80").unwrap();
assert_eq!(rule.get_address_type(), AddressType::IPv4);
let rule = ExitPolicyRule::parse("accept [::1]:80").unwrap();
assert_eq!(rule.get_address_type(), AddressType::IPv6);Variants§
Wildcard
Matches any address, both IPv4 and IPv6.
This is used when the address specification is * without
a version suffix.
IPv4
Matches only IPv4 addresses.
This includes explicit IPv4 addresses, CIDR ranges, and the *4 wildcard.
IPv6
Matches only IPv6 addresses.
This includes explicit IPv6 addresses (in brackets), CIDR ranges,
the *6 wildcard, and rules using accept6/reject6.
Trait Implementations§
Source§impl Clone for AddressType
impl Clone for AddressType
Source§fn clone(&self) -> AddressType
fn clone(&self) -> AddressType
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for AddressType
impl Debug for AddressType
Source§impl Hash for AddressType
impl Hash for AddressType
Source§impl PartialEq for AddressType
impl PartialEq for AddressType
impl Copy for AddressType
impl Eq for AddressType
impl StructuralPartialEq for AddressType
Auto Trait Implementations§
impl Freeze for AddressType
impl RefUnwindSafe for AddressType
impl Send for AddressType
impl Sync for AddressType
impl Unpin for AddressType
impl UnwindSafe for AddressType
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
Mutably borrows from an owned value. Read more