mirror of
https://github.com/tun2proxy/tun2proxy.git
synced 2025-06-05 14:20:21 +00:00
reading code
This commit is contained in:
parent
59fa5b155e
commit
b8dab403e9
1 changed files with 4 additions and 4 deletions
|
@ -4,7 +4,7 @@ use crate::{
|
|||
socks::SocksProxyManager,
|
||||
tun2proxy::{ConnectionManager, TunToProxy},
|
||||
};
|
||||
use socks5_impl::protocol::{UserKey, Version};
|
||||
use socks5_impl::protocol::UserKey;
|
||||
use std::{
|
||||
net::{SocketAddr, ToSocketAddrs},
|
||||
rc::Rc,
|
||||
|
@ -145,10 +145,10 @@ pub fn tun_to_proxy<'a>(
|
|||
let mut ttp = TunToProxy::new(interface, options)?;
|
||||
let credentials = proxy.credentials.clone();
|
||||
let server = proxy.addr;
|
||||
#[rustfmt::skip]
|
||||
use socks5_impl::protocol::Version::{V4, V5};
|
||||
let mgr = match proxy.proxy_type {
|
||||
ProxyType::Socks4 => Rc::new(SocksProxyManager::new(server, Version::V4, credentials)) as Rc<dyn ConnectionManager>,
|
||||
ProxyType::Socks5 => Rc::new(SocksProxyManager::new(server, Version::V5, credentials)) as Rc<dyn ConnectionManager>,
|
||||
ProxyType::Socks4 => Rc::new(SocksProxyManager::new(server, V4, credentials)) as Rc<dyn ConnectionManager>,
|
||||
ProxyType::Socks5 => Rc::new(SocksProxyManager::new(server, V5, credentials)) as Rc<dyn ConnectionManager>,
|
||||
ProxyType::Http => Rc::new(HttpManager::new(server, credentials)) as Rc<dyn ConnectionManager>,
|
||||
};
|
||||
ttp.set_connection_manager(Some(mgr));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue