Add dns_cache for server addresses as in pgbouncer (#249)

* Add dns_cache so server addresses are cached and invalidated when DNS changes.

Adds a module to deal with dns_cache feature. It's
main struct is CachedResolver, which is a simple thread safe
hostname <-> Ips cache with the ability to refresh resolutions
every `dns_max_ttl` seconds. This way, a client can check whether its
ip address has changed.

* Allow reloading dns cached

* Add documentation for dns_cached
This commit is contained in:
Jose Fernández
2023-05-02 10:26:40 +02:00
committed by GitHub
parent 3601130ba1
commit 7dfbd993f2
10 changed files with 794 additions and 3 deletions

View File

@@ -42,6 +42,8 @@ fallible-iterator = "0.2"
pin-project = "1"
webpki-roots = "0.23"
rustls = { version = "0.21", features = ["dangerous_configuration"] }
trust-dns-resolver = "0.22.0"
tokio-test = "0.4.2"
[target.'cfg(not(target_env = "msvc"))'.dependencies]
jemallocator = "0.5.0"