restructure codebase around LocalBackend with clear data ownership#370
Draft
garmr-ulfr wants to merge 10 commits intomainfrom
Draft
restructure codebase around LocalBackend with clear data ownership#370garmr-ulfr wants to merge 10 commits intomainfrom
garmr-ulfr wants to merge 10 commits intomainfrom
Conversation
…ith VPNStatus type Introduce a Server-Sent Events endpoint (/status/events) that streams VPN status changes to clients in real time, replacing the previous poll-based approach. Refactor status representation from string constants (StatusRunning, StatusClosed, etc.) to a typed VPNStatus enum (Connected, Disconnected, Connecting, Disconnecting, Restarting, ErrorStatus) and move status emission from the IPC server into the tunnel layer. The tracer middleware is scoped to standard routes so it no longer buffers long-lived SSE connections, and the HTTP transport is upgraded to unencrypted HTTP/2 for multiplexed streaming support.
…terns Reorganize the project architecture to establish clear data ownership and dependency flow, inspired by Tailscale's LocalBackend/localapi pattern.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
LocalBackendas central orchestrator, replacing the oldRadiancestructTunnelServicetoVPNClientwith all VPN operations as methodscmd/lantern) for interacting with the daemon over IPCPackage changes
api/→account/, replacing resty withnet/httpvpn/ipc/→ root-levelipc/with separate client/serverbackend/package withLocalBackendlog/package for logger creation and log streaming viaPublishHandleroption/packageArchitecture
ipc → vpn(not reverse)settings.jsonBug fixes
reflect.Typeinstead of zero-value instancessetData()change detection (&&→||)internal.LevelTrace→log.LevelTraceimport errors in several packagesOther
config.Configto aliasConfigResponsedirectlyservers.Managermap tomap[string]Servergo-resty/resty/v2, addalexflint/go-argandgolang.org/x/termTest plan
go build ./...passesgo vet ./...passesgo test ./...passes