mirror of
https://github.com/tun2proxy/tun2proxy.git
synced 2025-06-23 09:30:54 +00:00
send_udp_packet
This commit is contained in:
parent
da87fa8d5a
commit
30420059cc
2 changed files with 20 additions and 21 deletions
16
src/socks.rs
16
src/socks.rs
|
@ -158,11 +158,11 @@ impl SocksProxyImpl {
|
|||
return Err("SOCKS5 server requires an unsupported authentication method.".into());
|
||||
}
|
||||
|
||||
if auth_method == AuthMethod::UserPass {
|
||||
self.state = SocksState::SendAuthData;
|
||||
self.state = if auth_method == AuthMethod::UserPass {
|
||||
SocksState::SendAuthData
|
||||
} else {
|
||||
self.state = SocksState::SendRequest;
|
||||
}
|
||||
SocksState::SendRequest
|
||||
};
|
||||
self.state_change()
|
||||
}
|
||||
|
||||
|
@ -344,12 +344,8 @@ impl ConnectionManager for SocksProxyManager {
|
|||
fn new_tcp_proxy(&self, info: &ConnectionInfo, udp_associate: bool) -> Result<Box<dyn TcpProxy>> {
|
||||
use socks5_impl::protocol::Command::{Connect, UdpAssociate};
|
||||
let command = if udp_associate { UdpAssociate } else { Connect };
|
||||
Ok(Box::new(SocksProxyImpl::new(
|
||||
info,
|
||||
self.credentials.clone(),
|
||||
self.version,
|
||||
command,
|
||||
)?))
|
||||
let credentials = self.credentials.clone();
|
||||
Ok(Box::new(SocksProxyImpl::new(info, credentials, self.version, command)?))
|
||||
}
|
||||
|
||||
fn close_connection(&self, _: &ConnectionInfo) {}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue