fix: update ip of example.com

This commit is contained in:
situ2001 2024-04-20 00:34:15 +08:00 committed by Benjamin Fry
parent 76a4b84216
commit eb79382a36
30 changed files with 122 additions and 120 deletions

View File

@ -312,7 +312,7 @@ fn test_forward() {
.unwrap();
assert_eq!(
*response.answers()[0].data().and_then(RData::as_a).unwrap(),
A::new(93, 184, 216, 34)
A::new(93, 184, 215, 14)
);
// just tests that multiple queries work
@ -335,7 +335,7 @@ fn test_forward() {
.unwrap();
assert_eq!(
*response.answers()[0].data().and_then(RData::as_a).unwrap(),
A::new(93, 184, 216, 34)
A::new(93, 184, 215, 14)
);
assert!(!response.header().authoritative());
})

View File

@ -44,9 +44,9 @@ async fn main() {
// this can return IPv4 and/or IPv6 addresses
let address = response.iter().next().expect("no addresses returned!");
if address.is_ipv4() {
assert_eq!(address, IpAddr::V4(Ipv4Addr::new(93, 184, 216, 34)));
assert_eq!(address, IpAddr::V4(Ipv4Addr::new(93, 184, 215, 14)));
} else {
assert_eq!(address, IpAddr::V6(Ipv6Addr::new(0x2606, 0x2800, 0x220, 0x1, 0x248, 0x1893, 0x25c8, 0x1946)));
assert_eq!(address, IpAddr::V6(Ipv6Addr::new(0x2606, 0x2800, 0x21f, 0xcb07, 0x6820, 0x80da, 0xaf6b, 0x8b2c)));
}
}
```

View File

@ -66,9 +66,9 @@
//! // this can return IPv4 and/or IPv6 addresses
//! let address = response.iter().next().expect("no addresses returned!");
//! if address.is_ipv4() {
//! assert_eq!(address, IpAddr::V4(Ipv4Addr::new(93, 184, 216, 34)));
//! assert_eq!(address, IpAddr::V4(Ipv4Addr::new(93, 184, 215, 14)));
//! } else {
//! assert_eq!(address, IpAddr::V6(Ipv6Addr::new(0x2606, 0x2800, 0x220, 0x1, 0x248, 0x1893, 0x25c8, 0x1946)));
//! assert_eq!(address, IpAddr::V6(Ipv6Addr::new(0x2606, 0x2800, 0x21f, 0xcb07, 0x6820, 0x80da, 0xaf6b, 0x8b2c)));
//! }
//! }
//! ```

View File

@ -50,7 +50,7 @@ let answers: &[Record] = response.answers();
// 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 Some(RData::A(ref ip)) = answers[0].data() {
assert_eq!(*ip, Ipv4Addr::new(93, 184, 216, 34))
assert_eq!(*ip, Ipv4Addr::new(93, 184, 215, 14))
} else {
assert!(false, "unexpected result")
}

View File

@ -1117,7 +1117,7 @@ mod tests {
// validate it's what we expected
if let Some(RData::A(addr)) = message_returned.answers()[0].data() {
assert_eq!(*addr, A::new(93, 184, 216, 34));
assert_eq!(*addr, A::new(93, 184, 215, 14));
}
let message_parsed = Message::from_vec(&buffer)
@ -1125,7 +1125,7 @@ mod tests {
// validate it's what we expected
if let Some(RData::A(addr)) = message_parsed.answers()[0].data() {
assert_eq!(*addr, A::new(93, 184, 216, 34));
assert_eq!(*addr, A::new(93, 184, 215, 14));
}
}
}

View File

@ -129,7 +129,7 @@
//! // 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 Some(RData::A(ref ip)) = answers[0].data() {
//! assert_eq!(*ip, A::new(93, 184, 216, 34))
//! assert_eq!(*ip, A::new(93, 184, 215, 14))
//! } else {
//! assert!(false, "unexpected result")
//! }
@ -264,7 +264,7 @@
//!
//! // validate it's what we expected
//! if let Some(RData::A(addr)) = response.answers()[0].data() {
//! assert_eq!(*addr, A::new(93, 184, 216, 34));
//! assert_eq!(*addr, A::new(93, 184, 215, 14));
//! }
//! }
//! ```

View File

