diff options
| author | tv <tv@krebsco.de> | 2026-11-01 13:23:21 +0100 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-01 13:23:21 +0100 |
| commit | d5de69630cf544fd048c8376e1b51cd0e4e7c7fc (patch) | |
| tree | 0a27c4b92b6faab64a872958e9e010affd27660a /src/transport/libp2p/tests.rs | |
| parent | 7348524430ab2af7ccdcf38bfe76461b476337a5 (diff) | |
libp2p: public means global routable
Diffstat (limited to 'src/transport/libp2p/tests.rs')
| -rw-r--r-- | src/transport/libp2p/tests.rs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/transport/libp2p/tests.rs b/src/transport/libp2p/tests.rs index 801dfd3..fd607fe 100644 --- a/src/transport/libp2p/tests.rs +++ b/src/transport/libp2p/tests.rs @@ -539,6 +539,30 @@ async fn a_member_that_relays_is_picked() { /// A peer on the LAN that speaks continuum becomes a seed once, at its address. #[test] +fn public_ranges() { + let public = |ip: &str| book::is_public(ip.parse().unwrap()); + assert!(public("203.0.114.5")); + assert!(public("2a01:4f8::1")); + for not in [ + "10.1.2.3", + "100.64.0.1", + "192.0.2.1", + "198.18.0.1", + "224.0.0.1", + "255.255.255.255", + "::1", + "fd00::1", + "fe80::1", + "2001:db8::1", + "64:ff9b::1", + // Mycelium's overlay. + "45f:fa21:4bdd::1", + ] { + assert!(!public(not), "{not}"); + } +} + +#[test] fn lan_peers_become_seeds_once() { let mut book = Book::default(); let lan = peer(); |
