From c2ccb18465a5fe57d4058c249f208ac9ee618d06 Mon Sep 17 00:00:00 2001 From: HimbeerserverDE Date: Sat, 5 Nov 2022 21:46:40 +0100 Subject: use new inwx-rs api --- src/main.rs | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/main.rs b/src/main.rs index c303585..35a89cf 100644 --- a/src/main.rs +++ b/src/main.rs @@ -9,7 +9,6 @@ use std::thread; use std::time::Duration; use inwx::call::nameserver::{RecordInfo as RecordInfoCall, RecordUpdate}; -use inwx::common::nameserver::RecordType; use inwx::response::nameserver::RecordInfo as RecordInfoResponse; use inwx::{Client, Endpoint}; use ipnet::{IpBitAnd, IpBitOr, IpNet, Ipv4Net, Ipv6Net}; @@ -386,7 +385,7 @@ fn push_addr4(config: ConfigIpv4, rx: &mpsc::Receiver) -> Result<()> { clt.call(RecordUpdate { ids: config.records.clone(), name: None, - record_type: Some(RecordType::A), + record_type: Some(String::from("A")), content: Some(address.addr().to_string()), ttl: Some(300), priority: None, @@ -413,7 +412,7 @@ fn push_addr6(config: ConfigIpv6, rx: &mpsc::Receiver) -> Result<()> { clt.call(RecordUpdate { ids: config.records.clone(), name: None, - record_type: Some(RecordType::Aaaa), + record_type: Some(String::from("AAAA")), content: Some(address.addr().to_string()), ttl: Some(300), priority: None, @@ -438,18 +437,16 @@ fn push_net6(config: ConfigNet6, rx: &mpsc::Receiver) -> Result<()> { let clt = Client::login(Endpoint::Sandbox, user, pass)?; for id in &config.records { - let info: RecordInfoResponse = clt - .call(RecordInfoCall { - domain_name: None, - domain_id: None, - record_id: Some(*id), - record_type: Some(RecordType::Aaaa), - name: None, - content: None, - ttl: None, - priority: None, - })? - .try_into()?; + let info: RecordInfoResponse = clt.call(RecordInfoCall { + domain_name: None, + domain_id: None, + record_id: Some(*id), + record_type: Some(String::from("AAAA")), + name: None, + content: None, + ttl: None, + priority: None, + })?; let records = info.records.ok_or(Error::MissingRecord(*id))?; let record = records.first().ok_or(Error::MissingRecord(*id))?; @@ -463,7 +460,7 @@ fn push_net6(config: ConfigNet6, rx: &mpsc::Receiver) -> Result<()> { clt.call(RecordUpdate { ids: vec![record.id], name: None, - record_type: Some(RecordType::Aaaa), + record_type: Some(String::from("AAAA")), content: Some(new.to_string()), ttl: Some(300), priority: None, -- cgit v1.2.3