Added config parsing in config.rs
This commit is contained in:
28
src/main.rs
28
src/main.rs
@@ -1,17 +1,35 @@
|
||||
use axum::Router;
|
||||
use tokio::net::TcpListener;
|
||||
use axum::routing::get;
|
||||
use tower_http::services::ServeDir;
|
||||
use axum::routing::{get, post};
|
||||
use axum::Router;
|
||||
use std::env;
|
||||
use std::net::SocketAddr;
|
||||
|
||||
mod argparse;
|
||||
mod print_dir;
|
||||
mod config;
|
||||
mod shells;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
let args = argparse::parse_args();
|
||||
print_dir::print_interface(&args.interface, &args.port, &args.directory);
|
||||
let conf = config::load_config();
|
||||
let cwd = env::current_dir().unwrap();
|
||||
|
||||
let app = Router::new().route("/", get(|| async { "Hello world!" }));
|
||||
let listener = TcpListener::bind(format!("0.0.0.0:{}", args.port))
|
||||
let port = match args.port {
|
||||
Some(port) => port,
|
||||
None => conf.web_port
|
||||
};
|
||||
|
||||
print_dir::print_interface(&args.interface, &port, &args.directory);
|
||||
|
||||
let app = Router::new()
|
||||
//.route("/download/:path", get(download_handler))
|
||||
//.route("/upload", post(upload_handler))
|
||||
.route("/shells/:shell", get(shells::shells_handler))
|
||||
.nest_service("/", ServeDir::new(cwd));
|
||||
|
||||
let listener = TcpListener::bind(format!("0.0.0.0:{}", port))
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user