IPv6 By Default (#6808)

This commit is contained in:
Age Manning
2025-02-10 12:58:11 +11:00
committed by GitHub
parent ceb5ecf349
commit 62a0f25f97
6 changed files with 77 additions and 12 deletions

View File

@@ -6,6 +6,7 @@ use directory::{
DEFAULT_BEACON_NODE_DIR, DEFAULT_HARDCODED_NETWORK, DEFAULT_NETWORK_DIR, DEFAULT_ROOT_DIR,
};
use libp2p::Multiaddr;
use local_ip_address::local_ipv6;
use serde::{Deserialize, Serialize};
use sha2::{Digest, Sha256};
use std::net::{Ipv4Addr, Ipv6Addr};
@@ -266,6 +267,18 @@ impl Config {
}
}
/// A helper function to check if the local host has a globally routeable IPv6 address. If so,
/// returns true.
pub fn is_ipv6_supported() -> bool {
// If IPv6 is supported
let Ok(std::net::IpAddr::V6(local_ip)) = local_ipv6() else {
return false;
};
// If its globally routable, return true
is_global_ipv6(&local_ip)
}
pub fn listen_addrs(&self) -> &ListenAddress {
&self.listen_addresses
}