Skip to content

[processor/dnslookup] Add DNS resolver with hostfile, nameserver, and caching support #40390

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

kaisecheng
Copy link
Contributor

@kaisecheng kaisecheng commented May 30, 2025

Description

This PR introduces the core DNS resolution functionality for use in the dnslookupprocessor.

  • Resolver interface: Defines forward and reverse DNS lookup operations.
  • Hostfile resolver: Supports resolving from one or more hostfiles.
    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.
  • Nameserver resolver: Supports custom DNS servers and system resolver.
    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.
  • Chain resolver: Attempts resolution through a sequence of resolvers.
    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.
  • Cache resolver: Cache results from chain resolver.
    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

…r, and caching support

This PR introduces the core DNS resolution functionality for use in the `dnslookupprocessor`.
- Resolver interface: Defines forward and reverse DNS lookup operations.
- Hostfile resolver: Supports resolving from one or more hostfiles.
- Nameserver resolver: Supports custom DNS servers and system resolver.
   It retries with exponential backoff on failures.
- Chain resolver: Attempts resolution through a sequence of resolvers.
   Returns the first successful result. No resolution is considered a success
- Cache resolver - Cache results from chain resolvers.
   Successful resolutions are stored in the hit cache. Failed lookups are stored in miss cache.
   Implements LRU caching with TTL support.
@kaisecheng
Copy link
Contributor Author

@edmocosta I believe this is ready for review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants