1use bincode::{Decode, Encode};
2use std::{fmt::Debug, path::PathBuf};
3
4#[derive(Decode, Encode, PartialEq, Eq, PartialOrd, Ord, Clone)]
5pub struct Request {
6 pub action: Action,
7 pub path: PathBuf,
8 pub size: u64,
9 pub hash: u64,
10 pub password: [u8; 32],
11}
12
13impl Debug for Request {
14 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
15 f.debug_struct("Request")
16 .field("action", &self.action)
17 .field("path", &self.path)
18 .field("size", &self.size)
19 .field("hash", &self.hash)
20 .field("password", &"REDACTED")
21 .finish()
22 }
23}
24
25#[derive(Debug, Decode, Encode, PartialEq, Eq, PartialOrd, Ord, Clone, Copy)]
26pub enum Action {
27 Upload,
28 Run,
29}
30
31#[derive(Debug, Decode, Encode, PartialEq, Eq, PartialOrd, Ord, Clone, Copy)]
32pub enum PasswordMatch {
33 Match,
34 NoMatch,
35}
36
37#[derive(Debug, Decode, Encode, PartialEq, Eq, PartialOrd, Ord, Clone, Copy)]
38pub enum HashMatch {
39 Match,
40 NoMatch,
41}