@ -577,7 +577,7 @@ mod tests {
.and_then(RData::as_a)
.expect("Expected A record");
assert_eq!(addr, &A::new(93, 184, 216, 34));
assert_eq!(addr, &A::new(93, 184, 215, 14));
//
// assert that the connection works for a second query
@ -605,7 +605,7 @@ mod tests {
assert_eq!(
addr,
&AAAA::new(0x2606, 0x2800, 0x0220, 0x0001, 0x0248, 0x1893, 0x25c8, 0x1946)
&AAAA::new(0x2606, 0x2800, 0x21f, 0xcb07, 0x6820, 0x80da, 0xaf6b, 0x8b2c)
);
}
}
@ -642,7 +642,7 @@ mod tests {
.and_then(RData::as_a)
.expect("Expected A record");
assert_eq!(addr, &A::new(93, 184, 216, 34));
assert_eq!(addr, &A::new(93, 184, 215, 14));
//
// assert that the connection works for a second query
@ -670,7 +670,7 @@ mod tests {
assert_eq!(
addr,
&AAAA::new(0x2606, 0x2800, 0x0220, 0x0001, 0x0248, 0x1893, 0x25c8, 0x1946)
&AAAA::new(0x2606, 0x2800, 0x21f, 0xcb07, 0x6820, 0x80da, 0xaf6b, 0x8b2c)
);
}
}
@ -708,7 +708,7 @@ mod tests {
.and_then(RData::as_a)
.expect("invalid response, expected A record");
assert_eq!(addr, &A::new(93, 184, 216, 34));
assert_eq!(addr, &A::new(93, 184, 215, 14));
//
// assert that the connection works for a second query
@ -732,7 +732,7 @@ mod tests {
assert_eq!(
addr,
&AAAA::new(0x2606, 0x2800, 0x0220, 0x0001, 0x0248, 0x1893, 0x25c8, 0x1946)
&AAAA::new(0x2606, 0x2800, 0x21f, 0xcb07, 0x6820, 0x80da, 0xaf6b, 0x8b2c)
);
}

View File

@ -493,7 +493,7 @@ mod tests {
.and_then(RData::as_a)
.expect("Expected A record");
assert_eq!(addr, &A::new(93, 184, 216, 34));
assert_eq!(addr, &A::new(93, 184, 215, 14));
//
// assert that the connection works for a second query
@ -521,7 +521,7 @@ mod tests {
assert_eq!(
addr,
&AAAA::new(0x2606, 0x2800, 0x0220, 0x0001, 0x0248, 0x1893, 0x25c8, 0x1946)
&AAAA::new(0x2606, 0x2800, 0x21f, 0xcb07, 0x6820, 0x80da, 0xaf6b, 0x8b2c)
);
}
}
@ -558,7 +558,7 @@ mod tests {
.and_then(RData::as_a)
.expect("Expected A record");
assert_eq!(addr, &A::new(93, 184, 216, 34));
assert_eq!(addr, &A::new(93, 184, 215, 14));
//
// assert that the connection works for a second query
@ -586,7 +586,7 @@ mod tests {
assert_eq!(
addr,
&AAAA::new(0x2606, 0x2800, 0x0220, 0x0001, 0x0248, 0x1893, 0x25c8, 0x1946)
&AAAA::new(0x2606, 0x2800, 0x21f, 0xcb07, 0x6820, 0x80da, 0xaf6b, 0x8b2c)
);
}
}
@ -625,7 +625,7 @@ mod tests {
.and_then(RData::as_a)
.expect("invalid response, expected A record");
assert_eq!(addr, &A::new(93, 184, 216, 34));
assert_eq!(addr, &A::new(93, 184, 215, 14));
//
// assert that the connection works for a second query
@ -649,7 +649,7 @@ mod tests {
assert_eq!(
addr,
&AAAA::new(0x2606, 0x2800, 0x0220, 0x0001, 0x0248, 0x1893, 0x25c8, 0x1946)
&AAAA::new(0x2606, 0x2800, 0x21f, 0xcb07, 0x6820, 0x80da, 0xaf6b, 0x8b2c)
);
}
}

View File

@ -553,7 +553,7 @@ mod test {
.set_ttl(86400)
.set_record_type(RecordType::A)
.set_dns_class(DNSClass::IN)
.set_data(Some(RData::A(Ipv4Addr::new(93, 184, 216, 34).into())))
.set_data(Some(RData::A(Ipv4Addr::new(93, 184, 215, 14).into())))
.clone(),
);
(
@ -625,7 +625,7 @@ mod test {
.set_ttl(86400)
.set_record_type(RecordType::A)
.set_dns_class(DNSClass::IN)
.set_data(Some(RData::A(Ipv4Addr::new(93, 184, 216, 34).into())))
.set_data(Some(RData::A(Ipv4Addr::new(93, 184, 215, 14).into())))
.clone(),
Record::new()
.set_name(origin)
@ -633,7 +633,10 @@ mod test {
.set_record_type(RecordType::AAAA)
.set_dns_class(DNSClass::IN)
.set_data(Some(RData::AAAA(
Ipv6Addr::new(0x2606, 0x2800, 0x220, 0x1, 0x248, 0x1893, 0x25c8, 0x1946).into(),
Ipv6Addr::new(
0x2606, 0x2800, 0x21f, 0xcb07, 0x6820, 0x80da, 0xaf6b, 0x8b2c,
)
.into(),
)))
.clone(),
soa,

View File

@ -40,9 +40,9 @@ let mut response = resolver.lookup_ip("www.example.com.").unwrap();
// this can return IPv4 and/or IPv6 addresses
let address = response.iter().next().expect("no addresses returned!");
if address.is_ipv4() {
assert_eq!(address, IpAddr::V4(Ipv4Addr::new(93, 184, 216, 34)));
assert_eq!(address, IpAddr::V4(Ipv4Addr::new(93, 184, 215, 14)));
} else {
assert_eq!(address, IpAddr::V6(Ipv6Addr::new(0x2606, 0x2800, 0x220, 0x1, 0x248, 0x1893, 0x25c8, 0x1946)));
assert_eq!(address, IpAddr::V6(Ipv6Addr::new(0x2606, 0x2800, 0x21f, 0xcb07, 0x6820, 0x80da, 0xaf6b, 0x8b2c)));
}
```
@ -95,7 +95,7 @@ cargo install --bin resolve hickory-util
$ resolve www.example.com.
Querying for www.example.com. A from udp:8.8.8.8:53, tcp:8.8.8.8:53, udp:8.8.4.4:53, tcp:8.8.4.4:53, udp:[2001:4860:4860::8888]:53, tcp:[2001:4860:4860::8888]:53, udp:[2001:4860:4860::8844]:53, tcp:[2001:4860:4860::8844]:53
Success for query name: www.example.com. type: A class: IN
www.example.com. 21063 IN A 93.184.216.34
www.example.com. 21063 IN A 93.184.215.14
```
## Minimum Rust Version

View File

@ -64,12 +64,12 @@ async fn lookup_test<R: ConnectionProvider>(resolver: AsyncResolver<R>) {
// this can return IPv4 and/or IPv6 addresses
let address = response.iter().next().expect("no addresses returned!");
if address.is_ipv4() {
assert_eq!(address, IpAddr::V4(Ipv4Addr::new(93, 184, 216, 34)));
assert_eq!(address, IpAddr::V4(Ipv4Addr::new(93, 184, 215, 14)));
} else {
assert_eq!(
address,
IpAddr::V6(Ipv6Addr::new(
0x2606, 0x2800, 0x220, 0x1, 0x248, 0x1893, 0x25c8, 0x1946
0x2606, 0x2800, 0x21f, 0xcb07, 0x6820, 0x80da, 0xaf6b, 0x8b2c
))
);
}

View File

@ -487,12 +487,12 @@ pub mod testing {
assert_eq!(response.iter().count(), 1);
for address in response.iter() {
if address.is_ipv4() {
assert_eq!(address, IpAddr::V4(Ipv4Addr::new(93, 184, 216, 34)));
assert_eq!(address, IpAddr::V4(Ipv4Addr::new(93, 184, 215, 14)));
} else {
assert_eq!(
address,
IpAddr::V6(Ipv6Addr::new(
0x2606, 0x2800, 0x220, 0x1, 0x248, 0x1893, 0x25c8, 0x1946,
0x2606, 0x2800, 0x21f, 0xcb07, 0x6820, 0x80da, 0xaf6b, 0x8b2c,
))
);
}
@ -514,12 +514,12 @@ pub mod testing {
);
let response = exec
.block_on(resolver.lookup_ip("2606:2800:220:1:248:1893:25c8:1946"))
.block_on(resolver.lookup_ip("2606:2800:21f:cb07:6820:80da:af6b:8b2c"))
.expect("failed to run lookup");
assert_eq!(
Some(IpAddr::V6(Ipv6Addr::new(
0x2606, 0x2800, 0x220, 0x1, 0x248, 0x1893, 0x25c8, 0x1946,
0x2606, 0x2800, 0x21f, 0xcb07, 0x6820, 0x80da, 0xaf6b, 0x8b2c,
))),
response.iter().next()
);
@ -552,12 +552,12 @@ pub mod testing {
);
let response = exec
.block_on(resolver.lookup_ip("2606:2800:220:1:248:1893:25c8:1946"))
.block_on(resolver.lookup_ip("2606:2800:21f:cb07:6820:80da:af6b:8b2c"))
.expect("failed to run lookup");
assert_eq!(
Some(IpAddr::V6(Ipv6Addr::new(
0x2606, 0x2800, 0x220, 0x1, 0x248, 0x1893, 0x25c8, 0x1946,
0x2606, 0x2800, 0x21f, 0xcb07, 0x6820, 0x80da, 0xaf6b, 0x8b2c,
))),
response.iter().next()
);
@ -602,12 +602,12 @@ pub mod testing {
//assert_eq!(response.iter().count(), 1);
for address in response.iter() {
if address.is_ipv4() {
assert_eq!(address, IpAddr::V4(Ipv4Addr::new(93, 184, 216, 34)));
assert_eq!(address, IpAddr::V4(Ipv4Addr::new(93, 184, 215, 14)));
} else {
assert_eq!(
address,
IpAddr::V6(Ipv6Addr::new(
0x2606, 0x2800, 0x220, 0x1, 0x248, 0x1893, 0x25c8, 0x1946,
0x2606, 0x2800, 0x21f, 0xcb07, 0x6820, 0x80da, 0xaf6b, 0x8b2c,
))
);
}
@ -662,12 +662,12 @@ pub mod testing {
assert_eq!(response.iter().count(), 2);
for address in response.iter() {
if address.is_ipv4() {
assert_eq!(address, IpAddr::V4(Ipv4Addr::new(93, 184, 216, 34)));
assert_eq!(address, IpAddr::V4(Ipv4Addr::new(93, 184, 215, 14)));
} else {
assert_eq!(
address,
IpAddr::V6(Ipv6Addr::new(
0x2606, 0x2800, 0x220, 0x1, 0x248, 0x1893, 0x25c8, 0x1946,
0x2606, 0x2800, 0x21f, 0xcb07, 0x6820, 0x80da, 0xaf6b, 0x8b2c,
))
);
}
@ -724,7 +724,7 @@ pub mod testing {
assert_eq!(response.iter().count(), 1);
for address in response.iter() {
if address.is_ipv4() {
assert_eq!(address, IpAddr::V4(Ipv4Addr::new(93, 184, 216, 34)));
assert_eq!(address, IpAddr::V4(Ipv4Addr::new(93, 184, 215, 14)));
} else {
panic!("should only be looking up IPv4");
}
@ -760,7 +760,7 @@ pub mod testing {
assert_eq!(response.iter().count(), 1);
for address in response.iter() {
if address.is_ipv4() {
assert_eq!(address, IpAddr::V4(Ipv4Addr::new(93, 184, 216, 34)));
assert_eq!(address, IpAddr::V4(Ipv4Addr::new(93, 184, 215, 14)));
} else {
panic!("should only be looking up IPv4");
}
@ -799,7 +799,7 @@ pub mod testing {
assert_eq!(response.iter().count(), 1);
for address in response.iter() {
if address.is_ipv4() {
assert_eq!(address, IpAddr::V4(Ipv4Addr::new(93, 184, 216, 34)));
assert_eq!(address, IpAddr::V4(Ipv4Addr::new(93, 184, 215, 14)));
} else {
panic!("should only be looking up IPv4");
}
@ -839,7 +839,7 @@ pub mod testing {
assert_eq!(response.iter().count(), 1);
for address in response.iter() {
if address.is_ipv4() {
assert_eq!(address, IpAddr::V4(Ipv4Addr::new(93, 184, 216, 34)));
assert_eq!(address, IpAddr::V4(Ipv4Addr::new(93, 184, 215, 14)));
} else {
panic!("should only be looking up IPv4");
}
@ -878,7 +878,7 @@ pub mod testing {
assert_eq!(response.iter().count(), 1);
for address in response.iter() {
if address.is_ipv4() {
assert_eq!(address, IpAddr::V4(Ipv4Addr::new(93, 184, 216, 34)));
assert_eq!(address, IpAddr::V4(Ipv4Addr::new(93, 184, 215, 14)));
} else {
panic!("should only be looking up IPv4");
}

View File

@ -102,12 +102,12 @@ mod tests {
assert_eq!(response.iter().count(), 1);
for address in response.iter() {
if address.is_ipv4() {
assert_eq!(address, IpAddr::V4(Ipv4Addr::new(93, 184, 216, 34)));
assert_eq!(address, IpAddr::V4(Ipv4Addr::new(93, 184, 215, 14)));
} else {
assert_eq!(
address,
IpAddr::V6(Ipv6Addr::new(
0x2606, 0x2800, 0x220, 0x1, 0x248, 0x1893, 0x25c8, 0x1946,
0x2606, 0x2800, 0x21f, 0xcb07, 0x6820, 0x80da, 0xaf6b, 0x8b2c,
))
);
}
@ -121,12 +121,12 @@ mod tests {
assert_eq!(response.iter().count(), 1);
for address in response.iter() {
if address.is_ipv4() {
assert_eq!(address, IpAddr::V4(Ipv4Addr::new(93, 184, 216, 34)));
assert_eq!(address, IpAddr::V4(Ipv4Addr::new(93, 184, 215, 14)));
} else {
assert_eq!(
address,
IpAddr::V6(Ipv6Addr::new(
0x2606, 0x2800, 0x220, 0x1, 0x248, 0x1893, 0x25c8, 0x1946,
0x2606, 0x2800, 0x21f, 0xcb07, 0x6820, 0x80da, 0xaf6b, 0x8b2c,
))
);
}

View File

@ -102,12 +102,12 @@ mod tests {
assert_eq!(response.iter().count(), 1);
for address in response.iter() {
if address.is_ipv4() {
assert_eq!(address, IpAddr::V4(Ipv4Addr::new(93, 184, 216, 34)));
assert_eq!(address, IpAddr::V4(Ipv4Addr::new(93, 184, 215, 14)));
} else {
assert_eq!(
address,
IpAddr::V6(Ipv6Addr::new(
0x2606, 0x2800, 0x220, 0x1, 0x248, 0x1893, 0x25c8, 0x1946,
0x2606, 0x2800, 0x21f, 0xcb07, 0x6820, 0x80da, 0xaf6b, 0x8b2c,
))
);
}
@ -121,12 +121,12 @@ mod tests {
assert_eq!(response.iter().count(), 1);
for address in response.iter() {
if address.is_ipv4() {
assert_eq!(address, IpAddr::V4(Ipv4Addr::new(93, 184, 216, 34)));
assert_eq!(address, IpAddr::V4(Ipv4Addr::new(93, 184, 215, 14)));
} else {
assert_eq!(
address,
IpAddr::V6(Ipv6Addr::new(
0x2606, 0x2800, 0x220, 0x1, 0x248, 0x1893, 0x25c8, 0x1946,
0x2606, 0x2800, 0x21f, 0xcb07, 0x6820, 0x80da, 0xaf6b, 0x8b2c,
))
);
}

View File

@ -60,9 +60,9 @@
//! // this can return IPv4 and/or IPv6 addresses
//! let address = response.iter().next().expect("no addresses returned!");
//! if address.is_ipv4() {
//! assert_eq!(address, IpAddr::V4(Ipv4Addr::new(93, 184, 216, 34)));
//! assert_eq!(address, IpAddr::V4(Ipv4Addr::new(93, 184, 215, 14)));
//! } else {
//! assert_eq!(address, IpAddr::V6(Ipv6Addr::new(0x2606, 0x2800, 0x220, 0x1, 0x248, 0x1893, 0x25c8, 0x1946)));
//! assert_eq!(address, IpAddr::V6(Ipv6Addr::new(0x2606, 0x2800, 0x21f, 0xcb07, 0x6820, 0x80da, 0xaf6b, 0x8b2c)));
//! }
//! # }
//! # }
@ -126,9 +126,9 @@
//! // this can return IPv4 and/or IPv6 addresses
//! let address = response.iter().next().expect("no addresses returned!");
//! if address.is_ipv4() {
//! assert_eq!(address, IpAddr::V4(Ipv4Addr::new(93, 184, 216, 34)));
//! assert_eq!(address, IpAddr::V4(Ipv4Addr::new(93, 184, 215, 14)));
//! } else {
//! assert_eq!(address, IpAddr::V6(Ipv6Addr::new(0x2606, 0x2800, 0x220, 0x1, 0x248, 0x1893, 0x25c8, 0x1946)));
//! assert_eq!(address, IpAddr::V6(Ipv6Addr::new(0x2606, 0x2800, 0x21f, 0xcb07, 0x6820, 0x80da, 0xaf6b, 0x8b2c)));
//! }
//! # }
//! # }

View File

@ -621,7 +621,7 @@ mod tests {
.data()
.and_then(RData::as_a)
.expect("no a record available"),
Ipv4Addr::new(93, 184, 216, 34).into()
Ipv4Addr::new(93, 184, 215, 14).into()
);
assert!(
@ -645,7 +645,7 @@ mod tests {
.data()
.and_then(RData::as_aaaa)
.expect("no aaaa record available"),
Ipv6Addr::new(0x2606, 0x2800, 0x0220, 0x0001, 0x0248, 0x1893, 0x25c8, 0x1946).into()
Ipv6Addr::new(0x2606, 0x2800, 0x21f, 0xcb07, 0x6820, 0x80da, 0xaf6b, 0x8b2c).into()
);
assert!(

View File

@ -106,12 +106,12 @@ mod tests {
assert_eq!(response.iter().count(), 1);
for address in response.iter() {
if address.is_ipv4() {
assert_eq!(address, IpAddr::V4(Ipv4Addr::new(93, 184, 216, 34)));
assert_eq!(address, IpAddr::V4(Ipv4Addr::new(93, 184, 215, 14)));
} else {
assert_eq!(
address,
IpAddr::V6(Ipv6Addr::new(
0x2606, 0x2800, 0x220, 0x1, 0x248, 0x1893, 0x25c8, 0x1946,
0x2606, 0x2800, 0x21f, 0xcb07, 0x6820, 0x80da, 0xaf6b, 0x8b2c,
))
);
}
@ -125,12 +125,12 @@ mod tests {
assert_eq!(response.iter().count(), 1);
for address in response.iter() {
if address.is_ipv4() {
assert_eq!(address, IpAddr::V4(Ipv4Addr::new(93, 184, 216, 34)));
assert_eq!(address, IpAddr::V4(Ipv4Addr::new(93, 184, 215, 14)));
} else {
assert_eq!(
address,
IpAddr::V6(Ipv6Addr::new(
0x2606, 0x2800, 0x220, 0x1, 0x248, 0x1893, 0x25c8, 0x1946,
0x2606, 0x2800, 0x21f, 0xcb07, 0x6820, 0x80da, 0xaf6b, 0x8b2c,
))
);
}

View File

@ -191,12 +191,12 @@ mod tests {
assert_eq!(response.iter().count(), 1);
for address in response.iter() {
if address.is_ipv4() {
assert_eq!(address, IpAddr::V4(Ipv4Addr::new(93, 184, 216, 34)));
assert_eq!(address, IpAddr::V4(Ipv4Addr::new(93, 184, 215, 14)));
} else {
assert_eq!(
address,
IpAddr::V6(Ipv6Addr::new(
0x2606, 0x2800, 0x220, 0x1, 0x248, 0x1893, 0x25c8, 0x1946,
0x2606, 0x2800, 0x21f, 0xcb07, 0x6820, 0x80da, 0xaf6b, 0x8b2c,
))
);
}
@ -216,12 +216,12 @@ mod tests {
assert_eq!(response.iter().count(), 1);
for address in response.iter() {
if address.is_ipv4() {
assert_eq!(address, IpAddr::V4(Ipv4Addr::new(93, 184, 216, 34)));
assert_eq!(address, IpAddr::V4(Ipv4Addr::new(93, 184, 215, 14)));
} else {
assert_eq!(
address,
IpAddr::V6(Ipv6Addr::new(
0x2606, 0x2800, 0x220, 0x1, 0x248, 0x1893, 0x25c8, 0x1946,
0x2606, 0x2800, 0x21f, 0xcb07, 0x6820, 0x80da, 0xaf6b, 0x8b2c,
))
);
}

View File

@ -56,12 +56,12 @@ mod tests {
assert_eq!(response.iter().count(), 1);
for address in response.iter() {
if address.is_ipv4() {
assert_eq!(address, IpAddr::V4(Ipv4Addr::new(93, 184, 216, 34)));
assert_eq!(address, IpAddr::V4(Ipv4Addr::new(93, 184, 215, 14)));
} else {
assert_eq!(
address,
IpAddr::V6(Ipv6Addr::new(
0x2606, 0x2800, 0x220, 0x1, 0x248, 0x1893, 0x25c8, 0x1946,
0x2606, 0x2800, 0x21f, 0xcb07, 0x6820, 0x80da, 0xaf6b, 0x8b2c,
))
);
}

View File

@ -272,7 +272,7 @@ mod tests {
let answer = Record::new()
.set_record_type(RecordType::A)
.set_name(Name::from_str("www.example.com.").unwrap())
.set_data(Some(RData::A(Ipv4Addr::new(93, 184, 216, 34).into())))
.set_data(Some(RData::A(Ipv4Addr::new(93, 184, 215, 14).into())))
.set_dns_class(DNSClass::NONE)
.clone();
@ -309,7 +309,7 @@ mod tests {
let answer = Record::new()
.set_record_type(RecordType::A)
.set_name(Name::from_str("www.example.com.").unwrap())
.set_data(Some(RData::A(Ipv4Addr::new(93, 184, 216, 34).into())))
.set_data(Some(RData::A(Ipv4Addr::new(93, 184, 215, 14).into())))
.set_dns_class(DNSClass::NONE)
.clone();

View File

@ -33,5 +33,5 @@ fn test_lookup() {
.data()
.and_then(RData::as_a)
.expect("not an A record");
assert_eq!(*address, Ipv4Addr::new(93, 184, 216, 34).into());
assert_eq!(*address, Ipv4Addr::new(93, 184, 215, 14).into());
}

View File

@ -81,19 +81,19 @@ pub fn create_example() -> InMemoryAuthority {
0,
);
// example.com. 86400 IN A 93.184.216.34
// example.com. 86400 IN A 93.184.215.14
records.upsert_mut(
Record::new()
.set_name(origin.clone())
.set_ttl(86400)
.set_record_type(RecordType::A)
.set_dns_class(DNSClass::IN)
.set_data(Some(RData::A(A::new(93, 184, 216, 34))))
.set_data(Some(RData::A(A::new(93, 184, 215, 14))))
.clone(),
0,
);
// example.com. 86400 IN AAAA 2606:2800:220:1:248:1893:25c8:1946
// example.com. 86400 IN AAAA 2606:2800:21f:cb07:6820:80da:af6b:8b2c
records.upsert_mut(
Record::new()
.set_name(origin)
@ -101,7 +101,7 @@ pub fn create_example() -> InMemoryAuthority {
.set_record_type(RecordType::AAAA)
.set_dns_class(DNSClass::IN)
.set_data(Some(RData::AAAA(AAAA::new(
0x2606, 0x2800, 0x220, 0x1, 0x248, 0x1893, 0x25c8, 0x1946,
0x2606, 0x2800, 0x21f, 0xcb07, 0x6820, 0x80da, 0xaf6b, 0x8b2c,
))))
.clone(),
0,
@ -136,19 +136,19 @@ pub fn create_example() -> InMemoryAuthority {
0,
);
// www.example.com. 86400 IN A 93.184.216.34
// www.example.com. 86400 IN A 93.184.215.14
records.upsert_mut(
Record::new()
.set_name(www_name.clone())
.set_ttl(86400)
.set_record_type(RecordType::A)
.set_dns_class(DNSClass::IN)
.set_data(Some(RData::A(A::new(93, 184, 216, 34))))
.set_data(Some(RData::A(A::new(93, 184, 215, 14))))
.clone(),
0,
);
// www.example.com. 86400 IN AAAA 2606:2800:220:1:248:1893:25c8:1946
// www.example.com. 86400 IN AAAA 2606:2800:21f:cb07:6820:80da:af6b:8b2c
records.upsert_mut(
Record::new()
.set_name(www_name.clone())
@ -156,7 +156,7 @@ pub fn create_example() -> InMemoryAuthority {
.set_record_type(RecordType::AAAA)
.set_dns_class(DNSClass::IN)
.set_data(Some(RData::AAAA(AAAA::new(
0x2606, 0x2800, 0x220, 0x1, 0x248, 0x1893, 0x25c8, 0x1946,
0x2606, 0x2800, 0x21f, 0xcb07, 0x6820, 0x80da, 0xaf6b, 0x8b2c,
))))
.clone(),
0,

View File

@ -85,7 +85,7 @@ pub fn create_test() -> InMemoryAuthority {
.set_record_type(RecordType::AAAA)
.set_dns_class(DNSClass::IN)
.set_data(Some(RData::AAAA(AAAA::new(
0x2606, 0x2800, 0x220, 0x1, 0x248, 0x1893, 0x25c8, 0x1946,
0x2606, 0x2800, 0x21f, 0xcb07, 0x6820, 0x80da, 0xaf6b, 0x8b2c,
))))
.clone(),
0,
@ -109,7 +109,7 @@ pub fn create_test() -> InMemoryAuthority {
.set_record_type(RecordType::AAAA)
.set_dns_class(DNSClass::IN)
.set_data(Some(RData::AAAA(AAAA::new(
0x2606, 0x2800, 0x220, 0x1, 0x248, 0x1893, 0x25c8, 0x1946,
0x2606, 0x2800, 0x21f, 0xcb07, 0x6820, 0x80da, 0xaf6b, 0x8b2c,
))))
.clone(),
0,
@ -157,7 +157,7 @@ async fn test_catalog_lookup() {
assert_eq!(answers.first().unwrap().record_type(), RecordType::A);
assert_eq!(
answers.first().unwrap().data().unwrap(),
&RData::A(A::new(93, 184, 216, 34))
&RData::A(A::new(93, 184, 215, 14))
);
let ns = result.name_servers();
@ -451,7 +451,7 @@ async fn test_axfr() {
.set_record_type(RecordType::AAAA)
.set_dns_class(DNSClass::IN)
.set_data(Some(RData::AAAA(AAAA::new(
0x2606, 0x2800, 0x220, 0x1, 0x248, 0x1893, 0x25c8, 0x1946,
0x2606, 0x2800, 0x21f, 0xcb07, 0x6820, 0x80da, 0xaf6b, 0x8b2c,
))))
.clone(),
Record::new()
@ -467,7 +467,7 @@ async fn test_axfr() {
.set_record_type(RecordType::AAAA)
.set_dns_class(DNSClass::IN)
.set_data(Some(RData::AAAA(AAAA::new(
0x2606, 0x2800, 0x220, 0x1, 0x248, 0x1893, 0x25c8, 0x1946,
0x2606, 0x2800, 0x21f, 0xcb07, 0x6820, 0x80da, 0xaf6b, 0x8b2c,
))))
.clone(),
Record::new()
@ -576,7 +576,7 @@ async fn test_cname_additionals() {
assert_eq!(additionals.first().unwrap().record_type(), RecordType::A);
assert_eq!(
additionals.first().unwrap().data().unwrap(),
&RData::A(A::new(93, 184, 216, 34))
&RData::A(A::new(93, 184, 215, 14))
);
}
@ -636,6 +636,6 @@ async fn test_multiple_cname_additionals() {
assert_eq!(additionals.last().unwrap().record_type(), RecordType::A);
assert_eq!(
additionals.last().unwrap().data().unwrap(),
&RData::A(A::new(93, 184, 216, 34))
&RData::A(A::new(93, 184, 215, 14))
);
}

View File

@ -192,7 +192,7 @@ fn test_query(client: &mut AsyncClient) -> impl Future<Output = ()> {
assert_eq!(record.dns_class(), DNSClass::IN);
if let RData::A(ref address) = record.data().unwrap() {
assert_eq!(address, &A::new(93, 184, 216, 34))
assert_eq!(address, &A::new(93, 184, 215, 14))
} else {
panic!();
}
@ -251,7 +251,7 @@ fn test_query_edns(client: &mut AsyncClient) -> impl Future<Output = ()> {
&EdnsOption::Subnet("1.2.0.0/16".parse().unwrap())
);
if let RData::A(ref address) = *record.data().unwrap() {
assert_eq!(address, &A::new(93, 184, 216, 34))
assert_eq!(address, &A::new(93, 184, 215, 14))
} else {
panic!();
}

View File

@ -126,7 +126,7 @@ where
assert_eq!(record.dns_class(), DNSClass::IN);
if let RData::A(ref address) = *record.data().unwrap() {
assert_eq!(address, &A::new(93, 184, 216, 34))
assert_eq!(address, &A::new(93, 184, 215, 14))
} else {
panic!();
}
@ -184,7 +184,7 @@ where
);
if let RData::A(ref address) = *record.data().unwrap() {
assert_eq!(address, &A::new(93, 184, 216, 34))
assert_eq!(address, &A::new(93, 184, 215, 14))
} else {
panic!();
}
@ -243,7 +243,7 @@ where
assert_eq!(record.dns_class(), DNSClass::IN);
if let RData::A(ref address) = *record.data().unwrap() {
assert_eq!(address, &A::new(93, 184, 216, 34))
assert_eq!(address, &A::new(93, 184, 215, 14))
} else {
panic!();
}

View File

@ -65,7 +65,7 @@ where
assert_eq!(record.proof(), Proof::Secure);
if let RData::A(ref address) = *record.data().unwrap() {
assert_eq!(address, &A::new(93, 184, 216, 34))
assert_eq!(address, &A::new(93, 184, 215, 14))
} else {
panic!();
}

View File

@ -50,7 +50,7 @@ fn test_lookup() {
assert_eq!(
*lookup.iter().next().unwrap(),
RData::A(A::new(93, 184, 216, 34))
RData::A(A::new(93, 184, 215, 14))
);
}
@ -177,7 +177,7 @@ fn test_mock_lookup() {
let resp_query = Query::query(Name::from_str("www.example.com.").unwrap(), RecordType::A);
let v4_record = v4_record(
Name::from_str("www.example.com.").unwrap(),
Ipv4Addr::new(93, 184, 216, 34),
Ipv4Addr::new(93, 184, 215, 14),
);
let message = message(resp_query, vec![v4_record], vec![], vec![]);
let client: MockClientHandle<_> =
@ -195,7 +195,7 @@ fn test_mock_lookup() {
assert_eq!(
*lookup.iter().next().unwrap(),
RData::A(A::new(93, 184, 216, 34))
RData::A(A::new(93, 184, 215, 14))
);
}
@ -208,7 +208,7 @@ fn test_cname_lookup() {
);
let v4_record = v4_record(
Name::from_str("v4.example.com.").unwrap(),
Ipv4Addr::new(93, 184, 216, 34),
Ipv4Addr::new(93, 184, 215, 14),
);
let message = message(resp_query, vec![cname_record, v4_record], vec![], vec![]);
let client: MockClientHandle<_> =
@ -226,7 +226,7 @@ fn test_cname_lookup() {
assert_eq!(
*lookup.iter().next().unwrap(),
RData::A(A::new(93, 184, 216, 34))
RData::A(A::new(93, 184, 215, 14))
);
}
@ -239,7 +239,7 @@ fn test_cname_lookup_preserve() {
);
let v4_record = v4_record(
Name::from_str("v4.example.com.").unwrap(),
Ipv4Addr::new(93, 184, 216, 34),
Ipv4Addr::new(93, 184, 215, 14),
);
let message = message(
resp_query,
@ -262,7 +262,7 @@ fn test_cname_lookup_preserve() {
let mut iter = lookup.iter();
assert_eq!(iter.next().unwrap(), cname_record.data().unwrap());
assert_eq!(*iter.next().unwrap(), RData::A(A::new(93, 184, 216, 34)));
assert_eq!(*iter.next().unwrap(), RData::A(A::new(93, 184, 215, 14)));
}
#[test]
@ -274,7 +274,7 @@ fn test_chained_cname_lookup() {
);
let v4_record = v4_record(
Name::from_str("v4.example.com.").unwrap(),
Ipv4Addr::new(93, 184, 216, 34),
Ipv4Addr::new(93, 184, 215, 14),
);
// The first response should be a cname, the second will be the actual record
@ -299,7 +299,7 @@ fn test_chained_cname_lookup() {
assert_eq!(
*lookup.iter().next().unwrap(),
RData::A(A::new(93, 184, 216, 34))
RData::A(A::new(93, 184, 215, 14))
);
}
@ -312,7 +312,7 @@ fn test_chained_cname_lookup_preserve() {
);
let v4_record = v4_record(
Name::from_str("v4.example.com.").unwrap(),
Ipv4Addr::new(93, 184, 216, 34),
Ipv4Addr::new(93, 184, 215, 14),
);
// The first response should be a cname, the second will be the actual record
@ -342,7 +342,7 @@ fn test_chained_cname_lookup_preserve() {
let mut iter = lookup.iter();
assert_eq!(iter.next().unwrap(), cname_record.data().unwrap());
assert_eq!(*iter.next().unwrap(), RData::A(A::new(93, 184, 216, 34)));
assert_eq!(*iter.next().unwrap(), RData::A(A::new(93, 184, 215, 14)));
}
#[test]
@ -386,7 +386,7 @@ fn test_max_chained_lookup_depth() {
);
let v4_record = v4_record(
Name::from_str("v4.example.com.").unwrap(),
Ipv4Addr::new(93, 184, 216, 34),
Ipv4Addr::new(93, 184, 215, 14),
);
// The first response should be a cname, the second will be the actual record
@ -441,6 +441,6 @@ fn test_max_chained_lookup_depth() {
assert_eq!(
*lookup.iter().next().unwrap(),
RData::A(A::new(93, 184, 216, 34))
RData::A(A::new(93, 184, 215, 14))
);
}

View File

@ -351,7 +351,7 @@ where
assert_eq!(record.dns_class(), DNSClass::IN);
if let RData::A(ref address) = *record.data().unwrap() {
assert_eq!(address, &A::new(93, 184, 216, 34))
assert_eq!(address, &A::new(93, 184, 215, 14))
} else {
panic!();
}

View File

@ -52,7 +52,7 @@ async fn test_search() {
let record = result.iter().next().unwrap();
assert_eq!(record.record_type(), RecordType::A);
assert_eq!(record.dns_class(), DNSClass::IN);
assert_eq!(record.data().unwrap(), &RData::A(A::new(93, 184, 216, 34)));
assert_eq!(record.data().unwrap(), &RData::A(A::new(93, 184, 215, 14)));
} else {
panic!("expected a result"); // valid panic, in test
}
@ -82,7 +82,7 @@ async fn test_search_www() {
let record = result.iter().next().unwrap();
assert_eq!(record.record_type(), RecordType::A);
assert_eq!(record.dns_class(), DNSClass::IN);
assert_eq!(record.data().unwrap(), &RData::A(A::new(93, 184, 216, 34)));
assert_eq!(record.data().unwrap(), &RData::A(A::new(93, 184, 215, 14)));
} else {
panic!("expected a result"); // valid panic, in test
}
@ -199,7 +199,7 @@ async fn test_authority() {
.set_ttl(86400)
.set_record_type(RecordType::A)
.set_dns_class(DNSClass::IN)
.set_data(Some(RData::A(A::new(93, 184, 216, 34))))
.set_data(Some(RData::A(A::new(93, 184, 215, 14))))
.clone()
);
}
@ -369,7 +369,7 @@ async fn test_prerequisites() {
.set_ttl(0)
.set_dns_class(DNSClass::IN)
.set_record_type(RecordType::A)
.set_data(Some(RData::A(A::new(93, 184, 216, 34))))
.set_data(Some(RData::A(A::new(93, 184, 215, 14))))
.clone()])
.await
.is_ok());
@ -381,7 +381,7 @@ async fn test_prerequisites() {
.set_ttl(0)
.set_dns_class(DNSClass::CH)
.set_record_type(RecordType::A)
.set_data(Some(RData::A(A::new(93, 184, 216, 34))))
.set_data(Some(RData::A(A::new(93, 184, 215, 14))))
.clone()],)
.await,
Err(ResponseCode::FormErr)
@ -665,7 +665,7 @@ async fn test_update() {
.set_ttl(86400)
.set_record_type(RecordType::A)
.set_dns_class(DNSClass::IN)
.set_data(Some(RData::A(A::new(93, 184, 216, 34))))
.set_data(Some(RData::A(A::new(93, 184, 215, 14))))
.clone(),
Record::new()
.set_name(www_name.clone())
@ -673,7 +673,7 @@ async fn test_update() {
.set_record_type(RecordType::AAAA)
.set_dns_class(DNSClass::IN)
.set_data(Some(RData::AAAA(AAAA::new(
0x2606, 0x2800, 0x220, 0x1, 0x248, 0x1893, 0x25c8, 0x1946,
0x2606, 0x2800, 0x21f, 0xcb07, 0x6820, 0x80da, 0xaf6b, 0x8b2c,
))))
.clone(),
];
@ -852,7 +852,7 @@ async fn test_update() {
.set_record_type(RecordType::AAAA)
.set_dns_class(DNSClass::IN)
.set_data(Some(RData::AAAA(AAAA::new(
0x2606, 0x2800, 0x220, 0x1, 0x248, 0x1893, 0x25c8, 0x1946,
0x2606, 0x2800, 0x21f, 0xcb07, 0x6820, 0x80da, 0xaf6b, 0x8b2c,
))))
.clone(),
];
@ -1010,7 +1010,7 @@ async fn test_journal() {
let delete_record = Record::new()
.set_name(delete_name.clone())
.set_record_type(RecordType::A)
.set_data(Some(RData::A(A::new(93, 184, 216, 34))))
.set_data(Some(RData::A(A::new(93, 184, 215, 14))))
.set_dns_class(DNSClass::NONE)
.clone();
authority

View File

@ -16,7 +16,7 @@ $ cargo install --bin resolve hickory-util
$ resolve www.example.com.
Querying for www.example.com. A from udp:8.8.8.8:53, tcp:8.8.8.8:53, udp:8.8.4.4:53, tcp:8.8.4.4:53, udp:[2001:4860:4860::8888]:53, tcp:[2001:4860:4860::8888]:53, udp:[2001:4860:4860::8844]:53, tcp:[2001:4860:4860::8844]:53
Success for query name: www.example.com. type: A class: IN
www.example.com. 21063 IN A 93.184.216.34
www.example.com. 21063 IN A 93.184.215.14
```
### help
@ -62,7 +62,7 @@ ARGS:
## dnskey-to-pem
This will take a private DNSKEY as generated by BIND9 and output an OpenSSL compatible PEM formatted file. *WARNING* this will contain private key material.
This will take a private DNSKEY as generated by BIND9 and output an OpenSSL compatible PEM formatted file. _WARNING_ this will contain private key material.
```console
$ cargo run --bin pem-to-public-dnskey -- --help
@ -84,7 +84,6 @@ ARGS:
<PRIVATE_KEY_FILE> Input FILE from which to read the DNSSEC private key
```
## pem-to-public-dnskey
This utility can be used to output raw bytes in the DNSKEY RDATA format. This is useful for associating custom public keys with the TrustAnchor facility in Hickory DNS.