pub struct Socks5Server {
pub listen_addr: String,
pub auth_config: Option<Arc<UserPass>>,
}Expand description
Socks5Server represents a SOCKS5 server and houses related configuration data
Fields§
§listen_addr: String§auth_config: Option<Arc<UserPass>>Implementations§
Source§impl Socks5Server
Socks5Server implementation block
impl Socks5Server
Socks5Server implementation block
Sourcepub fn new(listen_addr: impl Into<String>) -> Self
pub fn new(listen_addr: impl Into<String>) -> Self
new is a constructor for the Socks5Server type
Examples found in repository?
More examples
examples/with_auth.rs (line 14)
6async fn main() -> Result<(), Box<dyn std::error::Error>> {
7 tracing_subscriber::fmt::init();
8
9 let auth = UserPass {
10 username: "<user>".to_string(),
11 password: "<pass>".to_string(),
12 };
13
14 let server = Socks5Server::new("127.0.0.1:1080").with_auth(Some(auth));
15
16 server.run().await?;
17 Ok(())
18}Sourcepub fn with_auth(self, auth: Option<UserPass>) -> Self
pub fn with_auth(self, auth: Option<UserPass>) -> Self
with_auth applies the desired authentication
Examples found in repository?
examples/with_auth.rs (line 14)
6async fn main() -> Result<(), Box<dyn std::error::Error>> {
7 tracing_subscriber::fmt::init();
8
9 let auth = UserPass {
10 username: "<user>".to_string(),
11 password: "<pass>".to_string(),
12 };
13
14 let server = Socks5Server::new("127.0.0.1:1080").with_auth(Some(auth));
15
16 server.run().await?;
17 Ok(())
18}Sourcepub async fn run(&self) -> Result<()>
pub async fn run(&self) -> Result<()>
run handles server spinup and listens for incoming connections
Examples found in repository?
More examples
examples/with_auth.rs (line 16)
6async fn main() -> Result<(), Box<dyn std::error::Error>> {
7 tracing_subscriber::fmt::init();
8
9 let auth = UserPass {
10 username: "<user>".to_string(),
11 password: "<pass>".to_string(),
12 };
13
14 let server = Socks5Server::new("127.0.0.1:1080").with_auth(Some(auth));
15
16 server.run().await?;
17 Ok(())
18}Auto Trait Implementations§
impl Freeze for Socks5Server
impl RefUnwindSafe for Socks5Server
impl Send for Socks5Server
impl Sync for Socks5Server
impl Unpin for Socks5Server
impl UnwindSafe for Socks5Server
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