commit 3c7aef4bfc233ae9d80d1c8172373ac566e136b0
parent 76048b970a077f5ebaac4d8310830ba993407911
Author: triesap <tyson@radroots.org>
Date: Thu, 13 Aug 2026 13:52:17 +0000
transport-nostr: complete coverage boundaries
- exercise the earlier-than-cursor reconnect outcome
- reject undotted public relay hostnames explicitly
- bind public localhost suffix rejection
- restore the required branch coverage gate
Diffstat:
2 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/crates/transport_nostr/src/cursor.rs b/crates/transport_nostr/src/cursor.rs
@@ -69,6 +69,7 @@ mod tests {
let cursor = RelayCursor::new(10, "b".repeat(64)).expect("cursor");
assert!(cursor.precedes(11, &"0".repeat(64)));
assert!(cursor.precedes(10, &"c".repeat(64)));
+ assert!(!cursor.precedes(9, &"f".repeat(64)));
assert!(!cursor.precedes(10, &"b".repeat(64)));
assert!(cursor.page_precedes(9, &"f".repeat(64)));
assert!(cursor.page_precedes(10, &"a".repeat(64)));
diff --git a/crates/transport_nostr/src/relay.rs b/crates/transport_nostr/src/relay.rs
@@ -389,6 +389,8 @@ mod tests {
assert!(RelayUrl::parse("wss://localhost", RelayUrlPolicy::Local).is_ok());
assert!(RelayUrl::parse("wss://localhost", RelayUrlPolicy::Public).is_err());
assert!(!public_hostname("localhost."));
+ assert!(!public_hostname("intranet"));
+ assert!(!public_hostname("host.localhost"));
assert!(RelayUrl::parse("wss://host.local", RelayUrlPolicy::Public).is_err());
assert!(RelayUrl::parse("wss://host.home.arpa", RelayUrlPolicy::Public).is_err());
assert!(RelayUrl::parse("wss://private.example", RelayUrlPolicy::PrivateNetwork).is_ok());