# technitium
Typed async Rust client for the [Technitium DNS Server](https://technitium.com/dns/) HTTP API.
## Installation
```toml
[dependencies]
technitium = "0.1"
tokio = { version = "1", features = ["macros", "rt-multi-thread"] }
```
## Quick Start
```rust,no_run
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:
```rust,no_run
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