3 releases

0.1.2 Apr 18, 2024
0.1.1 Apr 17, 2024
0.1.0 Apr 16, 2024

#1283 in Network programming

Download history 92/week @ 2024-06-17 51/week @ 2024-06-24 81/week @ 2024-07-01 67/week @ 2024-07-08 32/week @ 2024-07-15 13/week @ 2024-07-22 101/week @ 2024-07-29 72/week @ 2024-08-05 57/week @ 2024-08-12 77/week @ 2024-08-19 96/week @ 2024-08-26 67/week @ 2024-09-02 57/week @ 2024-09-09 86/week @ 2024-09-16 140/week @ 2024-09-23 98/week @ 2024-09-30

387 downloads per month

Apache-2.0 OR MIT

36KB
860 lines

dns-update

crates.io build docs.rs crates.io

dns-update is an Dynamic DNS update library for Rust that supports updating DNS records using the RFC 2136 protocol and different cloud provider APIs such as Cloudflare. It was designed to be simple and easy to use, while providing a high level of flexibility and performance.

Limitations

  • Currently the library is async only.
  • Besides RFC 2136, it only supports Cloudflare's API.

PRs Welcome

PRs to add more providers are welcome. The goal is to support as many providers as Go's lego library.

Usage Example

Using RFC2136 with TSIG:

        // Create a new RFC2136 client
        let client = Rfc2136Provider::new_tsig("tcp://127.0.0.1:53", "<KEY_NAME>", STANDARD.decode("<TSIG_KEY>").unwrap(), TsigAlgorithm::HmacSha512).unwrap();

        // Create a new TXT record
        c.create(
            "test._domainkey.example.org",
            DnsRecord::TXT {
                content: "v=DKIM1; k=rsa; h=sha256; p=test".to_string(),
            },
            300,
            "example.org",
        )
        .await
        .unwrap();

        // Delete the record
        c.delete("test._domainkey.example.org", "example.org").await.unwrap();

Using Cloudflare's API:

        // Create a new Cloudflare client
        let client =
            DnsUpdater::new_cloudflare("<API_TOKEN>", None::<String>)
                .unwrap();

        // Create a new TXT record
        c.create(
            "test._domainkey.example.org",
            DnsRecord::TXT {
                content: "v=DKIM1; k=rsa; h=sha256; p=test".to_string(),
            },
            300,
            "example.org",
        )
        .await
        .unwrap();

        // Delete the record
        c.delete("test._domainkey.example.org", "example.org").await.unwrap();

License

Licensed under either of

at your option.

Copyright (C) 2020-2024, Stalwart Labs Ltd.

Dependencies

~16–29MB
~520K SLoC