buffer size changes and dns adds block

This commit is contained in:
2026-03-17 16:21:05 +07:00
parent 25d7e8b290
commit 530568d27a
13 changed files with 89025 additions and 117 deletions
+8 -4
View File
@@ -1,11 +1,15 @@
use crate::connections::dns::handle_dns_query;
use crate::connections::dns::DnsHandler; // проверь путь
use crate::connections::ip_store::FakeIpStore;
use smoltcp::socket::udp;
pub struct UdpConnection;
impl UdpConnection {
pub fn process_incoming(socket: &mut udp::Socket, store: &mut FakeIpStore) {
pub fn process_incoming(
socket: &mut udp::Socket,
store: &mut FakeIpStore,
dns_handler: &DnsHandler,
) {
while socket.can_recv() {
let (data, metadata) = match socket.recv() {
Ok(res) => res,
@@ -14,8 +18,8 @@ impl UdpConnection {
let endpoint = metadata.endpoint;
if let Some(response) = handle_dns_query(&data, store) {
netrunner_logger::debug!(to = %endpoint, "Sending DNS response");
if let Some(response) = dns_handler.handle_query(&data, store) {
netrunner_logger::debug!(to = %endpoint, "Sending DNS response (filtered)");
let _ = socket.send_slice(&response, metadata);
}
}