[processor/dnslookup] Add DNS resolver with hostfile, nameserver, and caching support #40390
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR introduces the core DNS resolution functionality for use in the
dnslookupprocessor
.Note that later hostfiles in the list take precedence over earlier ones for duplicate entries.
When hostname is not in files, the processor continues to the next resolver in the chain.
It performs A/CNAME record lookups to resolve hostnames to IP addresses,
and PTR record lookups for reverse DNS resolution (IP to hostname)
It retries with exponential backoff on failures.
The resolver prefers IPv4 addresses over IPv6 when both are available.
Returns the first successful result. No resolution is considered a success.
Designed to support a resolution chain such as: hostfile -> nameserver -> system default.
The actual resolver chain initialization logic will be added in the next PR.
Successful resolutions are stored in the hit cache.
Failed lookups are stored in miss cache.
Implements LRU caching with TTL support.
The current processor is a no-op, as user configuration and signal processing are not yet implemented
Link to tracking issue
#34398
Testing
Added unit tests for all resolvers
Documentation