| Crates.io | zone-update |
| lib.rs | zone-update |
| version | 0.11.0 |
| created_at | 2025-10-26 00:14:05.359919+00 |
| updated_at | 2026-01-16 06:37:07.978567+00 |
| description | A library of CRUD-like operations on DNS zones for multiple providers |
| homepage | |
| repository | https://github.com/tarka/zone-update |
| max_upload_size | |
| id | 1900803 |
| size | 294,148 |
A minimal Rust library providing CRUD-like operations on DNS records with various DNS providers.
Zone Update is a lightweight library that provides a simple interface for programmatically managing DNS zone records through provider APIs. The library is both blocking and async, and supports multiple async runtimes (see below).
Currently, Zone Update supports the following DNS providers:
See the DNS providers matrix for more details.
zone-update supports both blocking and async APIs. For async the library
attempts to be as provider-agnostic; it is known (tested) to work with the
following runtimes:
zone-update is tested against Linux, Mac & Windows.
Each DNS provider is gated behind their name, however all provider are enabled
by default. To limit the providers you can add zone-update to your
Cargo.toml in the following format:
zone-update = { version = "*", default-features = false, features = ["digitalocean", "desec"] }
The other notable flag is async, which is not enabled by default.
use zone_update::{gandi, DnsProvider, errors::Result};
use std::net::Ipv4Addr;
fn update_gandi_record() -> Result<()> {
let config = zone_update::Config {
domain: "example.com".to_string(),
dry_run: false,
};
let auth = gandi::Auth::ApiKey("your-api-key".to_string());
let client = gandi::Gandi::new(config, auth);
let host = "www";
let new_ip = Ipv4Addr::new(192, 0, 2, 1);
// Update the A record for www.example.com
client.update_a_record(host, &new_ip)?;
Ok(())
}
The Provider enum supports deserialisation with serde, which allows runtime
lookup of DNS providers from a configuration file:
use serde::Deserialize;
use zone_update::{Provider, errors::Result};
use std::net::Ipv4Addr;
const CONFIG_TOML: &str = r#"
domain = "example.com"
dry_run = true
[provider]
name = "porkbun"
key = "my_key"
secret = "my_secret"
"#;
#[derive(Deserialize)]
pub struct MyConfig {
domain: String,
dry_run: bool,
provider: Provider,
}
fn update_website_record() -> Result<()> {
let config: MyConfig = toml::from_str(CONFIG_TOML).unwrap();
let zu_config = zone_update::Config {
domain: config.domain,
dry_run: config.dry_run,
};
let client = config.provider
.blocking_impl(zu_config);
let host = "www";
let new_ip = Ipv4Addr::new(192, 0, 2, 1);
// Update the A record for www.example.com
client.update_a_record(host, &new_ip)?;
Ok(())
}
See the examples directory for other use-cases.
At this point the most useful contributions would be to add additional DNS provider APIs. However other contributions are welcome.
This needs to be expanded, and the existing implementations are currently your best reference, but is a basic checklist:
src and add mod.rs and (recommended)
types.rs. Create the appropriate features flags in Cargo.toml.curl.Auth & Config.DnsProvider trait for this
struct. This tends to be provider-specific, but most follow on of several
patterns. The existing implementations can be consulted as a reference.generate_helpers macro to fill out the rest of the trait.generate_tests macro to create the standard
tests.Provider enum and its impl.This reason this project will not accept runtime code generated by AI. Generation of draft documentation and test code is acceptable, but should be reviewed by the submitter before raising a PR.
This project is licensed under either of:
at your option.