Broadcast external IP from NAT in enode record (#10274)

Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
cody-wang-cb
2024-10-10 07:12:27 -04:00
committed by GitHub
parent b50e710f84
commit 47c3a481de
14 changed files with 108 additions and 9 deletions

View File

@ -61,6 +61,14 @@ impl NatResolver {
pub async fn external_addr(self) -> Option<IpAddr> {
external_addr_with(self).await
}
/// Returns the external ip, if it is [`NatResolver::ExternalIp`]
pub const fn as_external_ip(self) -> Option<IpAddr> {
match self {
Self::ExternalIp(ip) => Some(ip),
_ => None,
}
}
}
impl fmt::Display for NatResolver {