pub struct NetworkPolicy {
pub allow_hosts: Vec<String>,
pub allow_request: Option<AllowCallback>,
pub unrestricted: bool,
pub resolver: Option<Resolver>,
/* private fields */
}Fields§
§allow_hosts: Vec<String>Hosts (exact, case-insensitive) allowed even when their address class is blocked.
allow_request: Option<AllowCallback>Called only for requests the defaults would block; true allows.
unrestricted: boolDisable every check (trusted callers only).
resolver: Option<Resolver>Replaces the system resolver (offline tests, pinned DNS, split-horizon setups).
Implementations§
Source§impl NetworkPolicy
impl NetworkPolicy
Sourcepub fn unrestricted() -> Self
pub fn unrestricted() -> Self
Policy with every check off.
pub fn allow_host(self, host: impl Into<String>) -> Self
pub fn with_resolver( self, f: impl Fn(&str) -> Vec<IpAddr> + Send + Sync + 'static, ) -> Self
pub fn allow_with( self, f: impl Fn(&NetworkRequest) -> bool + Send + Sync + 'static, ) -> Self
Trait Implementations§
Source§impl Clone for NetworkPolicy
impl Clone for NetworkPolicy
Source§impl Debug for NetworkPolicy
impl Debug for NetworkPolicy
Auto Trait Implementations§
impl !RefUnwindSafe for NetworkPolicy
impl !UnwindSafe for NetworkPolicy
impl Freeze for NetworkPolicy
impl Send for NetworkPolicy
impl Sync for NetworkPolicy
impl Unpin for NetworkPolicy
impl UnsafeUnpin for NetworkPolicy
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