pub struct NetworkBuilder { /* private fields */ }Expand description
Fluent builder for NetworkConfig.
Implementations§
Source§impl NetworkBuilder
impl NetworkBuilder
Sourcepub fn from_config(config: NetworkConfig) -> Self
pub fn from_config(config: NetworkConfig) -> Self
Start building from an existing network configuration.
Sourcepub fn port(self, host_port: u16, guest_port: u16) -> Self
pub fn port(self, host_port: u16, guest_port: u16) -> Self
Publish a TCP port: host_port on the host maps to guest_port in the guest.
Sourcepub fn policy(self, policy: NetworkPolicy) -> Self
pub fn policy(self, policy: NetworkPolicy) -> Self
Set the network policy.
Sourcepub fn block_domain(self, domain: impl Into<String>) -> Self
pub fn block_domain(self, domain: impl Into<String>) -> Self
Block a specific domain via DNS interception.
Sourcepub fn block_domain_suffix(self, suffix: impl Into<String>) -> Self
pub fn block_domain_suffix(self, suffix: impl Into<String>) -> Self
Block a domain suffix via DNS interception.
Sourcepub fn dns_rebind_protection(self, enabled: bool) -> Self
pub fn dns_rebind_protection(self, enabled: bool) -> Self
Enable or disable DNS rebinding protection.
Sourcepub fn tls(self, f: impl FnOnce(TlsBuilder) -> TlsBuilder) -> Self
pub fn tls(self, f: impl FnOnce(TlsBuilder) -> TlsBuilder) -> Self
Configure TLS interception via a closure.
Sourcepub fn secret(self, f: impl FnOnce(SecretBuilder) -> SecretBuilder) -> Self
pub fn secret(self, f: impl FnOnce(SecretBuilder) -> SecretBuilder) -> Self
Add a secret via a closure builder.
ⓘ
.secret(|s| s
.env("OPENAI_API_KEY")
.value(api_key)
.allow_host("api.openai.com")
)Sourcepub fn secret_env(
self,
env_var: impl Into<String>,
value: impl Into<String>,
placeholder: impl Into<String>,
allowed_host: impl Into<String>,
) -> Self
pub fn secret_env( self, env_var: impl Into<String>, value: impl Into<String>, placeholder: impl Into<String>, allowed_host: impl Into<String>, ) -> Self
Shorthand: add a secret with env var, value, placeholder, and allowed host.
Sourcepub fn on_secret_violation(self, action: ViolationAction) -> Self
pub fn on_secret_violation(self, action: ViolationAction) -> Self
Set the violation action for secrets.
Sourcepub fn max_connections(self, max: usize) -> Self
pub fn max_connections(self, max: usize) -> Self
Set the maximum number of concurrent connections.
Sourcepub fn interface(self, overrides: InterfaceOverrides) -> Self
pub fn interface(self, overrides: InterfaceOverrides) -> Self
Set guest interface overrides.
Sourcepub fn build(self) -> NetworkConfig
pub fn build(self) -> NetworkConfig
Consume the builder and return the configuration.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for NetworkBuilder
impl RefUnwindSafe for NetworkBuilder
impl Send for NetworkBuilder
impl Sync for NetworkBuilder
impl Unpin for NetworkBuilder
impl UnsafeUnpin for NetworkBuilder
impl UnwindSafe for NetworkBuilder
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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