summaryrefslogtreecommitdiffhomepage
path: root/test/connection-checker/src/cli.rs
blob: ecc33dd7e9dbde1dd28c6bc8890c7f1db1e903ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
use std::net::SocketAddr;

use clap::Parser;

/// CLI tool that queries <https://am.i.mullvad.net> to check if the machine is connected to
/// Mullvad VPN.
#[derive(Parser)]
pub struct Opt {
    /// Interactive mode, press enter to check if you are Mullvad.
    #[clap(short, long)]
    pub interactive: bool,

    /// Timeout for network connection to am.i.mullvad (in millis).
    #[clap(short, long, default_value = "3000")]
    pub timeout: u64,

    /// Try to send some junk data over TCP to <leak>.
    #[clap(long, requires = "leak")]
    pub leak_tcp: bool,

    /// Try to send some junk data over UDP to <leak>.
    #[clap(long, requires = "leak")]
    pub leak_udp: bool,

    /// Try to send ICMP request to <leak>.
    #[clap(long, requires = "leak")]
    pub leak_icmp: bool,

    /// Target of <leak_tcp>, <leak_udp> or <leak_icmp>.
    #[clap(long)]
    pub leak: Option<SocketAddr>,

    /// Timeout for leak check network connections (in millis).
    #[clap(long, default_value = "1000")]
    pub leak_timeout: u64,

    /// Junk data for each UDP and TCP packet
    #[clap(long, requires = "leak", default_value = "Hello there!")]
    pub payload: String,
}