resolve work

This commit is contained in:
Christien Rioux
2023-09-16 11:26:07 -04:00
parent 0c5b89a15e
commit 3a4c211e85
3 changed files with 66 additions and 14 deletions

View File

@@ -871,6 +871,47 @@ impl VeilidAPI {
Ok(format!("{:#?}", cm))
}
async fn debug_resolve(&self, args: String) -> VeilidAPIResult<String> {
let netman = self.network_manager()?;
let routing_table = netman.routing_table();
let args: Vec<String> = args.split_whitespace().map(|s| s.to_owned()).collect();
let dest = async_get_debug_argument_at(
&args,
0,
"debug_resolve",
"destination",
get_destination(routing_table.clone()),
)
.await?;
match &dest {
Destination::Direct {
target,
safety_selection: _,
} => Ok(format!(
"Destination: {:#?}\nTarget Entry:\n{}\n",
&dest,
routing_table.debug_info_entry(target.clone())
)),
Destination::Relay {
relay,
target,
safety_selection: _,
} => Ok(format!(
"Destination: {:#?}\nTarget Entry:\n{}\nRelay Entry:\n{}\n",
&dest,
routing_table.clone().debug_info_entry(target.clone()),
routing_table.debug_info_entry(relay.clone())
)),
Destination::PrivateRoute {
private_route: _,
safety_selection: _,
} => Ok(format!("Destination: {:#?}", &dest)),
}
}
async fn debug_ping(&self, args: String) -> VeilidAPIResult<String> {
let netman = self.network_manager()?;
let routing_table = netman.routing_table();