Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
112 changes: 19 additions & 93 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion beacon_node/lighthouse_network/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ fixed_bytes = { workspace = true }
fnv = { workspace = true }
futures = { workspace = true }
hex = { workspace = true }
if-addrs = "0.14"
itertools = { workspace = true }
libp2p = { workspace = true }
libp2p-mplex = { git = "https://github.com/libp2p/rust-libp2p.git" }
lighthouse_version = { workspace = true }
local-ip-address = "0.6"
logging = { workspace = true }
lru = { workspace = true }
lru_cache = { workspace = true }
Expand Down
10 changes: 5 additions & 5 deletions beacon_node/lighthouse_network/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ use crate::{Enr, PeerIdSerialized};
use directory::{
DEFAULT_BEACON_NODE_DIR, DEFAULT_HARDCODED_NETWORK, DEFAULT_NETWORK_DIR, DEFAULT_ROOT_DIR,
};
use if_addrs::get_if_addrs;
use libp2p::{Multiaddr, gossipsub};
use local_ip_address::local_ipv6;
use network_utils::listen_addr::{ListenAddr, ListenAddress};
use serde::{Deserialize, Serialize};
use sha2::{Digest, Sha256};
Expand Down Expand Up @@ -262,13 +262,13 @@ 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 {
let Ok(addrs) = get_if_addrs() else {
return false;
};

// If its globally routable, return true
is_global_ipv6(&local_ip)
addrs.iter().any(
|iface| matches!(iface.addr, if_addrs::IfAddr::V6(ref v6) if is_global_ipv6(&v6.ip)),
)
}

pub fn listen_addrs(&self) -> &ListenAddress {
Expand Down