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

Usability tweaks #397

Merged
merged 478 commits into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
478 commits
Select commit Hold shift + click to select a range
bf9588e
Merge branch 'xfr-zone-updating' into add-rfc1996-notify-support
ximon18 Sep 11, 2024
6298934
Merge branch 'add-rfc1996-notify-support' into rr-batching
ximon18 Sep 11, 2024
8abad93
Merge branch 'rr-batching' into xfr-middleware
ximon18 Sep 11, 2024
67bb521
Add TSIG client tests.
ximon18 Sep 11, 2024
aea337d
Merge branch 'tsig-client' into tsig-middleware
ximon18 Sep 11, 2024
1bab568
Merge branch 'tsig-middleware' into xfr-response-processing
ximon18 Sep 11, 2024
008574b
Add docs for validator_test.
Philip-NLnetLabs Sep 11, 2024
22d8c62
Resolve cargo doc issues.
ximon18 Sep 11, 2024
bc7baca
Merge branch 'tsig-client' into tsig-middleware
ximon18 Sep 11, 2024
85a2455
Merge branch 'main' into tsig-middleware
ximon18 Sep 11, 2024
35937a9
Fix test compilation failure after merging with main including revers…
ximon18 Sep 11, 2024
346e8cf
Merge branch 'tsig-middleware' into xfr-response-processing
ximon18 Sep 11, 2024
afd371f
Merge branch 'xfr-response-processing' into xfr-zone-updating
ximon18 Sep 11, 2024
8b5d17d
Merge branch 'tsig-middleware' into add-rfc1996-notify-support.
ximon18 Sep 11, 2024
68cb197
Merge branch 'add-rfc1996-notify-support' into rr-batching
ximon18 Sep 11, 2024
36d682d
Merge branch 'rr-batching' into xfr-middleware
ximon18 Sep 11, 2024
f782927
Revert changes not related to the PR.
ximon18 Sep 11, 2024
88665d9
Revert changes not related to the PR.
ximon18 Sep 11, 2024
c4a0afe
More RustDoc. Removed the unused MaybeAuthenticated trait.
ximon18 Sep 12, 2024
5174a48
- More RustDoc.
ximon18 Sep 12, 2024
226d311
Update references to removed Authentication type.
ximon18 Sep 12, 2024
bf977f7
Fix broken RustDoc references.
ximon18 Sep 12, 2024
a0b100a
Merge branch 'tsig-middleware' into xfr-response-processing
ximon18 Sep 12, 2024
e2338c9
Merge branch 'xfr-response-processing' into xfr-zone-updating
ximon18 Sep 12, 2024
00f833f
Merge branch 'xfr-zone-updating' into add-rfc1996-notify-support
ximon18 Sep 12, 2024
c1dbb33
Merge branch 'add-rfc1996-notify-support' into rr-batching
ximon18 Sep 12, 2024
5b5f2e2
Merge branch 'rr-batching' into xfr-middleware
ximon18 Sep 12, 2024
92821c7
Update uses of no longer existing Authentication type.
ximon18 Sep 12, 2024
1783c82
Use the existing error response building functionality rather than ig…
ximon18 Sep 12, 2024
f29b8d4
Document known limitation.
ximon18 Sep 12, 2024
41cebe0
- Handle TSIG response truncation using the existing ServerSequence i…
ximon18 Sep 12, 2024
778b93e
Merge branch 'tsig-middleware' into xfr-response-processing
ximon18 Sep 12, 2024
8c254b8
Merge branch 'xfr-response-processing' into xfr-zone-updating
ximon18 Sep 12, 2024
a2c6012
Merge branch 'xfr-zone-updating' into add-rfc1996-notify-support
ximon18 Sep 12, 2024
efbae79
Merge branch 'add-rfc1996-notify-support' into rr-batching
ximon18 Sep 12, 2024
b4f4a17
Merge branch 'rr-batching' into xfr-middleware
ximon18 Sep 12, 2024
9251700
Revert changes to network servers, will move them to a separate PR.
ximon18 Sep 13, 2024
9fbcf22
Make the reference to the other tsig module less confusing.
ximon18 Sep 15, 2024
cef732f
More RustDoc for the TSIG middleware service.
ximon18 Sep 15, 2024
5679724
Merge branch 'main' into tsig-middleware
ximon18 Sep 15, 2024
0b41774
Fix compilation errors caused by merging with main.
ximon18 Sep 15, 2024
82ae2c8
Merge branch 'tsig-middleware' into xfr-response-processing
ximon18 Sep 15, 2024
73d7d7d
Remove opcode/query type TSIG verification restrictions.
ximon18 Sep 16, 2024
a0c6281
Leave xfr response processing out of client-transporrts.rs, keep it f…
ximon18 Sep 16, 2024
b1c75bc
Minor RustDoc language improvement.
ximon18 Sep 16, 2024
f484929
Rename XfrResponseProcessor to XfrResponseInterpreter, as it doesn't …
ximon18 Sep 16, 2024
306dae6
More renaming.
ximon18 Sep 16, 2024
d009a56
Cargo fmt.
ximon18 Sep 16, 2024
deeaf7d
Merge branch 'tsig-middleware' into xfr-response-processing
ximon18 Sep 16, 2024
ad5281f
Merge branch 'xfr-response-processing' into xfr-zone-updating
ximon18 Sep 16, 2024
ef959e1
Compilation fixes due to changes in upstream code.
ximon18 Sep 16, 2024
be4ec06
Merge branch 'xfr-zone-updating' into add-rfc1996-notify-support
ximon18 Sep 16, 2024
e218912
Compilation fixes due to changes in upstream code.
ximon18 Sep 16, 2024
d3f46b5
Merge branch 'add-rfc1996-notify-support' into rr-batching
ximon18 Sep 16, 2024
f933441
Merge branch 'rr-batching' into xfr-middleware
ximon18 Sep 16, 2024
bf7b77f
Use the existing TSIG error building code, don't hand create it ourse…
ximon18 Sep 16, 2024
a3af7e5
Update src/net/server/middleware/tsig.rs
ximon18 Sep 16, 2024
8509a68
Update src/net/server/middleware/tsig.rs
ximon18 Sep 16, 2024
df0499a
Update src/net/server/middleware/tsig.rs
ximon18 Sep 16, 2024
d9c04b4
Comment correction.
ximon18 Sep 16, 2024
749721e
Rename PostprocessingConfig to PostprocessingState to better reflect …
ximon18 Sep 16, 2024
d88fd56
Merge branch 'tsig-middleware' into xfr-response-processing
ximon18 Sep 16, 2024
862993a
Merge branch 'xfr-response-processing' into xfr-zone-updating
ximon18 Sep 16, 2024
c1a9097
Merge branch 'main' into xfr-response-processing
ximon18 Sep 16, 2024
fb3ed86
Generalize the notion of zone updates, it need not be specific to XFR…
ximon18 Sep 17, 2024
26fa1f8
Merge branch 'xfr-response-processing' into xfr-zone-updating
ximon18 Sep 17, 2024
0b8e4d7
Merge branch 'xfr-zone-updating' into add-rfc1996-notify-support
ximon18 Sep 17, 2024
593ee06
Merge branch 'add-rfc1996-notify-support' into rr-batching
ximon18 Sep 17, 2024
dcc7826
Merge branch 'rr-batching' into xfr-middleware
ximon18 Sep 17, 2024
4eae169
Review feedback: Add `is_finished()` method. Also variaous renames an…
ximon18 Sep 17, 2024
42da1ff
Merge branch 'xfr-response-processing' into xfr-zone-updating
ximon18 Sep 17, 2024
34e893b
Follow upstream changes, some cleanup, and more RustDoc.
ximon18 Sep 17, 2024
871ce9b
Remove unnecessary change to exsting public interface.
ximon18 Sep 17, 2024
e3f398b
Merge branch 'xfr-response-processing' into xfr-zone-updating
ximon18 Sep 17, 2024
4e19172
Merge branch 'xfr-zone-updating' into add-rfc1996-notify-support
ximon18 Sep 17, 2024
6f56721
Merge branch 'add-rfc1996-notify-support' into rr-batching
ximon18 Sep 17, 2024
a58213e
Merge branch 'rr-batching' into xfr-middleware
ximon18 Sep 17, 2024
f97713e
Merge branch 'main' into xfr-zone-updating
ximon18 Sep 17, 2024
f719bbf
Avoid lifetime issues.
ximon18 Sep 17, 2024
089dff2
Merge branch 'main' into xfr-zone-updating
ximon18 Sep 17, 2024
a048f55
RustDoc and typo correction.
ximon18 Sep 17, 2024
3f91553
Cargo fmt.
ximon18 Sep 17, 2024
4f67ecb
Rename `XfrRecord` to `ParsedRecord`, `evt` to `update` and add more …
ximon18 Sep 17, 2024
024a980
Cargo fmt.
ximon18 Sep 17, 2024
74b129f
More RustDoc.
ximon18 Sep 17, 2024
071c58f
More RustDoc.
ximon18 Sep 17, 2024
2d6b949
More RustDoc. Error handling tweaks. Some simplification.
ximon18 Sep 17, 2024
9f443df
More RustDocs.
ximon18 Sep 18, 2024
146d4c2
Don't assume that an initial ZoneUpdate::AddRecord(soa) when updating…
ximon18 Sep 18, 2024
c97d062
More RustDoc.
ximon18 Sep 18, 2024
1c096db
Compilation fix.
ximon18 Sep 18, 2024
3c68db4
Merge branch 'xfr-zone-updating' into add-rfc1996-notify-support
ximon18 Sep 18, 2024
b93d79a
Merge branch 'add-rfc1996-notify-support' into rr-batching
ximon18 Sep 18, 2024
42f7810
Merge branch 'rr-batching' into xfr-middleware
ximon18 Sep 18, 2024
ef41acf
Make ZoneDiff immutable and cheaply clonable by introducing ZoneDiffB…
ximon18 Sep 18, 2024
3d23544
Merge branch 'xfr-zone-updating' into add-rfc1996-notify-support
ximon18 Sep 18, 2024
38ed1ed
Merge branch 'add-rfc1996-notify-support' into rr-batching
ximon18 Sep 18, 2024
30af472
Merge branch 'rr-batching' into xfr-middleware
ximon18 Sep 18, 2024
f98ba5d
Compilation fixes for upstream changes.
ximon18 Sep 18, 2024
d060e07
Compilation fix.
ximon18 Sep 18, 2024
5871d4e
Merge branch 'xfr-zone-updating' into add-rfc1996-notify-support
ximon18 Sep 18, 2024
7cc239f
Merge branch 'add-rfc1996-notify-support' into rr-batching
ximon18 Sep 18, 2024
b0f8ce1
Merge branch 'rr-batching' into xfr-middleware
ximon18 Sep 18, 2024
2eb4507
Don't swallow any created diffs.
ximon18 Sep 18, 2024
3f798d5
Fix cargo doc broken link warnings.
ximon18 Sep 19, 2024
f55046b
Remove questionable Serial::prev() addition, we don't want some mathe…
ximon18 Sep 19, 2024
75fef4e
Cargo fmt.
ximon18 Sep 19, 2024
54892b0
Move dependency requirement to correct feature gate.
ximon18 Sep 19, 2024
6dde951
Remove added fn as_any(), this PR doesn't use it.
ximon18 Sep 19, 2024
d003eb4
More accurate name.
ximon18 Sep 19, 2024
8d52037
Improved comment.
ximon18 Sep 19, 2024
aaedea4
Remove unused function.
ximon18 Sep 19, 2024
e836a1a
This isn't the right place for this change.
ximon18 Sep 19, 2024
0ac6a2a
Hmm, maybe it should be here, but with slightly different behaviour.
ximon18 Sep 19, 2024
2ee5a1a
Avoid cluttering the version vec with uneccessary entries.
ximon18 Sep 19, 2024
570942b
Move and tweak some RustDocs.
ximon18 Sep 19, 2024
9518221
More RustDocs.
ximon18 Sep 19, 2024
81852ac
More RustDocs.
ximon18 Sep 19, 2024
cd032dd
Improved a comment.
ximon18 Sep 19, 2024
cabde23
Keep it simple.
ximon18 Sep 19, 2024
d2ae807
Re-use code instead of duplicating it.
ximon18 Sep 19, 2024
02b8c86
Cleanup.
ximon18 Sep 19, 2024
e4239b8
Remove unnecessary clone.
ximon18 Sep 19, 2024
c0cea17
Use an own error type.
ximon18 Sep 19, 2024
714b293
More use of an own error type.
ximon18 Sep 19, 2024
8ed8bf4
Cleanup and more RustDoc.
ximon18 Sep 19, 2024
9d0bc80
More RustDocs and cleanup.
ximon18 Sep 19, 2024
8565753
Remove an outdated comment.
ximon18 Sep 19, 2024
d615b40
More RustDocs.
ximon18 Sep 19, 2024
60b6a47
More RustDocs.
ximon18 Sep 19, 2024
d718eaf
Organize imports.
ximon18 Sep 19, 2024
acfea32
More RustDocs.
ximon18 Sep 19, 2024
303e526
More RustDocs.
ximon18 Sep 19, 2024
2de2cdc
More cleanup and RustDocs.
ximon18 Sep 19, 2024
1d7ea63
Remove added code that is not used by this branch.
ximon18 Sep 20, 2024
1ecc80d
Remove added code that is not used by this branch.
ximon18 Sep 20, 2024
f55362b
More RustDocs. Remove the unused dirty flag.
ximon18 Sep 20, 2024
c43fe0c
Cargo fmt.
ximon18 Sep 20, 2024
0f81e33
Remove commented out code.
ximon18 Sep 20, 2024
b8453b8
Merge branch 'xfr-zone-updating' into add-rfc1996-notify-support
ximon18 Sep 20, 2024
868a5e4
Merge branch 'add-rfc1996-notify-support' into rr-batching
ximon18 Sep 20, 2024
b432dc9
Merge branch 'rr-batching' into xfr-middleware
ximon18 Sep 20, 2024
4aa68f6
FIX: Don't always rollback changes. Instead add the dirty flag back i…
ximon18 Sep 20, 2024
be95515
FIX: Store diffs even if the SOA serial was not bumped on commit.
ximon18 Sep 20, 2024
25f0e1e
Extend unit tet to verify created zone content is as expected. Catche…
ximon18 Sep 20, 2024
c546c2a
Don't leave behind an empty RRset node for a version if the update re…
ximon18 Sep 23, 2024
2e9abac
Don't skip deleted node versions when get()'ing the best match for a …
ximon18 Sep 23, 2024
a94f098
Only mark the zone as dirty if WriteNode creation actually succeeded.
ximon18 Sep 23, 2024
81afa23
Determine ZoneDiff start and end serial from the given RRsets, so the…
ximon18 Sep 23, 2024
6335e95
Determine ZoneDiff start and end serial from the given RRsets, so the…
ximon18 Sep 23, 2024
8f74fc9
Only add the removed and added RRs to a diff, not the entire correspo…
ximon18 Sep 23, 2024
ee5ea62
Cargo fmt.
ximon18 Sep 23, 2024
5428bd5
Various fixes and improvements:
ximon18 Sep 23, 2024
94d218e
Merge branch 'saved-commits' into saved-commits-more
ximon18 Sep 23, 2024
899dbbb
More RustDocs.
ximon18 Sep 23, 2024
4bf2a58
Fix broken RustDoc link.
ximon18 Sep 23, 2024
1d8c40a
More RustDoc and remove an unnecessary helper function.
ximon18 Sep 23, 2024
d26ede9
Cargo fmt.
ximon18 Sep 23, 2024
c414360
Added RustDocs.
ximon18 Sep 23, 2024
dce66a1
More RustDocs.
ximon18 Sep 23, 2024
807d9f4
More RustDocs.
ximon18 Sep 23, 2024
cbbf2e0
Merge branch 'xfr-zone-updating' into add-rfc1996-notify-support
ximon18 Sep 23, 2024
2dfd37c
Merge branch 'add-rfc1996-notify-support' into rr-batching
ximon18 Sep 23, 2024
d49b446
Merge branch 'rr-batching' into xfr-middleware
ximon18 Sep 23, 2024
447632b
Compilation fixes due to upstream changes.
ximon18 Sep 23, 2024
81dbbff
Backport improvements from the `xfr` branch.
ximon18 Sep 23, 2024
c4544bf
Merge branch 'xfr-zone-updating' into add-rfc1996-notify-support
ximon18 Sep 23, 2024
0b75e3a
Merge branch 'add-rfc1996-notify-support' into rr-batching
ximon18 Sep 23, 2024
8893143
Merge branch 'rr-batching' into xfr-middleware
ximon18 Sep 23, 2024
fd5e299
Merge branch 'main' into add-rfc1996-notify-support
ximon18 Sep 23, 2024
ecc1d41
Merge branch 'add-rfc1996-notify-support' into rr-batching
ximon18 Sep 23, 2024
35635f4
Merge branch 'rr-batching' into xfr-middleware
ximon18 Sep 23, 2024
296ed37
Note SOA QTYPE support only.
ximon18 Sep 23, 2024
d533b89
Cargo fmt.
ximon18 Sep 24, 2024
234da59
Merge branch 'add-rfc1996-notify-support' into rr-batching
ximon18 Sep 24, 2024
96d5f10
Merge branch 'rr-batching' into xfr-middleware
ximon18 Sep 24, 2024
feb646d
RustDocs and get rid of unnecessary function.
ximon18 Sep 24, 2024
f84c033
Cargo fmt and RustDoc tweaks.
ximon18 Sep 24, 2024
0594753
Don't use magic values.
ximon18 Sep 24, 2024
0f2b68c
More RustDoc and comment tweaks.
ximon18 Sep 24, 2024
cf9c754
Document how to require TSIG signed XFX requests.
ximon18 Sep 24, 2024
73ecabd
RustDoc correction.
ximon18 Sep 24, 2024
5ee9e07
Improved RustDoc.
ximon18 Sep 24, 2024
2e5ea83
Cargo fmt.
ximon18 Sep 24, 2024
dd4da4f
Don't require the diffs supplied to XfrMiddlewareSvc to be in-memory …
ximon18 Sep 24, 2024
d3a08a5
Make ZoneDiff responses async, in case e.g. diffs are fetched from di…
ximon18 Sep 24, 2024
d43aa26
More RustDocs.
ximon18 Sep 24, 2024
b325479
Return an error and use ?. Remove unnecessary helper functions.
ximon18 Sep 24, 2024
08e969e
Review feedback: remove unnecessary leading underscores in trait fn v…
ximon18 Sep 25, 2024
3ecfce3
Merge branch 'rr-batching' into xfr-middleware
ximon18 Sep 25, 2024
14c960d
- More unwrap/error handling.
ximon18 Sep 25, 2024
1a90d6f
Update changelog.
ximon18 Sep 23, 2024
c923bb4
Add RFC 1996 NOTIFY support. (#382)
ximon18 Sep 24, 2024
e383cc5
Update changelog.
ximon18 Sep 25, 2024
ca13612
Merge branch 'main' into rr-batching
ximon18 Sep 25, 2024
226a21d
Merge branch 'rr-batching' into xfr-middleware
ximon18 Sep 25, 2024
28f068b
Merge branch 'main' into xfr-middleware
ximon18 Sep 25, 2024
b27304d
Merge branch 'main' into xfr-middleware
ximon18 Sep 25, 2024
e70f8ea
Compilation fix for Rust 1.76.0.
ximon18 Sep 25, 2024
ab6a634
Fix compilation bug with Rust 1.68.2 caused by an unnecessary HRTB (f…
ximon18 Sep 25, 2024
875e2d6
Fix RustDoc test compilation error.
ximon18 Sep 25, 2024
569d65d
Improve the last fix.
ximon18 Sep 25, 2024
4407c84
Code simplification with additional From impls.
ximon18 Sep 26, 2024
69ea093
- Fix temporarily removed support for RFC 5936 backward compatible mode.
ximon18 Sep 26, 2024
ceb66f8
Normalize how AXFR and IXFR sending are implemented.
ximon18 Sep 26, 2024
609ed59
Split the large xfr module into separate sub-modules.
ximon18 Sep 26, 2024
84950e2
Remove unrelated change.
ximon18 Sep 26, 2024
b817338
Minor comment change.
ximon18 Sep 26, 2024
863636c
RustDoc fixes.
ximon18 Sep 26, 2024
d4423ec
Add some RustDocs about combining domain features to act as primary o…
ximon18 Sep 26, 2024
d54782a
Simplify test key store Arc wrapper.
ximon18 Sep 26, 2024
2912ec3
Organize imports.
ximon18 Sep 26, 2024
e2f921e
Clippy.
ximon18 Sep 26, 2024
185d99c
Extend the serve-zone example with minimal AXFR out with support for …
ximon18 Sep 26, 2024
a1a9213
Clippy.
ximon18 Sep 26, 2024
a26221e
IXFR fix: removes before adds.
ximon18 Sep 26, 2024
dceb299
Fix bump SOA serial if not bumped to actually properly detect not bum…
ximon18 Sep 26, 2024
ab6bba1
Extend serve-zone example to demonstrate AXFR. TSIG and NOTIFY.
ximon18 Sep 26, 2024
dd18900
Add an ixfr-client example.
ximon18 Sep 26, 2024
2225031
Clippy.
ximon18 Sep 26, 2024
c30bf68
Added some comments.
ximon18 Sep 26, 2024
c66895d
Cargo fmt.
ximon18 Sep 26, 2024
b89f081
Organize imports.
ximon18 Sep 26, 2024
7c2e2fe
Remove some temporary diagnostic logging.
ximon18 Sep 26, 2024
7043421
Remove some temporary diagnostic logging.
ximon18 Sep 26, 2024
d396301
More XFR RustDoc.
ximon18 Sep 26, 2024
ee1b0f4
Document some known limitations.
ximon18 Sep 27, 2024
030c68e
Fix RustDoc broken links and clarify limitation note.
ximon18 Sep 27, 2024
72b5d76
Fix line wrapping.
ximon18 Sep 27, 2024
181b533
Document the `create_diff` argument to `WritableZone::open()`.
ximon18 Sep 27, 2024
351b227
Fix RustDoc broken links.
ximon18 Sep 27, 2024
9d3cbcf
Add some small Zone extensions from the xfr branch.
ximon18 Sep 29, 2024
a112b1e
Expose ZoneKey.
ximon18 Sep 29, 2024
317acd0
Add as_any().
ximon18 Sep 29, 2024
74c69b1
impl Arc for KeyStore.
ximon18 Sep 29, 2024
4d38999
Impl SendRequest for Boxed types.
ximon18 Oct 1, 2024
bb254bf
Remove unused import.
ximon18 Oct 1, 2024
51facf6
Allow a Zone to be exchanged for its underlying ZoneStore type.
ximon18 Oct 1, 2024
d4d7dbf
Impl Display for tsig::Key.
ximon18 Oct 1, 2024
def789a
Impl AsRef to get a reference to the underlying ZoneStore type.
ximon18 Oct 1, 2024
67d7200
Impl Display for update::Error.
ximon18 Oct 1, 2024
e2f85a0
Document `ZoneStore::as_any()` and the purpose behind it.
ximon18 Oct 1, 2024
36bd95b
Cargo fmt.
ximon18 Oct 1, 2024
508afa3
Review feedback: Use a less confusing and more accurate name: ZoneTup…
ximon18 Oct 2, 2024
7de9492
Review feedback: Use `fmt() `directly.
ximon18 Oct 2, 2024
3a8ff03
Review feedback: Use write!.
ximon18 Oct 2, 2024
6fe1493
Merge branch 'main' into zone-tweaks
ximon18 Oct 3, 2024
adf9476
Merge branch 'main' into zone-tweaks
ximon18 Oct 3, 2024
7366719
Remove ZoneTuple and Zone::key(). They are confusing and hard to name…
ximon18 Oct 3, 2024
fa2eeff
Compilation fix.
ximon18 Oct 3, 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
22 changes: 22 additions & 0 deletions src/net/client/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,17 @@ pub trait SendRequest<CR> {
) -> Box<dyn GetResponse + Send + Sync>;
}

impl<T: SendRequest<RequestMessage<Octs>> + ?Sized, Octs: Octets>
SendRequest<RequestMessage<Octs>> for Box<T>
{
fn send_request(
&self,
request_msg: RequestMessage<Octs>,
) -> Box<dyn GetResponse + Send + Sync> {
(**self).send_request(request_msg)
}
}

//------------ SendRequestMulti -----------------------------------------------

/// Trait for starting a DNS request based on a request composer.
Expand All @@ -133,6 +144,17 @@ pub trait SendRequestMulti<CR> {
) -> Box<dyn GetResponseMulti + Send + Sync>;
}

impl<T: SendRequestMulti<RequestMessage<Octs>> + ?Sized, Octs: Octets>
SendRequestMulti<RequestMessage<Octs>> for Box<T>
{
fn send_request(
&self,
request_msg: RequestMessage<Octs>,
) -> Box<dyn GetResponseMulti + Send + Sync> {
(**self).send_request(request_msg)
}
}

//------------ GetResponse ---------------------------------------------------

/// Trait for getting the result of a DNS query.
Expand Down
42 changes: 36 additions & 6 deletions src/tsig/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,16 @@
#![cfg(feature = "tsig")]
#![cfg_attr(docsrs, doc(cfg(feature = "tsig")))]

use core::{cmp, fmt, mem, str};

#[cfg(feature = "std")]
use std::collections::HashMap;
use std::sync::Arc;

use bytes::{Bytes, BytesMut};
use octseq::octets::Octets;
use ring::{constant_time, hkdf::KeyType, hmac, rand};

use crate::base::header::HeaderSection;
use crate::base::iana::{Class, Rcode, TsigRcode};
use crate::base::message::Message;
Expand All @@ -64,12 +74,6 @@ use crate::base::name::{Label, Name, ParsedName, ToLabelIter, ToName};
use crate::base::record::Record;
use crate::base::wire::{Composer, ParseError};
use crate::rdata::tsig::{Time48, Tsig};
use bytes::{Bytes, BytesMut};
use core::{cmp, fmt, mem, str};
use octseq::octets::Octets;
use ring::{constant_time, hkdf::KeyType, hmac, rand};
#[cfg(feature = "std")]
use std::collections::HashMap;

