Set up CLI flags to manually test 2 servers at once

main
_ 2020-10-31 22:17:11 -05:00
parent 063e79d217
commit c056118798
3 changed files with 25 additions and 9 deletions

View File

@ -4,7 +4,6 @@ name = "ptth"
version = "0.1.0" version = "0.1.0"
authors = ["Trish"] authors = ["Trish"]
edition = "2018" edition = "2018"
license-file = "COPYING"
license = "AGPL-3.0" license = "AGPL-3.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # 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"] } reqwest = { version = "0.10.8", features = ["stream"] }
rmp-serde = "0.14.4" rmp-serde = "0.14.4"
serde = {version = "1.0.117", features = ["derive"]} serde = {version = "1.0.117", features = ["derive"]}
structopt = "0.3.20"
tokio = { version = "0.2.22", features = ["full"] } tokio = { version = "0.2.22", features = ["full"] }
ulid = "0.4.1" ulid = "0.4.1"

View File

@ -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] #[tokio::main]
async fn main () -> Result <(), Box <dyn Error>> { async fn main () -> Result <(), Box <dyn Error>> {
let opt = Opt::from_args ();
let opt = ptth::server::Opt { let opt = ptth::server::Opt {
relay_url: "http://127.0.0.1:4000".into (), relay_url: opt.relay_url,
server_name: "alien_wildlands".into (), server_name: opt.server_name,
file_server_root: "/home/user".into (), file_server_root: opt.file_server_root.unwrap_or ("/home/user".into ()),
}; };
ptth::server::main (opt).await ptth::server::main (opt).await

View File

@ -1,11 +1,8 @@
- Parameter for server URL - Fix possible timing gap when refreshing http_listen
- Parameter for static file serve path
- Parameter for server name
- Set up tokens or privkeys or tripcodes or something so - Set up tokens or privkeys or tripcodes or something so
clients can't trivially impersonate servers clients can't trivially impersonate servers
- Prevent directory traversal attacks - Prevent directory traversal attacks
- Fix possible timing gap when refreshing http_listen (Just have client wait a few seconds?)
- Error handling - Error handling
- Reverse proxy to other local servers - Reverse proxy to other local servers