initial commit

master
Avril 3 years ago
commit fdd9bace61
Signed by: flanchan
GPG Key ID: 284488987C31F630

1
.gitignore vendored

@ -0,0 +1 @@
/target

1563
Cargo.lock generated

File diff suppressed because it is too large Load Diff

@ -0,0 +1,28 @@
[package]
name = "datse"
description = "DATa SErver"
version = "0.1.0"
authors = ["Avril <flanchan@cumallover.me>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[features]
default = ["server", "client",
"server-http",
]
server-http = ["server"]
server-tcp = ["server"]
# At least one must be present.
server = []
client = []
[dependencies]
color-eyre = {version = "0.5", default-features=false}
futures = "0.3.8"
log = "0.4.11"
pretty_env_logger = "0.4.0"
tokio = {version = "0.2", features = ["full"]}
warp = "0.2.5"

@ -0,0 +1,26 @@
//! Parse args
use super::*;
#[derive(Debug, PartialEq, Eq, Clone)]
pub enum Operation
{
#[cfg(feature="server")] Server(server::Config),
#[cfg(feature="client")] Client(client::Config),
Help,
}
#[derive(Debug)]
pub struct Error;
pub fn parse_args() -> impl Future<Output = Result<Operation, Error>>
{
parse(std::env::args().skip(1))
}
async fn parse<T, I>(args: I) -> Result<Operation, Error>
where I: IntoIterator<Item = T>,
T: Into<String>
{
let mut args = args.into_iter().map(Into::into);
todo!()
}

@ -0,0 +1,10 @@
//! datse client
use super::*;
#[derive(Debug, PartialEq, Eq, Clone)]
pub struct Config
{
}
//TODO

@ -0,0 +1,40 @@
#![allow(dead_code)]
#[macro_use] extern crate log;
use color_eyre::{
eyre::{
self, eyre,
WrapErr as _,
},
SectionExt as _,
};
use futures::{
prelude::*,
};
fn install() -> eyre::Result<()>
{
color_eyre::install()?;
pretty_env_logger::init();
trace!("init oke");
Ok(())
}
mod args;
#[cfg(feature="server")] mod server;
#[cfg(feature="client")] mod client;
#[tokio::main]
async fn main() -> eyre::Result<()> {
install()
.wrap_err(eyre!("Failed to install handlers"))?;
//TODO: Parse args and delegate to client or server
Ok(())
}

@ -0,0 +1,11 @@
use super::*;
#[derive(Debug, PartialEq, Eq, Clone)]
pub struct Config
{
}
#[cfg(feature="server-http")] pub mod web;
#[cfg(feature="server-tcp")] pub mod tcp;

@ -0,0 +1,4 @@
//! datse server over TCP
use super::*;
//TODO: Depends on yet-to-be-written rust TCP encnet RSA-AES encryption wrapper

@ -0,0 +1,2 @@
//! datse server over HTTP
use super::*;
Loading…
Cancel
Save