bridgedb now listens for connections, performs a function
This commit is contained in:
parent
bd31dfe666
commit
5216ede738
|
@ -1,12 +1,22 @@
|
|||
// This seems like probably not the best way to do this, but it works.
|
||||
#[path = "../server_net.rs"]
|
||||
mod server_net;
|
||||
use crate::server_net::listen;
|
||||
|
||||
use lox::BridgeDb;
|
||||
use std::env::args;
|
||||
use std::fs::File;
|
||||
use std::io::Write;
|
||||
use std::path::Path;
|
||||
|
||||
fn main() {
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
let bridgedb_filename = "bridgedb.json";
|
||||
let bridgedb_pubkey_filename = "bridgedb_pubkey.json";
|
||||
|
||||
// network address to listen on, e.g., localhost:8181
|
||||
let addr = args().nth(1).unwrap();
|
||||
|
||||
// If bridgedb has already been created, recreate it from file.
|
||||
// Otherwise, create new bridgedb.
|
||||
let bridgedb = if Path::new(bridgedb_filename).exists() {
|
||||
|
@ -38,4 +48,10 @@ fn main() {
|
|||
)
|
||||
.expect("Failed to write to bridgedb pubkey file");
|
||||
}
|
||||
|
||||
listen(addr, to_uppercase).await;
|
||||
}
|
||||
|
||||
fn to_uppercase(str: String) -> String {
|
||||
str.to_uppercase()
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue