Commit graph

1009 commits

Author SHA1 Message Date
jortkoopmans
ec2d5f7f69 dnsexit2: Add tests
Needs LWP::UserAgent.
2024-06-02 16:58:00 -04:00
Richard Hansen
282bb01e17 Bump version to v3.12.0~alpha
Enough has changed to warrant a minor revision bump.
2024-06-01 03:49:16 -04:00
Richard Hansen
a0e119c2f2
Merge pull request #681 from rhansen/group_hosts_by
group_hosts_by: Add IPv6 and undef/unset support
2024-06-01 03:09:18 -04:00
Richard Hansen
e60e6e804b group_hosts_by: Use Data::Dumper to make the group signature
This is a bit more robust than manually making the group signature
because it gracefully handles corner cases such as `undef`.
2024-06-01 03:06:06 -04:00
Richard Hansen
f4802fc534 Fix group_hosts_by call for IPv6-enabled services 2024-06-01 03:05:36 -04:00
Richard Hansen
343fcff625 group_hosts_by: Add support for wantipv4, wantipv6 2024-06-01 03:05:36 -04:00
Richard Hansen
ce0a362fd0 group_hosts_by: Add tests 2024-06-01 03:05:26 -04:00
Richard Hansen
ddb04075be
Merge pull request #680 from rhansen/dnsexit2
dnsexit2: Fix parsing of JSON response
2024-05-31 03:27:34 -04:00
Richard Hansen
f976b771d4 dnsexit2: Fix logging of erroneous response body 2024-05-30 18:29:38 -04:00
Richard Hansen
f7f4856b93 dnsexit2: Combine related log messages 2024-05-30 18:28:57 -04:00
Richard Hansen
24a22092ca dnsexit2: Don't croak if JSON decoding fails 2024-05-30 18:22:59 -04:00
Richard Hansen
d28c8ea7ad dnsexit2: Delete unnecessary debug messages 2024-05-30 17:56:51 -04:00
Richard Hansen
7b95b379aa dnsexit2: Fix extraction and processing of JSON response body 2024-05-30 17:52:12 -04:00
Richard Hansen
86ec02a9b6
Merge pull request #679 from rhansen/dnsexit2
dnsexit2: Minor fixes and improvements
2024-05-30 17:22:52 -04:00
Richard Hansen
2a47b17541 dnsexit2: Include the unexpected status in the error message 2024-05-30 16:26:44 -04:00
Richard Hansen
d8a1449a19 dnsexit2: Fix error message format string
This fixes a bug introduced in commit
2bf6d348b0.
2024-05-30 16:25:25 -04:00
Richard Hansen
6e5e2ab63f dnsexit2: Remove https:// from update service URL
This allows the `ssl` setting to control TLS vs. plain HTTP, and makes
it possible to create a compatible service that doesn't use TLS (e.g.,
for testing).
2024-05-30 16:21:25 -04:00
Richard Hansen
eebb1b8a47 dnsexit2: Delete redundant status-ipv* assignments 2024-05-30 16:19:41 -04:00
Richard Hansen
b3951e407a
Merge pull request #678 from rhansen/dnsexit2
dnsexit2: Code health improvements
2024-05-30 05:02:11 -04:00
Richard Hansen
3c84f7a1b5 dnsexit2: Delete unnecessary debug messages 2024-05-30 04:49:46 -04:00
Richard Hansen
5b7400ae7d dnsexit2: Normalize the zone up front 2024-05-30 04:48:44 -04:00
Richard Hansen
46bca54393 dnsexit2: Fix string interpolation 2024-05-30 04:04:19 -04:00
Richard Hansen
da9f39917f dnsexit2: Inline some unnecessary variables 2024-05-29 18:29:09 -04:00
Richard Hansen
6c89eaf4ac dnsexit2: Build updates array directly, not hash to array
to improve readability, and to make it easier to use
`group_hosts_by()` in the future to update multiple hosts at the same
time.
2024-05-29 18:25:24 -04:00
Richard Hansen
2bf6d348b0 dnsexit2: Reuse the $url variable 2024-05-29 18:25:24 -04:00
Richard Hansen
4804e15c12 dnsexit2: Add final comma after last list item
for consistency, and to avoid bugs if additional items are added or
the items are reordered.
2024-05-29 18:25:24 -04:00
Richard Hansen
7c4fe28bab dnsexit2: Simplify IP version loop 2024-05-29 17:57:20 -04:00
Richard Hansen
40d1bc8e51 dnsexit2: Clarify comments 2024-05-29 17:51:54 -04:00
Richard Hansen
18007dda8a dnsexit2: Delete unnecessary comments
Comments should only be used if the code is doing something
subtle/tricky/non-obvious/unusual, otherwise they're distracting and
might get out of sync with the code (in which case it becomes
difficult to tell if it's the comment or the code that's wrong).  If
the code is difficult to understand without comments but is doing
something ordinary, then the code needs to be modified to improve
readability.
2024-05-29 17:51:54 -04:00
Richard Hansen
61d34a9157 dnsexit2: Move code meanings closer to where it is used 2024-05-29 17:42:35 -04:00
Richard Hansen
df81075e49 dnsexit2: Rename variable to avoid confusion 2024-05-29 17:41:34 -04:00
Richard Hansen
ed7f4a68a4 dnsexit2: Rewrite circuitous variable assignments 2024-05-29 17:34:51 -04:00
Richard Hansen
3e91fd02bf dnsexit2: Invert conditions to improve readability
Instead of:

    if ($success1) {
        if ($success2) {
            if ($success3) {
                # yay
            } else {
                # fail
            }
        } else {
            # fail
        }
    } else {
        # fail
    }