//------------ KeyName -------------------------------------------------------

Expand Down Expand Up @@ -387,6 +391,15 @@ impl AsRef<Key> for Key {
}
}

//--- Display

#[cfg(feature = "std")]
impl fmt::Display for Key {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
self.name.fmt(f)
}
}

//------------ KeyStore ------------------------------------------------------

/// A type that stores TSIG secret keys.
Expand Down Expand Up @@ -458,6 +471,23 @@ where
}
}

#[cfg(feature = "std")]
impl KeyStore for Arc<HashMap<(KeyName, Algorithm), Key>> {
type Key = Key;

fn get_key<N: ToName>(
&self,
name: &N,
algorithm: Algorithm,
) -> Option<Self::Key> {
if let Ok(name) = name.try_to_name() {
self.get(&(name, algorithm)).cloned()
} else {
None
}
}
}

//------------ ClientTransaction ---------------------------------------------

/// TSIG Client transaction state.
Expand Down
6 changes: 6 additions & 0 deletions src/zonetree/in_memory/nodes.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
//! The resource record tree nodes of an in-memory zone.

use core::any::Any;

use std::boxed::Box;
use std::collections::{hash_map, HashMap};
use std::future::Future;
Expand Down Expand Up @@ -145,6 +147,10 @@ impl ZoneStore for ZoneApex {
as Box<dyn WritableZone>
})
}

fn as_any(&self) -> &dyn Any {
self as &dyn Any
}
}

//--- impl From<&'a ZoneApex>
Expand Down
7 changes: 7 additions & 0 deletions src/zonetree/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ pub trait ZoneStore: Debug + Sync + Send + Any {
+ 'static),
>,
>;

/// Returns an [`Any`] interface to the store.
///
/// This can be used to obtain access to methods on the specific
/// [`ZoneStore`] implementation. See [`Zone`] for how this can used to
/// layer functionality on top of a zone.
fn as_any(&self) -> &dyn Any;
}

//------------ ReadableZone --------------------------------------------------
Expand Down
6 changes: 3 additions & 3 deletions src/zonetree/tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use super::zone::Zone;
/// A multi-rooted [`Zone`] hierarchy.
///
/// [`Zone`]: crate::zonetree::Zone
#[derive(Default)]
#[derive(Clone, Default, Debug)]
pub struct ZoneTree {
roots: Roots,
}
Expand Down Expand Up @@ -82,7 +82,7 @@ impl ZoneTree {

//------------ Roots ---------------------------------------------------------

#[derive(Default)]
#[derive(Clone, Default, Debug)]
struct Roots {
in_: ZoneSetNode,
others: HashMap<Class, ZoneSetNode>,
Expand Down Expand Up @@ -116,7 +116,7 @@ impl Roots {

//------------ ZoneSetNode ---------------------------------------------------

#[derive(Default)]
#[derive(Clone, Default, Debug)]
struct ZoneSetNode {
zone: Option<Zone>,
children: HashMap<OwnedLabel, ZoneSetNode>,
Expand Down
14 changes: 14 additions & 0 deletions src/zonetree/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1309,6 +1309,20 @@ pub enum Error {
Finished,
}

//--- Display

impl std::fmt::Display for Error {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Error::OutOfZone => f.write_str("OutOfZone"),
Error::NotSoaRecord => f.write_str("NotSoaRecord"),
Error::IoError(err) => write!(f, "I/O error: {err}"),

Error::Finished => f.write_str("Finished"),
}
}
}

//--- From

impl From<std::io::Error> for Error {
Expand Down
43 changes: 41 additions & 2 deletions src/zonetree/zone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,36 @@ use super::traits::WritableZone;
use super::types::StoredName;
use super::{parsed, ReadableZone, ZoneStore};

//------------ Zone ----------------------------------------------------------

/// A single DNS zone.
///
/// # Abstract backing store
///
/// The actual backing store implementation used by a [`Zone`] is determined
/// by the [`ZoeStore`] impl it wraps. In this way one can treat in-memory
/// zone implementations and other backing store types (for example a database
/// backed zone) in the same way, and even to store zones with different
/// backing stores together in the same [`ZoneTree`].
///
/// # Layering functionality
///
/// The functionality of [`Zone`]s can be extended by creating a [`ZoneStore`]
/// implementation that wraps another [`ZoneStore`] implementation with the
/// purpose of wrapping the original zone with additional state and
/// functionality.
///
/// This could be used to detect changes to the [`Zone`] via your own
/// [`WritableZone`] impl e.g. to sign it or persist it, or to detect updated
/// SOA timers, and so on.
///
/// To layer [`ZoneStore`] implementations on top of one another, use
/// [`Zone::into_inner()`] to obtain backing store implementation of a
/// [`Zone`] then store that (via [`Arc<dyn ZoneStore`]) in a wrapper type
/// that itself implements [`ZoneStore`], and then use [`Zone::new()`] to
/// create a new [`Zone`] based on the outer backing store impl.
///
/// Then to gain access to the additional functionality and state use
/// [`ZoneStore::as_any()`] and attempt to [`Any::downcast()`] to a
/// [`ZoneStore`] implementing type that was used earlier.
#[derive(Clone, Debug)]
pub struct Zone {
store: Arc<dyn ZoneStore>,
Expand All @@ -29,6 +56,12 @@ impl Zone {
}
}

/// Exchange this [`Zone`] wrapper for the actual underlying backing store
/// implementation.
pub fn into_inner(self) -> Arc<dyn ZoneStore> {
self.store
}

/// Gets the CLASS of this zone.
pub fn class(&self) -> Class {
self.store.class()
Expand All @@ -53,6 +86,12 @@ impl Zone {
}
}

impl AsRef<dyn ZoneStore> for Zone {
fn as_ref(&self) -> &dyn ZoneStore {
self.store.as_ref()
}
}

//--- TryFrom<inplace::Zonefile>

impl TryFrom<inplace::Zonefile> for Zone {
Expand Down