mirror of
https://github.com/tun2proxy/tun2proxy.git
synced 2025-06-09 08:07:43 +00:00
Initial support digest auth scheme
This commit is contained in:
parent
6767076a6b
commit
86429ee8eb
6 changed files with 321 additions and 67 deletions
12
src/socks.rs
12
src/socks.rs
|
@ -156,10 +156,10 @@ impl SocksConnection {
|
|||
}
|
||||
self.server_outbuf.extend(ip_vec);
|
||||
if let Some(credentials) = credentials {
|
||||
self.server_outbuf.extend(&credentials.username);
|
||||
self.server_outbuf.extend(credentials.username.as_bytes());
|
||||
if !credentials.password.is_empty() {
|
||||
self.server_outbuf.push_back(b':');
|
||||
self.server_outbuf.extend(&credentials.password);
|
||||
self.server_outbuf.extend(credentials.password.as_bytes());
|
||||
}
|
||||
}
|
||||
self.server_outbuf.push_back(0);
|
||||
|
@ -250,10 +250,10 @@ impl SocksConnection {
|
|||
let credentials = self.credentials.as_ref().unwrap_or(&tmp);
|
||||
self.server_outbuf
|
||||
.extend(&[1u8, credentials.username.len() as u8]);
|
||||
self.server_outbuf.extend(&credentials.username);
|
||||
self.server_outbuf.extend(credentials.username.as_bytes());
|
||||
self.server_outbuf
|
||||
.extend(&[credentials.password.len() as u8]);
|
||||
self.server_outbuf.extend(&credentials.password);
|
||||
self.server_outbuf.extend(credentials.password.as_bytes());
|
||||
self.state = SocksState::ReceiveAuthResponse;
|
||||
self.state_change()
|
||||
}
|
||||
|
@ -424,6 +424,10 @@ impl TcpProxy for SocksConnection {
|
|||
},
|
||||
}
|
||||
}
|
||||
|
||||
fn reset_connection(&self) -> bool {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
pub struct SocksManager {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue