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 | 86a7d35438df0c1c3174583205df56d8dd4c8788 (patch) | |
| tree | 5b736a854c691d77cdf3be658b06b1be4a77ec73 /src/transport/libp2p/tests.rs | |
| parent | 2ec7d7e0eedf504035417bebcace68f22f38ba10 (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(); |
