From 88145aac5c5d2ed3c52a1c2d36bc78895d652984 Mon Sep 17 00:00:00 2001 From: notplants Date: Mon, 10 May 2021 13:23:57 +0200 Subject: [PATCH] Working on client' --- src/client.rs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/client.rs b/src/client.rs index d94b39f..e641655 100644 --- a/src/client.rs +++ b/src/client.rs @@ -16,15 +16,14 @@ use trust_dns_client::op::DnsResponse; use trust_dns_client::rr::{DNSClass, Name, RData, Record, RecordType}; -#[tokio::main] -async fn main() { +fn main() { let address = "127.0.0.1:12323".parse().unwrap(); let conn = UdpClientConnection::new(address).unwrap(); let client = SyncClient::new(conn); // Specify the name, note the final '.' which specifies it's an FQDN - let name = Name::from_str("www.example.com.").unwrap(); + let name = Name::from_str("peach.dyn.commoninternet.net").unwrap(); // NOTE: see 'Setup a connection' example above // Send the query and get a message response, see RecordType for all supported options @@ -39,9 +38,5 @@ async fn main() { // Records are generic objects which can contain any data. // In order to access it we need to first check what type of record it is // In this case we are interested in A, IPv4 address - if let &RData::A(ref ip) = answers[0].rdata() { - assert_eq!(*ip, Ipv4Addr::new(93, 184, 216, 34)) - } else { - assert!(false, "unexpected result") - } + println!("found: {:?}", answers[0].rdata()) }