Skip to content

Feature Request: Cross-platform library to query the system resolver for arbitrary DNS records #317

@fortuna

Description

@fortuna

I would like to have a cross-platform package to query the system DNS resolver and get DNS messages. This will enable:

  • Fetching of the HTTPS (and SVCB) records to jump straight to TLS/H2/H3, bypassing vulnerable protocols.
  • Fetching of ECH keys.
  • Better detection of DNS interference on the fly.

I have prototypes for macOS/iOS, Linux and Android that queries an arbitrary resource record using the system resolver. It's Go code using cgo.

Some observations:

  • libresolv doesn't work on Android and iOS because you can't query localhost:53.
  • libresolv is bad, since it's blocking and doesnt' allow for cancellation.
  • On Android you can call android_res_nquery from C/C++
  • Apple was a pain to figure out due to lack of documentation. I found their source code to be helpful and I have pointers in my code. This repo has example clients as well.
  • I haven't tried Windows yet, but I was going to try the DnsQueryEx api (example).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions