diff --git a/prototypes/quic_demo/src/bin/quic_demo_client.rs b/prototypes/quic_demo/src/bin/quic_demo_client.rs index a6bc14a..0237d60 100644 --- a/prototypes/quic_demo/src/bin/quic_demo_client.rs +++ b/prototypes/quic_demo/src/bin/quic_demo_client.rs @@ -2,6 +2,7 @@ use structopt::StructOpt; use tokio::net::TcpListener; use quic_demo::prelude::*; +use protocol::Command; #[derive (Debug, StructOpt)] struct Opt { diff --git a/prototypes/quic_demo/src/bin/quic_demo_end_server.rs b/prototypes/quic_demo/src/bin/quic_demo_end_server.rs index 5f9bc9f..ca74902 100644 --- a/prototypes/quic_demo/src/bin/quic_demo_end_server.rs +++ b/prototypes/quic_demo/src/bin/quic_demo_end_server.rs @@ -2,6 +2,7 @@ use structopt::StructOpt; use tokio::net::TcpStream; use quic_demo::prelude::*; +use protocol::Command; #[derive (Debug, StructOpt)] struct Opt { diff --git a/prototypes/quic_demo/src/bin/quic_demo_relay_server.rs b/prototypes/quic_demo/src/bin/quic_demo_relay_server.rs index 6ab9876..e5fae3b 100644 --- a/prototypes/quic_demo/src/bin/quic_demo_relay_server.rs +++ b/prototypes/quic_demo/src/bin/quic_demo_relay_server.rs @@ -1,6 +1,7 @@ use structopt::StructOpt; use quic_demo::prelude::*; +use protocol::Command; #[derive (Debug, StructOpt)] struct Opt { diff --git a/prototypes/quic_demo/src/lib.rs b/prototypes/quic_demo/src/lib.rs index d102ef4..96c3681 100644 --- a/prototypes/quic_demo/src/lib.rs +++ b/prototypes/quic_demo/src/lib.rs @@ -1,2 +1,3 @@ pub mod prelude; +pub mod protocol; pub mod quinn_utils; diff --git a/prototypes/quic_demo/src/prelude.rs b/prototypes/quic_demo/src/prelude.rs index f8b3dda..0efa892 100644 --- a/prototypes/quic_demo/src/prelude.rs +++ b/prototypes/quic_demo/src/prelude.rs @@ -31,16 +31,5 @@ pub use tracing::{ warn, }; +pub use crate::protocol; pub use crate::quinn_utils::*; - -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] -pub struct Command (pub u8); - -impl Command { - pub const CONNECT_P2_TO_P3: Command = Command (2); - pub const CONNECT_P4_TO_P3: Command = Command (4); - pub const CONNECT_P2_TO_P4: Command = Command (10); - pub const CONNECT_P2_TO_P4_STEP_2: Command = Command (11); - pub const CONNECT_P2_TO_P5: Command = Command (12); - pub const OKAY: Command = Command (20); -} diff --git a/prototypes/quic_demo/src/protocol.rs b/prototypes/quic_demo/src/protocol.rs new file mode 100644 index 0000000..779510f --- /dev/null +++ b/prototypes/quic_demo/src/protocol.rs @@ -0,0 +1,13 @@ +#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct Command (pub u8); + +impl Command { + pub const CONNECT_P2_TO_P3: Command = Command (2); + pub const CONNECT_P4_TO_P3: Command = Command (4); + pub const CONNECT_P2_TO_P4: Command = Command (10); + pub const CONNECT_P2_TO_P4_STEP_2: Command = Command (11); + pub const CONNECT_P2_TO_P5: Command = Command (12); + pub const OKAY: Command = Command (20); +} + +// pub fn p2_connect_to_p3 (