aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorHristo Venev <hristo@venev.name>2020-02-04 22:43:44 +0100
committerHristo Venev <hristo@venev.name>2020-02-04 22:43:44 +0100
commite6c406879696a53d40f175d11d14a55d9480a57e (patch)
tree4f91613dbd7f019f33117148177a8a17dc84a94a /src/main.rs
parenta7cff9572d672d516569b4a55b4a0dbbeb3cb9e1 (diff)
More peer options in config.
endpoint and keepalive
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs
index 8ab9fb3..462da48 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -62,13 +62,25 @@ fn cli_config(mut args: impl Iterator<Item = OsString>) -> Option<config::Config
}
}
State::Peer(ref mut p) => {
+ if key == "source" {
+ p.source = Some(args.next()?.into_string().ok()?);
+ continue;
+ }
+ if key == "endpoint" {
+ arg = args.next()?;
+ let arg = arg.to_str()?;
+ p.endpoint = Some(model::Endpoint::from_str(arg).ok()?);
+ continue;
+ }
if key == "psk" {
arg = args.next()?;
p.psk = Some(model::Secret::new(arg.into()));
continue;
}
- if key == "source" {
- p.source = Some(args.next()?.into_string().ok()?);
+ if key == "keepalive" {
+ arg = args.next()?;
+ let arg = arg.to_str()?;
+ p.keepalive = Some(u32::from_str(arg).ok()?);
continue;
}
}
@@ -111,7 +123,9 @@ fn cli_config(mut args: impl Iterator<Item = OsString>) -> Option<config::Config
let key = model::Key::from_str(arg.to_str()?).ok()?;
cur = State::Peer(cfg.global.peers.entry(key).or_insert(config::Peer {
source: None,
+ endpoint: None,
psk: None,
+ keepalive: None,
}));
continue;
}