skip publishing relay for fullconenat

This commit is contained in:
John Smith 2023-08-24 17:17:48 -04:00 committed by Christien Rioux
parent 945215aba1
commit 6bb35dd6a6
2 changed files with 18 additions and 4 deletions

View File

@ -5,8 +5,8 @@ use super::*;
pub enum DialInfoClass { pub enum DialInfoClass {
Direct = 0, // D = Directly reachable with public IP and no firewall, with statically configured port Direct = 0, // D = Directly reachable with public IP and no firewall, with statically configured port
Mapped = 1, // M = Directly reachable with via portmap behind any NAT or firewalled with dynamically negotiated port Mapped = 1, // M = Directly reachable with via portmap behind any NAT or firewalled with dynamically negotiated port
FullConeNAT = 2, // F = Directly reachable device without portmap behind full-cone NAT FullConeNAT = 2, // F = Directly reachable device without portmap behind full-cone NAT (or manually mapped firewall port with no configuration change)
Blocked = 3, // B = Inbound blocked at firewall but may hole punch with public address Blocked = 3, // B = Inbound blocked at firewall but may hole punch with public address
AddressRestrictedNAT = 4, // A = Device without portmap behind address-only restricted NAT AddressRestrictedNAT = 4, // A = Device without portmap behind address-only restricted NAT
PortRestrictedNAT = 5, // P = Device without portmap behind address-and-port restricted NAT PortRestrictedNAT = 5, // P = Device without portmap behind address-and-port restricted NAT
} }

View File

@ -128,7 +128,18 @@ impl RoutingDomainDetailCommon {
self.dial_info_details.clone() self.dial_info_details.clone()
); );
let relay_info = self // Check if any of our dialinfo require a relay for signaling
// FullConeNAT requires a relay but it does not have to be published because it does not require signaling
let mut publish_relay = false;
for did in self.dial_info_details() {
if did.class.requires_signal() {
publish_relay = true;
break;
}
}
let relay_info = if publish_relay {
self
.relay_node .relay_node
.as_ref() .as_ref()
.and_then(|rn| { .and_then(|rn| {
@ -145,7 +156,10 @@ impl RoutingDomainDetailCommon {
} else { } else {
None None
} }
}); })
} else {
None
};
let signed_node_info = match relay_info { let signed_node_info = match relay_info {
Some((relay_ids, relay_sdni)) => SignedNodeInfo::Relayed( Some((relay_ids, relay_sdni)) => SignedNodeInfo::Relayed(