get_credentials removed

This commit is contained in:
ssrlive 2023-09-02 21:26:58 +08:00
parent 2122cc0ba8
commit 59fa5b155e
3 changed files with 3 additions and 12 deletions

View file

@ -401,7 +401,7 @@ impl ConnectionManager for HttpManager {
} }
Ok(Box::new(HttpConnection::new( Ok(Box::new(HttpConnection::new(
info, info,
self.get_credentials().clone(), self.credentials.clone(),
self.digest_state.clone(), self.digest_state.clone(),
)?)) )?))
} }
@ -409,10 +409,6 @@ impl ConnectionManager for HttpManager {
fn get_server_addr(&self) -> SocketAddr { fn get_server_addr(&self) -> SocketAddr {
self.server self.server
} }
fn get_credentials(&self) -> &Option<UserKey> {
&self.credentials
}
} }
impl HttpManager { impl HttpManager {

View file

@ -346,17 +346,13 @@ impl ConnectionManager for SocksProxyManager {
fn new_proxy_handler(&self, info: &ConnectionInfo, udp_associate: bool) -> Result<Box<dyn ProxyHandler>> { fn new_proxy_handler(&self, info: &ConnectionInfo, udp_associate: bool) -> Result<Box<dyn ProxyHandler>> {
use socks5_impl::protocol::Command::{Connect, UdpAssociate}; use socks5_impl::protocol::Command::{Connect, UdpAssociate};
let command = if udp_associate { UdpAssociate } else { Connect }; 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)?)) Ok(Box::new(SocksProxyImpl::new(info, credentials, self.version, command)?))
} }
fn get_server_addr(&self) -> SocketAddr { fn get_server_addr(&self) -> SocketAddr {
self.server self.server
} }
fn get_credentials(&self) -> &Option<UserKey> {
&self.credentials
}
} }
impl SocksProxyManager { impl SocksProxyManager {

View file

@ -18,7 +18,7 @@ use smoltcp::{
time::Instant, time::Instant,
wire::{IpCidr, IpProtocol, Ipv4Packet, Ipv6Packet, TcpPacket, UdpPacket, UDP_HEADER_LEN}, 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; use std::collections::LinkedList;
#[cfg(target_family = "unix")] #[cfg(target_family = "unix")]
use std::os::unix::io::AsRawFd; use std::os::unix::io::AsRawFd;
@ -205,7 +205,6 @@ pub(crate) trait ProxyHandler {
pub(crate) trait ConnectionManager { pub(crate) trait ConnectionManager {
fn new_proxy_handler(&self, info: &ConnectionInfo, udp_associate: bool) -> Result<Box<dyn ProxyHandler>>; fn new_proxy_handler(&self, info: &ConnectionInfo, udp_associate: bool) -> Result<Box<dyn ProxyHandler>>;
fn get_server_addr(&self) -> SocketAddr; fn get_server_addr(&self) -> SocketAddr;
fn get_credentials(&self) -> &Option<UserKey>;
} }
const TUN_TOKEN: Token = Token(0); const TUN_TOKEN: Token = Token(0);