Skip to content

Commit

Permalink
add parsing with checking of header
Browse files Browse the repository at this point in the history
  • Loading branch information
justRkive committed Nov 10, 2023
1 parent b4ca95f commit 246c8bc
Showing 1 changed file with 26 additions and 17 deletions.
43 changes: 26 additions & 17 deletions src/resolver/lookup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,28 +171,37 @@ pub async fn lookup_stub( //FIXME: podemos ponerle de nombre lookup_strategy y
ConnectionProtocol::UDP=> {
let result_response = conn_udp.send(new_query.clone());

response = match result_response {
Ok(response_message) => {
match DnsMessage::from_bytes(&response_message) {
Ok(dns_message) => dns_message,
Err(_) => Err(ResolverError::Parse("The name server was unable to interpret the query.".to_string()))?,
}
},
// FIXME: arrelar para que se mantengan los errores
response = match parse_response(result_response) {
Ok(response_message) => response_message,
Err(_) => response,
}
};
// response = match result_response {
// Ok(response_message) => {
// match DnsMessage::from_bytes(&response_message) {
// Ok(dns_message) => dns_message,
// Err(_) => Err(ResolverError::Parse("The name server was unable to interpret the query.".to_string()))?,
// }
// },
// Err(_) => response,
// }
}
ConnectionProtocol::TCP => {
let result_response = conn_tcp.send(new_query.clone());

response = match result_response {
Ok(response_message) => {
match DnsMessage::from_bytes(&response_message) {
Ok(dns_message) => dns_message,
Err(_) => Err(ResolverError::Parse("The name server was unable to interpret the query.".to_string()))?,
}
},

response = match parse_response(result_response) {
Ok(response_message) => response_message,
Err(_) => response,
}
};
// response = match result_response {
// Ok(response_message) => {
// match DnsMessage::from_bytes(&response_message) {
// Ok(dns_message) => dns_message,
// Err(_) => Err(ResolverError::Parse("The name server was unable to interpret the query.".to_string()))?,
// }
// },
// Err(_) => response,
// }
}
_ => continue,
}
Expand Down

0 comments on commit 246c8bc

Please sign in to comment.