Skip to content
Unverified Commit a1b18e5a authored by Landon James's avatar Landon James Committed by GitHub
Browse files

Add `aws-smithy-dns` crate and `HickoryDnsResolver` (#4274)

## Motivation and Context
<!--- Why is this change required? What problem does it solve? -->
<!--- If it fixes an open issue, please link to the issue here -->
Add an optional in-memory `HickoryDnsResolver` to `aws-smithy-runtime`.
This is mostly targeted at supporting customers on AL2023 since it has
disabled OS level DNS caching by default. Hyper relies on OS DNS caching
if no DNS resolver is provided and this has led to some DNS throttling
for users. See links below for examples:
*
https://www.madebymikal.com/amazon-linux-2023-dns-and-systemd-resolved-a-story-of-no-caching/
*
https://repost.aws/questions/QUXJ5yuiRpQE2c2Htf4Dc9iA/dns-caching-in-amazon-linux-2023
* https://repost.aws/knowledge-center/dns-resolution-failures-ec2-linux

We leverage the
[hickory-resolver](https://crates.io/crates/hickory-resolver) crate to
provide this functionality.

## Description
<!--- Describe your changes in detail -->
Add new `HickoryDnsResolver` under `aws_smithy_dns`. This wraps a
`hickory_resolver::Resolver` and provides some minimal configuration
options (timeouts, retries, etc.) that seem unlikely to ever go away
even though the `hickory-dns` ecosystem is still pre-1x.

## Testing
<!--- Please describe in detail how you tested your changes -->
<!--- Include details of your testing environment, and the tests you ran
to -->
<!--- see how your change affects other areas of the code, etc. -->
Added new integration tests at `tests/hickory.rs`. These tests spin up
an in-process DNS server on a random port and query it over `localhost`.

Had to fix `CrateSetTest.kt` since the TOML library we use in Kotlin
won't parse Cargo.toml files with `cfg` statements like
`[target.'cfg(not(target_family = "wasm"))'.dependencies]`. I had to add
one of those statements to prevent `hickory-resolver` from being
compiled for WASM targets since it was introducing a tokio feature that
caused compilation to fail and that caused `aws-smithy-runtime` to fail
in the stability test.

## Checklist
<!--- If a checkbox below is not applicable, then please DELETE it
rather than leaving it unchecked -->
- [x] For changes to the smithy-rs codegen or runtime crates, I have
created a changelog entry Markdown file in the `.changelog` directory,
specifying "client," "server," or both in the `applies_to` key.


----

_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
parent abeb5501
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment