Add overlay planning commands
This commit is contained in:
parent
7d4a288729
commit
c2dee50dae
18 changed files with 928 additions and 16 deletions
|
|
@ -16,6 +16,7 @@ geth-discovery = { path = "../geth-discovery" }
|
|||
geth-document = { path = "../geth-document" }
|
||||
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" }
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ use geth_discovery::{DiscoveredPeer, PeerCard};
|
|||
use geth_document::{DocumentResource, DocumentState};
|
||||
use geth_keychain::{KeychainOp, KeychainOpSignature, NodeEnrollmentRequest, NodeRecord};
|
||||
use geth_kv::{KvEntry, KvResource, KvSyncEntry};
|
||||
use geth_overlay::{OverlayJoinPlan, OverlayNetworkStatus, OverlayPlan};
|
||||
use geth_pipe::{PipeConnection, PipeListener, PipeMessage};
|
||||
use geth_pubsub::PubsubMessage;
|
||||
use geth_resource::ResourceDescriptor;
|
||||
|
|
@ -43,6 +44,19 @@ pub enum ControlRequest {
|
|||
kind: String,
|
||||
name: String,
|
||||
},
|
||||
OverlayStatus,
|
||||
OverlayPlan {
|
||||
name: String,
|
||||
cidr: Option<String>,
|
||||
},
|
||||
OverlayJoin {
|
||||
name: String,
|
||||
secret: String,
|
||||
cidr: Option<String>,
|
||||
},
|
||||
OverlayLeave {
|
||||
name: String,
|
||||
},
|
||||
CasAdd {
|
||||
path: PathBuf,
|
||||
},
|
||||
|
|
@ -472,6 +486,21 @@ pub enum ControlResponse {
|
|||
ResourceCreated {
|
||||
resource: ResourceDescriptor,
|
||||
},
|
||||
OverlayStatus {
|
||||
networks: Vec<OverlayNetworkStatus>,
|
||||
note: String,
|
||||
},
|
||||
OverlayPlanned {
|
||||
plan: OverlayPlan,
|
||||
},
|
||||
OverlayJoined {
|
||||
join: OverlayJoinPlan,
|
||||
},
|
||||
OverlayLeft {
|
||||
name: String,
|
||||
stopped: bool,
|
||||
note: String,
|
||||
},
|
||||
CasAdded {
|
||||
hash: BlobHash,
|
||||
size_bytes: u64,
|
||||
|
|
@ -1549,6 +1578,15 @@ mod tests {
|
|||
request
|
||||
);
|
||||
|
||||
let request = ControlRequest::OverlayPlan {
|
||||
name: "home-lan".to_owned(),
|
||||
cidr: Some("172.22.0.0/24".to_owned()),
|
||||
};
|
||||
assert_eq!(
|
||||
decode_request(&encode_request(&request).expect("encode")).expect("decode"),
|
||||
request
|
||||
);
|
||||
|
||||
let response = ControlResponse::CasHas {
|
||||
hash: "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef".into(),
|
||||
present: true,
|
||||
|
|
@ -1558,6 +1596,15 @@ mod tests {
|
|||
response
|
||||
);
|
||||
|
||||
let response = ControlResponse::OverlayPlanned {
|
||||
plan: geth_overlay::plan_overlay("home-lan", None, geth_overlay::OVERLAY_ALPN)
|
||||
.expect("overlay plan"),
|
||||
};
|
||||
assert_eq!(
|
||||
decode_response(&encode_response(&response).expect("encode")).expect("decode"),
|
||||
response
|
||||
);
|
||||
|
||||
let response = ControlResponse::NodeList {
|
||||
nodes: vec![NodeRecord {
|
||||
id: geth_types::NodeId::new("node:local"),
|
||||
|
|
|
|||
Loading…
Reference in a new issue