Git Product home page Git Product logo

dns-update's Introduction

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

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

dns-update's People

Contributors

mdecimus avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.