Crates.io | duckdns |
lib.rs | duckdns |
version | 0.1.1 |
source | src |
created_at | 2018-02-26 18:49:40.302549 |
updated_at | 2018-02-26 19:42:18.620003 |
description | DuckDNS client library |
homepage | |
repository | https://gitlab.com/imp/duckdns-rs.git |
max_upload_size | |
id | 52945 |
size | 21,023 |
Usage is pretty simple. All you need is instantiate new DuckDns
object with your token and add domains.
Then call update()
extern crate dotenv;
extern crate duckdns;
use duckdns::DuckDns;
fn main() {
let token = dotenv::var("DUCKDNS_TOKEN").unwrap();
duckdns::DuckDns::new(token).domains("mydomain").update();
}
In addition you may choose to specify an IP address, rather than let duckdns use the source of your request.
extern crate dotenv;
extern crate duckdns;
use duckdns::DuckDns;
fn main() {
let token = dotenv::var("DUCKDNS_TOKEN").unwrap();
duckdns::DuckDns::new(token).domains("mydomain").ipv4("192.168.123.234").update();
}
If you have IpAddr
object you can use it directly
extern crate dotenv;
extern crate duckdns;
use duckdns::DuckDns;
fn main() {
let token = dotenv::var("DUCKDNS_TOKEN").unwrap();
let addr = "8.8.8.8".parse().unwrap();
duckdns::DuckDns::new(token).domains("mydomain").ip(addr).update();
}