added protocol crate for the program, also removed unused crates
This commit is contained in:
parent
e6905cb6b2
commit
66edb18a90
|
|
@ -2,7 +2,8 @@
|
||||||
members = [
|
members = [
|
||||||
'foundation',
|
'foundation',
|
||||||
'server',
|
'server',
|
||||||
'client',
|
'protocol'
|
||||||
'serverctl',
|
|
||||||
'example_plugin'
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[workspace.dependencies]
|
||||||
|
protobuf-codegen = "3.4.0"
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
[package]
|
||||||
|
name = "protocol"
|
||||||
|
version = "0.1.0"
|
||||||
|
authors = ["michael-bailey <mickyb18a@gmail.com>"]
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
|
[lib]
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
chrono = "0.4"
|
||||||
|
uuid = {version = "1.1.2", features = ["serde", "v4"]}
|
||||||
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
|
serde_json = "1.0"
|
||||||
|
crossbeam = "0.8.0"
|
||||||
|
crossbeam-channel = "0.5.0"
|
||||||
|
zeroize = "1.1.0"
|
||||||
|
tokio = { version = "1.9.0", features = ["full"] }
|
||||||
|
futures = "0.3.16"
|
||||||
|
async-trait = "0.1.52"
|
||||||
|
toml = "0.8.8"
|
||||||
|
protobuf = "3.4.0"
|
||||||
|
|
||||||
|
[build-dependencies]
|
||||||
|
protobuf-codegen.workspace = true
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
use protobuf_codegen::Codegen;
|
||||||
|
|
||||||
|
// Use this in build.rs
|
||||||
|
fn main() {
|
||||||
|
Codegen::new()
|
||||||
|
.includes(["src/proto"])
|
||||||
|
.input("src/proto/messages.proto")
|
||||||
|
.input("src/proto/network.proto")
|
||||||
|
.cargo_out_dir("proto")
|
||||||
|
.run_from_script();
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
mod proto;
|
||||||
|
|
||||||
|
pub mod prelude {
|
||||||
|
pub use super::proto::network::*;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
message Person {
|
||||||
|
string name = 1;
|
||||||
|
int32 id = 2; // Unique ID number for this person.
|
||||||
|
string email = 3;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
include!(concat!(env!("OUT_DIR"), "/proto/mod.rs"));
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
// Network messages from the client.
|
||||||
|
message NetoworkClientMessage {
|
||||||
|
oneof message {
|
||||||
|
GetInfo get_info = 1;
|
||||||
|
Connect connect = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetInfo {}
|
||||||
|
|
||||||
|
message Connect {
|
||||||
|
string username = 1;
|
||||||
|
string uuid = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Network messages from the server.
|
||||||
|
message NetworkServerMessage {
|
||||||
|
oneof message {
|
||||||
|
Request request = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
message Request {}
|
||||||
|
|
||||||
|
message Info {
|
||||||
|
string server_name = 1;
|
||||||
|
string owner = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Connected {}
|
||||||
Loading…
Reference in New Issue