[−][src]Struct socks5_async::SocksServer
A SOCKS5 Server
Implementations
impl SocksServer
[src]
pub async fn new(
socket_addr: SocketAddr,
allow_no_auth: bool,
auth: Box<dyn Fn(String, String) -> bool + Send>
) -> SocksServer
[src]
socket_addr: SocketAddr,
allow_no_auth: bool,
auth: Box<dyn Fn(String, String) -> bool + Send>
) -> SocksServer
Creates and returns a new SocksServer
pub async fn serve<'_>(&'_ mut self)
[src]
Starts the server. It should be called after initializing server
Example
use socks5_async::SocksServer; use std::{ boxed::Box, error::Error, net::SocketAddr, }; let users = vec![ (String::from("user1"), String::from("123456")) ]; // Server address let address: SocketAddr = "127.0.0.1:1080".parse().unwrap(); let mut socks5 = SocksServer::new(address, true, Box::new(move |username, password| { // Authenticate user return users.contains(&(username, password)); }), ).await; socks5.serve().await;
Auto Trait Implementations
impl !RefUnwindSafe for SocksServer
impl Send for SocksServer
impl Sync for SocksServer
impl Unpin for SocksServer
impl !UnwindSafe for SocksServer
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,