2019-04-03 16:57:00 +02:00

46 lines
1.2 KiB
Rust

use std::path::PathBuf;
use structopt::StructOpt;
#[derive(StructOpt, Debug)]
#[structopt(name = "event-gen")]
pub struct Opts {
///Time after which a client is considered as offline
#[structopt(
short = "t",
long = "timeout",
default_value = "115",
env = "WG_EVENT_TIMEOUT"
)]
pub timeout: u64,
///Interval after which Wireguard will be polled for updates
#[structopt(
short = "p",
long = "poll-interval",
default_value = "3000",
env = "WG_EVENT_INTERVAL"
)]
pub poll: u64,
///Programm to run when an event has fired
#[structopt(
short = "e",
long = "event-handler",
parse(from_os_str),
env = "WG_EVENT_HANDLER"
)]
pub events: Option<PathBuf>,
///Don't exit on API errors
#[structopt(short = "I", long = "ignore-socket-err", env = "WG_IGNORE_SOCKET_ERR")]
pub ignore_socket_errors: bool,
///Log all events to Stdout
#[structopt(short = "l", long = "log", env = "WG_LOG_EVENTS")]
pub log: bool,
///Socket for the userspace implementation to poll
#[structopt(name = "SOCKET", parse(from_os_str), env = "WG_EVENT_SOCKET")]
pub socket: PathBuf,
}