Commit Graph

19 Commits

Author SHA1 Message Date
Quentin McGaw
05d566c807 chore(all): format code using gofumpt 2024-10-20 13:12:33 +00:00
Benjamin Temple
4254600bcf Provider Porkbun: Delete Default Parked DNS Entry for *.domain.tld (#774)
* Provider Porkbun: Delete Default Parked DNS Entry for *.domain.tld

Description:

By default, Porkbun creates default ALIAS and CNAME domain records pointing to `pixie.porkbun.com` (Porkbun's parked domain website)

The current logic flow prior to this PR would look for an A or AAAA domain record, and if none exists, attempt to delete the ALIAS record for any subdomain.
This updates the logic flow to only look for a conflicting ALIAS record for the top level `domain.tld`, and a conflicting CNAME record for the `*.domain.tld`. Additionally, we verify that the content of this record matches `pixie.porkbun.com` and we only delete for the expected default values.
If the value does not match the expected `pixie.porkbun.com` we produce more helpful error messages.

Test-Plan:

Created a new domain.tld on Porkbun
Verified the default records were created:
`ALIAS domain.tld -> pixie.porkbun.com`
`CNAME *.domain.tld -> pixie.porkbun.com`
Started DDNS-Updater
Verified that both domain records were successfully deleted and updated

Reset the ALIAS domain record to point to `not-pixie.porkbun.com`
Reset the CNAME domain record to point to `not-pixie.porkbun.com`
Started DDNS-Updater
Verified that both domain records failed with the expected conflicting record error message.

![screenshot_2024-08-17-0210 20](https://github.com/user-attachments/assets/eb567401-ad4b-454d-a7aa-70ab1db1e3e9)

- add `deleteDefaultConflictingRecordsIfNeeded` method
- handle non conflicting errors from `deleteSingleMatchingRecord`
- simplify comments by linking to documentation
- improve error wrappings

---------

Co-authored-by: Quentin McGaw <quentin.mcgaw@gmail.com>
2024-10-07 21:46:12 -07:00
Quentin McGaw
dbd2f79760 chore(providers): move domain check to each provider validation 2024-06-27 08:37:04 +00:00
Quentin McGaw
da4791e2db chore(providers): separate settings validation in its own function 2024-06-27 08:26:36 +00:00
Quentin McGaw
32fafeca95 chore(all): rename host to owner
- Retro-compatible change, `host` field still works
- Documentation updated to use `owner` field
- Code updated to use owner variable name
2024-06-27 06:51:08 +00:00
Quentin McGaw
d37f05766b chore(providers): change ttl type to uint32 2024-06-17 19:01:08 +00:00
Quentin McGaw
1697697b81 chore(porkbun): add context to top level errors 2024-02-09 10:00:13 +00:00
Quentin McGaw
bad0d3aeda fix(ipv6): add JSON IPv6 suffix parameter (#611)
- Remove `IPV6_PREFIX` environment variable (unneeded) and remove associated code
- Update all documentation for each provider supporting IPv6
- Build IPv6 as prefix:suffix when getting it from a public IP source for each record IPv6 suffix parameter
- Automatically disable provider_ip if public ip is IPv6 and IPv6 suffix is set (they are not compatible with each other)
2024-01-29 17:31:07 +01:00
Quentin McGaw
869b010853 fix(porkbun): delete ALIAS record before creating an A or AAAA record 2024-01-18 17:15:41 +00:00
Quentin McGaw
46054fb631 chore(porkbun): split API specific code to api.go 2024-01-18 17:03:59 +00:00
Quentin McGaw
28b2e121da feat(porkbun): json decode error messages 2024-01-18 16:58:49 +00:00
Felix Wirth
5c0b2012b7 fix(ui): include ip version for all providers (#512) 2023-08-08 09:06:08 +02:00
Quentin McGaw
5a353c1b66 chore(models): remove unneeded HTML string alias type 2023-06-16 09:14:43 +00:00
Quentin McGaw
1033711ab4 chore(provider): review update errors and wrappings
- `ErrBadHTTPStatus` -> `ErrHTTPStatusNotValid`
- `ErrNumberOfResultsReceived` -> `ErrResultsCountReceived`
- `ErrNoResultReceived` -> `ErrReceivedNoResult`
- `ErrAbuse` -> `ErrBannedAbuse`
- `ErrInvalidSystemParam` -> `ErrSystemParamNotValid`
- `ErrNoIPInResponse` -> `ErrReceivedNoIP`
- `ErrUnsuccessfulResponse` -> `ErrUnsuccessful`
- Remove `ErrRequestEncode` and `ErrRequestMarshal` and wrap errors with string instead
- Remove `ErrUnmarshalResponse` and wrap errors with string instead
- Add `ErrResponseTooShort`
- Remove `ErrNotFound` and replace with more precise not found errors
- Add `ErrRecordResourceSetNotFound` error
- Sort errors list alphabetically
2023-06-15 07:13:14 +00:00
Quentin McGaw
f2b56afda7 chore(providers): review error wrappings for client.Do
- Do not wrap with sentinel error ErrUnsuccesfulResponse
- Wrap with text `doing http request`
2023-06-15 06:42:38 +00:00
Quentin McGaw
c26b3fc0d3 chore(provider/errors): review error names and text
- Move problem part at end of error variable name for better autocompletion
- Move problem part at end of error message to match error variable name
- Change `Empty` -> `NotSet`
- Change `Malformed` -> `NotValid`
- Sort all errors alphabetically
2023-06-15 06:31:29 +00:00
Quentin McGaw
05473044a6 fix(providers): review all http headers
- Add missing header(s) for some providers
- Remove provider receiver on `setHeaders` function when not needed
- Inline `setHeaders` function body when used only once for provider
- Remove unneeded headers such as content-type for GET requests
2023-06-15 06:14:13 +00:00
Quentin McGaw
6e65c4f3a5 chore(providers): use errors.BadRequest for badrequest responses only
- Replace HTTP request creation error wrappings with string
- Add missing HTTP request creation error wrappings
2023-06-15 05:48:07 +00:00
Quentin McGaw
4a6020558f chore(all): rename settings package to provider
- internal/provider: rename `Settings` interface to `Provider`
- internal/params: rename *Settings* to *Providers*
- internal/records: rename `Settings` to `Provider`
2023-06-14 06:25:56 +00:00