feat: added connection and authentication

client can now generate a server binary, and try to connect to it and
get capabilities
This commit is contained in:
Andrew Rioux
2023-09-02 22:29:13 -04:00
parent cda6388596
commit 4449a771e2
12 changed files with 606 additions and 67 deletions

View File

@@ -3,17 +3,12 @@ pub const CONFIG_SEPARATOR: &'static [u8] =
pub mod messages {
pub const CONNECT_MESSAGE: &'static [u8] = b"CONNECT";
pub const CONNECTED_MESSAGE: &'static [u8] = b"CONNECTED";
use std::{ffi::OsString, path::PathBuf};
use ed25519_dalek::Signature;
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize)]
pub struct CommandWrapper {
sig: Signature,
command: Vec<u8>,
}
use serde_repr::{Deserialize_repr, Serialize_repr};
#[derive(Serialize, Deserialize)]
pub enum Command {
@@ -61,7 +56,7 @@ pub mod messages {
#[derive(Serialize, Deserialize)]
pub enum Response {
Connected(Capabilities),
// Connected(Capabilities, ed25519_dalek::PublicKey, ecies_ed25519::PublicKey),
SendData(Vec<u8>),
CdDone,
@@ -76,14 +71,23 @@ pub mod messages {
DownloadFileSegment(u64, u64, Vec<u8>),
}
#[derive(Serialize, Deserialize, Debug, Clone, Copy)]
#[derive(Serialize_repr, Deserialize_repr, Debug, Clone, Copy)]
#[repr(u8)]
pub enum TransportType {
RawUdp,
Udp,
}
#[derive(Serialize_repr, Deserialize_repr, Debug, Clone, Copy)]
#[repr(u8)]
pub enum OperatingSystem {
Windows,
Linux,
}
#[derive(Serialize, Deserialize, Debug)]
pub struct Capabilities {
pub operating_system: OperatingSystem,
pub docker_container: bool,
pub docker_breakout: bool,
pub setuid: bool,