Skip to content

Commit d0505e4

Browse files
committed
Help printout reorganized
It was quite a mess and inconsistent. It will not be perfect with this change, but still better. In case of boolean options, default values are omitted.
1 parent 348447a commit d0505e4

File tree

2 files changed

+56
-45
lines changed

2 files changed

+56
-45
lines changed

README.md

Lines changed: 30 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -159,47 +159,55 @@ Just run it as a daemon and point traffic at it. Commandline flags are:
159159

160160
```
161161
Usage: ./https_dns_proxy [-a <listen_addr>] [-p <listen_port>]
162-
[-d] [-u <user>] [-g <group>] [-b <dns_servers>]
163-
[-i <polling_interval>] [-4] [-r <resolver_url>]
164-
[-t <proxy_server>] [-l <logfile>] [-c <dscp_codepoint>]
165-
[-x] [-q] [-s <statistic_interval>] [-F <log_limit>]
166-
[-v]+ [-V] [-h]
167-
168-
-a listen_addr Local IPv4/v6 address to bind to. (127.0.0.1)
169-
-p listen_port Local port to bind to. (5053)
170-
-d Daemonize.
171-
-u user Optional user to drop to if launched as root.
172-
-g group Optional group to drop to if launched as root.
162+
[-b <dns_servers>] [-i <polling_interval>] [-4]
163+
[-r <resolver_url>] [-t <proxy_server>] [-x] [-q] [-C <ca_path>] [-c <dscp_codepoint>]
164+
[-d] [-u <user>] [-g <group>]
165+
[-v]+ [-l <logfile>] [-s <statistic_interval>] [-F <log_limit>] [-V] [-h]
166+
167+
DNS server
168+
-a listen_addr Local IPv4/v6 address to bind to. (Default: 127.0.0.1)
169+
-p listen_port Local port to bind to. (Default: 5053)
170+
171+
DNS client
173172
-b dns_servers Comma-separated IPv4/v6 addresses and ports (addr:port)
174173
of DNS servers to resolve resolver host (e.g. dns.google).
175174
When specifying a port for IPv6, enclose the address in [].
176-
(8.8.8.8,1.1.1.1,8.8.4.4,1.0.0.1,145.100.185.15,145.100.185.16,185.49.141.37)
175+
(Default: 8.8.8.8,1.1.1.1,8.8.4.4,1.0.0.1,145.100.185.15,145.100.185.16,185.49.141.37)
177176
-i polling_interval Optional polling interval of DNS servers.
178177
(Default: 120, Min: 5, Max: 3600)
179178
-4 Force IPv4 hostnames for DNS resolvers non IPv6 networks.
180-
-r resolver_url The HTTPS path to the resolver URL. Default: https://dns.google/dns-query
179+
180+
HTTPS client
181+
-r resolver_url The HTTPS path to the resolver URL. (Default: https://dns.google/dns-query)
181182
-t proxy_server Optional HTTP proxy. e.g. socks5://127.0.0.1:1080
182183
Remote name resolution will be used if the protocol
183184
supports it (http, https, socks4a, socks5h), otherwise
184185
initial DNS resolution will still be done via the
185186
bootstrap DNS servers.
186-
-l logfile Path to file to log to. ("-")
187-
-c dscp_codepoint Optional DSCP codepoint[0-63] to set on upstream DNS server
188-
connections.
189187
-x Use HTTP/1.1 instead of HTTP/2. Useful with broken
190-
or limited builds of libcurl. (false)
191-
-q Use HTTP/3 (QUIC) only. (false)
188+
or limited builds of libcurl.
189+
-q Use HTTP/3 (QUIC) only.
192190
-m max_idle_time Maximum idle time in seconds allowed for reusing a HTTPS connection.
193191
(Default: 118, Min: 0, Max: 3600)
194-
-s statistic_interval Optional statistic printout interval.
195-
(Default: 0, Disabled: 0, Min: 1, Max: 3600)
196-
-C path Optional file containing CA certificates.
192+
-C ca_path Optional file containing CA certificates.
193+
-c dscp_codepoint Optional DSCP codepoint to set on upstream HTTPS server
194+
connections. (Min: 0, Max: 63)
195+
196+
Process
197+
-d Daemonize.
198+
-u user Optional user to drop to if launched as root.
199+
-g group Optional group to drop to if launched as root.
200+
201+
Logging
197202
-v Increase logging verbosity. (Default: error)
198203
Levels: fatal, stats, error, warning, info, debug
199204
Request issues are logged on warning level.
205+
-l logfile Path to file to log to. (Default: standard output)
206+
-s statistic_interval Optional statistic printout interval.
207+
(Default: 0, Disabled: 0, Min: 1, Max: 3600)
200208
-F log_limit Flight recorder: storing desired amount of logs from all levels
201209
in memory and dumping them on fatal error or on SIGUSR2 signal.
202-
(Default: 0, Min: 100, Max: 100000)
210+
(Default: 0, Disabled: 0, Min: 100, Max: 100000)
203211
-V Print version and exit.
204212
-h Print help and exit.
205213
```

