technitium 0.4.0

Typed async Rust client for the Technitium DNS Server API
Documentation

technitium

Typed async Rust client for the Technitium DNS Server HTTP API.

Installation

[dependencies]
technitium = "0.1"
tokio = { version = "1", features = ["macros", "rt-multi-thread"] }

Quick Start

use technitium::{Client, ZoneType};

#[tokio::main]
async fn main() -> Result<(), technitium::Error> {
    let client = Client::builder()
        .base_url("http://localhost:5380")
        .build()?;

    client.login("admin", "admin").await?;

    // Create a zone
    client.create_zone("example.com", ZoneType::Primary).await?;

    // List zones
    let zones = client.list_zones().await?;
    for zone in &zones {
        println!("{} ({:?})", zone.name, zone.zone_type);
    }

    Ok(())
}

Error Handling

All errors are typed — match on variants without string parsing:

use technitium::{Client, Error};

# async fn example() {
let client = Client::builder()
    .base_url("http://localhost:5380")
    .build()
    .unwrap();

match client.login("admin", "wrong").await {
    Ok(()) => println!("logged in"),
    Err(Error::Authentication { message }) => eprintln!("bad creds: {message}"),
    Err(Error::TwoFactorRequired) => eprintln!("need TOTP"),
    Err(e) => eprintln!("other: {e}"),
}
# }

API Coverage

  • Authentication: login, logout, API tokens, 2FA, session info
  • Zones: create, list, delete, enable, disable, export, import, clone, convert
  • Records: add, list, update, delete (A, AAAA, CNAME, MX, TXT, SRV, NS, SOA, PTR, CAA)
  • DNS Client: resolve queries with custom server and protocol (UDP, TCP, TLS, HTTPS, QUIC)
  • Cache: list, delete, flush
  • Settings: get, set, backup, restore
  • Dashboard: statistics, top stats
  • Logs: list, query, download, delete
  • Admin: users, groups, permissions
  • Allowed/Blocked: zone lists with import/export
  • DHCP: scopes, leases
  • DNS Apps: install, update, uninstall, configure

License

MIT