Open
Conversation
WendelHime
reviewed
Apr 13, 2026
WendelHime
approved these changes
Apr 13, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Adds persistence for the currently selected VPN server so selection can survive VPN lifecycle restarts (notably on Android), and refactors tunnel restart flow for clarity.
Changes:
- Persist selected server (group/tag) to a JSON file under the app data directory; add helpers to clear/read the persisted selection.
- Update
AutoConnect/SelectServerto update the persisted selection whenever the selection changes. - Refactor
restartTunnel()to delegate toRestart(), and adjust related comments/formatting.
Reviewed changes
Copilot reviewed 1 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
vpn/vpn.go |
Adds selection persistence helpers and calls them from selection flows; refactors tunnel restart implementation. |
common/settings/settings.go |
Minor formatting/alignment cleanup of settings key constants. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
garmr-ulfr
approved these changes
Apr 15, 2026
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.
This pull request adds persistent storage for the selected VPN server, ensuring that the server choice survives Android VPN service restarts and OS-driven tunnel lifecycle events. It also introduces helper functions to manage this persisted state, updates the
SelectServerlogic to save selections, and refactors tunnel restart logic for clarity.Persistent server selection:
persistSelectionfunction and supporting helpers (ClearLastSelectedServer,LastSelectedServer) to save and retrieve the selected server to a JSON file in the app's data directory, ensuring the selection can be restored after service restarts.Server selection logic:
SelectServerandAutoConnectto callpersistSelectionwhenever the server selection changes, so the persisted state always matches the current selection. [1] [2]SelectServerto clarify the persistence mechanism and its purpose in the Android VPN lifecycle.Tunnel restart logic:
restartTunnelto use the newRestartfunction, which now stops and starts the service, improving clarity and reliability.Restartto accurately reflect its behavior.Other:
preTest), removing an unnecessary blank line.