diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/basalt.rs | 6 | ||||
-rw-r--r-- | examples/fullmesh.rs | 6 |
2 files changed, 10 insertions, 2 deletions
diff --git a/examples/basalt.rs b/examples/basalt.rs index eaf056b..e1ac2e4 100644 --- a/examples/basalt.rs +++ b/examples/basalt.rs @@ -31,6 +31,9 @@ pub struct Opt { #[structopt(long = "listen-addr", short = "l", default_value = "127.0.0.1:1980")] listen_addr: String, + #[structopt(long = "public-addr", short = "a")] + public_addr: Option<String>, + #[structopt(long = "view-size", short = "v", default_value = "100")] view_size: usize, @@ -83,7 +86,8 @@ async fn main() { info!("KYEV PK {}", hex::encode(&privkey.public_key())); let listen_addr = opt.listen_addr.parse().unwrap(); - let netapp = NetApp::new(listen_addr, netid, privkey); + let public_addr = opt.public_addr.map(|x| x.parse().unwrap()); + let netapp = NetApp::new(listen_addr, public_addr, netid, privkey); let mut bootstrap_peers = vec![]; for peer in opt.bootstrap_peers.iter() { diff --git a/examples/fullmesh.rs b/examples/fullmesh.rs index 5addcea..88784c1 100644 --- a/examples/fullmesh.rs +++ b/examples/fullmesh.rs @@ -25,6 +25,9 @@ pub struct Opt { #[structopt(long = "listen-addr", short = "l", default_value = "127.0.0.1:1980")] listen_addr: String, + + #[structopt(long = "public-addr", short = "a")] + public_addr: Option<String>, } #[tokio::main] @@ -63,7 +66,8 @@ async fn main() { info!("Node public key: {}", hex::encode(&privkey.public_key())); let listen_addr = opt.listen_addr.parse().unwrap(); - let netapp = NetApp::new(listen_addr, netid, privkey); + let public_addr = opt.public_addr.map(|x| x.parse().unwrap()); + let netapp = NetApp::new(listen_addr, public_addr, netid, privkey); let mut bootstrap_peers = vec![]; for peer in opt.bootstrap_peers.iter() { |