cloudflare / cloudflare/cloudflare-rs

DNS: Support for additional record types

Open
#219 2 comments 1 reaction 0 assignees View on GitHub
Dominant language
Rust
Stars
316
Forks
111
PR merge metrics
No merged PRs in 30d

Description

It seems like this crate currently only supports the most common DNS record types:

```rust
// in cloudflare/src/endpoints/dns.rs
pub enum DnsContent {
A { content: Ipv4Addr },
AAAA { content: Ipv6Addr },
CNAME { content: String },
NS { content: String },
MX { content: String, priority: u16 },
TXT { content: String },
}
```

However, the [Cloudflare API](https://developers.cloudflare.com/api/operations/dns-records-for-a-zone-list-dns-records) lists several additional record types that are currently not implemented, including `CAA`, `CERT`, `DNSKEY` and more.

From what I can tell, adding any of these records to a zone causes the `ListDnsRecords` query to fail with an `unknown variant` error during deserialization, effectively making the `ListDnsRecords` query unavailable for such a zone (example below).
I'm running into this issue on my own zones, since I have a `CAA` record set on them.

I have a [fork](https://github.com/spacebird-dev/cloudflare-rs/commit/8eb18ca21e7f76ad93288b5d7a3ec32e2b9002ce) that fixes this for `CAA` records, but I'd be interested in seeing support for these record types in this main crate.
Adding simple enum variants for these records with the `content` field should be sufficient to allow the `ListDnsRecords` request to succeed (the API also returns a structured `data` field for some record types, but I don't think this is necessary for basic support).

If support for these record types is desired, I'd be more than happy to make the required changes and open a PR!

---

Steps to reproduce:

1. Create a zone and create a CAA record through the Web Interface (such as `0 issue letsencrypt.org`).
2. Attempt to list all records in that zone using the `cloudflare-examples` utility like so:

```
cargo run -p cloudflare-examples -- --auth-token dns
```

3. The client will return the following error:

```
Error: error decoding response body: unknown variant `CAA`, expected one of `A`, `AAAA`, `CNAME`, `NS`, `MX`, `TXT`, `SRV` at line 1 column 8705
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.