Crate dns
Expand description
DNS support for Rama.
§Hickory Dns
Hickory Dns is a Rust based DNS client, server, and resolver, built to be safe and secure from the ground up. It is the default (and only) dns provider for Rama.
By implementing the DnsResolver
and optionally also using try_init_global_dns_resolver
you can set however any kind of DnsResolver
you wish.
More info about hickory dns can be found at https://github.com/hickory-dns/hickory-dns.
§Global DNS resolver
Rama uses by default a global and shared dns resolver.
The default one for this is the Default
HickoryDns
value,
which on unix and windows platforms is pulled from the system if possible,
and as a fallback or on all other platforms the default cloudflare config is used.
Thank you cloudflare.
Use try_init_global_dns_resolver
or init_global_dns_resolver
to
set the global DnsResolver
as early as possible (e.g. at the top of your main function).
Use global_dns_resolver
should you have a need for this global DnsResolver
yourself.
The global dns resolver can be lazily fetched by making use of GlobalDnsResolver
which allows you to create it only when actually using it. Great in case
you need to have a DnsResolver
value that you do not wish to do any work for,
until you “really” need it.
§Rama
Crate used by the end-user rama
crate and rama
crate authors alike.
Learn more about rama
:
- Github: https://github.com/plabayo/rama
- Book: https://ramaproxy.org/book/
Modules§
Structs§
- BoxDns
Resolver - A boxed
DnsResolver
, to resolve dns, for where you require dynamic dispatch. - Deny
AllDns - a
DnsResolver
implementation which denies all incoming DNS requests with aDnsDeniedError
. - DnsDenied
Error - Dns denied
- DnsOverwrite
- Wrapper struct that can be used to add dns overwrites to a service Context.
- Domain
NotMapped Err - domain not mapped in memory
- Global
DnsResolver - Hickory
Dns DnsResolver
using the [hickory_resolver
] crate- InMemory
Dns - in-memory Dns that can be used as a simplistic cache,
or wrapped in
DnsOverwrite
to indicate dns overwrites.
Traits§
- DnsResolver
- A resolver of domains into IP addresses.
Functions§
- global_
dns_ resolver - Get the global
DnsResolver
. - init_
global_ dns_ resolver - Initialises the global
DnsResolver
. - try_
init_ global_ dns_ resolver - Tries to initialise the global
DnsResolver
.