mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-14 10:22:38 +00:00
IPv6 By Default (#6808)
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user