src/options.c

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -202,54 +202,57 @@ void options_show_usage(int __attribute__((unused)) argc, char **argv) {
202202
struct Options defaults;
203203
options_init(&defaults);
204204
printf("Usage: %s [-a <listen_addr>] [-p <listen_port>]\n", argv[0]);
205-
printf(" [-d] [-u <user>] [-g <group>] [-b <dns_servers>]\n");
206-
printf(" [-i <polling_interval>] [-4] [-r <resolver_url>]\n");
207-
printf(" [-t <proxy_server>] [-l <logfile>] [-c <dscp_codepoint>]\n");
208-
printf(" [-x] [-q] [-s <statistic_interval>] [-F <log_limit>]\n");
209-
printf(" [-v]+ [-V] [-h]\n\n");
210-
printf(" -a listen_addr Local IPv4/v6 address to bind to. (%s)\n",
205+
printf(" [-b <dns_servers>] [-i <polling_interval>] [-4]\n");
206+
printf(" [-r <resolver_url>] [-t <proxy_server>] [-x] [-q] [-C <ca_path>] [-c <dscp_codepoint>]\n");
207+
printf(" [-d] [-u <user>] [-g <group>] \n");
208+
printf(" [-v]+ [-l <logfile>] [-s <statistic_interval>] [-F <log_limit>] [-V] [-h]\n");
209+
printf("\n DNS server\n");
210+
printf(" -a listen_addr Local IPv4/v6 address to bind to. (Default: %s)\n",
211211
defaults.listen_addr);
212-
printf(" -p listen_port Local port to bind to. (%d)\n",
212+
printf(" -p listen_port Local port to bind to. (Default: %d)\n",
213213
defaults.listen_port);
214-
printf(" -d Daemonize.\n");
215-
printf(" -u user Optional user to drop to if launched as root.\n");
216-
printf(" -g group Optional group to drop to if launched as root.\n");
214+
printf("\n DNS client\n");
217215
printf(" -b dns_servers Comma-separated IPv4/v6 addresses and ports (addr:port)\n");
218216
printf(" of DNS servers to resolve resolver host (e.g. dns.google).\n"\
219217
" When specifying a port for IPv6, enclose the address in [].\n"\
220-
" (%s)\n",
218+
" (Default: %s)\n",
221219
defaults.bootstrap_dns);
222220
printf(" -i polling_interval Optional polling interval of DNS servers.\n"\
223221
" (Default: %d, Min: 5, Max: 3600)\n",
224222
defaults.bootstrap_dns_polling_interval);
225223
printf(" -4 Force IPv4 hostnames for DNS resolvers non IPv6 networks.\n");
226-
printf(" -r resolver_url The HTTPS path to the resolver URL. Default: %s\n",
224+
printf("\n HTTPS client\n");
225+
printf(" -r resolver_url The HTTPS path to the resolver URL. (Default: %s)\n",
227226
defaults.resolver_url);
228227
printf(" -t proxy_server Optional HTTP proxy. e.g. socks5://127.0.0.1:1080\n");
229228
printf(" Remote name resolution will be used if the protocol\n");
230229
printf(" supports it (http, https, socks4a, socks5h), otherwise\n");
231230
printf(" initial DNS resolution will still be done via the\n");
232231
printf(" bootstrap DNS servers.\n");
233-
printf(" -l logfile Path to file to log to. (\"%s\")\n",
234-
defaults.logfile);
235-
printf(" -c dscp_codepoint Optional DSCP codepoint[0-63] to set on upstream DNS server\n");
236-
printf(" connections.\n");
237232
printf(" -x Use HTTP/1.1 instead of HTTP/2. Useful with broken\n"
238-
" or limited builds of libcurl. (false)\n");
239-
printf(" -q Use HTTP/3 (QUIC) only. (false)\n");
233+
" or limited builds of libcurl.\n");
234+
printf(" -q Use HTTP/3 (QUIC) only.\n");
240235
printf(" -m max_idle_time Maximum idle time in seconds allowed for reusing a HTTPS connection.\n"\
241236
" (Default: %d, Min: 0, Max: 3600)\n",
242237
defaults.max_idle_time);
243-
printf(" -s statistic_interval Optional statistic printout interval.\n"\
244-
" (Default: %d, Disabled: 0, Min: 1, Max: 3600)\n",
245-
defaults.stats_interval);
246-
printf(" -C path Optional file containing CA certificates.\n");
238+
printf(" -C ca_path Optional file containing CA certificates.\n");
239+
printf(" -c dscp_codepoint Optional DSCP codepoint to set on upstream HTTPS server\n");
240+
printf(" connections. (Min: 0, Max: 63)\n");
241+
printf("\n Process\n");
242+
printf(" -d Daemonize.\n");
243+
printf(" -u user Optional user to drop to if launched as root.\n");
244+
printf(" -g group Optional group to drop to if launched as root.\n");
245+
printf("\n Logging\n");
247246
printf(" -v Increase logging verbosity. (Default: error)\n");
248247
printf(" Levels: fatal, stats, error, warning, info, debug\n");
249248
printf(" Request issues are logged on warning level.\n");
249+
printf(" -l logfile Path to file to log to. (Default: standard output)\n");
250+
printf(" -s statistic_interval Optional statistic printout interval.\n"\
251+
" (Default: %d, Disabled: 0, Min: 1, Max: 3600)\n",
252+
defaults.stats_interval);
250253
printf(" -F log_limit Flight recorder: storing desired amount of logs from all levels\n"\
251254
" in memory and dumping them on fatal error or on SIGUSR2 signal.\n"
252-
" (Default: %u, Min: 100, Max: 100000)\n",
255+
" (Default: %u, Disabled: 0, Min: 100, Max: 100000)\n",
253256
defaults.flight_recorder_size);
254257
printf(" -V Print version and exit.\n");
255258
printf(" -h Print help and exit.\n");

0 commit comments

Comments
 (0)