Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(client): clean-up dns01 request code #23

Merged
merged 3 commits into from
Dec 19, 2024
Merged

Conversation

lidel
Copy link
Contributor

@lidel lidel commented Dec 17, 2024

Client code was really bad when things went wrong. p2p-forge looked like error returned by Let's Encrypt, and we don't want users bothering them with problems caused by our DNS TXT record broker.

  • remove duplicated/unused request code
  • add logs to dns01 solver showing what is happening and where, so on error it is clear which part of the flow failed
  • ci passes green
    • ⚠️ this regression (e2e_test.go:250: failed to run handshake: signature not set) must be something obvious, but I don't see it yet. Created chore: go-libp2p@37fbd7 #24 to confirm it is not a problem with my local setup. Ideas welcome.

@lidel lidel changed the title refactor(client): cleanup dns01 request code refactor(client): clean-up dns01 request code Dec 17, 2024
@lidel lidel mentioned this pull request Dec 17, 2024
2 tasks
removed duplicated/unused code, added logs
@lidel lidel force-pushed the refactor-client-request branch from 7e83663 to af85ef7 Compare December 17, 2024 21:17
// Construction of the request requires a list of multiaddresses that the peerID is listening on using
// publicly reachable IP addresses.
//
// Sending the request to the DNS server requires performing HTTP PeerID Authentication for the corresponding peerID
func ChallengeRequest(ctx context.Context, baseURL string, challenge string, addrs []multiaddr.Multiaddr) (*http.Request, error) {
func ChallengeRequest(ctx context.Context, registrationURL string, challenge string, addrs []multiaddr.Multiaddr) (*http.Request, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

@lidel the reason why the test is now failing is that you changed the semantics to this function which is the one called by the test (i.e. there is now a 404 here because adding "/v1/_acme-challenge" was removed. So the test needs modification also (e.g. to the changed ChallengeRequest semantics or perhaps to just use SendChallenge now).

It might also be worth considering if both of these functions need exporting or not.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks!

Let's keep them, I feel they may be useful in testing, solving the problem of the same code in 2-3 places, like in was in our case before this PR.

@lidel lidel marked this pull request as ready for review December 19, 2024 16:11
@lidel
Copy link
Contributor Author

lidel commented Dec 19, 2024

CI green, merging to include in Kubo 0.33.0-rc1

@lidel lidel merged commit bebe2f4 into main Dec 19, 2024
4 checks passed
@lidel lidel deleted the refactor-client-request branch December 19, 2024 16:14
lidel added a commit to ipfs/kubo that referenced this pull request Dec 19, 2024
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.

2 participants