Initial support digest auth scheme

This commit is contained in:
Jorge Alejandro Jimenez Luna 2023-06-22 13:09:36 -04:00
parent 6767076a6b
commit 86429ee8eb
No known key found for this signature in database
GPG key ID: 58F10568E03E6001
6 changed files with 321 additions and 67 deletions

View file

@ -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 {