From e6c406879696a53d40f175d11d14a55d9480a57e Mon Sep 17 00:00:00 2001 From: Hristo Venev Date: Tue, 4 Feb 2020 22:43:44 +0100 Subject: More peer options in config. endpoint and keepalive --- src/main.rs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'src/main.rs') 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) -> Option { + 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) -> Option