[PR #1680] [MERGED] Trust dns client cli #2510

Closed
opened 2026-03-16 09:50:24 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/hickory-dns/hickory-dns/pull/1680
Author: @bluejekyll
Created: 4/8/2022
Status: Merged
Merged: 4/10/2022
Merged by: @bluejekyll

Base: mainHead: trust-dns-client-cli


📝 Commits (10+)

  • 15aa003 create initial dns cli
  • 2c0e211 add version to dns cli
  • 67187c1 udp and query wired up
  • 8107b41 wire up tcp in dns client
  • 577344a add methods for update operations to dns client
  • aef0705 add tls protocol impl to dns client
  • c2f99fe add https to dns client
  • 2170572 improve debug output on request senging
  • 40823b8 Allow TLS to ignore server certificate validation in dns util
  • c8d74f9 allow custom ALPNs

📊 Changes

19 files changed (+791 additions, -23 deletions)

View changed files

📝 .codecov.yml (+3 -0)
📝 Cargo.lock (+12 -0)
📝 README.md (+8 -0)
📝 crates/client/src/serialize/txt/mod.rs (+1 -0)
📝 crates/client/src/serialize/txt/parse_rdata.rs (+72 -1)
📝 crates/proto/src/https/https_client_stream.rs (+8 -6)
📝 crates/proto/src/op/edns.rs (+19 -0)
📝 crates/proto/src/op/header.rs (+2 -1)
📝 crates/proto/src/op/message.rs (+38 -1)
📝 crates/proto/src/op/query.rs (+9 -4)
📝 crates/proto/src/quic/mod.rs (+2 -2)
📝 crates/proto/src/quic/quic_client_stream.rs (+5 -2)
📝 crates/proto/src/udp/udp_client_stream.rs (+7 -0)
📝 crates/proto/src/xfer/dns_multiplexer.rs (+7 -0)
📝 crates/proto/src/xfer/dns_response.rs (+5 -0)
📝 crates/proto/src/xfer/mod.rs (+5 -1)
📝 crates/resolver/src/config.rs (+1 -1)
📝 util/Cargo.toml (+12 -4)
util/src/dns.rs (+575 -0)

📄 Description

This is a new CLI for trust-dns-client that mimics the dig command:

$> cargo install --all-features --path util --bin dns
...

The options are:

$> dns -h
trust dns client 0.21.2
A CLI interface for the trust-dns-client

USAGE:
    dns [OPTIONS] --nameserver <NAMESERVER> <SUBCOMMAND>

OPTIONS:
    -a, --alpn <ALPN>
            For TLS, HTTPS, and QUIC a custom ALPN code can be supplied

        --class <CLASS>
            The Class of the record [default: IN]

        --debug
            Enable debug and all logging

        --do-not-verify-nameserver-cert
            DANGER: do not verify remote nameserver

        --error
            Enable error logging

    -h, --help
            Print help information

        --info
            Enable info + warning + error logging

    -n, --nameserver <NAMESERVER>
            Specify a nameserver to use, ip and port e.g. 8.8.8.8:53 or \[2001:4860:4860::8888\]:53
            (port required)

    -p, --protocol <PROTOCOL>
            Protocol type to use for the communication [default: udp] [possible values: udp, tcp,
            tls, https, quic]

    -t, --tls-dns-name <TLS_DNS_NAME>
            TLS endpoint name, i.e. the name in the certificate presented by the remote server

    -V, --version
            Print version information

        --warn
            Enable warning + error logging

    -z, --zone <ZONE>
            Zone, required for dynamic DNS updates, e.g. example.com if updating www.example.com

SUBCOMMANDS:
    append           Append record data to a record set
    create           Create a new record in the target zone
    delete-record    Delete a single record from a zone, the data must match the record
    help             Print this message or the help of the given subcommand(s)
    notify           Notify a nameserver that a record has been updated
    query            Query a name server for the record of the given type

This supports all the protocols supported by trust-dns, udp, tcp, tls, https, and quic.

Here's an example query:

$> dns -p https -t cloudflare-dns.com -n 1.1.1.1:443 query www.example.com. SOA
; using https:1.1.1.1:443 dns_name:cloudflare-dns.com
; sending query: www.example.com. IN SOA
; received response
; header 0:RD,RA:NoError:QUERY:0/1/1
; edns version: 0 dnssec_ok: false max_payload: 1232 opts: 0
; query
;; name: www.example.com. type: SOA class: IN
; answers 0
; nameservers 1
example.com. 3600 IN SOA ns.icann.org. noc.dns.icann.org. 2022040401 7200 3600 1209600 3600
; additionals 1

Fixes: #1663


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/hickory-dns/hickory-dns/pull/1680 **Author:** [@bluejekyll](https://github.com/bluejekyll) **Created:** 4/8/2022 **Status:** ✅ Merged **Merged:** 4/10/2022 **Merged by:** [@bluejekyll](https://github.com/bluejekyll) **Base:** `main` ← **Head:** `trust-dns-client-cli` --- ### 📝 Commits (10+) - [`15aa003`](https://github.com/hickory-dns/hickory-dns/commit/15aa003b9eb6c82d3ab4bfe6cd81dc96b5a1e415) create initial dns cli - [`2c0e211`](https://github.com/hickory-dns/hickory-dns/commit/2c0e2111991f033e231bcf9fd00693656001769e) add version to dns cli - [`67187c1`](https://github.com/hickory-dns/hickory-dns/commit/67187c1e553f2ff3ac81e1f03eec6068803b7d8e) udp and query wired up - [`8107b41`](https://github.com/hickory-dns/hickory-dns/commit/8107b41214b8cfe23083ea2132430e55b86a377a) wire up tcp in dns client - [`577344a`](https://github.com/hickory-dns/hickory-dns/commit/577344ab8ed5bf8da53638d909b31921fa82b7a4) add methods for update operations to dns client - [`aef0705`](https://github.com/hickory-dns/hickory-dns/commit/aef07056d59a0e8e721ccbba285d8f2e654d910f) add tls protocol impl to dns client - [`c2f99fe`](https://github.com/hickory-dns/hickory-dns/commit/c2f99fe87da27e01b0b25f6e1dc91550e5c830de) add https to dns client - [`2170572`](https://github.com/hickory-dns/hickory-dns/commit/2170572b4bec500050ed6e7441d2e4a44d9fc55b) improve debug output on request senging - [`40823b8`](https://github.com/hickory-dns/hickory-dns/commit/40823b8c9e757841b2ffd7daa886c52888b79ec9) Allow TLS to ignore server certificate validation in dns util - [`c8d74f9`](https://github.com/hickory-dns/hickory-dns/commit/c8d74f9eec49ab71826349811e8dfd1863a6c55e) allow custom ALPNs ### 📊 Changes **19 files changed** (+791 additions, -23 deletions) <details> <summary>View changed files</summary> 📝 `.codecov.yml` (+3 -0) 📝 `Cargo.lock` (+12 -0) 📝 `README.md` (+8 -0) 📝 `crates/client/src/serialize/txt/mod.rs` (+1 -0) 📝 `crates/client/src/serialize/txt/parse_rdata.rs` (+72 -1) 📝 `crates/proto/src/https/https_client_stream.rs` (+8 -6) 📝 `crates/proto/src/op/edns.rs` (+19 -0) 📝 `crates/proto/src/op/header.rs` (+2 -1) 📝 `crates/proto/src/op/message.rs` (+38 -1) 📝 `crates/proto/src/op/query.rs` (+9 -4) 📝 `crates/proto/src/quic/mod.rs` (+2 -2) 📝 `crates/proto/src/quic/quic_client_stream.rs` (+5 -2) 📝 `crates/proto/src/udp/udp_client_stream.rs` (+7 -0) 📝 `crates/proto/src/xfer/dns_multiplexer.rs` (+7 -0) 📝 `crates/proto/src/xfer/dns_response.rs` (+5 -0) 📝 `crates/proto/src/xfer/mod.rs` (+5 -1) 📝 `crates/resolver/src/config.rs` (+1 -1) 📝 `util/Cargo.toml` (+12 -4) ➕ `util/src/dns.rs` (+575 -0) </details> ### 📄 Description This is a new CLI for trust-dns-client that mimics the `dig` command: ```shell $> cargo install --all-features --path util --bin dns ... ``` The options are: ```shell $> dns -h trust dns client 0.21.2 A CLI interface for the trust-dns-client USAGE: dns [OPTIONS] --nameserver <NAMESERVER> <SUBCOMMAND> OPTIONS: -a, --alpn <ALPN> For TLS, HTTPS, and QUIC a custom ALPN code can be supplied --class <CLASS> The Class of the record [default: IN] --debug Enable debug and all logging --do-not-verify-nameserver-cert DANGER: do not verify remote nameserver --error Enable error logging -h, --help Print help information --info Enable info + warning + error logging -n, --nameserver <NAMESERVER> Specify a nameserver to use, ip and port e.g. 8.8.8.8:53 or \[2001:4860:4860::8888\]:53 (port required) -p, --protocol <PROTOCOL> Protocol type to use for the communication [default: udp] [possible values: udp, tcp, tls, https, quic] -t, --tls-dns-name <TLS_DNS_NAME> TLS endpoint name, i.e. the name in the certificate presented by the remote server -V, --version Print version information --warn Enable warning + error logging -z, --zone <ZONE> Zone, required for dynamic DNS updates, e.g. example.com if updating www.example.com SUBCOMMANDS: append Append record data to a record set create Create a new record in the target zone delete-record Delete a single record from a zone, the data must match the record help Print this message or the help of the given subcommand(s) notify Notify a nameserver that a record has been updated query Query a name server for the record of the given type ``` This supports all the protocols supported by trust-dns, `udp`, `tcp`, `tls`, `https`, and `quic`. Here's an example query: ```shell $> dns -p https -t cloudflare-dns.com -n 1.1.1.1:443 query www.example.com. SOA ; using https:1.1.1.1:443 dns_name:cloudflare-dns.com ; sending query: www.example.com. IN SOA ; received response ; header 0:RD,RA:NoError:QUERY:0/1/1 ; edns version: 0 dnssec_ok: false max_payload: 1232 opts: 0 ; query ;; name: www.example.com. type: SOA class: IN ; answers 0 ; nameservers 1 example.com. 3600 IN SOA ns.icann.org. noc.dns.icann.org. 2022040401 7200 3600 1209600 3600 ; additionals 1 ``` Fixes: #1663 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-16 09:50:24 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hickory-dns#2510
No description provided.