Skip to main content

over_there/core/
mod.rs

1mod client;
2mod event;
3mod msg;
4mod server;
5pub mod transport;
6
7pub use client::{
8    error::AskError,
9    error::ExecAskError,
10    error::FileAskError,
11    error::SendError,
12    file::RemoteFile,
13    proc::{RemoteProc, RemoteProcStatus},
14    Client, ClientBuilder, ConnectedClient,
15};
16pub use event::{AddrEventManager, EventManager};
17pub use msg::{
18    content::{
19        reply, reply::Capability, request, Content, LazilyTransformedRequest,
20        Reply, ReplyError, Request, TransformRequestError, TransformRule,
21    },
22    Header, Msg, MsgError,
23};
24pub use server::{
25    fs::{FileSystemManager, LocalDirEntry, LocalFile, LocalFileHandle},
26    proc::{ExitStatus, LocalProc},
27    ListeningServer, Server, ServerBuilder,
28};
29pub use transport::net;
30
31use std::net::SocketAddr;
32
33/// Transportation medium to use with the client/server
34#[derive(Clone, Debug)]
35pub enum Transport {
36    /// TCP-based communication
37    /// - If binding, will use addr available
38    /// - If connecting, will use first addr that succeeds
39    Tcp(Vec<SocketAddr>),
40
41    /// UDP-based communication
42    /// - If binding, will use addr available
43    /// - If connecting, will use first addr that succeeds, which should be
44    ///   the very first addr in most cases as no network validation is used
45    Udp(Vec<SocketAddr>),
46}
47
48pub trait SchemaInfo: schemars::JsonSchema {
49    /// Outputs schema as a pretty JSON string
50    fn schema() -> String {
51        let schema = schemars::schema_for!(Self);
52        serde_json::to_string_pretty(&schema)
53            .expect("Failed to serialize schema")
54    }
55}