mirror of
https://github.com/Astatin3/unshell.git
synced 2026-06-09 06:47:59 -06:00
Improve hook state and routing
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user