37 lines
753 B
Rust
37 lines
753 B
Rust
use bincode::config::Configuration;
|
|
|
|
mod no_cert;
|
|
mod transfer;
|
|
|
|
pub use no_cert::*;
|
|
pub use transfer::*;
|
|
|
|
pub const SERVER_NAME: &str = "openworm";
|
|
pub const BINCODE_CONFIG: Configuration = bincode::config::standard();
|
|
|
|
#[derive(Debug, bincode::Encode, bincode::Decode)]
|
|
pub enum ClientMsg {
|
|
SendMsg(Msg),
|
|
RequestMsgs,
|
|
}
|
|
|
|
#[derive(Debug, bincode::Encode, bincode::Decode)]
|
|
pub enum ServerMsg {
|
|
SendMsg(Msg),
|
|
LoadMsgs(Vec<Msg>),
|
|
}
|
|
|
|
pub type ServerResp<T> = Result<T, String>;
|
|
|
|
#[derive(Debug, Clone, bincode::Encode, bincode::Decode)]
|
|
pub struct Msg {
|
|
pub content: String,
|
|
pub user: String,
|
|
}
|
|
|
|
pub fn install_crypto_provider() {
|
|
quinn::rustls::crypto::ring::default_provider()
|
|
.install_default()
|
|
.unwrap();
|
|
}
|