Skip to content

Commit

Permalink
New -list-web-services option
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
rhansen authored and SuperSandro2000 committed May 15, 2022
1 parent 69996e9 commit f5932d8
Showing 1 changed file with 70 additions and 65 deletions.
135 changes: 70 additions & 65 deletions ddclient.in
Original file line number Diff line number Diff line change
Expand Up @@ -884,92 +884,97 @@ 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> : deprecated, see 'usev4' and 'usev6'"],
["use", "=s", "-use <which> : deprecated, see 'usev4' and 'usev6'"],
&ip_strategies_usage(),
[ "usev4", "=s", "-usev4 <which> : how the should IPv4 address be obtained."],
[ "usev4", "=s", "-usev4 <which> : how the should IPv4 address be obtained."],
&ipv4_strategies_usage(),
[ "usev6", "=s", "-usev6 <which> : how the should IPv6 address be obtained."],
[ "usev6", "=s", "-usev6 <which> : how the should IPv6 address be obtained."],
&ipv6_strategies_usage(),
"",
" Options that apply to 'use=ip':",
["ip", "=s", "-ip <address> : deprecated, use 'ipv4' or 'ipv6'"],
["ipv4", "=s", "-ipv4 <address> : set the IPv4 address to <address>"],
["ipv6", "=s", "-ipv6 <address> : set the IPv6 address to <address>"],
["ip", "=s", "-ip <address> : deprecated, use 'ipv4' or 'ipv6'"],
["ipv4", "=s", "-ipv4 <address> : set the IPv4 address to <address>"],
["ipv6", "=s", "-ipv6 <address> : set the IPv6 address to <address>"],
"",
" Options that apply to 'use=if':",
["if", "=s", "-if <interface> : deprecated, use 'ifv4' or 'ifv6'"],
["ifv4", "=s", "-ifv4 <interface> : obtain IPv4 address from <interface>"],
["ifv6", "=s", "-ifv6 <interface> : obtain IPv6 address from <interface>"],
["if", "=s", "-if <interface> : deprecated, use 'ifv4' or 'ifv6'"],
["ifv4", "=s", "-ifv4 <interface> : obtain IPv4 address from <interface>"],
["ifv6", "=s", "-ifv6 <interface> : obtain IPv6 address from <interface>"],
"",
" Options that apply to 'use=web':",
["web", "=s", "-web <service>|<url> : deprecated, use 'webv4' or 'webv6'"],
["web-skip", "=s", "-web-skip <pattern> : deprecated, use 'webv4-skip' or 'webv6-skip'"],
["webv4", "=s", "-webv4 <service>|<url>: obtain IPv4 address from a web-based IP discovery service, either a known <service> or a custom <url>"],
["webv4-skip", "=s", "-webv4-skip <pattern> : skip any IP addresses before <pattern> in the output of 'ip address show dev <interface>' (or 'ifconfig <interface>')"],
["webv6", "=s", "-webv6 <service>|<url>: obtain IPv6 address from a web-based IP discovery service, either a known <service> or a custom <url>"],
["webv6-skip", "=s", "-webv6-skip <pattern> : skip any IP addresses before <pattern> in the output of 'ip address show dev <interface>' (or 'ifconfig <interface>')"],
["web", "=s", "-web <service>|<url> : deprecated, use 'webv4' or 'webv6'"],
["web-skip", "=s", "-web-skip <pattern> : deprecated, use 'webv4-skip' or 'webv6-skip'"],
["webv4", "=s", "-webv4 <service>|<url>: obtain IPv4 address from a web-based IP discovery service, either a known <service> or a custom <url>"],
["webv4-skip", "=s", "-webv4-skip <pattern> : skip any IP addresses before <pattern> in the output of 'ip address show dev <interface>' (or 'ifconfig <interface>')"],
["webv6", "=s", "-webv6 <service>|<url>: obtain IPv6 address from a web-based IP discovery service, either a known <service> or a custom <url>"],
["webv6-skip", "=s", "-webv6-skip <pattern> : skip any IP addresses before <pattern> in the output of 'ip address show dev <interface>' (or 'ifconfig <interface>')"],
["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> : deprecated, use 'fwv4' or 'fwv6'"],
["fw-skip", "=s", "-fw-skip <pattern> : deprecated, use 'fwv4-skip' or 'fwv6-skip'"],
["fwv4", "=s", "-fwv4 <address>|<url> : obtain IPv4 address from device with IP address <address> or URL <url>"],
["fwv4-skip", "=s", "-fwv4-skip <pattern> : skip any IP addresses before <pattern> in the text returned from the device"],
["fwv6", "=s", "-fwv6 <address>|<url> : obtain IPv6 address from device with IP address <address> or URL <url>"],
["fwv6-skip", "=s", "-fwv6-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> : deprecated, use 'fwv4' or 'fwv6'"],
["fw-skip", "=s", "-fw-skip <pattern> : deprecated, use 'fwv4-skip' or 'fwv6-skip'"],
["fwv4", "=s", "-fwv4 <address>|<url> : obtain IPv4 address from device with IP address <address> or URL <url>"],
["fwv4-skip", "=s", "-fwv4-skip <pattern> : skip any IP addresses before <pattern> in the text returned from the device"],
["fwv6", "=s", "-fwv6 <address>|<url> : obtain IPv6 address from device with IP address <address> or URL <url>"],
["fwv6-skip", "=s", "-fwv6-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> : deprecated, use 'cmdv4' or 'cmdv6'"],
["cmd-skip", "=s", "-cmd-skip <pattern> : deprecated, filter in program wrapper script"],
["cmdv4", "=s", "-cmdv4 <command> : obtain IPv4 address from the output of <command>"],
["cmdv6", "=s", "-cmdv6 <command> : obtain IPv6 address from the output of <command>"],
["cmd", "=s", "-cmd <command> : deprecated, use 'cmdv4' or 'cmdv6'"],
["cmd-skip", "=s", "-cmd-skip <pattern> : deprecated, filter in program wrapper script"],
["cmdv4", "=s", "-cmdv4 <command> : obtain IPv4 address from the output of <command>"],
["cmdv6", "=s", "-cmdv6 <command> : obtain IPv6 address from the output of <command>"],
"",
["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)"],
["fw-ssl-validate","!", "-{no}fw-ssl-validate : Validate SSL certificate when retrieving IP address from firewall"],
["web-ssl-validate","!","-{no}web-ssl-validate : Validate SSL certificate when retrieving IP address from web"],
["curl", "!", "-{no}curl : use curl for network connections"],
["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>"],
["max-warn", "=i", "-max-warn <max> : log at most <max> warning messages for undefined IP address"],
["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"],
["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)"],
["fw-ssl-validate", "!", "-{no}fw-ssl-validate : Validate SSL certificate when retrieving IP address from firewall"],
["web-ssl-validate", "!","-{no}web-ssl-validate : Validate SSL certificate when retrieving IP address from web"],
["curl", "!", "-{no}curl : use curl for network connections"],
["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>"],
["max-warn", "=i", "-max-warn <max> : log at most <max> warning messages for undefined IP address"],
["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"],
["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, ",
Expand Down

0 comments on commit f5932d8

Please sign in to comment.