Requiring explicit host + printing bound address on startup
This commit is contained in:
+9
-10
@@ -14,8 +14,10 @@ pub fn start(matches: &ArgMatches) {
|
||||
let config = new_config(matches);
|
||||
println!("Public key: {}", config.public_key_string());
|
||||
|
||||
// println!("Startup on: {}", config.socket_address);
|
||||
println!("Listening for incoming packets...");
|
||||
println!(
|
||||
"Listening for incoming packets on {}",
|
||||
config.socket_address
|
||||
);
|
||||
|
||||
let mix = MixNode::new(&config);
|
||||
thread::spawn(move || {
|
||||
@@ -26,7 +28,7 @@ pub fn start(matches: &ArgMatches) {
|
||||
}
|
||||
|
||||
fn new_config(matches: &ArgMatches) -> node::Config {
|
||||
let host = matches.value_of("host").unwrap_or("0.0.0.0");
|
||||
let host = matches.value_of("host").unwrap();
|
||||
|
||||
let port = match matches.value_of("port").unwrap_or("1789").parse::<u16>() {
|
||||
Ok(n) => n,
|
||||
@@ -38,8 +40,6 @@ fn new_config(matches: &ArgMatches) -> node::Config {
|
||||
Err(err) => panic!("Invalid layer value provided - {:?}", err),
|
||||
};
|
||||
|
||||
let is_local = matches.is_present("local");
|
||||
|
||||
let socket_address = (host, port)
|
||||
.to_socket_addrs()
|
||||
.expect("Failed to combine host and port")
|
||||
@@ -48,11 +48,10 @@ fn new_config(matches: &ArgMatches) -> node::Config {
|
||||
|
||||
let (secret_key, public_key) = sphinx::crypto::keygen();
|
||||
|
||||
let directory_server = if is_local {
|
||||
"http://localhost:8080".to_string()
|
||||
} else {
|
||||
"https://directory.nymtech.net".to_string()
|
||||
};
|
||||
let directory_server = matches
|
||||
.value_of("directory")
|
||||
.unwrap_or("https://directory.nymtech.net")
|
||||
.to_string();
|
||||
|
||||
node::Config {
|
||||
directory_server,
|
||||
|
||||
Reference in New Issue
Block a user