mirror of
https://github.com/tun2proxy/tun2proxy.git
synced 2025-06-21 16:41:01 +00:00
Implement SOCKS5 authentication
This commit is contained in:
parent
c1aaec6159
commit
d2aef08e3c
5 changed files with 244 additions and 121 deletions
|
@ -1,3 +1,4 @@
|
|||
use crate::tun2proxy::Credentials;
|
||||
use crate::{http::HttpManager, socks5::Socks5Manager, tun2proxy::TunToProxy};
|
||||
use std::net::SocketAddr;
|
||||
|
||||
|
@ -12,14 +13,14 @@ pub enum ProxyType {
|
|||
Http,
|
||||
}
|
||||
|
||||
pub fn main_entry(tun: &str, addr: SocketAddr, proxy_type: ProxyType) {
|
||||
pub fn main_entry(tun: &str, addr: SocketAddr, proxy_type: ProxyType, credentials: Credentials) {
|
||||
let mut ttp = TunToProxy::new(tun);
|
||||
match proxy_type {
|
||||
ProxyType::Socks5 => {
|
||||
ttp.add_connection_manager(Box::new(Socks5Manager::new(addr)));
|
||||
ttp.add_connection_manager(Socks5Manager::new(addr, credentials));
|
||||
}
|
||||
ProxyType::Http => {
|
||||
ttp.add_connection_manager(Box::new(HttpManager::new(addr)));
|
||||
ttp.add_connection_manager(HttpManager::new(addr, credentials));
|
||||
}
|
||||
}
|
||||
ttp.run();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue