feat: added a basic interactivity to the client

This commit is contained in:
Andrew Rioux
2023-09-04 01:11:55 -04:00
parent 7876e00dc8
commit 7f1f43a601
10 changed files with 381 additions and 65 deletions

View File

@@ -12,19 +12,23 @@ pub mod messages {
#[derive(Serialize, Deserialize)]
pub enum Command {
SendData(Vec<u8>),
RunCommand(OsString),
SendStdin(Vec<u8>, u64),
Cd(PathBuf),
Ls(PathBuf),
OpenTTY,
CloseTTY,
CloseTTY(u64),
SendRawData(Vec<u64>, u64),
StartUploadFile(PathBuf, u64),
SendFileSegment(u64, u64, Vec<u8>),
SendFileSegment(u64, u64, Vec<u64>),
StartDownloadFile(PathBuf, u64),
DownloadFileStatus(Result<(), Vec<u8>>),
StartDownloadFile(PathBuf),
DownloadFileStatus(Result<(), Vec<u64>>),
Disconnect,
}
#[derive(Serialize, Deserialize)]
@@ -56,19 +60,22 @@ pub mod messages {
#[derive(Serialize, Deserialize)]
pub enum Response {
// Connected(Capabilities, ed25519_dalek::PublicKey, ecies_ed25519::PublicKey),
SendData(Vec<u8>),
AckRunCommand(u64),
SendStdout(Vec<u8>, u64, u64),
CommandDone(u64),
CdDone,
LsResults(Vec<DirEntry>),
OpenedTTY,
ClosedTTY,
OpenedTTY(u64),
ClosedTTY(u64),
SendRawData(Vec<u64>, u64),
UploadFileID(u64),
UploadFileStatus(Result<(), Vec<u8>>),
UploadFileStatus(u64, Result<(), Vec<u64>>),
DownloadFileSegment(u64, u64, Vec<u8>),
StartDownloadFile(u64),
DownloadFileSegment(u64, u64, Vec<u64>),
}
#[derive(Serialize_repr, Deserialize_repr, Debug, Clone, Copy)]
@@ -94,5 +101,6 @@ pub mod messages {
pub root: bool,
pub userent: Option<String>,
pub transport: TransportType,
pub hostname: Option<String>,
}
}