Skip to content
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

Trust dns client cli #1680

Merged
merged 19 commits into from
Apr 10, 2022
Merged

Trust dns client cli #1680

merged 19 commits into from
Apr 10, 2022

Conversation

bluejekyll
Copy link
Member

@bluejekyll bluejekyll commented Apr 8, 2022

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

@codecov
Copy link

codecov bot commented Apr 8, 2022

Codecov Report

Merging #1680 (8a749d3) into main (fd2065a) will decrease coverage by 1.11%.
The diff coverage is 50.00%.

❗ Current head 8a749d3 differs from pull request most recent head 12f19ef. Consider uploading reports for the commit 12f19ef to get more accurate results

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1680      +/-   ##
==========================================
- Coverage   79.88%   78.76%   -1.12%     
==========================================
  Files         183      182       -1     
  Lines       18594    18802     +208     
==========================================
- Hits        14853    14809      -44     
- Misses       3741     3993     +252     
Impacted Files Coverage Δ
crates/proto/src/op/edns.rs 91.75% <0.00%> (-7.14%) ⬇️
crates/proto/src/op/header.rs 83.85% <ø> (-15.53%) ⬇️
crates/proto/src/op/message.rs 79.08% <0.00%> (-8.26%) ⬇️
crates/proto/src/op/query.rs 93.47% <ø> (-3.23%) ⬇️
crates/proto/src/xfer/dns_response.rs 95.80% <ø> (ø)
crates/proto/src/xfer/mod.rs 87.09% <ø> (ø)
crates/resolver/src/config.rs 86.09% <ø> (-0.07%) ⬇️
crates/proto/src/https/https_client_stream.rs 71.72% <20.00%> (-1.31%) ⬇️
crates/proto/src/udp/udp_client_stream.rs 74.74% <50.00%> (-0.52%) ⬇️
crates/proto/src/xfer/dns_multiplexer.rs 79.87% <50.00%> (-0.19%) ⬇️
... and 44 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fd2065a...12f19ef. Read the comment docs.

@bluejekyll bluejekyll force-pushed the trust-dns-client-cli branch 2 times, most recently from 40c7181 to 82778c7 Compare April 8, 2022 23:00
@bluejekyll bluejekyll merged commit 05f9642 into main Apr 10, 2022
@bluejekyll bluejekyll deleted the trust-dns-client-cli branch April 10, 2022 18:35
Copy link
Collaborator

@djc djc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for failing to review this sooner. I generally don't have much time on weekends to do larger reviews, so couldn't respond to your query from yesterday sooner.

@@ -22,12 +22,40 @@ use crate::proto::rr::dnssec::rdata::DNSSECRData;
use crate::rr::{Name, RData, RecordType};
use crate::serialize::txt::rdata_parsers::*;

pub(crate) trait RDataParser: Sized {
use crate::serialize::txt::zone_lex::Lexer;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feels like this use and the one below should be grouped with the block above?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm. That might have been a mistake. No worries on the timeline. I’ll post a patch to follow this up. I just needed to get these things bound together for some other testing. It was getting unwieldy keeping all the changes straight.

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

Successfully merging this pull request may close these issues.

New CLI for trust-dns-client, dns
2 participants