discv5_cli/server/
command.rs1use clap::{Args, Subcommand as ClapSubcommand};
2
3#[derive(ClapSubcommand, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Default)]
5pub enum ServerSubcommand {
6 #[default]
8 Query,
9 Events,
11}
12
13#[derive(Args, Default, Debug, Clone, PartialEq, Eq, PartialOrd, Ord)]
15pub struct Server {
16 #[clap(subcommand)]
18 pub service: ServerSubcommand,
19 #[clap(
21 short = 'l',
22 long = "listen-addresses",
23 help = "Specifies the listening address(es) of the server. A comma separated string can specify ipv4 and ipv6 addresses for dual stack.",
24 default_value = "0.0.0.0"
25 )]
26 pub listen_addresses: String,
27 #[clap(
29 short = 'p',
30 long = "listen-port",
31 help = "Specifies the listening UDP port of the server.",
32 default_value = "9000"
33 )]
34 pub listen_port: u16,
35 #[clap(
37 short = 'p',
38 long = "listen-port-v6",
39 help = "Specifies the listening UDP port of the server if an ipv6 address is specified as a listening address."
40 )]
41 pub listen_port_v6: Option<u16>,
42 #[clap(
44 short = 'i',
45 long = "enr-addresses",
46 help = "Specifies the IP address(es) of the ENR record. Not specifying this results in an ENR with no IP field, unless the -w switch is used. These can be a comma separated addresses of ipv4,ipv6. Only the last two are used."
47 )]
48 pub enr_addresses: Option<String>,
49 #[clap(
51 short = 'u',
52 long = "enr-v4-port",
53 help = "Specifies the UDP port of the ENR record corresponding to ipv4 address. Not specifying this results in an ENR with no UDP field, unless the -w switch is used."
54 )]
55 pub enr_v4_port: Option<u16>,
56 #[clap(
58 short = 'u',
59 long = "enr-v6-port",
60 help = "Specifies the UDP port of the ENR record corresponding to ipv6 address. Not specifying this results in an ENR with no UDP field, unless the -w switch is used."
61 )]
62 pub enr_v6_port: Option<u16>,
63 #[clap(
65 short = 'q',
66 long = "enr-seq-no",
67 help = "Specifies the ENR sequence number when creating the ENR."
68 )]
69 pub enr_seq_no: Option<String>,
70 #[clap(
72 short = 'd',
73 long = "enr-eth2",
74 help = "Specifies the Eth2 field as ssz encoded hex bytes."
75 )]
76 pub enr_eth2: Option<String>,
77 #[clap(
79 short = 'w',
80 long = "enr-default",
81 help = "The Enr IP address and port will be the same as the specified listening address and port."
82 )]
83 pub enr_default: bool,
84 #[clap(
86 short = 'k',
87 long = "static-key",
88 help = "Use a fixed static key (hard-coded). This is primarily for debugging."
89 )]
90 pub static_key: bool,
91 #[clap(
93 short = 't',
94 long = "secp256k1-key",
95 help = "Specify a secp256k1 private key (hex encoded) to use for the nodes identity."
96 )]
97 pub secp256k1_key: Option<String>,
98 #[clap(
100 short = 'e',
101 long = "enr",
102 allow_hyphen_values = true,
103 help = "A base64 ENR that this node will initially connect to."
104 )]
105 pub enr: Option<String>,
106 #[clap(
108 short = 'n',
109 long = "peer-update-min",
110 help = "The minimum number of peers required to update the IP address. Cannot be less than 2.",
111 default_value = "2"
112 )]
113 pub peer_update_min: u64,
114 #[clap(
116 short = 'b',
117 long = "break-time",
118 help = "The time to wait between successive searches. Default is 10 seconds.",
119 default_value = "10"
120 )]
121 pub break_time: u64,
122 #[clap(
124 short = 's',
125 long = "stats",
126 help = "Displays statistics on the local routing table.",
127 default_value = "10"
128 )]
129 pub stats: u64,
130 #[clap(
132 short = 'x',
133 long = "no-search",
134 help = "Prevents the server from doing any peer searches."
135 )]
136 pub no_search: bool,
137 #[clap(
139 short = 'o',
140 long = "bootstrap",
141 help = "Bootstraps the server peers from a specified file."
142 )]
143 pub bootstrap: Option<String>,
144}