Commit Graph

40 Commits

Author SHA1 Message Date
Peter Johnston
aefb6deded Default to only switch to TCP if response was truncated
Currently, if queries to name servers over UDP result in either a
truncated response, or any kind of error, the query will be retried over
TCP. It should be possible to only use TCP for the case of oversized
messages, and avoid it in the common case. This change makes this the
default behavior and adds an option to ResolverOpts that can be enabled
to get the current behavior.
2021-10-08 09:46:55 -07:00
Benjamin Fry
69829fa9ca fix negative dnssec test after trust-dns.org zone change 2021-08-22 19:51:56 -07:00
Trinity Pointard
032b33c9fc clippy 2021-05-08 13:42:42 -07:00
Trinity Pointard
e4118250f8 try to prevent search of onion domain as subdomain of a search zone 2021-05-08 13:42:42 -07:00
Benjamin Fry
6dfc6713fa fix panic on name too long 2021-04-11 08:48:15 -07:00
Benjamin Fry
4e30b1b1c9 disable mDNS, remove multi-return array 2021-04-09 21:57:43 -07:00
Benjamin Fry
3f270a0aae mark ResolverOpts and DnsRequestOptions as non_exhaustive 2021-04-06 10:29:16 +02:00
Benjamin Fry
c425bdbd6e improve resolver docs for docsrs 2021-03-27 19:53:44 -07:00
Benjamin Fry
6fcc72acca Make all warnings across crates and binaries consistent 2021-03-08 15:34:26 -08:00
Benjamin Fry
7a4b3b55c3 fix clippy warnings for rustc 1.50 2021-02-17 23:19:59 -08:00
Benjamin Fry
24c4ccdf02 remove TokioHandle from public interfaces 2020-11-28 20:38:00 -08:00
Benjamin Fry
402a14abce upgrade trust-dns-resolver to Tokio 0.3 2020-11-28 20:38:00 -08:00
Benjamin Fry
8056cb0d83 clippy updates for rust 1.48 2020-11-24 14:54:07 -08:00
Dirkjan Ochtman
4ee7ffadfd explicitly make Connect implement the Transport 2020-10-16 13:24:45 -07:00
Dirkjan Ochtman
587273247e resolver: rename lookup_state to caching_client 2020-10-16 01:53:05 -07:00
Dirkjan Ochtman
90bfbede51 move Arc<Mutex<_>> wrapper into DnsLru 2020-10-16 01:53:05 -07:00
Dirkjan Ochtman
c0cdfbf2dd inline single-use constructor method 2020-10-16 01:53:05 -07:00
Dirkjan Ochtman
5ea0956819 use synchronous Mutex for resolver cache
Since the lock is not held across await points, the sync Mutex is simpler.
2020-10-16 01:53:05 -07:00
Dirkjan Ochtman
94fa917c74 remove non-macro-use extern crate imports 2020-10-13 07:58:06 -07:00
Dirkjan Ochtman
756749bd9e avoid unwrap() for functions that don't error 2020-10-05 09:31:30 -07:00
Benjamin Fry
248fd8709b make errors generic in DnsHandle for Resolver 2020-09-15 15:27:44 -07:00
Andrew McConachie
e6f6f9dc8b Add support for tlsa RRs in trust_dns_resolver, trust_dns_resolver::Resolver.tlsa_lookup() 2020-08-16 13:22:46 -07:00
Zvi "CtrlZvi" Effron
70427e0383 Make EDNS optional for resolvers
Some servers do not support EDNS, and some (such as the ingress-dns
addon to Minikube) return malformed DNS responses when sent EDNS
additional records. Previously, it was not possible to not send the
EDNS records, despite having a ResolverOpts field for it, which was
confusing.

This commit wires the ResolverOpts edns0 option to a new
DnsRequestOptions field and uses that option to control whether or not
additional EDNS records should be used.

Note: this changes the default behavior of the resolver, as the default
value for ResolverOpts::edns0 is false, but previously the additional
EDNS records would be added anyway. It seems this change is inline with
the desired behavior, as the defaults are intended to match the
resolv.conf defaults, which do not use EDNS.

