Add peer-share toggle to lantern-core (Share My Connection PR 3/4)#8729
Open
myleshorton wants to merge 1 commit intomainfrom
Open
Add peer-share toggle to lantern-core (Share My Connection PR 3/4)#8729myleshorton wants to merge 1 commit intomainfrom
myleshorton wants to merge 1 commit intomainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds Lantern-side wiring for the Share My Connection feature by introducing a new peer-share toggle in lantern-core, exposed through both gomobile bindings and the existing C FFI surface, and backed by a radiance settings patch.
Changes:
- Add a
PeerShareinterface tolantern-coreand implementSetPeerShareEnabled/IsPeerShareEnabledvia radiance settings (PatchSettings+ snapshot read). - Expose the toggle through FFI exports (
setPeerProxyEnabled/isPeerProxyEnabled) and gomobile (SetPeerShareEnabled/IsPeerShareEnabled). - Temporarily bump
github.com/getlantern/radianceto a newer pseudo-version containingsettings.PeerShareEnabledKey.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| lantern-core/mobile/mobile.go | Adds gomobile-facing setters/getters to toggle peer-share and query its current state. |
| lantern-core/ffi/ffi.go | Adds C-exported functions to toggle/query peer-share from the Dart/FFI layer. |
| lantern-core/core.go | Introduces PeerShare interface and core implementation backed by radiance settings. |
| go.mod | Updates the radiance dependency to a newer pseudo-version for the new settings key. |
| go.sum | Updates sums to match the radiance version bump. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
2 tasks
myleshorton
pushed a commit
that referenced
this pull request
May 5, 2026
Final PR in the four-PR stack. Stacks on lantern #8729 (FFI exports); combined with radiance #458 / #460 / lantern-cloud #2678-#2681 this ships a feature-complete Phase 1 of "Share My Connection" for desktop (macOS + Linux + Windows). * lantern_generated_bindings.dart: add setPeerProxyEnabled + isPeerProxyEnabled. Manually inserted to match the existing pattern rather than regenerating the whole file (a local ffigen run from the macOS header would drop ~5K lines of Windows-only declarations the upstream generator emits). * LanternCoreService / LanternFFIService / LanternPlatformService / LanternService: add setPeerProxyEnabled / isPeerProxyEnabled across all four service layers, mirroring the setBlockAdsEnabled pattern. FFI path on isFFISupported platforms (Windows + Linux), MethodChannel fallback on macOS / mobile. * RadianceSettingsState: new peerProxy bool field with copyWith and equality. * RadianceSettings notifier: new setPeerProxy method (pessimistic — call FFI, log on failure, update state on success — matching setBlockAds). _refresh now reads peerProxy alongside the others. * vpn_setting.dart: SwitchButton tile gated to PlatformUtils.isDesktop with i18n strings share_my_connection / share_my_connection_subtitle in en.po. Other locales will pick up via the standard translation flow. Lifecycle end-to-end: Dart toggle → RadianceSettings.setPeerProxy(bool) → LanternService.setPeerProxyEnabled → FFI: setPeerProxyEnabled(int) -> *char → Core.SetPeerShareEnabled(bool) → ipc.Client.PatchSettings({PeerShareEnabledKey: ...}) → radiance LocalBackend.PatchSettings dispatch → peer.Client.Start / Stop → UPnP MapPort + register + sing-box samizdat inbound + heartbeat flutter analyze: clean. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
PR 3 of 4 implementing the lantern-side wiring for "Share My Connection". Bumps radiance to fisk/peer-localbackend tip so we can reference the new PeerShareEnabledKey setting; that bump is provisional and should be re-pinned to a release tag once radiance #460 merges. * lantern-core/core.go: new PeerShare interface (mirrors Ads / SmartRouting), embedded in Core. SetPeerShareEnabled patches PeerShareEnabledKey via the radiance ipc client; IsPeerShareEnabled reads the snapshot. * lantern-core/ffi/ffi.go: new //export setPeerProxyEnabled and //export isPeerProxyEnabled, mirroring setBlockAdsEnabled exactly. The Dart FFI binding name uses "PeerProxy" to match the existing user-facing naming in the lantern repo (vpn_setting.dart toggle was drafted as "Peer Proxy"). * lantern-core/mobile/mobile.go: SetPeerShareEnabled / IsPeerShareEnabled for the gomobile-bind surface so Android can toggle once Dart wires it up in PR 4. The lifecycle path: Dart toggle → setPeerProxyEnabled(enabled) → LanternCore.SetPeerShareEnabled → ipc.Client.PatchSettings({PeerShareEnabledKey: ...}) → radiance LocalBackend.PatchSettings dispatch → peer.Client.Start / Stop ffigen regen for the Dart bindings happens in PR 4 alongside the Dart wire-through and rollback logic. go test ./lantern-core/... and golangci-lint --new-from-rev=origin/main both clean. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
myleshorton
pushed a commit
that referenced
this pull request
May 5, 2026
Final PR in the four-PR stack. Stacks on lantern #8729 (FFI exports); combined with radiance #458 / #460 / lantern-cloud #2678-#2681 this ships a feature-complete Phase 1 of "Share My Connection" for desktop (macOS + Linux + Windows). * lantern_generated_bindings.dart: add setPeerProxyEnabled + isPeerProxyEnabled. Manually inserted to match the existing pattern rather than regenerating the whole file (a local ffigen run from the macOS header would drop ~5K lines of Windows-only declarations the upstream generator emits). * LanternCoreService / LanternFFIService / LanternPlatformService / LanternService: add setPeerProxyEnabled / isPeerProxyEnabled across all four service layers, mirroring the setBlockAdsEnabled pattern. FFI path on isFFISupported platforms (Windows + Linux), MethodChannel fallback on macOS / mobile. * RadianceSettingsState: new peerProxy bool field with copyWith and equality. * RadianceSettings notifier: new setPeerProxy method (pessimistic — call FFI, log on failure, update state on success — matching setBlockAds). _refresh now reads peerProxy alongside the others. * vpn_setting.dart: SwitchButton tile gated to PlatformUtils.isDesktop with i18n strings share_my_connection / share_my_connection_subtitle in en.po. Other locales will pick up via the standard translation flow. Lifecycle end-to-end: Dart toggle → RadianceSettings.setPeerProxy(bool) → LanternService.setPeerProxyEnabled → FFI: setPeerProxyEnabled(int) -> *char → Core.SetPeerShareEnabled(bool) → ipc.Client.PatchSettings({PeerShareEnabledKey: ...}) → radiance LocalBackend.PatchSettings dispatch → peer.Client.Start / Stop → UPnP MapPort + register + sing-box samizdat inbound + heartbeat flutter analyze: clean. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
PR 3 of 4 implementing the lantern-side wiring for Share My Connection (peer-proxy). Builds on radiance #458 (peer module) and #460 (LocalBackend wiring).
Lifecycle
```
Dart toggle → setPeerProxyEnabled(C.int)
→ LanternCore.SetPeerShareEnabled(bool)
→ ipc.Client.PatchSettings({PeerShareEnabledKey: ...})
→ radiance LocalBackend.PatchSettings dispatch
→ peer.Client.Start / Stop
```
What's in here
lantern-core/core.go— newPeerShareinterface (mirrorsAds/SmartRouting), embedded inCore.SetPeerShareEnabledpatches via the radiance IPC client;IsPeerShareEnabledreads the snapshot.lantern-core/ffi/ffi.go—//export setPeerProxyEnabledand//export isPeerProxyEnabled, mirroringsetBlockAdsEnabled/isBlockAdsEnabledexactly.lantern-core/mobile/mobile.go— gomobile-bind surface (SetPeerShareEnabled/IsPeerShareEnabled) so Android can toggle once Dart wires it up.go.mod/go.sum— provisional radiance bump to6a238ce(fisk/peer-localbackend tip).Naming
C export name uses
PeerProxyto match the existing user-facing terminology in this repo (the toggle stub inlib/features/setting/vpn_setting.dartwas drafted as "Peer Proxy"). Internal Go names usePeerShareto match the radiance setting key (PeerShareEnabledKey). The Dart side will routesetPeerProxyEnabledin PR 4.What's NOT in here (PR 4)
ffigenregen for the auto-generated Dart bindings.LanternFFIService.setPeerProxyEnabledDart method.app_setting_notifier.setPeerProxy()body rewrite (mirrorsetBlockAdsrollback pattern)./peer/status/eventsfrom radiance Write a complete spec of Lantern in preparation for a security audit #460).Test plan
go build ./lantern-core/...go test ./lantern-core/...golangci-lint run --new-from-rev=origin/main ./lantern-core/...🤖 Generated with Claude Code