pub struct NetworkConfig {
pub enabled: bool,
pub mode: Option<String>,
pub allowed_hosts: Option<Vec<String>>,
pub blocked_hosts: Option<Vec<String>>,
pub dns: Option<Vec<String>>,
}Expand description
Network configuration.
Fields§
§enabled: boolWhether network access is allowed.
mode: Option<String>Network mode for Docker (none, bridge, host).
allowed_hosts: Option<Vec<String>>Allowed outbound hosts (whitelist).
blocked_hosts: Option<Vec<String>>Blocked hosts (blacklist).
dns: Option<Vec<String>>DNS servers.
Implementations§
Source§impl NetworkConfig
impl NetworkConfig
Sourcepub fn with_allowed_hosts(self, hosts: Vec<String>) -> Self
pub fn with_allowed_hosts(self, hosts: Vec<String>) -> Self
Set allowed hosts.
Sourcepub fn allow_host(self, host: impl Into<String>) -> Self
pub fn allow_host(self, host: impl Into<String>) -> Self
Add an allowed host.
Sourcepub fn with_blocked_hosts(self, hosts: Vec<String>) -> Self
pub fn with_blocked_hosts(self, hosts: Vec<String>) -> Self
Set blocked hosts.
Sourcepub fn block_host(self, host: impl Into<String>) -> Self
pub fn block_host(self, host: impl Into<String>) -> Self
Block a host.
Sourcepub fn is_host_allowed(&self, host: &str) -> bool
pub fn is_host_allowed(&self, host: &str) -> bool
Check if a host is allowed.
Trait Implementations§
Source§impl Clone for NetworkConfig
impl Clone for NetworkConfig
Source§fn clone(&self) -> NetworkConfig
fn clone(&self) -> NetworkConfig
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 NetworkConfig
impl Debug for NetworkConfig
Source§impl Default for NetworkConfig
impl Default for NetworkConfig
Source§impl<'de> Deserialize<'de> for NetworkConfig
impl<'de> Deserialize<'de> for NetworkConfig
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 NetworkConfig
impl RefUnwindSafe for NetworkConfig
impl Send for NetworkConfig
impl Sync for NetworkConfig
impl Unpin for NetworkConfig
impl UnwindSafe for NetworkConfig
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