more routingdomain refactor

This commit is contained in:
John Smith
2022-08-31 21:41:48 -04:00
parent 68ea977d0f
commit 9966d25672
12 changed files with 486 additions and 279 deletions

View File

@@ -118,11 +118,13 @@ impl DiscoveryContext {
// Build an filter that matches our protocol and address type
// and excludes relays so we can get an accurate external address
let dial_info_filter = DialInfoFilter::global()
let dial_info_filter = DialInfoFilter::all()
.with_protocol_type(protocol_type)
.with_address_type(address_type);
let inbound_dial_info_entry_filter =
RoutingTable::make_inbound_dial_info_entry_filter(dial_info_filter.clone());
let inbound_dial_info_entry_filter = RoutingTable::make_inbound_dial_info_entry_filter(
RoutingDomain::PublicInternet,
dial_info_filter.clone(),
);
let disallow_relays_filter = move |e: &BucketEntryInner| {
if let Some(n) = e.node_info(RoutingDomain::PublicInternet) {
n.relay_peer_info.is_none()
@@ -169,7 +171,7 @@ impl DiscoveryContext {
protocol_type: ProtocolType,
address_type: AddressType,
) -> Vec<SocketAddress> {
let filter = DialInfoFilter::local()
let filter = DialInfoFilter::all()
.with_protocol_type(protocol_type)
.with_address_type(address_type);
self.routing_table

View File

@@ -253,12 +253,11 @@ impl Network {
pub(super) async fn start_udp_listeners(&self) -> EyreResult<()> {
trace!("starting udp listeners");
let routing_table = self.routing_table();
let (listen_address, public_address, enable_local_peer_scope, detect_address_changes) = {
let (listen_address, public_address, detect_address_changes) = {
let c = self.config.get();
(
c.network.protocol.udp.listen_address.clone(),
c.network.protocol.udp.public_address.clone(),
c.network.enable_local_peer_scope,
c.network.detect_address_changes,
)
};
@@ -288,6 +287,9 @@ impl Network {
// Register local dial info
for di in &local_dial_info_list {
xxx write routing table sieve for routing domain from dialinfo and local network detection and registration
// If the local interface address is global, or we are enabling local peer scope
// register global dial info if no public address is specified
if !detect_address_changes