pub struct NetworkPolicy {
pub default: DecisionToml,
pub allow: Vec<String>,
pub deny: Vec<String>,
pub audit: bool,
}Expand description
Per-domain allow/deny list with a default fallback.
See the module docs for host-matching rules and deny-wins precedence.
Fields§
§default: DecisionTomlDecision for hosts that match neither allow nor deny.
allow: Vec<String>Hosts that should be allowed without prompting.
deny: Vec<String>Hosts that should always be denied.
audit: boolWhether to record one audit-log line per network call. Defaults to true.
Implementations§
Source§impl NetworkPolicy
impl NetworkPolicy
Sourcepub fn decide(&self, host: &str) -> Decision
pub fn decide(&self, host: &str) -> Decision
Decide what to do for a single outbound call to host.
Deny-wins precedence: if host matches any entry in deny, the
answer is Decision::Deny regardless of allow. This makes deny
lists safe to combine with broad allow rules.
Sourcepub fn add_allow(&mut self, host: &str)
pub fn add_allow(&mut self, host: &str)
Append host to the allow list (de-duplicated, case-insensitive).
Used by the prompt flow when the user picks “always for this host”.
Sourcepub fn audit_enabled(&self) -> bool
pub fn audit_enabled(&self) -> bool
Whether audit logging is enabled.
Trait Implementations§
Source§impl Clone for NetworkPolicy
impl Clone for NetworkPolicy
Source§fn clone(&self) -> NetworkPolicy
fn clone(&self) -> NetworkPolicy
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 NetworkPolicy
impl Debug for NetworkPolicy
Source§impl Default for NetworkPolicy
impl Default for NetworkPolicy
Source§impl<'de> Deserialize<'de> for NetworkPolicy
impl<'de> Deserialize<'de> for NetworkPolicy
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>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for NetworkPolicy
impl RefUnwindSafe for NetworkPolicy
impl Send for NetworkPolicy
impl Sync for NetworkPolicy
impl Unpin for NetworkPolicy
impl UnsafeUnpin for NetworkPolicy
impl UnwindSafe 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