Struct socks5_impl::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 an 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(
addr: SocketAddr,
auth: Arc<dyn Auth + Send + Sync>
) -> Result<Self>
pub async fn bind( addr: SocketAddr, 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
Auto Trait Implementations§
impl !RefUnwindSafe for Server
impl Send for Server
impl Sync for Server
impl Unpin for Server
impl !UnwindSafe for Server
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