pub struct NetStack { /* private fields */ }Expand description
Host user-space NAT network stack bridged to wasm_driver_net_*.
Implementations§
Source§impl NetStack
impl NetStack
Sourcepub fn new(cfg: NetConfig, raise_irq: Arc<dyn Fn() + Send + Sync>) -> Arc<Self> ⓘ
pub fn new(cfg: NetConfig, raise_irq: Arc<dyn Fn() + Send + Sync>) -> Arc<Self> ⓘ
Construct a NetStack, pre-reading host DNS resolvers from /etc/resolv.conf.
Sourcepub fn new_with_resolvers(
cfg: NetConfig,
resolvers: Vec<SocketAddrV4>,
monitor: Option<Arc<Monitor>>,
raise_irq: Arc<dyn Fn() + Send + Sync>,
) -> Arc<Self> ⓘ
pub fn new_with_resolvers( cfg: NetConfig, resolvers: Vec<SocketAddrV4>, monitor: Option<Arc<Monitor>>, raise_irq: Arc<dyn Fn() + Send + Sync>, ) -> Arc<Self> ⓘ
Construct a NetStack using pre-loaded DNS resolvers (allows calling apply_landlock
before spawning unkernel-net-timer so every thread inherits Landlock).
Sourcepub fn new_with_tls(
cfg: NetConfig,
resolvers: Vec<SocketAddrV4>,
monitor: Option<Arc<Monitor>>,
vmi_tls: Option<Arc<VmiTlsContext>>,
mitm_ca: Option<Arc<MitmCa>>,
raise_irq: Arc<dyn Fn() + Send + Sync>,
) -> Arc<Self> ⓘ
pub fn new_with_tls( cfg: NetConfig, resolvers: Vec<SocketAddrV4>, monitor: Option<Arc<Monitor>>, vmi_tls: Option<Arc<VmiTlsContext>>, mitm_ca: Option<Arc<MitmCa>>, raise_irq: Arc<dyn Fn() + Send + Sync>, ) -> Arc<Self> ⓘ
Construct a NetStack with optional Method-1 VMI TLS key extraction and/or Method-2 MITM CA.
Sourcepub fn new_with_identity(
cfg: NetConfig,
resolvers: Vec<SocketAddrV4>,
monitor: Option<Arc<Monitor>>,
vmi_tls: Option<Arc<VmiTlsContext>>,
mitm_ca: Option<Arc<MitmCa>>,
guest_mac: [u8; 6],
guest_ip: u32,
gateway_only_arp: bool,
frame_sink: Option<Arc<dyn Fn(Vec<u8>) + Send + Sync>>,
raise_irq: Arc<dyn Fn() + Send + Sync>,
) -> Arc<Self> ⓘ
pub fn new_with_identity( cfg: NetConfig, resolvers: Vec<SocketAddrV4>, monitor: Option<Arc<Monitor>>, vmi_tls: Option<Arc<VmiTlsContext>>, mitm_ca: Option<Arc<MitmCa>>, guest_mac: [u8; 6], guest_ip: u32, gateway_only_arp: bool, frame_sink: Option<Arc<dyn Fn(Vec<u8>) + Send + Sync>>, raise_irq: Arc<dyn Fn() + Send + Sync>, ) -> Arc<Self> ⓘ
Construct a NetStack with custom guest MAC/IP identity (used as a per-port NAT uplink
behind a crate::switch::VirtualSwitch).
pub fn mac(&self) -> [u8; 6]
pub fn rx_len(&self) -> usize
pub fn recv_frame(&self) -> Option<Vec<u8>>
pub fn send_frame(self: &Arc<Self>, frame: &[u8])
pub fn shutdown(&self)
Auto Trait Implementations§
impl !Freeze for NetStack
impl !RefUnwindSafe for NetStack
impl !UnwindSafe for NetStack
impl Forget for NetStack
impl Move for NetStack
impl Send for NetStack
impl Sync for NetStack
impl Unpin for NetStack
impl UnsafeUnpin for NetStackwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<String>: UnsafeUnpin,
PhantomData<PortForward>: UnsafeUnpin,
*const ArcInner<Mutex<File>> is !null: UnsafeUnpin,
PhantomData<ArcInner<Mutex<File>>>: UnsafeUnpin,
PhantomData<SocketAddrV4>: UnsafeUnpin,
*const ArcInner<Monitor> is !null: UnsafeUnpin,
PhantomData<ArcInner<Monitor>>: UnsafeUnpin,
*const ArcInner<VmiTlsContext> is !null: UnsafeUnpin,
PhantomData<ArcInner<VmiTlsContext>>: UnsafeUnpin,
*const ArcInner<MitmCa> is !null: UnsafeUnpin,
PhantomData<ArcInner<MitmCa>>: UnsafeUnpin,
*const ArcInner<dyn Fn(Vec<u8>) + Send + Sync> is !null: UnsafeUnpin,
PhantomData<ArcInner<dyn Fn(Vec<u8>) + Send + Sync>>: UnsafeUnpin,
Align4<u32>: UnsafeUnpin,
Align1<u8>: UnsafeUnpin,
PhantomData<Vec<u8>>: UnsafeUnpin,
PhantomData<(TcpKey, Arc<Mutex<TcpConn>>)>: UnsafeUnpin,
PhantomData<(u32, ())>: UnsafeUnpin,
PhantomData<(u32, String)>: UnsafeUnpin,
*const ArcInner<dyn Fn() + Send + Sync> is !null: UnsafeUnpin,
PhantomData<ArcInner<dyn Fn() + Send + Sync>>: UnsafeUnpin,
Align2<u16>: UnsafeUnpin,
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
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