mirror of
https://gitlab.com/veilid/veilid.git
synced 2024-12-24 06:49:38 -05:00
Merge branch 'public-address-detection-work' into 'main'
Fix public address detection See merge request veilid/veilid!180
This commit is contained in:
commit
d410dc940d
@ -420,7 +420,7 @@ impl DiscoveryContext {
|
||||
};
|
||||
|
||||
// If we have two different external addresses, then this is a symmetric NAT
|
||||
if external_2.address != external_1.address {
|
||||
if external_2.address.address() != external_1.address.address() {
|
||||
let do_symmetric_nat_fut: SendPinBoxFuture<Option<DetectedDialInfo>> =
|
||||
Box::pin(async move { Some(DetectedDialInfo::SymmetricNAT) });
|
||||
unord.push(do_symmetric_nat_fut);
|
||||
|
@ -11,19 +11,6 @@ impl Network {
|
||||
.get_network_class(RoutingDomain::PublicInternet)
|
||||
.unwrap_or_default();
|
||||
|
||||
// get existing dial info into table by protocol/address type
|
||||
let mut existing_dial_info = BTreeMap::<(ProtocolType, AddressType), DialInfoDetail>::new();
|
||||
for did in self.routing_table().all_filtered_dial_info_details(
|
||||
RoutingDomain::PublicInternet.into(),
|
||||
&DialInfoFilter::all(),
|
||||
) {
|
||||
// Only need to keep one per pt/at pair, since they will all have the same dialinfoclass
|
||||
existing_dial_info.insert(
|
||||
(did.dial_info.protocol_type(), did.dial_info.address_type()),
|
||||
did,
|
||||
);
|
||||
}
|
||||
|
||||
match ddi {
|
||||
DetectedDialInfo::SymmetricNAT => {
|
||||
// If we get any symmetric nat dialinfo, this whole network class is outbound only,
|
||||
@ -39,6 +26,19 @@ impl Network {
|
||||
}
|
||||
}
|
||||
DetectedDialInfo::Detected(did) => {
|
||||
// get existing dial info into table by protocol/address type
|
||||
let mut existing_dial_info =
|
||||
BTreeMap::<(ProtocolType, AddressType), DialInfoDetail>::new();
|
||||
for did in self.routing_table().all_filtered_dial_info_details(
|
||||
RoutingDomain::PublicInternet.into(),
|
||||
&DialInfoFilter::all(),
|
||||
) {
|
||||
// Only need to keep one per pt/at pair, since they will all have the same dialinfoclass
|
||||
existing_dial_info.insert(
|
||||
(did.dial_info.protocol_type(), did.dial_info.address_type()),
|
||||
did,
|
||||
);
|
||||
}
|
||||
// We got a dial info, upgrade everything unless we are fixed to outbound only due to a symmetric nat
|
||||
if !matches!(existing_network_class, NetworkClass::OutboundOnly) {
|
||||
// Get existing dial info for protocol/address type combination
|
||||
|
@ -648,7 +648,7 @@ impl VeilidAPI {
|
||||
if !args.is_empty() {
|
||||
if args[0] == "buckets" {
|
||||
// Must be detached
|
||||
if matches!(
|
||||
if !matches!(
|
||||
self.get_state().await?.attachment.state,
|
||||
AttachmentState::Detached | AttachmentState::Detaching
|
||||
) {
|
||||
|
Loading…
Reference in New Issue
Block a user