-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from LinkTed/add-more-tests
Add more tests
- Loading branch information
Showing
10 changed files
with
60 additions
and
168 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "dns-stamp-parser" | ||
version = "3.0.0" | ||
version = "3.0.1" | ||
authors = ["LinkTed <[email protected]>", "Evan Cameron <[email protected]>"] | ||
license = "BSD-3-Clause" | ||
edition = "2018" | ||
|
@@ -14,7 +14,7 @@ categories = ["parser-implementations", "encoding"] | |
base64 = "0.22" | ||
bitflags = "2" | ||
thiserror = "1" | ||
trust-dns-resolver = { version = "0.20", optional = true } | ||
trust-dns-resolver = { version = "0.23", optional = true } | ||
|
||
[features] | ||
default = [] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
use dns_stamp_parser::DnsStamp; | ||
|
||
// The list is from https://github.com/DNSCrypt/dnscrypt-resolvers/blob/master/v3/odoh-relays.md | ||
static DNS_STAMPS: [&str; 4] = [ | ||
"sdns://hQcAAAAAAAAADDg5LjM4LjEzMS4zOAAYb2RvaC1ubC5hbGVrYmVyZy5uZXQ6NDQzBi9wcm94eQ", | ||
"sdns://hQcAAAAAAAAAAAAab2RvaC1yZWxheS5lZGdlY29tcHV0ZS5hcHABLw", | ||
"sdns://hQcAAAAAAAAADjIxMy4xOTYuMTkxLjk2ABhpYmtzdHVybS5zeW5vbG9neS5tZTo0NDMGL3Byb3h5", | ||
"sdns://hQcAAAAAAAAADTQ1LjE1My4xODcuOTYAGG9kb2gtc2UuYWxla2JlcmcubmV0OjQ0MwYvcHJveHk", | ||
]; | ||
|
||
/// Test all DNS Stamp from the [list] by decode and encode and decode it again. | ||
/// | ||
/// [list]: https://github.com/DNSCrypt/dnscrypt-resolvers/blob/master/v3/odoh-relays.md | ||
#[test] | ||
fn relays() { | ||
for stamp_1 in DNS_STAMPS.iter() { | ||
let dns_stamp_1 = DnsStamp::decode(stamp_1).unwrap(); | ||
let stamp_2 = dns_stamp_1.encode().unwrap(); | ||
let dns_stamp_2 = DnsStamp::decode(&stamp_2).unwrap(); | ||
assert_eq!(dns_stamp_1, dns_stamp_2); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters