pub struct TcpStreamService { /* private fields */ }Expand description
TCP stream proxy service
Listens on a port and proxies TCP connections to registered backends using round-robin load balancing.
Implementations§
Source§impl TcpStreamService
impl TcpStreamService
Sourcepub fn new(registry: Arc<StreamRegistry>, listen_port: u16) -> Self
pub fn new(registry: Arc<StreamRegistry>, listen_port: u16) -> Self
Create a new TCP stream service
Sourcepub fn with_tls_acceptor(self, acceptor: TlsAcceptor) -> Self
pub fn with_tls_acceptor(self, acceptor: TlsAcceptor) -> Self
Enable TLS termination using the given acceptor (builder-style).
Sourcepub fn with_proxy_protocol(self, enabled: bool) -> Self
pub fn with_proxy_protocol(self, enabled: bool) -> Self
Enable PROXY protocol v2 toward the upstream backend (builder-style).
Sourcepub fn registry(&self) -> &Arc<StreamRegistry>
pub fn registry(&self) -> &Arc<StreamRegistry>
Get a reference to the registry
Sourcepub async fn serve(self: Arc<Self>, listener: TcpListener)
pub async fn serve(self: Arc<Self>, listener: TcpListener)
Run a standalone TCP accept loop on the given listener.
For each accepted connection, resolves a backend from the registry and spawns a task to perform bidirectional tunneling. This method runs indefinitely until the listener encounters a fatal error.
Auto Trait Implementations§
impl !Freeze for TcpStreamService
impl !RefUnwindSafe for TcpStreamService
impl !UnwindSafe for TcpStreamService
impl Send for TcpStreamService
impl Sync for TcpStreamService
impl Unpin for TcpStreamService
impl UnsafeUnpin for TcpStreamService
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