Enum virtual_net::ruleset::Rule
source · pub enum Rule {
IPV4(IPV4Rule),
IPV6(IPV6Rule),
DNS(DNSRule),
Neg(Arc<Rule>),
}
Expand description
Represents all supported rules
Variants§
IPV4(IPV4Rule)
Allowed IPv4 traffic
IPV6(IPV6Rule)
Allowed IPv6 traffic
DNS(DNSRule)
Allowed DNS queries
Neg(Arc<Rule>)
Negative of a rule
Implementations§
source§impl Rule
impl Rule
sourcepub fn allows_socket(
&self,
socket_addr: SocketAddr,
direction: Direction,
) -> bool
pub fn allows_socket( &self, socket_addr: SocketAddr, direction: Direction, ) -> bool
Returns true
if this rule allows accessing socket_addr
in the specific direction
sourcepub fn allows_domain(&self, domain: impl AsRef<str>) -> bool
pub fn allows_domain(&self, domain: impl AsRef<str>) -> bool
Returns true
if this rule allows querying the specific domain
sourcepub fn blocks_socket(
&self,
socket_addr: SocketAddr,
direction: Direction,
) -> bool
pub fn blocks_socket( &self, socket_addr: SocketAddr, direction: Direction, ) -> bool
Returns true
if this rule blocks accessing socket_addr
in the specific direction
sourcepub fn blocks_domain(&self, domain: impl AsRef<str>) -> bool
pub fn blocks_domain(&self, domain: impl AsRef<str>) -> bool
Returns true
if this rule blocks querying the specific domain
sourcepub fn port_spec_of_domain(
&mut self,
domain: impl AsRef<str>,
) -> Option<PortSpec>
pub fn port_spec_of_domain( &mut self, domain: impl AsRef<str>, ) -> Option<PortSpec>
Returns allowed ports for the specified domain
if this rule is a DNS rule
sourcepub fn is_expandable(&self) -> bool
pub fn is_expandable(&self) -> bool
Returns true
if this rule is a DNS rule and has not been expanded yet
sourcepub fn set_expanded(&mut self, expanded: bool)
pub fn set_expanded(&mut self, expanded: bool)
Sets the expanded state of this rule if its a DNS rule
Trait Implementations§
source§impl PartialEq for Rule
impl PartialEq for Rule
impl Eq for Rule
impl StructuralPartialEq for Rule
Auto Trait Implementations§
impl Freeze for Rule
impl RefUnwindSafe for Rule
impl Send for Rule
impl Sync for Rule
impl Unpin for Rule
impl UnwindSafe for Rule
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Returns the layout of the type.