Skip to content

Commit 9ea8889

Browse files
committed
Help printout reorganized
It was quite a mess and inconsistent. It will not be perfect with this change, but still better.
1 parent 8b58ac9 commit 9ea8889

File tree

2 files changed

+56
-45
lines changed

2 files changed

+56
-45
lines changed

README.md

+30-22
Original file line numberDiff line numberDiff line change
@@ -159,45 +159,53 @@ 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)
192-
-s statistic_interval Optional statistic printout interval.
193-
(Default: 0, Disabled: 0, Min: 1, Max: 3600)
194-
-C path Optional file containing CA certificates.
188+
or limited builds of libcurl.
189+
-q Use HTTP/3 (QUIC) only.
190+
-C ca_path Optional file containing CA certificates.
191+
-c dscp_codepoint Optional DSCP codepoint to set on upstream HTTPS server
192+
connections. (Min: 0, Max: 63)
193+
194+
Process
195+
-d Daemonize.
196+
-u user Optional user to drop to if launched as root.
197+
-g group Optional group to drop to if launched as root.
198+
199+
Logging
195200
-v Increase logging verbosity. (Default: error)
196201
Levels: fatal, stats, error, warning, info, debug
197202
Request issues are logged on warning level.
203+
-l logfile Path to file to log to. (Default: standard output)
204+
-s statistic_interval Optional statistic printout interval.
205+
(Default: 0, Disabled: 0, Min: 1, Max: 3600)
198206
-F log_limit Flight recorder: storing desired amount of logs from all levels
199207
in memory and dumping them on fatal error or on SIGUSR2 signal.
200-
(Default: 0, Min: 100, Max: 100000)
208+
(Default: 0, Disabled: 0, Min: 100, Max: 100000)
201209
-V Print version and exit.
202210
-h Print help and exit.
203211
```

src/options.c

+26-23
Original file line numberDiff line numberDiff line change
@@ -193,51 +193,54 @@ void options_show_usage(int __attribute__((unused)) argc, char **argv) {
193193
struct Options defaults;
194194
options_init(&defaults);
195195
printf("Usage: %s [-a <listen_addr>] [-p <listen_port>]\n", argv[0]);
196-
printf(" [-d] [-u <user>] [-g <group>] [-b <dns_servers>]\n");
197-
printf(" [-i <polling_interval>] [-4] [-r <resolver_url>]\n");
198-
printf(" [-t <proxy_server>] [-l <logfile>] [-c <dscp_codepoint>]\n");
199-
printf(" [-x] [-q] [-s <statistic_interval>] [-F <log_limit>]\n");
200-
printf(" [-v]+ [-V] [-h]\n\n");
201-
printf(" -a listen_addr Local IPv4/v6 address to bind to. (%s)\n",
196+
printf(" [-b <dns_servers>] [-i <polling_interval>] [-4]\n");
197+
printf(" [-r <resolver_url>] [-t <proxy_server>] [-x] [-q] [-C <ca_path>] [-c <dscp_codepoint>]\n");
198+
printf(" [-d] [-u <user>] [-g <group>] \n");
199+
printf(" [-v]+ [-l <logfile>] [-s <statistic_interval>] [-F <log_limit>] [-V] [-h]\n");
200+
printf("\n DNS server\n");
201+
printf(" -a listen_addr Local IPv4/v6 address to bind to. (Default: %s)\n",
202202
defaults.listen_addr);
203-
printf(" -p listen_port Local port to bind to. (%d)\n",
203+
printf(" -p listen_port Local port to bind to. (Default: %d)\n",
204204
defaults.listen_port);
205-
printf(" -d Daemonize.\n");
206-
printf(" -u user Optional user to drop to if launched as root.\n");
207-
printf(" -g group Optional group to drop to if launched as root.\n");
205+
printf("\n DNS client\n");
208206
printf(" -b dns_servers Comma-separated IPv4/v6 addresses and ports (addr:port)\n");
209207
printf(" of DNS servers to resolve resolver host (e.g. dns.google).\n"\
210208
" When specifying a port for IPv6, enclose the address in [].\n"\
211-
" (%s)\n",
209+
" (Default: %s)\n",
212210
defaults.bootstrap_dns);
213211
printf(" -i polling_interval Optional polling interval of DNS servers.\n"\
214212
" (Default: %d, Min: 5, Max: 3600)\n",
215213
defaults.bootstrap_dns_polling_interval);
216214
printf(" -4 Force IPv4 hostnames for DNS resolvers non IPv6 networks.\n");
217-
printf(" -r resolver_url The HTTPS path to the resolver URL. Default: %s\n",
215+
printf("\n HTTPS client\n");
216+
printf(" -r resolver_url The HTTPS path to the resolver URL. (Default: %s)\n",
218217
defaults.resolver_url);
219218
printf(" -t proxy_server Optional HTTP proxy. e.g. socks5://127.0.0.1:1080\n");
220219
printf(" Remote name resolution will be used if the protocol\n");
221220
printf(" supports it (http, https, socks4a, socks5h), otherwise\n");
222221
printf(" initial DNS resolution will still be done via the\n");
223222
printf(" bootstrap DNS servers.\n");
224-
printf(" -l logfile Path to file to log to. (\"%s\")\n",
225-
defaults.logfile);
226-
printf(" -c dscp_codepoint Optional DSCP codepoint[0-63] to set on upstream DNS server\n");
227-
printf(" connections.\n");
228223
printf(" -x Use HTTP/1.1 instead of HTTP/2. Useful with broken\n"
229-
" or limited builds of libcurl. (false)\n");
230-
printf(" -q Use HTTP/3 (QUIC) only. (false)\n");
231-
printf(" -s statistic_interval Optional statistic printout interval.\n"\
232-
" (Default: %d, Disabled: 0, Min: 1, Max: 3600)\n",
233-
defaults.stats_interval);
234-
printf(" -C path Optional file containing CA certificates.\n");
224+
" or limited builds of libcurl.\n");
225+
printf(" -q Use HTTP/3 (QUIC) only.\n");
226+
printf(" -C ca_path Optional file containing CA certificates.\n");
227+
printf(" -c dscp_codepoint Optional DSCP codepoint to set on upstream HTTPS server\n");
228+
printf(" connections. (Min: 0, Max: 63)\n");
229+
printf("\n Process\n");
230+
printf(" -d Daemonize.\n");
231+
printf(" -u user Optional user to drop to if launched as root.\n");
232+
printf(" -g group Optional group to drop to if launched as root.\n");
233+
printf("\n Logging\n");
235234
printf(" -v Increase logging verbosity. (Default: error)\n");
236235
printf(" Levels: fatal, stats, error, warning, info, debug\n");
237236
printf(" Request issues are logged on warning level.\n");
237+
printf(" -l logfile Path to file to log to. (Default: standard output)\n");
238+
printf(" -s statistic_interval Optional statistic printout interval.\n"\
239+
" (Default: %d, Disabled: 0, Min: 1, Max: 3600)\n",
240+
defaults.stats_interval);
238241
printf(" -F log_limit Flight recorder: storing desired amount of logs from all levels\n"\
239242
" in memory and dumping them on fatal error or on SIGUSR2 signal.\n"
240-
" (Default: %u, Min: 100, Max: 100000)\n",
243+
" (Default: %u, Disabled: 0, Min: 100, Max: 100000)\n",
241244
defaults.flight_recorder_size);
242245
printf(" -V Print version and exit.\n");
243246
printf(" -h Print help and exit.\n");

0 commit comments

Comments
 (0)