Improve hook state and routing

This commit is contained in:
Michael Mikovsky
2026-05-28 14:46:47 -06:00
parent 388da93b2b
commit aeffe8b8ec
11 changed files with 492 additions and 155 deletions
+4 -7
View File
@@ -1,5 +1,8 @@
mod hooks;
mod routing;
pub use hooks::HookID;
use alloc::{boxed::Box, vec::Vec};
use crate::{ConnectionSet, HookMap, Leaf, Packet, Path, RouteMap};
@@ -9,9 +12,8 @@ pub struct Endpoint {
pub id: u32,
// A counter that creates unique hook IDs.
// TODO: Actually check if the hook ID collides with any existing hooks.
// TODO: Randomize the hooks for more obfuscation
last_hook: u16,
pub(crate) last_hook: u16,
// Absolute path for this node. Must be set by some leaf
pub path: Path,
@@ -87,9 +89,4 @@ impl Endpoint {
queue.clear();
}
}
pub fn get_hook_id(&mut self) -> u16 {
self.last_hook = self.last_hook.wrapping_add(1);
self.last_hook - 1
}
}