Add overlay planning commands
This commit is contained in:
parent
7d4a288729
commit
c2dee50dae
18 changed files with 928 additions and 16 deletions
|
|
@ -26,6 +26,7 @@ geth-document = { path = "../geth-document" }
|
|||
geth-iroh = { path = "../geth-iroh" }
|
||||
geth-keychain = { path = "../geth-keychain" }
|
||||
geth-kv = { path = "../geth-kv" }
|
||||
geth-overlay = { path = "../geth-overlay" }
|
||||
geth-pipe = { path = "../geth-pipe" }
|
||||
geth-pubsub = { path = "../geth-pubsub" }
|
||||
geth-resource = { path = "../geth-resource" }
|
||||
|
|
|
|||
|
|
@ -73,6 +73,8 @@ pub enum NodeError {
|
|||
Cas(#[from] geth_cas::CasError),
|
||||
#[error("db error: {0}")]
|
||||
Db(#[from] geth_db::DbError),
|
||||
#[error("overlay error: {0}")]
|
||||
Overlay(#[from] geth_overlay::OverlayError),
|
||||
#[error("control error: {0}")]
|
||||
Control(#[from] geth_control::ControlError),
|
||||
#[error("codec error: {0}")]
|
||||
|
|
@ -6591,6 +6593,41 @@ pub fn handle_request(
|
|||
resource: stored_resource_to_descriptor(stored)?,
|
||||
})
|
||||
}
|
||||
ControlRequest::OverlayStatus => Ok(ControlResponse::OverlayStatus {
|
||||
networks: Vec::new(),
|
||||
note: geth_overlay::overlay_status_note().to_owned(),
|
||||
}),
|
||||
ControlRequest::OverlayPlan { name, cidr } => {
|
||||
let plan = geth_overlay::plan_overlay(
|
||||
&name,
|
||||
cidr.as_deref(),
|
||||
&String::from_utf8_lossy(geth_iroh::ALPN_OVERLAY),
|
||||
)?;
|
||||
Ok(ControlResponse::OverlayPlanned { plan })
|
||||
}
|
||||
ControlRequest::OverlayJoin { name, secret, cidr } => {
|
||||
geth_overlay::validate_overlay_secret(&secret)?;
|
||||
let plan = geth_overlay::plan_overlay(
|
||||
&name,
|
||||
cidr.as_deref(),
|
||||
&String::from_utf8_lossy(geth_iroh::ALPN_OVERLAY),
|
||||
)?;
|
||||
Ok(ControlResponse::OverlayJoined {
|
||||
join: geth_overlay::OverlayJoinPlan {
|
||||
plan,
|
||||
enabled: false,
|
||||
note: "overlay join is recorded as an implementation plan only; this prototype does not create a TUN/Wintun interface or route packets".to_owned(),
|
||||
},
|
||||
})
|
||||
}
|
||||
ControlRequest::OverlayLeave { name } => {
|
||||
geth_overlay::validate_overlay_name(&name)?;
|
||||
Ok(ControlResponse::OverlayLeft {
|
||||
name,
|
||||
stopped: false,
|
||||
note: "no overlay packet runtime is active in this prototype".to_owned(),
|
||||
})
|
||||
}
|
||||
ControlRequest::CasAdd { path } => {
|
||||
let cas = LocalCas::new(node.paths.cas_dir());
|
||||
let info = cas.add_path(&path)?;
|
||||
|
|
|
|||
Loading…
Reference in a new issue