Skip to main content

HostEgress

Struct HostEgress 

Source
pub struct HostEgress { /* private fields */ }
Expand description

Top-level host-socket egress that dispatches guest traffic to protocol-specific handlers and manages inbound port forwarding.

Implementations§

Source§

impl HostEgress

Source

pub fn new( gateway_ip: Ipv4Addr, gateway_mac: [u8; 6], guest_ip: Ipv4Addr, reply_tx: Sender<Vec<u8>>, cancel: CancellationToken, mtu: usize, ) -> Self

Creates a new host-socket egress.

reply_tx is used by all sub-proxies to send L2 frames back to the datapath for writing to the guest FD. mtu is the guest link MTU; guest-bound UDP datagrams above it are IPv4-fragmented.

Source

pub fn reply_sender(&self) -> Sender<Vec<u8>>

Returns a clone of the reply sender for external use (e.g. async DNS forwarding).

Source

pub fn set_proxy_awareness( &mut self, dns_log: DnsResolutionLog, proxy_env: ProxyEnvironment, )

Makes the UDP path proxy-aware, mirroring TcpBridge::set_proxy_awareness: shares the fake-IP dns_log (so a fake-IP destination is reversed to its domain) and the detected proxy_env (so a configured SOCKS proxy routes non-gateway, non-bypassed UDP flows). Opt-in and off by default, so the VMM and existing callers are unaffected. HTTP proxies can’t carry UDP, so only a SOCKS proxy engages this.

Source

pub fn handle_outbound(&mut self, frame: &[u8], guest_mac: [u8; 6])

Dispatches an outbound IPv4 frame to the appropriate protocol proxy.

Inbound reply frames (matching an active inbound connection) are intercepted first; everything else is proxied through host sockets.

Source

pub fn handle_inbound_command( &mut self, cmd: InboundCommand, guest_mac: [u8; 6], )

Handles an inbound UDP command from the listener manager.

Source

pub fn maintenance(&mut self)

Runs periodic maintenance (flow cleanup).

Source

pub fn expire_flow(&mut self, _addr: SocketAddr)

Expire a specific flow by address (called from timer wheel).

This is the timer-wheel-driven counterpart to maintenance(). Instead of scanning all flows, it targets a specific expired flow.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more