Implement socks5 support

This adds following settings:

- Socks5Enabled
- Socks5Host
- Socks5Port
- Socks5User
- Socks5Password

Currently http requests and dns requests are not getting executed as they currently can't get tunneled through socks5 proxy. Therefore gmail with oauth2 wont work through tor.
This commit is contained in:
Jikstra
2021-08-22 19:55:38 +02:00
committed by GitHub
parent a163be9248
commit 90703b0dd2
16 changed files with 355 additions and 42 deletions

View File

@@ -3,6 +3,7 @@ use std::ops::{Deref, DerefMut};
use async_imap::Session as ImapSession;
use async_native_tls::TlsStream;
use async_std::net::TcpStream;
use fast_socks5::client::Socks5Stream;
#[derive(Debug)]
pub(crate) struct Session {
@@ -17,6 +18,7 @@ pub(crate) trait SessionStream:
impl SessionStream for TlsStream<Box<dyn SessionStream>> {}
impl SessionStream for TlsStream<TcpStream> {}
impl SessionStream for TcpStream {}
impl SessionStream for Socks5Stream<TcpStream> {}
impl Deref for Session {
type Target = ImapSession<Box<dyn SessionStream>>;