pub struct PasstManager { /* private fields */ }Expand description
Manages a passt daemon instance for a single box.
Implementations§
Source§impl PasstManager
impl PasstManager
Sourcepub fn new(socket_dir: &Path) -> Self
pub fn new(socket_dir: &Path) -> Self
Create a new PasstManager.
The socket and PID file are placed directly in the provided runtime
socket directory (the same directory that holds the exec/PTY control
sockets, e.g. /tmp/a3s-box-sockets/<box_id>).
This directory MUST be reachable by the user passt runs as. When passt
is started as root it drops privileges to nobody, so the socket
directory has to be world-traversable — the box’s ~/.a3s/boxes/<id>
home is mode 0700 for root and would leave passt unable to bind its
socket, silently breaking all bridge networking and Compose.
Sourcepub fn socket_path(&self) -> &Path
pub fn socket_path(&self) -> &Path
Get the passt socket path.
Sourcepub fn spawn(
&mut self,
ip: Ipv4Addr,
gateway: Ipv4Addr,
prefix_len: u8,
dns_servers: &[Ipv4Addr],
port_map: &[String],
) -> Result<()>
pub fn spawn( &mut self, ip: Ipv4Addr, gateway: Ipv4Addr, prefix_len: u8, dns_servers: &[Ipv4Addr], port_map: &[String], ) -> Result<()>
Spawn the passt daemon.
Configures passt with:
- Unix socket mode (no PID namespace)
- The assigned IP, gateway, prefix length
- DNS forwarding
- No DHCP (static IP assignment)
- Inbound TCP port forwarding for any published ports (
port_map)
Sourcepub fn is_running(&mut self) -> bool
pub fn is_running(&mut self) -> bool
Check if the passt process is still running.
Trait Implementations§
Source§impl Debug for PasstManager
impl Debug for PasstManager
Source§impl Drop for PasstManager
impl Drop for PasstManager
Source§impl NetworkBackend for PasstManager
impl NetworkBackend for PasstManager
Auto Trait Implementations§
impl Freeze for PasstManager
impl RefUnwindSafe for PasstManager
impl Send for PasstManager
impl Sync for PasstManager
impl Unpin for PasstManager
impl UnsafeUnpin for PasstManager
impl UnwindSafe for PasstManager
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more