parent
1401c0efc4
commit
046ea8d3a3
9 changed files with 45 additions and 11 deletions
@ -1,6 +1,5 @@ |
||||
[workspace] |
||||
members = [ |
||||
"u-run", |
||||
"u-server", |
||||
"u-agent" |
||||
"bin/*", |
||||
"lib/u_lib" |
||||
] |
@ -0,0 +1,23 @@ |
||||
use warp::{ |
||||
Filter |
||||
}; |
||||
use env_logger; |
||||
use tokio::sync::Mutex; |
||||
use std::collections::HashMap; |
||||
|
||||
use u_lib::Client; |
||||
|
||||
type Storage = Mutex<HashMap<String, Client>>; |
||||
|
||||
#[tokio::main] |
||||
async fn main() { |
||||
env_logger::init(); |
||||
let db: Storage = Mutex::new(HashMap::<String, Client>::new()); |
||||
let hello = warp::get().and(warp::path::param()) |
||||
.map(|p: String| format!("Hello, {} ({})", p, LOL)); |
||||
|
||||
//let post = warp::post().and(warp::path("new"))
|
||||
let routes = hello |
||||
.with(warp::log("warp")); |
||||
warp::serve(routes).run(([127,0,0,1], 63714)).await; |
||||
} |
@ -0,0 +1,10 @@ |
||||
use serde::Deserialize; |
||||
|
||||
#[derive(Deserialize)] |
||||
pub struct Client { |
||||
pub ip: String, |
||||
pub hostname: String, |
||||
pub username: String, |
||||
pub os: String, |
||||
pub platform: String |
||||
} |
@ -1,3 +0,0 @@ |
||||
fn main() { |
||||
println!("Hello, world!"); |
||||
} |
Loading…
Reference in new issue