pub struct SmgwProxy { /* private fields */ }Expand description
A single authorized HAN-to-WAN route. A mutable borrow admits one session at a time.
Implementations§
Source§impl SmgwProxy
impl SmgwProxy
Sourcepub fn new(
han: TlsEndpoint,
wan: TlsEndpoint,
route: String,
wan_address: SocketAddr,
wan_sni: String,
handshake_timeout: Duration,
session_timeout: Duration,
) -> Result<Self>
pub fn new( han: TlsEndpoint, wan: TlsEndpoint, route: String, wan_address: SocketAddr, wan_sni: String, handshake_timeout: Duration, session_timeout: Duration, ) -> Result<Self>
Configures the SNI route and its fixed loopback WAN destination.
Sourcepub async fn relay(&mut self, tcp: TcpStream) -> Result<(u64, u64)>
pub async fn relay(&mut self, tcp: TcpStream) -> Result<(u64, u64)>
Authenticates the CLS and authorizes its SNI before opening a WAN socket.
The session deadline covers both handshakes and relay. Dropping this future closes the streams. The return value counts plaintext bytes in HAN-to-WAN and WAN-to-HAN order. Tokio bounds the relay buffer in each direction.
Auto Trait Implementations§
impl Freeze for SmgwProxy
impl RefUnwindSafe for SmgwProxy
impl Send for SmgwProxy
impl Sync for SmgwProxy
impl Unpin for SmgwProxy
impl UnsafeUnpin for SmgwProxy
impl UnwindSafe for SmgwProxy
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