refactor for routing domains
This commit is contained in:
@@ -392,11 +392,14 @@ impl NetworkClass {
|
||||
|
||||
#[derive(Clone, Debug, Default, Serialize, Deserialize)]
|
||||
pub struct NodeStatus {
|
||||
// PublicInternet RoutingDomain Status
|
||||
pub will_route: bool,
|
||||
pub will_tunnel: bool,
|
||||
pub will_signal: bool,
|
||||
pub will_relay: bool,
|
||||
pub will_validate_dial_info: bool,
|
||||
// LocalNetwork RoutingDomain Status
|
||||
// TODO
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
@@ -502,43 +505,6 @@ impl NodeInfo {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
pub struct LocalNodeInfo {
|
||||
pub dial_info_list: Vec<DialInfo>,
|
||||
}
|
||||
|
||||
impl LocalNodeInfo {
|
||||
pub fn first_filtered_dial_info<F>(&self, filter: F) -> Option<DialInfo>
|
||||
where
|
||||
F: Fn(&DialInfo) -> bool,
|
||||
{
|
||||
for di in &self.dial_info_list {
|
||||
if filter(di) {
|
||||
return Some(di.clone());
|
||||
}
|
||||
}
|
||||
None
|
||||
}
|
||||
|
||||
pub fn all_filtered_dial_info<F>(&self, filter: F) -> Vec<DialInfo>
|
||||
where
|
||||
F: Fn(&DialInfo) -> bool,
|
||||
{
|
||||
let mut dial_info_list = Vec::new();
|
||||
|
||||
for di in &self.dial_info_list {
|
||||
if filter(di) {
|
||||
dial_info_list.push(di.clone());
|
||||
}
|
||||
}
|
||||
dial_info_list
|
||||
}
|
||||
|
||||
pub fn has_dial_info(&self) -> bool {
|
||||
!self.dial_info_list.is_empty()
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(clippy::derive_hash_xor_eq)]
|
||||
#[derive(Debug, PartialOrd, Ord, Hash, Serialize, Deserialize, EnumSetType)]
|
||||
// Keep member order appropriate for sorting < preference
|
||||
|
Reference in New Issue
Block a user