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

Add a queryable zone tree #286

Merged
merged 510 commits into from
Apr 12, 2024
Merged
Show file tree
Hide file tree
Changes from 250 commits
Commits
Show all changes
510 commits
Select commit Hold shift + click to select a range
7e46c74
Naming cleanup: because Transceiver is no longer a transceiver, it ju…
ximon18 Mar 7, 2024
295178e
Various fixes and improvements:
ximon18 Mar 7, 2024
6d9b9b0
Rename MiddlewareBuilder::finish() to build(), extend middleware type…
ximon18 Mar 7, 2024
509b8f2
Fix typos in comments.
ximon18 Mar 7, 2024
1727c9e
Typo correction in comment.
ximon18 Mar 7, 2024
36a4f14
Note some possibly useful socket settings to try tweaking in future.
ximon18 Mar 8, 2024
f9cc26e
Add a stream response write timeout.
ximon18 Mar 8, 2024
6fa27ef
Add support for max response size hinting, checking, and extracting f…
ximon18 Mar 8, 2024
4075d47
Update connection.rs
ximon18 Mar 8, 2024
f10d7ac
Allow log level of the example to be overridden using the RUST_LOG en…
ximon18 Mar 9, 2024
7a14526
Allow the default UDP response size limit suggestion to be disabled e…
ximon18 Mar 10, 2024
19e70ff
Rename `ServiceCommand` to `ServerCommand` and create `ServiceFeedback`.
ximon18 Mar 11, 2024
6360952
Implement simplistic DNS response message truncation.
ximon18 Mar 11, 2024
5960a43
Handle ServiceFeedback in the datagram server.
ximon18 Mar 11, 2024
4523c2c
Minor tweaks.
ximon18 Mar 11, 2024
59d2267
Fix outdated references in comments to ServiceCommand.
ximon18 Mar 11, 2024
fe8e7f2
Implement some dynamic reconfiguration that was marked as TODO.
ximon18 Mar 11, 2024
1f39331
Merge branch 'net-client-cache' into serve-poc
ximon18 Mar 12, 2024
6855e41
Merge branch 'main' into serve-poc
ximon18 Mar 12, 2024
83a3732
Remove duplicate code block.
ximon18 Mar 12, 2024
447047b
Clippy.
ximon18 Mar 12, 2024
c2a75f8
Use Tokio fake time instead of Clock to be consistent with the rest o…
ximon18 Mar 12, 2024
6ef1fef
Remove unnecessary log level enabled guards.
ximon18 Mar 12, 2024
03d0123
Added a comment about the Unbound ednts-tcp-keepalive-timeout setting.
ximon18 Mar 12, 2024
c8e13dc
Don't expect the RA flag to be set in the cookies test, as we don't c…
ximon18 Mar 12, 2024
13bbceb
Fix test failure caused by client disconnection because no edns-tcp-k…
ximon18 Mar 12, 2024
f4528f6
Include the name of the rpl file being tested in Deckard logging output.
ximon18 Mar 13, 2024
69c9203
Comment improvements.
ximon18 Mar 13, 2024
92a5e8a
Middleware improvements:
ximon18 Mar 13, 2024
c728b69
Log stats from the example less frequently.
ximon18 Mar 13, 2024
88ba56a
Indicate why REFUSED is served in response to an A google.com lookup …
ximon18 Mar 13, 2024
706078d
Tidy up serve example `setsockopt()` invocation and retry per BIND ma…
ximon18 Mar 13, 2024
4f96a88
Enable env var configurable logging in the serve example.
ximon18 Mar 13, 2024
65c0463
More/improved EDNS(0) max response size, TCP keep-alive and MUST have…
ximon18 Mar 13, 2024
0aa1577
Combine multiple state args into a new struct and add a timeout on UD…
ximon18 Mar 13, 2024
14aa4f0
Add `is_shutdown()` to dgram and stream servers.
ximon18 Mar 13, 2024
1522e4a
Add `stream::Config::set_connection_config()`.
ximon18 Mar 13, 2024
23d054e
Shut the TCP connection stream down cleanly on connection handler exit.
ximon18 Mar 13, 2024
5dc22cf
Inc/dec num_pending_writes metric in DgramServer.
ximon18 Mar 13, 2024
5242cbd
Minor comment tweaks.
ximon18 Mar 13, 2024
819c40b
Use new `is_shutdown()` server fns to clceanly await shutdown on Deck…
ximon18 Mar 13, 2024
2db80bb
Additional stream connection loggigng.
ximon18 Mar 13, 2024
8c58a3d
Compilation fixes, clippy & fmt after commit splitting marathon.
ximon18 Mar 13, 2024
48ade7a
Silence dead code warnings when compiling the serve example.
ximon18 Mar 13, 2024
40124d7
Delete wrongly committed file.
ximon18 Mar 13, 2024
64346e5
Delete wrongly committed file.
ximon18 Mar 13, 2024
9fabbd9
Minor comment improvement.
ximon18 Mar 14, 2024
fcc8f34
Add `await_shutdown()` helper fn to servers.
ximon18 Mar 14, 2024
7fb8c84
Make "modern" middleware the default, and move middleware settings in…
ximon18 Mar 14, 2024
bae79c4
Add a `reconfigure()` fn to servers.
ximon18 Mar 14, 2024
fd97a40
Fix addition of EDNS options to not cause extra OPT records to be added.
ximon18 Mar 14, 2024
cf16114
Follow the Deckard -> Stelline rename on `main`.
ximon18 Mar 14, 2024
adedb9e
Remove the `Error` associated type from `Service` as the calling code…
ximon18 Mar 15, 2024
d157982
Tailor `ServiceError` more to the DNS context and automatically gener…
ximon18 Mar 15, 2024
5589a0e
Add new `strict` mode (on by default) to `MandatoryMiddlewareProcesso…
ximon18 Mar 15, 2024
440c18e
cargo fmt.
ximon18 Mar 15, 2024
6b39834
Remove the MkServiceXxx type aliases as they cause confusing compiler…
ximon18 Mar 15, 2024
02a4947
Rename the serve example to server-transports to be consistent with t…
ximon18 Mar 15, 2024
6b00b93
Move the Arc around ContextAwareMessage inside to remove it from the …
ximon18 Mar 15, 2024
8fa553f
Rename ContextAwareMessage to Request as it's shorter and more obviou…
ximon18 Mar 15, 2024
05b67dc
Merge branch 'serve-poc' into zonetree
ximon18 Mar 15, 2024
2a45343
Re-organize imports to more closely match project style.
ximon18 Mar 15, 2024
ad59bb7
Merge branch 'main' into serve-poc
ximon18 Mar 15, 2024
de01b8a
Merge branch 'serve-poc' into zonetree
ximon18 Mar 18, 2024
e17452b
Limit generic types required for server Config structs to the minimum…
ximon18 Mar 18, 2024
895b863
Merge branch 'serve-poc' into zonetree
ximon18 Mar 18, 2024
5275c0a
Remove wrongly added unnecessary lock.
ximon18 Mar 19, 2024
36e94ee
cargo fmt.
ximon18 Mar 19, 2024
62bfe1d
Clippy.
ximon18 Mar 19, 2024
5cb2a45
Add missing Box.
ximon18 Mar 19, 2024
6bb7d56
WIP: Working sync/async zone impl abstraction layer.
ximon18 Mar 20, 2024
ffb593c
Review feedback: Remove `ServiceResult` and `ServiceResultItem` type …
ximon18 Mar 20, 2024
bc470a0
Remove "flavor" support.
ximon18 Mar 20, 2024
1bb55cf
Make WriteableZone async only, and remove helper macros.
ximon18 Mar 20, 2024
ccb0e2e
Merge branch 'main' into zonetree
ximon18 Mar 22, 2024
5063755
Added a dig like `query-zone` example for loading and querying a zone.
ximon18 Mar 22, 2024
588a985
Report zone parsing errors.
ximon18 Mar 22, 2024
b8a0159
cargo fmt.
ximon18 Mar 22, 2024
ccd17d1
Clippy.
ximon18 Mar 22, 2024
eebc731
Support loading and querying multiple zones at once.
ximon18 Mar 22, 2024
5ce2412
Emulate dig a bit more showing response headers and responding with N…
ximon18 Mar 22, 2024
867967f
Remove comment.
ximon18 Mar 22, 2024
1766d90
Oops.
ximon18 Mar 22, 2024
139f4d9
First version of `serve-zone` example showing how to respond to queri…
ximon18 Mar 22, 2024
03e972e
Merge branch 'main' into serve-poc
ximon18 Mar 22, 2024
d2180c5
Merge branch 'serve-poc' into zonetree
ximon18 Mar 22, 2024
06fe2e0
Adjust code post merge.
ximon18 Mar 22, 2024
73ef6ca
Minor error logging improvements:
ximon18 Mar 22, 2024
36e1733
Add an example show MySQL backed zone querying.
ximon18 Mar 22, 2024
284dde1
Format imports.
ximon18 Mar 22, 2024
e9ad8da
Format imports.
ximon18 Mar 22, 2024
dc778de
Remove commented out log statement.
ximon18 Mar 22, 2024
7471171
Add AXFR support to the serve-zone example.
ximon18 Mar 24, 2024
00dc9d1
Remove outdated comment.
ximon18 Mar 25, 2024
6caf865
Simplify the service result signature by making Transaction always be…
ximon18 Mar 24, 2024
8a49648
Clippy.
ximon18 Mar 25, 2024
5099448
Add `cargo sqlx prepare` output to prevent build failures caused by u…
ximon18 Mar 25, 2024
26a2e2e
Use older sqlx to support compilation with our Rust MSRV 1.67.0.
ximon18 Mar 25, 2024
b9e5819
Tweaks for Rust 1.67.0 compatibility and Clippy.
ximon18 Mar 25, 2024
4f154b3
Remove unnecessary SQL prepare cache directories, we're not using que…
ximon18 Mar 25, 2024
8fe3608
Rust -D warnings fixes.
ximon18 Mar 25, 2024
7f2cb7a
Split zonetree out into its own unstable Cargo feature.
ximon18 Mar 25, 2024
c1e5e86
Disable the mysql-zone example as the sqlx dependency is difficult to…
ximon18 Mar 25, 2024
47e003e
Put related things together (in-memory store, errors, traits, types) …
ximon18 Mar 26, 2024
c13b9b5
WIP: RustDocs for zone tree support. Moves and renames some types and…
ximon18 Mar 26, 2024
2f3e417
Use RFC 9499 terminology: zonefiles have an origin, zones have an apex.
ximon18 Mar 26, 2024
c69815b
Minor RustDoc tweaks.
ximon18 Mar 26, 2024
946f89e
Minor RustDoc tweaks.
ximon18 Mar 26, 2024
124c0eb
Minor RustDoc tweak.
ximon18 Mar 26, 2024
69d84fc
Remove debug logging.
ximon18 Mar 27, 2024
0191556
Fix import path in mysql-zone example.
ximon18 Mar 27, 2024
28d4c95
cargo fmt.
ximon18 Mar 27, 2024
c76da78
Remove source_addr from ComposeRequest and AsyncConnect (#287)
Philip-NLnetLabs Mar 27, 2024
71d6051
More RustDoc, and rename `ZoneBuilder::finalize()` to `build()`.
ximon18 Mar 27, 2024
d41faa0
Clarification.
ximon18 Mar 27, 2024
cdcbe47
Clarification.
ximon18 Mar 27, 2024
e822377
Import formatting.
ximon18 Mar 27, 2024
36d0b3e
Less noisy RustDoc.
ximon18 Mar 27, 2024
20b7152
More RustDoc refinement.
ximon18 Mar 27, 2024
37b5ee6
More RustDoc.
ximon18 Mar 27, 2024
7bfd015
Talk about "application logic" instead of "business logic".
ximon18 Mar 27, 2024
cdce95d
Remove `Answer::other()` as it just calls `Answer::new()` and is thus…
ximon18 Mar 27, 2024
af4370e
RustDoc for Answer. Rename `add_authority()` to `set_authority()` as …
ximon18 Mar 27, 2024
8aeb29d
cargo fmt.
ximon18 Mar 27, 2024
fc25a23
Fix broken RustDoc link.
ximon18 Mar 27, 2024
bc245d0
Mark zone related/specific types as such to reduce confusion with sim…
ximon18 Mar 27, 2024
4aed036
One more.
ximon18 Mar 27, 2024
3936d93
Review feedback.
ximon18 Mar 27, 2024
29a4e82
Review feedback.
ximon18 Mar 27, 2024
a366c5e
Review feedback. Re-order and separate out more clearly the `Transact…
ximon18 Mar 27, 2024
59b8b67
Review feedback. Note why it is safe to unwrap `num_connections`.
ximon18 Mar 27, 2024
f5401e0
Review feedback. Note why it is safe to unwrap `self.stream_rx`.
ximon18 Mar 27, 2024
10fafc3
RustDoc correction.
ximon18 Mar 27, 2024
abd57fd
Move `ServerCommamd` out of service.rs as it is not used by Service i…
ximon18 Mar 27, 2024
f1cc6e1
Minor cleanup.
ximon18 Mar 27, 2024
d6c7324
cargo fmt.
ximon18 Mar 27, 2024
e2ffe13
Merge branch 'main' into serve-poc
ximon18 Mar 27, 2024
45c5271
Review feedback: Remove prelude.
ximon18 Mar 28, 2024
13e8522
Add missing cfg guard.
ximon18 Mar 28, 2024
78f911c
Fix broken RustDoc links.
ximon18 Mar 28, 2024
9dbe6ea
Fix missing dependency on the tracing feature.
ximon18 Mar 28, 2024
3d11f06
cargo fmt.
ximon18 Mar 28, 2024
3104627
Added comments to and slightly cleaned up the server unit test.
ximon18 Mar 28, 2024
7acec4f
Added RustDoc concerning StreamServer handling of ServerCommand::Reco…
ximon18 Mar 28, 2024
0b993f5
Update RustDoc and handling of ServerCommand::Reconfigure, and make s…
ximon18 Mar 28, 2024
ae559db
cargo fmt.
ximon18 Mar 28, 2024
bd21a36
Review feedback: Remove `ServiceFeedback::Shutdown`.
ximon18 Mar 28, 2024
500aa3e
Review feedback: Refer to application logic, not business logic.
ximon18 Mar 28, 2024
b1defb4
Review feedback: Refer to application logic, not business logic.
ximon18 Mar 28, 2024
e93c61e
Remove unwraps.
ximon18 Mar 28, 2024
5a198e7
Replace TODO with better RustDoc.
ximon18 Mar 28, 2024
6449b41
Remove outdated TODO comment.
ximon18 Mar 28, 2024
5993c99
Resolve some TODO comments.
ximon18 Mar 28, 2024
034f939
Make a RustDoc warning more visible.
ximon18 Mar 28, 2024
c5ec998
Remove incorrect TODO comment.
ximon18 Mar 28, 2024
69b28db
Formatting.
ximon18 Mar 28, 2024
8ba8dda
Add missing cfg guard.
ximon18 Mar 28, 2024
ec31f9b
Add missing feature dependency.
ximon18 Mar 28, 2024
1e0220b
Comment out the mock-time feature and note why.
ximon18 Mar 28, 2024
fe079ac
Remove the unused Clock as it shows up in public documentation.
ximon18 Mar 28, 2024
f131fcc
Re-enable accidentally disabled EDNS .rpl server test.
ximon18 Mar 28, 2024
a8cd904
Review feedback: Document some private fields Also simplified the cod…
ximon18 Mar 28, 2024
ea9925a
Use the name `buf` to be consistent with existing code.
ximon18 Mar 28, 2024
4c6ae80
More private field documentation.
ximon18 Mar 28, 2024
6470502
More RustDocs.
ximon18 Mar 28, 2024
33a01e9
More RustDocs.
ximon18 Mar 28, 2024
0343ca7
More RustDocs.
ximon18 Mar 28, 2024
5779f78
More RustDocs.
ximon18 Mar 28, 2024
8d63500
Review feedback: Remove `MessageDetails`, remove the possibility to o…
ximon18 Mar 28, 2024
8dff4bd
- More RustDocs.
ximon18 Mar 28, 2024
a708981
Better RustDoc.
ximon18 Mar 28, 2024
bd8734f
Remove unwraps.
ximon18 Mar 28, 2024
970028a
Remove unwraps.
ximon18 Mar 28, 2024
8f9fc9a
Remove unwraps.
ximon18 Mar 28, 2024
4a9f459
Remove unwraps.
ximon18 Mar 28, 2024
d5c6cae
Remove unwraps.
ximon18 Mar 28, 2024
bfa69ad
Remove unwraps.
ximon18 Mar 28, 2024
8d9cc7b
Review feedback: application logic rather than business logic.
ximon18 Mar 28, 2024
c444aa8
Remove outdated text.
ximon18 Mar 28, 2024
5d6f03e
Merge branch 'serve-poc' into zonetree
ximon18 Mar 30, 2024
7da41c7
cargo fmt.
ximon18 Mar 30, 2024
e3129ef
Fix broken RustDoc links.
ximon18 Mar 30, 2024
0cf159c
More RustDocs.
ximon18 Mar 30, 2024
cae47b9
More RustDocs.
ximon18 Mar 30, 2024
f1ffdb6
Typo correction: “illegale” -> “illegal”
ximon18 Mar 30, 2024
a6c71e8
Diagnosing Windows failure.
ximon18 Mar 30, 2024
c76005a
Testing.
ximon18 Mar 30, 2024
e668615
Remove diagnostics.
ximon18 Mar 31, 2024
31f5d0f
FIX: Don't run doc tests that bind to ports.
ximon18 Apr 2, 2024
b351012
FIX: Add missing dgram server metric increments.
ximon18 Apr 2, 2024
2bf8bf2
Merge branch 'serve-poc' into zonetree
ximon18 Apr 2, 2024
983f153
Relax and push down trait bound requirements.
ximon18 Apr 2, 2024
96ac823
Make parsing errors more helpful.
ximon18 Apr 2, 2024
2bbc67d
Add file missed from last commit.
ximon18 Apr 2, 2024
983e692
Add necessary trait bounds.
partim Apr 2, 2024
b414ab5
Also fix the test server.
partim Apr 2, 2024
cfd5425
FIX: Support multiple DgramServer instances using the same UdpSocket …
ximon18 Apr 3, 2024
c3cfbc0
FIX: Support multiple DgramServer instances using the same UdpSocket …
ximon18 Apr 3, 2024
f5b39af
Bump the Tokio dev dependency version to add support for the mpsc is_…
ximon18 Apr 3, 2024
84313cc
Review feedback: Change max response size logic, and add unit tests.
ximon18 Apr 3, 2024
d0782a9
Compilation fixes for Rust 1.67.
ximon18 Apr 3, 2024
18c3640
Review feedback: Change max response size logic, and add unit tests.
ximon18 Apr 3, 2024
6977d88
Compilation fixes for Rust 1.67.
ximon18 Apr 3, 2024
8278088
Merge branch 'serve-poc' into zonetree
ximon18 Apr 3, 2024
42c7294
Review feedback: Don't access metric atomics directly, use inc/dec/se…
ximon18 Apr 3, 2024
b3a1318
Review feedback: Rename "modern" to "standard".
ximon18 Apr 3, 2024
97ff657
Review feedback: Delete TODO.
ximon18 Apr 3, 2024
36fae3f
Review feedback: Remove EdnsMiddlewareProcessor configurable max vers…
ximon18 Apr 3, 2024
8881ed0
Merge branch 'main' into serve-poc
ximon18 Apr 4, 2024
19a2c16
Remove unused import.
ximon18 Apr 4, 2024
357310a
Constant no longer needs to be public.
ximon18 Apr 4, 2024
67ddcd9
Silence Clippy as it is intentional.
ximon18 Apr 4, 2024
68b91cd
Remove unnecessary Request from CallResult.
ximon18 Apr 4, 2024
ccc5187
Simplify connection count checking by reporting zero connections for …
ximon18 Apr 4, 2024
ea77f3a
Review feedback: Allow caller to specify that StreamServer should app…
ximon18 Apr 4, 2024
5fa19ef
Remove unused import.
ximon18 Apr 4, 2024
b47e169
Review feedback: Remove cookies from the default middleware.
ximon18 Apr 4, 2024
1a93ba6
Panic if a test requires cookies but the necessary siphasher feature …
ximon18 Apr 4, 2024
e666271
Ensure we only create or modify one OPT record, not more. Also docume…
ximon18 Apr 4, 2024
dca1aeb
Review feedback: Make it clear that pre-processing may at present ins…
ximon18 Apr 4, 2024
57135fa
RustDoc fixes.
ximon18 Apr 4, 2024
f730997
Remove the ip_allow_list functionality of the cookie middleware as it…
ximon18 Apr 4, 2024
6571cbd
Review feedback: remove TODO statement.
ximon18 Apr 4, 2024
1bcad50
Remove EDNS comments from the mandatory middleware processor as they …
ximon18 Apr 4, 2024
abdf4f3
Remove EDNS code in the mandatory middleware processor that is alread…
ximon18 Apr 4, 2024
b9a5b06
Review feedback: Implement response OPT stripping if the request lack…
ximon18 Apr 4, 2024
e846a90
Review feedback: Remove fn that has no purpose at present.
ximon18 Apr 5, 2024
a369676
Review feedback: RustDoc fn links should be without parentheses. This…
ximon18 Apr 5, 2024
89d16b3
Review feedback: The first RustDoc line should not exceed the project…
ximon18 Apr 5, 2024
f656aca
Merge branch 'main' into serve-poc
ximon18 Apr 5, 2024
bdbe76a
Merge branch 'serve-poc' into zonetree
ximon18 Apr 5, 2024
61e88d0
RustDoc fixes.
ximon18 Apr 5, 2024
929d07b
cargo fmt.
ximon18 Apr 5, 2024
9456ea4
Review feedback: Remove ServiceFeedback::CloseConnection, as there is…
ximon18 Apr 5, 2024
83c6a7c
Review feedback: truncation should be robust if a large OPT record ca…
ximon18 Apr 5, 2024
9f07892
Review feedback: Hidden types need to be available to `ReadableZone` …
ximon18 Apr 6, 2024
d15af98
Minor comment improvements.
ximon18 Apr 6, 2024
e2e598a
FIX: The mock server channel dgram "readable()" check should work for…
ximon18 Apr 8, 2024
b477928
Review feedback: Use derive.
ximon18 Apr 8, 2024
c153697
Respond to ANY with the first RRSET found at the QNAME.
ximon18 Apr 8, 2024
c64e783
Merge branch 'serve-poc' into zonetree
ximon18 Apr 8, 2024
a632aa4
Minimally add missing RustDocs.
ximon18 Apr 8, 2024
b29cb04
Clippy.
ximon18 Apr 8, 2024
5c681e0
Minor RustDoc tweaks and fixes. Also adds a note about the AA flag NO…
ximon18 Apr 8, 2024
2224284
AXFR should not be done over UDP.
ximon18 Apr 8, 2024
5cd0ea3
cargo fmt.
ximon18 Apr 8, 2024
fd65794
Typo correction in comment.
ximon18 Apr 11, 2024
e3eeb68
Correct a typo and slightly improveme the comment on `NodeChildren::w…
ximon18 Apr 11, 2024
d3471d4
Merge branch 'main' into zonetree
ximon18 Apr 11, 2024
4b0f441
Fix up mysql-zone example which hasn't been compiled for a while.
ximon18 Apr 11, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 62 additions & 18 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,31 @@ pin-project-lite = "0.2"
time = { version = "0.3.1", default-features = false }

rand = { version = "0.8", optional = true }
arc-swap = { version = "1.7.0", optional = true }
bytes = { version = "1.0", optional = true, default-features = false }
chrono = { version = "0.4.6", optional = true, default-features = false }
chrono = { version = "0.4.35", optional = true, default-features = false } # 0.4.35 deprecates Duration::seconds()
futures = { version = "0.3.22", optional = true } # Force futures to at least 0.3.22 for minimal-version build
futures-util = { version = "0.3", optional = true }
heapless = { version = "0.8", optional = true }
hex = { version = "0.4", optional = true }
libc = { version = "0.2.153", default-features = false, optional = true } # 0.2.79 is the first version that has IP_PMTUDISC_OMIT
parking_lot = { version = "0.11.2", optional = true }
moka = { version = "0.12.3", optional = true, features = ["future"] }
#openssl = { version = "0.10", optional = true }
proc-macro2 = { version = "1.0.69", optional = true } # Force proc-macro2 to at least 1.0.69 for minimal-version build
ring = { version = "0.17", optional = true }
serde = { version = "1.0.130", optional = true, features = ["derive"] }
siphasher = { version = "1", optional = true }
smallvec = { version = "1.3", optional = true }
tokio = { version = "1.33", optional = true, features = ["io-util", "macros", "net", "time", "sync", "rt-multi-thread" ] }
tokio-rustls = { version = "0.24", optional = true, features = [] }
tracing = { version = "0.1.40", optional = true }

# XXX Force proc-macro2 to at least 1.0.69 for minimal-version build
proc-macro2 = "1.0.69"
# For testing in integration tests:
mock_instant = { version = "0.3.2", optional = true, features = ["sync"] }

[target.'cfg(macos)'.dependencies]
# specifying this overrides minimum-version mio's 0.2.69 libc dependency, which allows the build to work
libc = { version = "0.2.71", default-features = false, optional = true }
libc = { version = "0.2.153", default-features = false, optional = true }

[features]
default = ["std", "rand"]
Expand All @@ -59,26 +65,37 @@ zonefile = ["bytes", "std"]

# Unstable features
unstable-client-transport = [ "moka" ]
unstable-server-transport = ["arc-swap", "chrono/clock", "hex", "libc", "tracing"]
unstable-zonetree = ["futures", "parking_lot", "serde", "tokio", "tracing"]

# Test features
mock-time = ["mock_instant"]

[dev-dependencies]
rstest = "0.18.2"
rustls = { version = "0.21.9" }
serde_test = "1.0.130"
serde_json = "1.0.113"
serde_yaml = "0.9"
tokio = { version = "1", features = ["rt-multi-thread", "io-util", "net"] }
tokio-test = "0.4"
tracing = "0.1.40"
webpki-roots = { version = "0.25" }
rstest = "0.18.2"
rustls = { version = "0.21.9" }
serde_test = "1.0.130"
serde_json = "1.0.113"
serde_yaml = "0.9"
tokio = { version = "1", features = ["rt-multi-thread", "io-util", "net", "test-util"] }
tokio-test = "0.4"
webpki-roots = { version = "0.25" }

rustls-pemfile = { version = "1.0" }
socket2 = { version = "0.5.5" }
tokio-tfo = { version = "0.2.0" }

# For tracing support in integration tests:
lazy_static = { version = "1.4.0" } # Force lazy_static to > 1.0.0 for https://github.com/rust-lang-nursery/lazy-static.rs/pull/107
tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }

# For the "mysql-zone" example
#sqlx = { version = "0.6", features = [ "runtime-tokio-native-tls", "mysql" ] }

[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]

[[example]]
name = "readzone"
required-features = ["zonefile"]

[[example]]
name = "download-rust-lang"
required-features = ["resolv"]
Expand All @@ -98,3 +115,30 @@ required-features = ["std", "rand"]
[[example]]
name = "client-transports"
required-features = ["net", "unstable-client-transport"]

[[example]]
name = "server-transports"
required-features = ["net", "unstable-server-transport"]

[[example]]
name = "read-zone"
required-features = ["zonefile"]

[[example]]
name = "query-zone"
required-features = ["zonefile", "unstable-zonetree"]

[[example]]
name = "serve-zone"
required-features = ["zonefile", "net", "unstable-server-transport", "unstable-zonetree"]

# This example is commented out because it is difficult, if not impossible,
# when including the sqlx dependency, to make the dependency tree compatible
# with both `cargo +nightly update -Z minimal versions` and the crate minimum
# supported Rust version (1.67 at the time of writing), both of which are
# tested by our CI setup. To try this example, uncomment the lines below and
# the sqlx dependency above, then run `cargo run --example mysql-zone`.
#[[example]]
#name = "mysql-zone"
#path = "examples/other/mysql-zone.rs"
#required-features = ["zonefile", "net", "unstable-server-transport", "unstable-zonetree"]
19 changes: 9 additions & 10 deletions examples/client-transports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ async fn main() {
// Get the reply
println!("Wating for UDP+TCP reply");
let reply = request.get_response().await;
println!("UDP+TCP reply: {:?}", reply);
println!("UDP+TCP reply: {reply:?}");

// The query may have a reference to the connection. Drop the query
// when it is no longer needed.
Expand All @@ -94,15 +94,15 @@ async fn main() {
// Get the reply
println!("Wating for cache reply");
let reply = request.get_response().await;
println!("Cache reply: {:?}", reply);
println!("Cache reply: {reply:?}");

// Send the request message again.
let mut request = cache.send_request(req.clone());

// Get the reply
println!("Wating for cached reply");
let reply = request.get_response().await;
println!("Cached reply: {:?}", reply);
println!("Cached reply: {reply:?}");

// Create a new TCP connections object. Pass the destination address and
// port as parameter.
Expand Down Expand Up @@ -130,7 +130,7 @@ async fn main() {
println!("Wating for multi TCP reply");
let reply =
timeout(Duration::from_millis(500), request.get_response()).await;
println!("multi TCP reply: {:?}", reply);
println!("multi TCP reply: {reply:?}");

drop(request);

Expand Down Expand Up @@ -181,7 +181,7 @@ async fn main() {
println!("Wating for TLS reply");
let reply =
timeout(Duration::from_millis(500), request.get_response()).await;
println!("TLS reply: {:?}", reply);
println!("TLS reply: {reply:?}");

drop(request);

Expand All @@ -205,7 +205,7 @@ async fn main() {
let mut request = redun.send_request(req.clone());
let reply = request.get_response().await;
if i == 2 {
println!("redundant connection reply: {:?}", reply);
println!("redundant connection reply: {reply:?}");
}
}

Expand All @@ -224,16 +224,15 @@ async fn main() {
//
// Get the reply
let reply = request.get_response().await;
println!("Dgram reply: {:?}", reply);
println!("Dgram reply: {reply:?}");

// Create a single TCP transport connection. This is usefull for a
// single request or a small burst of requests.
let tcp_conn = match TcpStream::connect(server_addr).await {
Ok(conn) => conn,
Err(err) => {
println!(
"TCP Connection to {} failed: {}, exiting",
server_addr, err
"TCP Connection to {server_addr} failed: {err}, exiting",
);
return;
}
Expand All @@ -250,7 +249,7 @@ async fn main() {

// Get the reply
let reply = request.get_response().await;
println!("TCP reply: {:?}", reply);
println!("TCP reply: {reply:?}");

drop(tcp);
}
4 changes: 2 additions & 2 deletions examples/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ fn main() {
for option in response.opt().unwrap().opt().iter::<AllOptData<_, _>>() {
let opt = option.unwrap();
match opt {
AllOptData::Nsid(nsid) => println!("{}", nsid),
AllOptData::Nsid(nsid) => println!("{nsid}"),
AllOptData::ExtendedError(extendederror) => {
println!("{}", extendederror)
println!("{extendederror}")
}
_ => println!("NO OPT!"),
}
Expand Down
119 changes: 119 additions & 0 deletions examples/common/serve-utils.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
use bytes::Bytes;
use domain::base::{Dname, Message, MessageBuilder, ParsedDname, Rtype};
use domain::rdata::ZoneRecordData;
use domain::zonetree::Answer;

pub fn generate_wire_query(
qname: &Dname<Bytes>,
qtype: Rtype,
) -> Message<Vec<u8>> {
let query = MessageBuilder::new_vec();
let mut query = query.question();
query.push((qname, qtype)).unwrap();
query.into()
}

pub fn generate_wire_response(
wire_query: &Message<Vec<u8>>,
zone_answer: Answer,
) -> Message<Vec<u8>> {
let builder = MessageBuilder::new_vec();
let response = zone_answer.to_message(wire_query, builder);
response.into()
}

pub fn print_dig_style_response(
query: &Message<Vec<u8>>,
response: &Message<Vec<u8>>,
short: bool,
) {
if !short {
let qh = query.header();
let rh = response.header();
println!("; (1 server found)");
println!(";; global options:");
println!(";; Got answer:");
println!(
";; ->>HEADER<<- opcode: {}, status: {}, id: {}",
qh.opcode(),
rh.rcode(),
rh.id()
);
print!(";; flags: ");
if rh.aa() {
print!("aa ");
}
if rh.ad() {
print!("ad ");
}
if rh.cd() {
print!("cd ");
}
if rh.qr() {
print!("qr ");
}
if rh.ra() {
print!("ra ");
}
if rh.rd() {
print!("rd ");
}
if rh.tc() {
print!("tc ");
}
let counts = response.header_counts();
println!(
"; QUERY: {}, ANSWER: {}, AUTHORITY: {}, ADDITIONAL: {}",
counts.qdcount(),
counts.ancount(),
counts.arcount(),
counts.adcount()
);

// TODO: add OPT PSEUDOSECTION

if let Ok(question) = query.sole_question() {
println!(";; QUESTION SECTION:");
println!(
";{} {} {}",
question.qname(),
question.qclass(),
question.qtype()
);
println!();
}
}

let sections = [
("ANSWER", response.answer()),
("AUTHORITY", response.authority()),
("ADDITIONAL", response.additional()),
];
for (name, section) in sections {
if let Ok(section) = section {
if section.count() > 0 {
if !short {
println!(";; {name} SECTION:");
}

for record in section {
let record = record
.unwrap()
.into_record::<ZoneRecordData<_, ParsedDname<_>>>()
.unwrap()
.unwrap();

if short {
println!("{}", record.data());
} else {
println!("{record}");
}
}

if !short {
println!();
}
}
}
}
}
8 changes: 4 additions & 4 deletions examples/download-rust-lang.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ async fn main() {
{
Ok(addr) => addr,
Err(err) => {
eprintln!("DNS query failed: {}", err);
eprintln!("DNS query failed: {err}");
return;
}
};
Expand All @@ -30,7 +30,7 @@ async fn main() {
let mut socket = match TcpStream::connect(&addr).await {
Ok(socket) => socket,
Err(err) => {
eprintln!("Failed to connect to {}: {}", addr, err);
eprintln!("Failed to connect to {addr}: {err}");
return;
}
};
Expand All @@ -45,12 +45,12 @@ async fn main() {
)
.await
{
eprintln!("Failed to send request: {}", err);
eprintln!("Failed to send request: {err}");
return;
};
let mut response = Vec::new();
if let Err(err) = socket.read_to_end(&mut response).await {
eprintln!("Failed to read response: {}", err);
eprintln!("Failed to read response: {err}");
return;
}

Expand Down
Loading
Loading