pub struct TcpServer { /* private fields */ }Expand description
TCP proxy server for a Cloud SQL instance.
Binds a TCP listener on construction, guaranteeing the socket is ready to accept connections once the struct is obtained.
Implementations§
Source§impl TcpServer
impl TcpServer
Sourcepub async fn new(
dialer: Arc<Dialer>,
address: SocketAddr,
) -> Result<Self, Error>
pub async fn new( dialer: Arc<Dialer>, address: SocketAddr, ) -> Result<Self, Error>
Bind a TCP proxy for a Cloud SQL instance.
The socket is bound immediately — if this returns Ok, the server
is ready to accept connections.
Sourcepub async fn new_localhost_v4(dialer: Arc<Dialer>) -> Result<Self, Error>
pub async fn new_localhost_v4(dialer: Arc<Dialer>) -> Result<Self, Error>
Bind a TCP proxy on localhost with an OS-assigned port.
Use TcpServer::local_addr to discover the assigned port.
Sourcepub async fn new_localhost_v6(dialer: Arc<Dialer>) -> Result<Self, Error>
pub async fn new_localhost_v6(dialer: Arc<Dialer>) -> Result<Self, Error>
Bind a TCP proxy on IPv6 localhost with an OS-assigned port.
Use TcpServer::local_addr to discover the assigned port.
Sourcepub fn local_addr(&self) -> Result<SocketAddr, Error>
pub fn local_addr(&self) -> Result<SocketAddr, Error>
Return the local address this server is bound to.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for TcpServer
impl !RefUnwindSafe for TcpServer
impl Send for TcpServer
impl Sync for TcpServer
impl Unpin for TcpServer
impl UnsafeUnpin for TcpServer
impl !UnwindSafe for TcpServer
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