Signed-off-by: Zvi "CtrlZvi" Effron <viz_skywalker+GitHub@outlook.com>
2020-08-03 17:40:09 -07:00
Benjamin Fry
2710b9f4f4 Fully support *ring* for all DNSSEC operations. (#1145)
* add more debug information to DNSSEC validation

* update ring validation to allow 1024bit keys for all Algorithm types

* disable dnssec tests in std builds

* ensure TrustAnchor is constructed properly in DnsSecSyncClient

* add key length to DNSKEY display
2020-06-23 10:46:22 -07:00
Yuki Okushi
3382d887b7 resolver: Minimize futures dependencies 2020-05-19 06:16:21 -07:00
Johnny Bergström
2502c58c14 use RuntimeProvider in https (#1077)
* logger: missing https crate

* https: use RuntimeProvider when making connections

- [X] use RuntimeProvider when making TCP connections
- [ ] use RuntimeProvider when making TLS upgrades
- [ ] migrate tests

* RuntimeProvider::Tcp: remove async read/write

The TCP needs to Connect, the async readwriter will be in the
transport of connect. Thus we don't need it to be a requirement
on the top trait of RuntimeProvider

* AsyncResolver: remove async from new()

Related to overriding RuntimeProvider for #1074

Solves #1056

* cleanup tests

* rebase master for 0.19.5

* fix windows tests

Co-authored-by: Benjamin Fry <benjaminfry@me.com>
2020-05-02 11:18:50 -07:00
Benjamin Fry
30e0f302a0 bump version to 0.19.5 2020-04-27 11:58:09 -07:00
Benjamin Fry
87efb45bf1 add separate crate for AsyncStd 2020-04-11 13:51:52 -07:00
Kaleb Elwert
5f8c39c243 Add basic support for async_std resolver 2020-04-11 13:51:52 -07:00
Benjamin Fry
e137e72f34 Balboah fix/missing cname records (#1033)
* Allow CNAME records on A/AAAA lookups

Fixes #184

* rustfmt

* Fix cname chain min TTL test

The test assumed that the CNAME record wouldn't be returned.
Now we only check that the A record TTLs were changed

* Fix lookup integration tests & max query depth

- include cname record in test
- move max query depth check

* add preserve_intermediates option

* preserve records across queries

* add as_lookup to LookupIp

Co-authored-by: Johnny Bergström <github@joonix.se>
2020-02-27 17:42:19 -08:00
Chunying Wang
4438413e26 [trust-dns-resolver] make some crates optional
Make ipconfig and resolv-conf which are related to dns config optional
2020-01-16 18:03:46 -08:00
Benjamin Fry
c10c3a589e remove failure dependency 2020-01-11 20:52:42 -08:00
Benjamin Fry
cac8ffe6a6 add TokioAsyncResolver::tokio apis for ease of use 2020-01-11 07:40:57 -08:00
chunyingw
ea57ae42ea [trust-dns-resolver] refactor unit tests (#979)
* [trust-dns-resolver] refactor tests

* [trust-dns-resolver] refactor tests

This allows the unit tests defined in the async_resolver mod to be run
with different runtimes.
2020-01-02 11:19:28 -08:00
Chunying Wang
e2abc67abf [trust-dns-resolver] Abstract resolver
1. Create a trait RuntimeProvider to abstract the resolver
implementation.
2. Make TokioAsyncResolver as default type.
3. Keep the tls related codes unchanged, which may be abstracted at a
later point.
4. Update the other codes and test cases wherever necessary.
2019-12-28 10:10:30 -08:00
Benjamin Fry
4661220c52 rename SecureClient et al to Dnssec (more accurate) 2019-12-22 13:32:10 -08:00
Benjamin Fry
70205fc9a6 place coverage data in separate test target dirs 2019-12-19 13:11:39 -08:00
Benjamin Fry
d39ce54ca3 make output for coverage unique to current crate 2019-12-19 13:11:39 -08:00
Benjamin Fry
f1bd65e9ea remove travis references 2019-12-15 14:02:29 -08:00
Benjamin Fry
224bde6561 Background with generic spawn (#935)
* all tests updated for new background

* background in Resolver now supported, wip

* clean up client impls

* client passing all tests

* cleanup review comments, remove try_locks

* remove mutexes on NameServers in NameServerPool

* refactored ConnectionProvider

* remove pinutils dependency

* remove the now unused custom *LookupFutures

* remove unused types

* remove all deprecated interfaces from Client

* rename ClientFuture to AsyncClient

* all clippy warnings and SecureClient working

* cleanup clippy warnnings

* Everything working with Background removed

* fix infinite loop

* Client refactored without background

* rebased onto tokio 0.2

* remove Clone and Option from background connects

* cleanup from review

* fix clippy warnings

* spawn in ConnectionProvider

* fix no-default-features test

* only expose testing functions during testing

* fix copyright typo

* revert lookup_ip interface change

* limit tokio features to least required set

* rename tokio-compat to tokio-runtime

* use async fns where possible on AsyncResolver

* fix lifetime issue
2019-12-11 17:43:02 -08:00