diff --git a/src/client.rs b/src/client.rs index e641655..6d4109a 100644 --- a/src/client.rs +++ b/src/client.rs @@ -13,11 +13,14 @@ use std::str::FromStr; use trust_dns_client::client::{Client, SyncClient}; use trust_dns_client::udp::UdpClientConnection; use trust_dns_client::op::DnsResponse; -use trust_dns_client::rr::{DNSClass, Name, RData, Record, RecordType}; +use trust_dns_client::op::update_message; +use trust_dns_client::rr::{DNSClass, Name, RData, Record, RecordType, RecordSet}; +use trust_dns_server::authority::{ + AuthLookup, Authority, LookupError, MessageRequest, UpdateResult, +}; -fn main() { - +fn simple_test() { let address = "127.0.0.1:12323".parse().unwrap(); let conn = UdpClientConnection::new(address).unwrap(); let client = SyncClient::new(conn); @@ -40,3 +43,24 @@ fn main() { // In this case we are interested in A, IPv4 address println!("found: {:?}", answers[0].rdata()) } + + +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("up.dyn.commoninternet.net").unwrap(); + + let record = Record::from_rdata(name.clone(), 8, RData::A(Ipv4Addr::new(127, 0, 0, 10))); + let rrset: RecordSet = record.clone().into(); + let zone_origin = Name::from_str("dyn.commoninternet.net").unwrap(); + + let response: DnsResponse = client.create(rrset, zone_origin).unwrap(); + println!("response: {:?}", response); + + // this also produces a response code of 4 (not yet implemented) +}