mirror of
https://github.com/tun2proxy/tun2proxy.git
synced 2025-06-22 17:10:54 +00:00
read code
This commit is contained in:
parent
64ab4b503c
commit
855aaa04fa
3 changed files with 18 additions and 18 deletions
15
src/socks.rs
15
src/socks.rs
|
@ -194,6 +194,13 @@ impl SocksProxyImpl {
|
|||
self.state_change()
|
||||
}
|
||||
|
||||
fn send_request_socks5(&mut self) -> Result<(), Error> {
|
||||
protocol::Request::new(protocol::Command::Connect, self.info.dst.clone())
|
||||
.write_to_stream(&mut self.server_outbuf)?;
|
||||
self.state = SocksState::ReceiveResponse;
|
||||
self.state_change()
|
||||
}
|
||||
|
||||
fn receive_connection_status(&mut self) -> Result<(), Error> {
|
||||
let response = protocol::Response::retrieve_from_stream(&mut self.server_inbuf.clone());
|
||||
if let Err(e) = &response {
|
||||
|
@ -217,14 +224,6 @@ impl SocksProxyImpl {
|
|||
self.state_change()
|
||||
}
|
||||
|
||||
fn send_request_socks5(&mut self) -> Result<(), Error> {
|
||||
// self.server_outbuf.extend(&[self.version as u8, self.command as u8, 0]);
|
||||
protocol::Request::new(protocol::Command::Connect, self.info.dst.clone())
|
||||
.write_to_stream(&mut self.server_outbuf)?;
|
||||
self.state = SocksState::ReceiveResponse;
|
||||
self.state_change()
|
||||
}
|
||||
|
||||
fn relay_traffic(&mut self) -> Result<(), Error> {
|
||||
self.client_outbuf.extend(self.server_inbuf.iter());
|
||||
self.server_outbuf.extend(self.client_inbuf.iter());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue