more private route work

This commit is contained in:
John Smith
2023-02-24 21:02:24 -05:00
parent 4823c979ab
commit 7962d3fe11
11 changed files with 810 additions and 623 deletions

View File

@@ -4,8 +4,8 @@ use super::*;
#[derive(Clone, Debug)]
pub enum Target {
NodeId(PublicKey),
PrivateRoute(PublicKey),
NodeId(PublicKey), // Node by any of its public keys
PrivateRoute(String), // Private route by its route set id
}
pub struct RoutingContextInner {}
@@ -118,17 +118,17 @@ impl RoutingContext {
safety_selection: self.unlocked_inner.safety_selection,
})
}
Target::PrivateRoute(pr) => {
Target::PrivateRoute(rsid) => {
// Get remote private route
let rss = self.api.routing_table()?.route_spec_store();
let Some(private_route) = rss
.get_remote_private_route(&pr)
.get_remote_private_route(&rsid)
else {
apibail_key_not_found!(pr);
};
Ok(rpc_processor::Destination::PrivateRoute {
private_route,
private_route: rsid,
safety_selection: self.unlocked_inner.safety_selection,
})
}

View File

@@ -512,8 +512,8 @@ impl SafetySelection {
)]
#[archive_attr(repr(C), derive(CheckBytes))]
pub struct SafetySpec {
/// preferred safety route if it still exists
pub preferred_route: Option<PublicKey>,
/// preferred safety route set id if it still exists
pub preferred_route: Option<String>,
/// must be greater than 0
pub hop_count: usize,
/// prefer reliability over speed