refactor(connlib): remove unused branch in match (#7550)

When deciding what to do with a certain DNS query, we check whether the
domain name in question corresponds to any of the (wildcard) DNS
resource addresses. If yes, we resolve it to the resource ID of that
resource. The source of those resource IDs is the `dns_resources` map.

If we have looked up a `ResourceId` in that map, it is impossible for it
to not be "known" which means the branch deleted in this PR is
completely redundant and already covered by the catch-all branch where
`maybe_resource` is `None`.
This commit is contained in:
Thomas Eizinger
2024-12-18 16:47:15 +01:00
committed by GitHub
parent 940438217c
commit a80abec4ff

View File

@@ -268,10 +268,6 @@ impl StubResolver {
Some(domain.clone())
}
fn knows_resource(&self, resource: &ResourceId) -> bool {
self.dns_resources.values().contains(resource)
}
/// Processes the incoming DNS query.
///
/// Any errors will result in an immediate `SERVFAIL` response.
@@ -323,9 +319,6 @@ impl StubResolver {
let maybe_resource = self.match_resource_linear(&domain);
let resource_records = match (qtype, maybe_resource) {
(_, Some(resource)) if !self.knows_resource(&resource) => {
return Ok(ResolveStrategy::Recurse)
}
(Rtype::A, Some(resource)) => self.get_or_assign_a_records(domain.clone(), resource),
(Rtype::AAAA, Some(resource)) => {
self.get_or_assign_aaaa_records(domain.clone(), resource)