Struct socks5_server::Server
source · pub struct Server { /* private fields */ }Expand description
The socks5 server itself.
The server can be constructed on a given socket address, or be created on a existing TcpListener.
The authentication method can be configured with the Auth trait.
Implementations§
source§impl Server
impl Server
sourcepub fn new(listener: TcpListener, auth: Arc<dyn Auth + Send + Sync>) -> Self
pub fn new(listener: TcpListener, auth: Arc<dyn Auth + Send + Sync>) -> Self
Create a new socks5 server with the given TCP listener and authentication method.
sourcepub async fn bind<T: ToSocketAddrs>(
addr: T,
auth: Arc<dyn Auth + Send + Sync>
) -> Result<Self>
pub async fn bind<T: ToSocketAddrs>(
addr: T,
auth: Arc<dyn Auth + Send + Sync>
) -> Result<Self>
Create a new socks5 server on the given socket address and authentication method.
sourcepub async fn accept(&self) -> Result<(IncomingConnection, SocketAddr)>
pub async fn accept(&self) -> Result<(IncomingConnection, SocketAddr)>
Accept an IncomingConnection. The connection may not be a valid socks5 connection. You need to call IncomingConnection::handshake() to hand-shake it into a proper socks5 connection.
sourcepub fn local_addr(&self) -> Result<SocketAddr>
pub fn local_addr(&self) -> Result<SocketAddr>
Get the the local socket address binded to this server