mirror of
https://github.com/tun2proxy/tun2proxy.git
synced 2025-06-21 16:41:01 +00:00
re-formatting with max_width = 120
This commit is contained in:
parent
4d9b10fd1c
commit
ff9c258fbd
11 changed files with 64 additions and 191 deletions
17
src/lib.rs
17
src/lib.rs
|
@ -124,24 +124,17 @@ pub fn tun_to_proxy<'a>(
|
|||
let mut ttp = TunToProxy::new(interface, options)?;
|
||||
let credentials = proxy.credentials.clone();
|
||||
let server = proxy.addr;
|
||||
#[rustfmt::skip]
|
||||
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::Http => {
|
||||
Rc::new(HttpManager::new(server, credentials)) as Rc<dyn ConnectionManager>
|
||||
}
|
||||
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::Http => Rc::new(HttpManager::new(server, credentials)) as Rc<dyn ConnectionManager>,
|
||||
};
|
||||
ttp.add_connection_manager(mgr);
|
||||
Ok(ttp)
|
||||
}
|
||||
|
||||
pub fn main_entry(
|
||||
interface: &NetworkInterface,
|
||||
proxy: &Proxy,
|
||||
options: Options,
|
||||
) -> Result<(), Error> {
|
||||
pub fn main_entry(interface: &NetworkInterface, proxy: &Proxy, options: Options) -> Result<(), Error> {
|
||||
let mut ttp = tun_to_proxy(interface, proxy, options)?;
|
||||
ttp.run()?;
|
||||
Ok(())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue