Skip to content

Conversation

@WendelHime
Copy link
Contributor

@WendelHime WendelHime commented Dec 15, 2025

This PR creates a package for handling kindling http client and places that refer to the http client now get notified to retrieve a new http client with new config available.
It also improve the list of DNSTT configurations available.

Out of scope:
This PR isn't loading the configurations since dnstt integration tests are still failing and getlantern/engineering#2872 should cover that

Resolve getlantern/engineering#2869

@WendelHime WendelHime marked this pull request as ready for review December 16, 2025 14:48
Copilot AI review requested due to automatic review settings December 16, 2025 14:48
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the handling of the Kindling HTTP client by introducing a dedicated kindling package that centralizes client management and enables dynamic updates. The key improvements include consolidating Kindling initialization logic, supporting runtime updates when DNSTT configurations change, and improving the structure of DNSTT configuration handling to support multiple configurations instead of a single one.

Key changes:

  • Created a new kindling package that manages HTTP client lifecycle and notifies consumers when new configurations are available
  • Modified DNSTT configuration parsing to support multiple configurations (dnsttConfigs array) instead of a single dnstt object
  • Added mutex-protected HTTP client updates across API, config fetcher, and issue reporter components

Reviewed changes

Copilot reviewed 10 out of 15 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
radiance.go Simplified Radiance initialization by delegating Kindling setup to the new package
kindling/client.go New package file implementing centralized HTTP client management with event-based updates
kindling/dnstt/parser.go Refactored to parse multiple DNSTT configurations and emit update events
kindling/dnstt/parser_test.go Updated tests to reflect new multi-config structure
api/api.go Added mutex and event subscription to handle HTTP client updates
api/user.go Added mutex locks around HTTP client usage in user-related API calls
api/subscription.go Added mutex locks around HTTP client usage in subscription-related API calls
config/fetcher.go Added mutex and event subscription for HTTP client updates
issue/issue.go Added mutex and event subscription for HTTP client updates
config/fetcher_test.go Updated import path for fronted package

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

fixing typo and using correct `newHTTPClient`

Co-authored-by: Copilot <[email protected]>
Copy link
Collaborator

@garmr-ulfr garmr-ulfr left a comment

Choose a reason for hiding this comment

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

A couple of comments, otherwise, LGTM.

@myleshorton
Copy link
Contributor

Definitely opposed to adding all this locking and storing of http client state. I would revert the change here:

https://github.com/getlantern/kindling/pull/22/changes#diff-6b0f41a9a52c4516297a0a7d67b2a60f85783f9cc33b6234dc32e5759f1118deR96

that also breaks all other uses of DefaultClient, and just create call NewHTTPClient dynamically whenever we need one.

tbh I also don't think we should go to such lengths to support DNSTT config changes from the config server. why DNSTT and not other transports?

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