fix dns-resolver cmd line parsing

This commit is contained in:
Σrebe - Romain GERARD 2024-01-02 13:15:04 +01:00
parent 817571c907
commit bffd2470e7
No known key found for this signature in database
GPG key ID: 7A42B4B97E0332F4
3 changed files with 16 additions and 5 deletions

View file

@ -1,4 +1,3 @@
use std::cmp::max;
use fastwebsockets::{Frame, OpCode, Payload, WebSocketError, WebSocketRead, WebSocketWrite};
use futures_util::{pin_mut, FutureExt};
use hyper::upgrade::Upgraded;
@ -23,7 +22,7 @@ pub(super) async fn propagate_read(
});
static MAX_PACKET_LENGTH: usize = 64 * 1024;
let mut buffer = vec![0u8; MAX_PACKET_LENGTH * 1];
let mut buffer = vec![0u8; MAX_PACKET_LENGTH];
// We do our own pin_mut! to avoid shadowing timeout and be able to reset it, on next loop iteration
// We reuse the future to avoid creating a timer in the tight loop
@ -77,7 +76,13 @@ pub(super) async fn propagate_read(
let new_size = buffer.capacity() + (buffer.capacity() / 4); // grow buffer by 1.25 %
buffer.reserve_exact(new_size);
buffer.resize(buffer.capacity(), 0);
//info!("Buffer {} Mb {} {} {}", buffer.capacity() as f64 / 1024.0 / 1024.0, new_size, buffer.as_slice().len(), buffer.capacity())
trace!(
"Buffer {} Mb {} {} {}",
buffer.capacity() as f64 / 1024.0 / 1024.0,
new_size,
buffer.as_slice().len(),
buffer.capacity()
)
}
}

View file

@ -351,7 +351,7 @@ async fn server_upgrade(server_config: Arc<WsServerConfig>, mut req: Request<Inc
if protocol == LocalProtocol::ReverseSocks5 {
let Ok(header_val) = HeaderValue::from_str(
&base64::engine::general_purpose::STANDARD.encode(format!("fake://{}:{}", dest, port)),
&base64::engine::general_purpose::STANDARD.encode(format!("https://{}:{}", dest, port)),
) else {
error!("Bad headervalue for reverse socks5: {} {}", dest, port);
return http::Response::builder()