New -list-web-services option

This will make it possible for the Debian package to fetch the list of
supported built-in web-based IP discovery services and prompt the user
to choose one upon installation.
This commit is contained in:
Richard Hansen 2020-08-02 16:49:28 -04:00
parent 791890741b
commit dd10696156

View file

@ -816,71 +816,76 @@ my %opt = ();
my $deprecated_handler = sub { warning("'-$_[0]' is deprecated and does nothing"); };
$opt{'fw-banlocal'} = $deprecated_handler;
$opt{'if-skip'} = $deprecated_handler;
$opt{'list-web-services'} = sub {
printf("%s %s\n", $_, $builtinweb{$_}{url}) for sort(keys(%builtinweb));
exit(0);
};
my @opt = (
"usage: ${program} [options]",
"options are:",
["daemon", "=s", "-daemon <delay> : run as a daemon, specify <delay> as an interval"],
["foreground", "!", "-foreground : do not fork"],
["proxy", "=s", "-proxy <host> : use <host> as the HTTP proxy"],
["server", "=s", "-server <host> : update DNS information on <host>"],
["protocol", "=s", "-protocol <type> : update protocol used"],
["file", "=s", "-file <path> : load configuration information from <path>"],
["cache", "=s", "-cache <path> : record address used in <path>"],
["pid", "=s", "-pid <path> : record process id in <path> if daemonized"],
["daemon", "=s", "-daemon <delay> : run as a daemon, specify <delay> as an interval"],
["foreground", "!", "-foreground : do not fork"],
["proxy", "=s", "-proxy <host> : use <host> as the HTTP proxy"],
["server", "=s", "-server <host> : update DNS information on <host>"],
["protocol", "=s", "-protocol <type> : update protocol used"],
["file", "=s", "-file <path> : load configuration information from <path>"],
["cache", "=s", "-cache <path> : record address used in <path>"],
["pid", "=s", "-pid <path> : record process id in <path> if daemonized"],
"",
["use", "=s", "-use <which> : how the IP address should be obtained"],
["use", "=s", "-use <which> : how the IP address should be obtained"],
&ip_strategies_usage(),
"",
" Options that apply to 'use=ip':",
["ip", "=s", "-ip <address> : set the IP address to <address>"],
["ip", "=s", "-ip <address> : set the IP address to <address>"],
"",
" Options that apply to 'use=if':",
["if", "=s", "-if <interface> : obtain IP address from <interface>"],
["if", "=s", "-if <interface> : obtain IP address from <interface>"],
"",
" Options that apply to 'use=web':",
["web", "=s", "-web <service>|<url> : obtain IP address from a web-based IP discovery service, either a known <service> or a custom <url>"],
["web-skip", "=s", "-web-skip <pattern> : skip any IP addresses before <pattern> in the text returned from the web-based IP discovery service"],
["web", "=s", "-web <service>|<url> : obtain IP address from a web-based IP discovery service, either a known <service> (see '-list-web-services') or a custom <url>"],
["web-skip", "=s", "-web-skip <pattern> : skip any IP addresses before <pattern> in the text returned from the web-based IP discovery service"],
["list-web-services", "", "-list-web-services : print a machine-readable list of web-based IP discovery services for use with 'web=<service>' and exit. Format: one service per line, each line has the form '<service> <url>'"],
"",
" Options that apply to 'use=fw' and 'use=<device>':",
["fw", "=s", "-fw <address>|<url> : obtain IP address from device with IP address <address> or URL <url>"],
["fw-skip", "=s", "-fw-skip <pattern> : skip any IP addresses before <pattern> in the text returned from the device"],
["fw-login", "=s", "-fw-login <login> : use <login> when getting the IP from the device"],
["fw-password", "=s", "-fw-password <secret> : use password <secret> when getting the IP from the device"],
["fw", "=s", "-fw <address>|<url> : obtain IP address from device with IP address <address> or URL <url>"],
["fw-skip", "=s", "-fw-skip <pattern> : skip any IP addresses before <pattern> in the text returned from the device"],
["fw-login", "=s", "-fw-login <login> : use <login> when getting the IP from the device"],
["fw-password", "=s", "-fw-password <secret> : use password <secret> when getting the IP from the device"],
"",
" Options that apply to 'use=cmd':",
["cmd", "=s", "-cmd <command> : obtain IP address from the output of <command>"],
["cmd-skip", "=s", "-cmd-skip <pattern> : skip any IP addresses before <pattern> in the command's output"],
["cmd", "=s", "-cmd <command> : obtain IP address from the output of <command>"],
["cmd-skip", "=s", "-cmd-skip <pattern> : skip any IP addresses before <pattern> in the command's output"],
"",
["login", "=s", "-login <user> : log in to the dynamic DNS service as <user>"],
["password", "=s", "-password <secret> : log in to the dynamic DNS service with password <secret>"],
["host", "=s", "-host <host> : update DNS information for <host>"],
["login", "=s", "-login <user> : log in to the dynamic DNS service as <user>"],
["password", "=s", "-password <secret> : log in to the dynamic DNS service with password <secret>"],
["host", "=s", "-host <host> : update DNS information for <host>"],
"",
["options", "=s", "-options <opt>=<val>[,<opt>=<val>,...]\n : optional per-service arguments (see below)"],
["options", "=s", "-options <opt>=<val>[,<opt>=<val>,...]\n : optional per-service arguments (see below)"],
"",
["ssl", "!", "-{no}ssl : do updates over encrypted SSL connection"],
["ssl_ca_dir", "=s", "-ssl_ca_dir <dir> : look in <dir> for certificates of trusted certificate authorities (default: auto-detect)"],
["ssl_ca_file", "=s", "-ssl_ca_file <file> : look at <file> for certificates of trusted certificate authorities (default: auto-detect)"],
["retry", "!", "-{no}retry : retry failed updates"],
["force", "!", "-{no}force : force an update even if the update may be unnecessary"],
["timeout", "=i", "-timeout <max> : when fetching a URL, wait at most <max> seconds for a response"],
["syslog", "!", "-{no}syslog : log messages to syslog"],
["facility", "=s", "-facility <type> : log messages to syslog to facility <type>"],
["priority", "=s", "-priority <pri> : log messages to syslog with priority <pri>"],
["mail", "=s", "-mail <address> : e-mail messages to <address>"],
["mail-failure", "=s", "-mail-failure <addr> : e-mail messages for failed updates to <addr>"],
["exec", "!", "-{no}exec : do {not} execute; just show what would be done"],
["debug", "!", "-{no}debug : print {no} debugging information"],
["verbose", "!", "-{no}verbose : print {no} verbose information"],
["quiet", "!", "-{no}quiet : print {no} messages for unnecessary updates"],
["ipv6", "!", "-{no}ipv6 : use ipv6"],
["help", "", "-help : display this message and exit"],
["postscript", "", "-postscript : script to run after updating ddclient, has new IP as param"],
["query", "!", "-{no}query : print {no} ip addresses and exit"],
["fw-banlocal", "!", ""], ## deprecated
["if-skip", "=s", ""], ## deprecated
["test", "!", ""], ## hidden
["geturl", "=s", ""], ## hidden
["ssl", "!", "-{no}ssl : do updates over encrypted SSL connection"],
["ssl_ca_dir", "=s", "-ssl_ca_dir <dir> : look in <dir> for certificates of trusted certificate authorities (default: auto-detect)"],
["ssl_ca_file", "=s", "-ssl_ca_file <file> : look at <file> for certificates of trusted certificate authorities (default: auto-detect)"],
["retry", "!", "-{no}retry : retry failed updates"],
["force", "!", "-{no}force : force an update even if the update may be unnecessary"],
["timeout", "=i", "-timeout <max> : when fetching a URL, wait at most <max> seconds for a response"],
["syslog", "!", "-{no}syslog : log messages to syslog"],
["facility", "=s", "-facility <type> : log messages to syslog to facility <type>"],
["priority", "=s", "-priority <pri> : log messages to syslog with priority <pri>"],
["mail", "=s", "-mail <address> : e-mail messages to <address>"],
["mail-failure", "=s", "-mail-failure <addr> : e-mail messages for failed updates to <addr>"],
["exec", "!", "-{no}exec : do {not} execute; just show what would be done"],
["debug", "!", "-{no}debug : print {no} debugging information"],
["verbose", "!", "-{no}verbose : print {no} verbose information"],
["quiet", "!", "-{no}quiet : print {no} messages for unnecessary updates"],
["ipv6", "!", "-{no}ipv6 : use ipv6"],
["help", "", "-help : display this message and exit"],
["postscript", "", "-postscript : script to run after updating ddclient, has new IP as param"],
["query", "!", "-{no}query : print {no} ip addresses and exit"],
["fw-banlocal", "!", ""], ## deprecated
["if-skip", "=s", ""], ## deprecated
["test", "!", ""], ## hidden
["geturl", "=s", ""], ## hidden
"",
nic_examples(),
"$program version $version, ",