diff --git a/src/http.rs b/src/http.rs index 8aabf2f..4d3e5bb 100644 --- a/src/http.rs +++ b/src/http.rs @@ -401,7 +401,7 @@ impl ConnectionManager for HttpManager { } Ok(Box::new(HttpConnection::new( info, - self.get_credentials().clone(), + self.credentials.clone(), self.digest_state.clone(), )?)) } @@ -409,10 +409,6 @@ impl ConnectionManager for HttpManager { fn get_server_addr(&self) -> SocketAddr { self.server } - - fn get_credentials(&self) -> &Option { - &self.credentials - } } impl HttpManager { diff --git a/src/socks.rs b/src/socks.rs index 216dd48..7c62aa9 100644 --- a/src/socks.rs +++ b/src/socks.rs @@ -346,17 +346,13 @@ impl ConnectionManager for SocksProxyManager { fn new_proxy_handler(&self, info: &ConnectionInfo, udp_associate: bool) -> Result> { use socks5_impl::protocol::Command::{Connect, UdpAssociate}; let command = if udp_associate { UdpAssociate } else { Connect }; - let credentials = self.get_credentials().clone(); + let credentials = self.credentials.clone(); Ok(Box::new(SocksProxyImpl::new(info, credentials, self.version, command)?)) } fn get_server_addr(&self) -> SocketAddr { self.server } - - fn get_credentials(&self) -> &Option { - &self.credentials - } } impl SocksProxyManager { diff --git a/src/tun2proxy.rs b/src/tun2proxy.rs index a8df375..a2629c1 100644 --- a/src/tun2proxy.rs +++ b/src/tun2proxy.rs @@ -18,7 +18,7 @@ use smoltcp::{ time::Instant, wire::{IpCidr, IpProtocol, Ipv4Packet, Ipv6Packet, TcpPacket, UdpPacket, UDP_HEADER_LEN}, }; -use socks5_impl::protocol::{Address, StreamOperation, UdpHeader, UserKey}; +use socks5_impl::protocol::{Address, StreamOperation, UdpHeader}; use std::collections::LinkedList; #[cfg(target_family = "unix")] use std::os::unix::io::AsRawFd; @@ -205,7 +205,6 @@ pub(crate) trait ProxyHandler { pub(crate) trait ConnectionManager { fn new_proxy_handler(&self, info: &ConnectionInfo, udp_associate: bool) -> Result>; fn get_server_addr(&self) -> SocketAddr; - fn get_credentials(&self) -> &Option; } const TUN_TOKEN: Token = Token(0);