Move the overlay interface to the system level
One agent, one interface, owned by the agent rather than by a protocol. That is what makes several protocols able to be live at once: a packet leaving the interface is routed to whichever peer owns its destination, over whichever protocol has a link to that peer, and neither protocol has to hold the address because the agent holds it. This commit moves the pieces without changing behaviour: provisioning, the TUN itself, IP header parsing and interface naming are now crates/tsunagi/src/overlay, and the WireGuard module re-exports them while its callers are moved over. They were never WireGuard-specific — netlink, capabilities and `ip tuntap` have nothing to do with the protocol running on top. They also get their own error type. An interface that cannot be created is not a plugin failing, and now that the two belong to different levels they should not share a word for it. Routing, addressing and the reduced plugin contract come next. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
60e6b263d1
commit
5bee148497
15 files changed
+163
-93
No files matched your search
@@ -67,6 +67,20 @@ pub enum PluginError {
|
||||
Other(String),
|
||||
}
|
||||
|
||||
/// Scaffolding while the interface moves out of the plugin.
|
||||
///
|
||||
/// The overlay interface belongs to the system level now, so a plugin has no
|
||||
/// business failing because of it. This exists only for the callers that
|
||||
/// have not been moved over yet and goes when the last of them does.
|
||||
impl From<crate::overlay::OverlayError> for PluginError {
|
||||
fn from(err: crate::overlay::OverlayError) -> Self {
|
||||
match err {
|
||||
crate::overlay::OverlayError::Unavailable(reason) => PluginError::Unavailable(reason),
|
||||
crate::overlay::OverlayError::Other(reason) => PluginError::Other(reason),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A request a plugin makes of the agent that owns it.
|
||||
#[derive(Debug)]
|
||||
pub(crate) enum PluginRequest {
|
||||
|
||||
Reference in new issue
Block a user