Set up CLI flags to manually test 2 servers at once
parent
063e79d217
commit
c056118798
|
@ -4,7 +4,6 @@ name = "ptth"
|
|||
version = "0.1.0"
|
||||
authors = ["Trish"]
|
||||
edition = "2018"
|
||||
license-file = "COPYING"
|
||||
license = "AGPL-3.0"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
@ -23,5 +22,6 @@ regex = "1.4.1"
|
|||
reqwest = { version = "0.10.8", features = ["stream"] }
|
||||
rmp-serde = "0.14.4"
|
||||
serde = {version = "1.0.117", features = ["derive"]}
|
||||
structopt = "0.3.20"
|
||||
tokio = { version = "0.2.22", features = ["full"] }
|
||||
ulid = "0.4.1"
|
||||
|
|
|
@ -1,11 +1,30 @@
|
|||
use std::error::Error;
|
||||
use std::{
|
||||
error::Error,
|
||||
path::PathBuf,
|
||||
};
|
||||
|
||||
use structopt::StructOpt;
|
||||
|
||||
#[derive (Debug, StructOpt)]
|
||||
struct Opt {
|
||||
#[structopt (name = "RELAY_URL")]
|
||||
relay_url: String,
|
||||
|
||||
#[structopt (name = "SERVER_NAME")]
|
||||
server_name: String,
|
||||
|
||||
#[structopt (long)]
|
||||
file_server_root: Option <PathBuf>,
|
||||
}
|
||||
|
||||
#[tokio::main]
|
||||
async fn main () -> Result <(), Box <dyn Error>> {
|
||||
let opt = Opt::from_args ();
|
||||
|
||||
let opt = ptth::server::Opt {
|
||||
relay_url: "http://127.0.0.1:4000".into (),
|
||||
server_name: "alien_wildlands".into (),
|
||||
file_server_root: "/home/user".into (),
|
||||
relay_url: opt.relay_url,
|
||||
server_name: opt.server_name,
|
||||
file_server_root: opt.file_server_root.unwrap_or ("/home/user".into ()),
|
||||
};
|
||||
|
||||
ptth::server::main (opt).await
|
||||
|
|
5
todo.md
5
todo.md
|
@ -1,11 +1,8 @@
|
|||
- Parameter for server URL
|
||||
- Parameter for static file serve path
|
||||
- Parameter for server name
|
||||
- Fix possible timing gap when refreshing http_listen
|
||||
- Set up tokens or privkeys or tripcodes or something so
|
||||
clients can't trivially impersonate servers
|
||||
|
||||
- Prevent directory traversal attacks
|
||||
- Fix possible timing gap when refreshing http_listen (Just have client wait a few seconds?)
|
||||
- Error handling
|
||||
|
||||
- Reverse proxy to other local servers
|
||||
|
|
Loading…
Reference in New Issue