pub struct NetworkPolicy {
pub isolation: IsolationMode,
pub ingress: Vec<PolicyRule>,
pub egress: Vec<PolicyRule>,
}Expand description
Network isolation policy.
Controls which boxes can communicate with each other on a network.
Fields§
§isolation: IsolationModeIsolation mode (default: None — all boxes can communicate).
ingress: Vec<PolicyRule>Ingress rules (who can receive traffic from whom).
Only used when isolation is Custom.
egress: Vec<PolicyRule>Egress rules (who can send traffic to whom).
Only used when isolation is Custom.
Implementations§
Source§impl NetworkPolicy
impl NetworkPolicy
Sourcepub fn validate(&self) -> Result<(), String>
pub fn validate(&self) -> Result<(), String>
Validate that the policy can be enforced at runtime.
Currently only IsolationMode::None is supported. Strict and Custom
modes require iptables/nftables integration which is not yet implemented.
Rejecting early prevents a false sense of security.
Sourcepub fn is_peer_allowed(&self, box_name: &str, peer_name: &str) -> bool
pub fn is_peer_allowed(&self, box_name: &str, peer_name: &str) -> bool
Check if a box is allowed to communicate with a peer.
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 · 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§fn default() -> NetworkPolicy
fn default() -> NetworkPolicy
Returns the “default value” for a type. Read more
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