1#![doc = include_str!("../README.md")]
2#[cfg(any(feature = "ring", feature = "aws-lc-rs"))]
14use providers::ovh::OvhProvider;
15
16#[cfg(feature = "test_provider")]
17use providers::{in_memory::InMemoryProvider, pebble::PebbleProvider};
18
19pub use hickory_client::proto::dnssec;
20use providers::{
21 bunny::BunnyProvider, cloudflare::CloudflareProvider, desec::DesecProvider,
22 digitalocean::DigitalOceanProvider, dnsimple::DNSimpleProvider, porkbun::PorkBunProvider,
23 rfc2136::Rfc2136Provider, route53::Route53Provider, spaceship::SpaceshipProvider,
24};
25use std::{
26 borrow::Cow,
27 net::{Ipv4Addr, Ipv6Addr},
28};
29
30pub mod bind;
31pub mod crypto;
32pub mod http;
33pub mod jwt;
34pub mod providers;
35pub mod tests;
36pub mod update;
37pub mod utils;
38
39#[derive(Debug)]
40pub enum Error {
41 Protocol(String),
42 Parse(String),
43 Client(String),
44 Response(String),
45 Api(String),
46 Serialize(String),
47 Unauthorized,
48 NotFound,
49 BadRequest,
50}
51
52#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
54pub enum DnsRecordType {
55 A,
56 AAAA,
57 CNAME,
58 NS,
59 MX,
60 TXT,
61 SRV,
62 TLSA,
63 CAA,
64}
65
66#[derive(Clone, Debug, PartialEq, Eq, Hash)]
68pub struct NamedDnsRecord {
69 pub name: String,
70 pub record: DnsRecord,
71}
72
73#[derive(Clone, Debug, PartialEq, Eq, Hash)]
75pub enum DnsRecord {
76 A(Ipv4Addr),
77 AAAA(Ipv6Addr),
78 CNAME(String),
79 NS(String),
80 MX(MXRecord),
81 TXT(String),
82 SRV(SRVRecord),
83 TLSA(TLSARecord),
84 CAA(CAARecord),
85}
86
87#[derive(Clone, Debug, PartialEq, Eq, Hash)]
89pub struct MXRecord {
90 pub exchange: String,
91 pub priority: u16,
92}
93
94#[derive(Clone, Debug, PartialEq, Eq, Hash)]
96pub struct SRVRecord {
97 pub target: String,
98 pub priority: u16,
99 pub weight: u16,
100 pub port: u16,
101}
102
103#[derive(Clone, Debug, PartialEq, Eq, Hash)]
105pub struct TLSARecord {
106 pub cert_usage: TlsaCertUsage,
107 pub selector: TlsaSelector,
108 pub matching: TlsaMatching,
109 pub cert_data: Vec<u8>,
110}
111
112#[derive(Debug, PartialEq, Eq, Hash, Clone, Copy)]
113pub enum TlsaCertUsage {
114 PkixTa,
115 PkixEe,
116 DaneTa,
117 DaneEe,
118 Private,
119}
120
121#[derive(Debug, PartialEq, Eq, Hash, Clone, Copy)]
122pub enum TlsaSelector {
123 Full,
124 Spki,
125 Private,
126}
127
128#[derive(Debug, PartialEq, Eq, Hash, Clone, Copy)]
129pub enum TlsaMatching {
130 Raw,
131 Sha256,
132 Sha512,
133 Private,
134}
135
136#[derive(Clone, Debug, PartialEq, Eq, Hash)]
138pub enum CAARecord {
139 Issue {
140 issuer_critical: bool,
141 name: Option<String>,
142 options: Vec<KeyValue>,
143 },
144 IssueWild {
145 issuer_critical: bool,
146 name: Option<String>,
147 options: Vec<KeyValue>,
148 },
149 Iodef {
150 issuer_critical: bool,
151 url: String,
152 },
153}
154
155#[derive(Clone, Debug, PartialEq, Eq, Hash)]
156pub struct KeyValue {
157 pub key: String,
158 pub value: String,
159}
160
161pub enum TsigAlgorithm {
163 HmacMd5,
164 Gss,
165 HmacSha1,
166 HmacSha224,
167 HmacSha256,
168 HmacSha256_128,
169 HmacSha384,
170 HmacSha384_192,
171 HmacSha512,
172 HmacSha512_256,
173}
174
175pub enum Algorithm {
177 RSASHA256,
178 RSASHA512,
179 ECDSAP256SHA256,
180 ECDSAP384SHA384,
181 ED25519,
182}
183
184pub type Result<T> = std::result::Result<T, Error>;
185
186#[derive(Clone)]
187#[non_exhaustive]
188pub enum DnsUpdater {
189 Rfc2136(Rfc2136Provider),
190 Cloudflare(CloudflareProvider),
191 DigitalOcean(DigitalOceanProvider),
192 Desec(DesecProvider),
193 #[cfg(any(feature = "ring", feature = "aws-lc-rs"))]
194 Ovh(OvhProvider),
195 Bunny(BunnyProvider),
196 Porkbun(PorkBunProvider),
197 Spaceship(SpaceshipProvider),
198 DNSimple(DNSimpleProvider),
199 GoogleCloudDns(providers::google_cloud_dns::GoogleCloudDnsProvider),
200 #[cfg(feature = "test_provider")]
201 Pebble(PebbleProvider),
202 #[cfg(feature = "test_provider")]
203 InMemory(InMemoryProvider),
204 Route53(Route53Provider),
205}
206
207pub trait IntoFqdn<'x> {
208 fn into_fqdn(self) -> Cow<'x, str>;
209 fn into_name(self) -> Cow<'x, str>;
210}