Skip to content

Server rotation fix#8567

Open
jigar-f wants to merge 4 commits intomainfrom
jigar/server-fix
Open

Server rotation fix#8567
jigar-f wants to merge 4 commits intomainfrom
jigar/server-fix

Conversation

@jigar-f
Copy link
Contributor

@jigar-f jigar-f commented Mar 24, 2026

This pull request introduces a new feature that checks if a VPN server tag is available before attempting to connect, improving reliability by avoiding connection attempts to unavailable servers. The change is implemented across the core Go backend, FFI bindings, platform channels (Android, iOS, macOS), and Dart service layers. Additionally, the VPN connection logic in the Flutter app is updated to use this check and fall back to auto-connect if the tag is not available. Minor refactoring is also included in the VPN notifier for improved readability.

New server tag availability check:

  • Added isTagAvailable function to the Go core (lantern-core/ffi/ffi.go, lantern-core/mobile/mobile.go) to check if a server tag exists, with a fail-open approach if the check cannot be performed. [1] [2]
  • Exposed the new check through FFI and platform channels, updating bindings and handlers for Android (MethodHandler.kt), iOS (MethodHandler.swift), and macOS (MethodHandler.swift). [1] [2] [3] [4] [5] [6] [7]
  • Implemented the isTagAvailable method in Dart service layers: LanternFFIService, LanternPlatformService, and LanternService, and added it to the LanternCoreService interface. [1] [2] [3] [4]

VPN connection logic improvements:

  • Updated VpnNotifier to check server tag availability before connecting; if unavailable, it falls back to auto VPN connection, preventing failed connection attempts to non-existent servers.
  • Minor refactoring in VpnNotifier for cleaner provider listening logic. [1] [2]

Other backend update:

  • Changed the VPN start logic in Go to use AutoConnect instead of QuickConnect, aligning with the new fallback behavior.

Copilot AI review requested due to automatic review settings March 24, 2026 12:19
@jigar-f jigar-f changed the title Server Fix server rotation fix Mar 24, 2026
@jigar-f jigar-f changed the title server rotation fix Server rotation fix Mar 24, 2026
@jigar-f jigar-f requested review from atavism and myleshorton March 24, 2026 12:23
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

Adds a cross-platform “tag availability” check so the app can avoid attempting to connect to a server tag that no longer exists, falling back to auto-connect instead.

Changes:

  • Introduces isTagAvailable(tag) on LanternCoreService and implements it via MethodChannel (mobile) and FFI (desktop/FFI-supported platforms).
  • Wires VpnNotifier to check tag availability before connecting to a specific server and fall back to auto VPN when unavailable.
  • Updates Go VPN start logic to use vpn.AutoConnect("") and exposes tag availability in Go mobile + FFI layers.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
macos/Runner/Handlers/MethodHandler.swift Adds MethodChannel handler for isTagAvailable calling into MobileIsTagAvailable.
ios/Runner/Handlers/MethodHandler.swift Adds MethodChannel handler for isTagAvailable calling into MobileIsTagAvailable.
android/app/src/main/kotlin/org/getlantern/lantern/handler/MethodHandler.kt Adds isTagAvailable method handling and calls into Mobile.isTagAvailable.
lib/lantern/lantern_core_service.dart Adds new isTagAvailable API to the shared service interface.
lib/lantern/lantern_service.dart Routes isTagAvailable to FFI vs platform implementations based on support.
lib/lantern/lantern_platform_service.dart Implements isTagAvailable over MethodChannel with fail-open behavior.
lib/lantern/lantern_generated_bindings.dart Adds generated binding for isTagAvailable FFI symbol.
lib/lantern/lantern_ffi_service.dart Implements isTagAvailable via FFI in a background worker.
lib/features/vpn/provider/vpn_notifier.dart Uses isTagAvailable before connecting to a specific tag; falls back to auto.
lantern-core/vpn_tunnel/vpn_tunnel.go Switches start VPN path from QuickConnect to AutoConnect.
lantern-core/mobile/mobile.go Exposes IsTagAvailable to gomobile consumers.
lantern-core/ffi/ffi.go Exposes isTagAvailable to Dart FFI consumers.

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

@jigar-f
Copy link
Contributor Author

jigar-f commented Mar 24, 2026

I am testing few more things on this.

* Update radiance + lantern-box for bandit distributed tracing (#8566)

- radiance: picks up lantern-box v0.0.51
- lantern-box v0.0.51: propagates traceparent from bandit callback URLs,
  enabling contiguous distributed tracing across the feedback loop

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* System tray changes (#8568)

* added back sys tray changes

* server location changes

* add flags only on desktop versions.

* code review updates (#8569)

* Update lantern_platform_service.dart

---------

Co-authored-by: atavism <atavism@users.noreply.github.com>

* Update radiance with bandit callback fixes (#8570)

Picks up:
- Pre-test uses live network config (not stale disk config)
- updateGroup fires SetURLOverrides + CheckOutbounds on repeat configs
- Pre-test timeout 5s → 15s for proxy callback tests

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* code review updates

---------

Co-authored-by: Myles Horton <afisk@getlantern.org>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: jigar-f <132374182+jigar-f@users.noreply.github.com>
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

Copilot reviewed 24 out of 25 changed files in this pull request and generated 5 comments.


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

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.

3 participants