Skip to content

Migrate to libdns 1.0 API#2

Merged
anxuanzi merged 2 commits into
libdns:mainfrom
worr:feature/libdns-1.0
Jun 11, 2025
Merged

Migrate to libdns 1.0 API#2
anxuanzi merged 2 commits into
libdns:mainfrom
worr:feature/libdns-1.0

Conversation

@worr

@worr worr commented May 8, 2025

Copy link
Copy Markdown
Contributor

This migrates to the new libdns 1.0 API, which has some major changes, such as
excluding provider-specific details from the information passed between
providers and consumers.

This diff also addresses some bugs present as part of the old implementation
that were necessary to meet the new 1.0 API featureset, including the following:

  • SetRecords would not properly handle RRSets, only modifying the exact record
    specified
  • Many record types, like CAA, MX, NS and SRV were not supported
    properly, since ClouDNS requires more parameters for these fields.
  • If authenticating with a SubAuthID, you cannot provide an AuthID in the
    API call

I'm making this a draft PR for now since I want to add some more tests and also rebase in the new retry work that was added. An early review would definitely be appreciated :)

@mholt

mholt commented May 9, 2025

Copy link
Copy Markdown

Not a cloudns user, but a quick scan of the libdns-related code looks good! Nice work. And thank you! 🙏

@ghost-of-cerberus

Copy link
Copy Markdown

Not a cloudns user, but a quick scan of the libdns-related code looks good! Nice work. And thank you! 🙏

@worr I am and appreciate you picking this up!

@worr worr force-pushed the feature/libdns-1.0 branch 2 times, most recently from c994582 to f404c1d Compare May 10, 2025 10:47
@worr worr changed the title WIP: Migrate to libdns 1.0 API Migrate to libdns 1.0 API May 10, 2025
@worr worr marked this pull request as ready for review May 10, 2025 10:48
@worr

worr commented May 10, 2025

Copy link
Copy Markdown
Contributor Author

I've rebased on the new changes.

I have some concerns with the new changes however. I already opened up #3 about the logging. One change that I think is worth discussing in context of this PR is the propagation checks. Now, the tests do not run well for me unless I pump up the timeout to many minutes, since at least ClouDNS changes don't hit my region as quickly. I'm not sure that under libdns 1.0, this is an acceptable amount of time to wait for these calls to complete, since the docs say the following:

If it will take longer than a couple seconds, best to return an error.

This is in the context of retrying and recovery, but having calls to SetRecords/AppendRecords take minutes or more, especially as they take multiple records and propagation is checked per record, seems contrary to that goal.

@mholt

mholt commented May 10, 2025

Copy link
Copy Markdown

FWIW, I don't think libdns expects you to block until propagation completes. (You can do whatever you need to do in your tests, but the blocking isn't necessary in functions like SetRecords, etc.) Presumably, Caddy is the main consumer of libdns packages, and it actually does the waiting on propagation for you when it is necessary.

@worr

worr commented May 10, 2025

Copy link
Copy Markdown
Contributor Author

Cool, in that case I've removed the propagation logic as well since it'd be redundant.

worr added 2 commits May 11, 2025 11:47
This migrates to the new libdns 1.0 API, which has some major changes, such as
excluding provider-specific details from the information passed between
providers and consumers.

This diff also addresses some bugs present as part of the old implementation
that were necessary to meet the new 1.0 API featureset, including the following:

* `SetRecords` would not properly handle RRSets, only modifying the exact record
  specified
* Many record types, like `CAA`, `MX`, `NS` and `SRV` were not supported
  properly, since ClouDNS requires more parameters for these fields.
* If authenticating with a `SubAuthID`, you cannot provide an `AuthID` in the
API call
Propagation logic can explode the runtime of these functions, and the main
consumer of libdns, caddy, already handles this out of the library. No need for
it in an individual provider.
@mholt

mholt commented Jun 11, 2025

Copy link
Copy Markdown

If @anxuanzi is unavailable to review/merge this, we can add another maintainer, I dunno if @worr would be interested in that?

@mholt mholt requested a review from anxuanzi June 11, 2025 17:03

@anxuanzi anxuanzi left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you guys so much for working on this! Sorry for the late response. I was working on the update but got distracted by other projects. Thanks again for the PR!

@anxuanzi anxuanzi merged commit d94f4eb into libdns:main Jun 11, 2025
@mholt

mholt commented Jun 11, 2025

Copy link
Copy Markdown

Wonderful! Thank you @anxuanzi

@worr

worr commented Jun 16, 2025

Copy link
Copy Markdown
Contributor Author

@anxuanzi Thanks for the merge

@mholt Thanks for the consideration, but I don't plan on being more than a drive-by contributor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants