Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run dns test for 50 times #1088

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions crates/telio-dns/src/nameserver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,10 @@ impl LocalNameServer {
let semaphore = Arc::new(Semaphore::new(MAX_CONCURRENT_QUERIES));
loop {
let bytes_read = match socket.recv(&mut receiving_buffer).await {
Ok(bytes) => bytes,
Ok(bytes) => {
telio_log_debug!("Pkt recvd");
bytes
}
Err(e) => {
telio_log_error!("[DNS] Failed to read bytes: {:?}", e);
continue;
Expand All @@ -109,7 +112,7 @@ impl LocalNameServer {
_ => break,
};
}

telio_log_debug!("Timers updated");
let peer = peer.clone();
let socket = socket.clone();
let nameserver = nameserver.clone();
Expand All @@ -122,6 +125,7 @@ impl LocalNameServer {
receiving_buffer.get(..bytes_read).unwrap_or(&[]),
&mut sending_buffer,
);
telio_log_debug!("Pkt decapsulated");
match res {
// Handshake packets
TunnResult::WriteToNetwork(packet) => {
Expand All @@ -141,6 +145,7 @@ impl LocalNameServer {
return;
};
}
telio_log_debug!("Handshake pkt");
}
// DNS packets
TunnResult::WriteToTunnelV4(packet, _)
Expand All @@ -153,6 +158,7 @@ impl LocalNameServer {
return;
}
};
telio_log_debug!("Write2Tun");

let nameserver = nameserver.clone();
let length = match LocalNameServer::process_packet(
Expand All @@ -172,6 +178,7 @@ impl LocalNameServer {
return;
}
};
telio_log_debug!("Pkt processed");

let tunn_res = peer.lock().await.encapsulate(
receiving_buffer.get(..length).unwrap_or(&[]),
Expand Down Expand Up @@ -205,6 +212,7 @@ impl LocalNameServer {
nameserver: Arc<RwLock<LocalNameServer>>,
request_info: &mut RequestInfo,
) -> Result<Vec<u8>, String> {
telio_log_debug!("Resolving dns");
let resolver = Resolver::new();
let zones = nameserver.zones().await;

Expand Down
Loading