Crate zone_update

Crate zone_update 

Source
Expand description

§Zone Update

Crates.io Docs.rs GitHub CI License

A minimal Rust library providing CRUD-like operations on DNS records with various DNS providers.

§Overview

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).

§Supported DNS providers

Currently, Zone Update supports the following DNS providers:

  • Cloudflare
  • deSEC
  • DigitalOcean
  • Dnsimple
  • DnsMadeEasy
  • Gandi
  • Linode
  • Porkbun

See the DNS providers matrix for more details.

§Supported Runtimes

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:

§Feature flags

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.

§Usage

§Basic Example

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(())
}

See the examples directory for other use-cases.

§Contributing

At this point the most useful contributions would be to add additional DNS provider APIs. However other contributions are welcome.

§AI Contribution Policy

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.

§License

This project is licensed under either of:

at your option.

Modules§

cloudflare
desec
digitalocean
dnsimple
dnsmadeeasy
errors
gandi
linode
porkbun

Macros§

generate_helpers
A macro to generate default helper implementations for provider impls.

Structs§

Config
Configuration for DNS operations.

Enums§

Provider
DNS provider selection used by this crate.
RecordType

Traits§

DnsProvider
A trait for a DNS provider.