Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(test): update ip of example.com #2187

Merged
merged 2 commits into from Apr 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -295,7 +295,7 @@ example:
$ 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
```

## Using as a dependency and custom features
Expand Down
4 changes: 2 additions & 2 deletions bin/tests/named_tests.rs
Expand Up @@ -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
Expand All @@ -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());
})
Expand Down
4 changes: 2 additions & 2 deletions crates/async-std-resolver/README.md
Expand Up @@ -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)));
}
}
```
Expand Down
4 changes: 2 additions & 2 deletions crates/async-std-resolver/src/lib.rs
Expand Up @@ -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)));
//! }
//! }
//! ```
Expand Down
2 changes: 1 addition & 1 deletion crates/client/README.md
Expand Up @@ -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")
}
Expand Down
4 changes: 2 additions & 2 deletions crates/client/src/client/async_client.rs
Expand Up @@ -1117,15 +1117,15 @@ 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)
.expect("buffer was parsed already by AsyncClient so we should be able to do it again");

// 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));
}
}
}
4 changes: 2 additions & 2 deletions crates/client/src/lib.rs
Expand Up @@ -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")
//! }
Expand Down Expand Up @@ -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));
//! }
//! }
//! ```
Expand Down
12 changes: 6 additions & 6 deletions crates/proto/src/h2/h2_client_stream.rs
Expand Up @@ -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
Expand Down Expand Up @@ -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)
);
}
}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
);
}
}
Expand Down Expand Up @@ -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
Expand All @@ -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)
);
}

Expand Down
12 changes: 6 additions & 6 deletions crates/proto/src/h3/h3_client_stream.rs
Expand Up @@ -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
Expand Down Expand Up @@ -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)
);
}
}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
);
}
}
Expand Down Expand Up @@ -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
Expand All @@ -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)
);
}
}
2 changes: 1 addition & 1 deletion crates/proto/src/op/message.rs
Expand Up @@ -1281,7 +1281,7 @@ mod tests {
0x00, 0x01, 0x00, 0x01, // RecordType = A, Class = IN
0x00, 0x00, 0x00, 0x02, // TTL = 2 seconds
0x00, 0x04, // record length = 4 (ipv4 address)
0x5D, 0xB8, 0xD8, 0x22, // address = 93.184.216.34
0x5D, 0xB8, 0xD7, 0x0E, // address = 93.184.215.14
];

let mut decoder = BinDecoder::new(&buf);
Expand Down
9 changes: 6 additions & 3 deletions crates/proto/src/xfer/dns_multiplexer.rs
Expand Up @@ -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(),
);
(
Expand Down Expand Up @@ -625,15 +625,18 @@ 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)
.set_ttl(86400)
.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,
Expand Down
6 changes: 3 additions & 3 deletions crates/resolver/README.md
Expand Up @@ -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)));
}
```

Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions crates/resolver/examples/custom_provider.rs
Expand Up @@ -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
))
);
}
Expand Down
30 changes: 15 additions & 15 deletions crates/resolver/src/async_resolver.rs
Expand Up @@ -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,
))
);
}
Expand All @@ -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()
);
Expand Down Expand Up @@ -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()
);
Expand Down Expand Up @@ -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,
))
);
}
Expand Down Expand Up @@ -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,
))
);
}
Expand Down Expand Up @@ -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");
}
Expand Down Expand Up @@ -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");
}
Expand Down Expand Up @@ -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");
}
Expand Down Expand Up @@ -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");
}
Expand Down Expand Up @@ -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");
}
Expand Down