do:

    if (!$success1) {
        # fail
    }
    if (!$success2) {
        # fail
    }
    if (!$success3) {
        # fail
    }
    # yay
2024-05-29 17:21:39 -04:00
Richard Hansen
9b1a785c6d dnsexit2: Don't repeat the same success message 2024-05-29 17:15:24 -04:00
Richard Hansen
3a5e86b4d2 dnsexit2: Convert string interpolation to sprintf format specifier
Rationale:
  * For consistency.
  * It's generally not a good idea to mix interpolation with `sprintf`
    because the interpolated string itself might coincidentally (or
    maliciously) contain format specifiers.
2024-05-29 17:10:06 -04:00
Richard Hansen
6cdf5da9f4 dnsexit2: Rename variable for brevity 2024-05-29 17:05:54 -04:00
Richard Hansen
63989d96fb dnsexit2: Move variable declaration to loop scope 2024-05-29 17:02:46 -04:00
Richard Hansen
0040fc9608 dnsexit2: Whitespace fixes 2024-05-29 17:02:46 -04:00
Richard Hansen
a91ca7a199 s/foreach/for/g for consistency 2024-05-29 16:48:00 -04:00
Richard Hansen
d1068bede1
Merge pull request #654 from TV4Fun/emailonly
Add 'emailonly' client to send status emails without needing a DDNS service
2024-05-25 15:13:36 -04:00
Joel Croteau
61b979c49e New 'emailonly' protocol that simply sends an email on IP change
This adds a protocol to email IP address changes without needing a
dynamic DNS service.  This is useful if you don't use a DDNS service
but want to be notified when the IP of a machine changes.
2024-05-25 00:38:10 -04:00
Richard Hansen
d8a9d9d089 Add support for infinite duration 2024-05-25 00:38:10 -04:00
Richard Hansen
65fb4db6cd
Merge pull request #676 from rhansen/logging
Various minor logging improvements
2024-05-23 02:07:40 -04:00
Richard Hansen
9c6e5fdda4 Output a | character in log message continuation lines
This makes it easier to tell where multi-line log messages begin and
end.
2024-05-23 02:04:29 -04:00
Richard Hansen
ff39ce3874 Don't use sprintf if there is only one argument
This avoids problems when logging a string that might have
metacharacters.
2024-05-23 02:04:19 -04:00
Richard Hansen
bcd57b486b Always log to STDERR, even for debug, info, etc.
Rationale:
  * Logging to STDERR enables separation of processable output (e.g.,
    `--version` or `--help`) and ephemeral status/error messages.
  * A single file descriptor for all log messages makes it easier for
    users to capture all log messages.
  * Consistency: it's what most utilities do.
2024-05-23 02:04:19 -04:00
Richard Hansen
d6693e0175 Use the de facto standard signature separator instead of "regards" 2024-05-23 01:57:12 -04:00
Richard Hansen
065b227711 logmsg: New low-level logging interface 2024-05-23 01:57:12 -04:00
Richard Hansen
f9dafa35a1 Rename $msgs to $emailbody to improve readability 2024-05-23 01:54:09 -04:00
Richard Hansen
66ec57a902
Merge pull request #670 from rhansen/status
Fix handling of legacy `status` with IPv6-aware protocols
2024-05-23 01:53:46 -04:00