Struct virtual_net::ruleset::Ruleset
source · pub struct Ruleset {
rules: Arc<RwLock<Vec<Rule>>>,
}
Expand description
Represents a ruleset that can be used to specify a whitelist and a blacklist in order to control the inbound and outbound traffic of a network.
Fields§
§rules: Arc<RwLock<Vec<Rule>>>
Implementations§
source§impl Ruleset
impl Ruleset
sourcepub fn allows_socket(&self, addr: impl Into<SocketAddr>, dir: Direction) -> bool
pub fn allows_socket(&self, addr: impl Into<SocketAddr>, dir: Direction) -> bool
Returns true
if at least one rule allows accessing socket_addr
in the specific direction
and no rule blocks it
sourcepub fn allows_domain(&self, domain: impl AsRef<str>) -> bool
pub fn allows_domain(&self, domain: impl AsRef<str>) -> bool
Returns true
if at least one rule allows querying the specific domain
and no rule blocks it
sourcepub fn expand_domain(
&self,
domain: impl AsRef<str>,
addrs: impl AsRef<[IpAddr]>,
) -> Result<(), RuleParseError>
pub fn expand_domain( &self, domain: impl AsRef<str>, addrs: impl AsRef<[IpAddr]>, ) -> Result<(), RuleParseError>
Expands the DNS rule that allows the specified domain
into a list of IP based
rules with addresses specified by addrs
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Ruleset
impl RefUnwindSafe for Ruleset
impl Send for Ruleset
impl Sync for Ruleset
impl Unpin for Ruleset
impl UnwindSafe for Ruleset
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<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.