Skip to content

Commit c1e2dc7

Browse files
committed
Cleanups and documentation
1 parent a823507 commit c1e2dc7

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

src/lib.rs

+5-7
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,21 @@ use hickory_client::op::DnsResponse;
33
use hickory_client::rr::{DNSClass, Name, RData, Record, RecordType};
44
use hickory_client::tcp::TcpClientConnection;
55
use rustdns::util::reverse;
6-
use std::net::{IpAddr, SocketAddr};
6+
use std::net::IpAddr;
77
use std::str::FromStr;
88
use std::{error::Error, fmt};
99

1010
#[derive(Clone, Debug, PartialEq)]
1111
pub struct PtrResult {
12+
// For example: one.one.one.one.
13+
// For example: dns.google.
1214
pub query: Name,
15+
// For example: 1.1.1.1.in-addr.arpa.
16+
// For example: 8.8.8.8.in-addr.arpa.
1317
pub result: Option<Name>,
1418
pub error: Option<String>,
1519
}
1620

17-
#[derive(Copy, Clone, Debug, PartialEq)]
18-
pub struct IpToResolve {
19-
pub address: IpAddr,
20-
pub server: SocketAddr,
21-
}
22-
2321
#[derive(Debug)]
2422
pub struct ResolvingError {
2523
pub message: String,

src/main.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::{env, thread};
22

3-
use dns_ptr_resolver::{get_ptr, IpToResolve};
3+
use dns_ptr_resolver::get_ptr;
44
use hickory_client::client::SyncClient;
55
use hickory_client::tcp::TcpClientConnection;
66
use rayon::prelude::*;
@@ -11,6 +11,12 @@ use std::str::FromStr;
1111
use std::time::Duration;
1212
use weighted_rs::{RoundrobinWeight, Weight};
1313

14+
#[derive(Copy, Clone, Debug, PartialEq)]
15+
struct IpToResolve {
16+
pub address: IpAddr,
17+
pub server: SocketAddr,
18+
}
19+
1420
fn resolve_file(filename: &str, dns_servers: Vec<&str>) {
1521
let mut rr: RoundrobinWeight<SocketAddr> = RoundrobinWeight::new();
1622
for dns_server in dns_servers {

0 commit comments

Comments
 (0)