Skip to content

[mobile] Export lazy connection environment variables for mobile clients#5310

Merged
doromaraujo merged 2 commits intonetbirdio:mainfrom
doromaraujo:feature/export-lazy-connection-env-vars-mobile-clients
Feb 16, 2026
Merged

[mobile] Export lazy connection environment variables for mobile clients#5310
doromaraujo merged 2 commits intonetbirdio:mainfrom
doromaraujo:feature/export-lazy-connection-env-vars-mobile-clients

Conversation

@doromaraujo
Copy link
Copy Markdown
Contributor

@doromaraujo doromaraujo commented Feb 13, 2026

Since both Android and iOS apps run in a sandboxed context, to be able to set values for the lazy connection environment
variables, they will need to be exported to the gomobile generated code, have their values set within their respective apps and exported once they connect to the VPN, similarly how Force Relay is implemented.

Describe your changes

Issue ticket number and link

Stack

Checklist

  • Is it a bug fix
  • Is a typo/documentation fix
  • Is a feature enhancement
  • It is a refactor
  • Created tests that fail without the change (if possible)

By submitting this pull request, you confirm that you have read and agree to the terms of the Contributor License Agreement.

Documentation

Select exactly one:

  • I added/updated documentation for this change
  • Documentation is not needed for this change (explain why)

Docs PR URL (required if "docs added" is checked)

Paste the PR link from https://github.com/netbirdio/docs here:

https://github.com/netbirdio/docs/pull/__

Summary by CodeRabbit

  • New Features
    • Added configurable lazy-connection option for Android and iOS to enable deferred connection behavior.
    • Added an inactivity-threshold configuration on Android and iOS to control idle connection time and improve connection management.

Copilot AI review requested due to automatic review settings February 13, 2026 14:20
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 13, 2026

📝 Walkthrough

Walkthrough

Adds two lazy-connection environment keys to Android and iOS mobile SDKs: Android exposes string constants, iOS exposes getter functions; both map to values from the lazyconn package. Comment for Android's EnvKeyNBForceRelay clarified.

Changes

Cohort / File(s) Summary
Android Environment Keys
client/android/env_list.go
Added exported string constants EnvKeyNBLazyConn and EnvKeyNBInactivityThreshold mapped to lazyconn values; clarified comment for EnvKeyNBForceRelay.
iOS Environment Keys
client/ios/NetBirdSDK/env_list.go
Added exported getters GetEnvKeyNBLazyConn() and GetEnvKeyNBInactivityThreshold() returning lazyconn values; retained existing GetEnvKeyNBForceRelay().

Sequence Diagram(s)

(omitted — changes are small API additions without multi-component control-flow needing visualization)

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • pascal-fischer
  • pappz

Poem

"I’m a rabbit in the code, ears tuned to the stream,
Lazy hops and quiet naps make peer-to-peer dream.
Keys tucked in my pouch, thresholds soft and light,
Android and iOS, together we take flight! 🐇✨"

🚥 Pre-merge checks | ✅ 3 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Merge Conflict Detection ⚠️ Warning ❌ Merge conflicts detected (82 files):

⚔️ .github/workflows/check-license-dependencies.yml (content)
⚔️ .github/workflows/golang-test-darwin.yml (content)
⚔️ .github/workflows/golang-test-freebsd.yml (content)
⚔️ .github/workflows/golang-test-linux.yml (content)
⚔️ .github/workflows/golang-test-windows.yml (content)
⚔️ .github/workflows/golangci-lint.yml (content)
⚔️ .github/workflows/release.yml (content)
⚔️ .gitignore (content)
⚔️ .goreleaser.yaml (content)
⚔️ LICENSE (content)
⚔️ client/android/env_list.go (content)
⚔️ client/embed/embed.go (content)
⚔️ client/firewall/uspfilter/conntrack/tcp.go (content)
⚔️ client/firewall/uspfilter/conntrack/tcp_test.go (content)
⚔️ client/firewall/uspfilter/log/log.go (content)
⚔️ client/internal/engine.go (content)
⚔️ client/internal/networkmonitor/monitor.go (content)
⚔️ client/ios/NetBirdSDK/env_list.go (content)
⚔️ combined/cmd/config.go (content)
⚔️ combined/cmd/root.go (content)
⚔️ go.mod (content)
⚔️ infrastructure_files/getting-started.sh (content)
⚔️ management/cmd/management.go (content)
⚔️ management/cmd/root.go (content)
⚔️ management/internals/controllers/network_map/controller/controller.go (content)
⚔️ management/internals/modules/peers/manager.go (content)
⚔️ management/internals/modules/peers/manager_mock.go (content)
⚔️ management/internals/server/boot.go (content)
⚔️ management/internals/server/config/config.go (content)
⚔️ management/internals/server/modules.go (content)
⚔️ management/internals/server/server.go (content)
⚔️ management/server/account.go (content)
⚔️ management/server/account/manager.go (content)
⚔️ management/server/account_test.go (content)
⚔️ management/server/activity/codes.go (content)
⚔️ management/server/group_test.go (content)
⚔️ management/server/http/handler.go (content)
⚔️ management/server/http/handlers/peers/peers_handler.go (content)
⚔️ management/server/http/handlers/peers/peers_handler_test.go (content)
⚔️ management/server/http/testing/testing_tools/channel/channel.go (content)
⚔️ management/server/idp/auth0.go (content)
⚔️ management/server/idp/authentik.go (content)
⚔️ management/server/idp/azure.go (content)
⚔️ management/server/idp/embedded.go (content)
⚔️ management/server/idp/google_workspace.go (content)
⚔️ management/server/idp/keycloak.go (content)
⚔️ management/server/idp/pocketid.go (content)
⚔️ management/server/idp/util.go (content)
⚔️ management/server/idp/zitadel.go (content)
⚔️ management/server/mock_server/account_mock.go (content)
⚔️ management/server/networks/manager_test.go (content)
⚔️ management/server/networks/resources/manager.go (content)
⚔️ management/server/networks/resources/manager_test.go (content)
⚔️ management/server/peer.go (content)
⚔️ management/server/peer/peer.go (content)
⚔️ management/server/peer_test.go (content)
⚔️ management/server/permissions/modules/module.go (content)
⚔️ management/server/store/sql_store.go (content)
⚔️ management/server/store/sqlstore_bench_test.go (content)
⚔️ management/server/store/store.go (content)
⚔️ management/server/types/account.go (content)
⚔️ management/server/types/networkmap_golden_test.go (content)
⚔️ management/server/util/util.go (content)
⚔️ shared/management/client/rest/client.go (content)
⚔️ shared/management/client/rest/events.go (content)
⚔️ shared/management/client/rest/events_test.go (content)
⚔️ shared/management/client/rest/networks.go (content)
⚔️ shared/management/client/rest/networks_test.go (content)
⚔️ shared/management/client/rest/peers.go (content)
⚔️ shared/management/client/rest/peers_test.go (content)
⚔️ shared/management/client/rest/users.go (content)
⚔️ shared/management/client/rest/users_test.go (content)
⚔️ shared/management/http/api/openapi.yml (content)
⚔️ shared/management/http/api/types.gen.go (content)
⚔️ shared/management/proto/generate.sh (content)
⚔️ shared/management/proto/management.pb.go (content)
⚔️ shared/management/status/error.go (content)
⚔️ shared/relay/client/client.go (content)
⚔️ shared/relay/client/conn.go (content)
⚔️ util/log.go (content)
⚔️ util/syslog_nonwindows.go (content)
⚔️ util/syslog_windows.go (content)

These conflicts must be resolved before merging into main.
Resolve conflicts locally and push changes to this branch.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: exporting lazy connection environment variables for mobile clients.
Description check ✅ Passed The description includes rationale for the change and addresses the template's checklist items, but lacks detail in the 'Describe your changes' section.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
⚔️ Resolve merge conflicts (beta)
  • Auto-commit resolved conflicts to branch feature/export-lazy-connection-env-vars-mobile-clients
  • Post resolved changes as copyable diffs in a comment

No actionable comments were generated in the recent review. 🎉


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
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 pull request exports lazy connection environment variables for mobile clients (iOS and Android) to allow configuration from within their sandboxed environments. The changes enable mobile apps to set values for lazy connection features similarly to how Force Relay is currently implemented.

Changes:

  • Added exports for lazy connection environment variables (EnvEnableLazyConn and EnvInactivityThreshold) to both iOS and Android client bindings
  • Imported the lazyconn package alongside the existing peer package in both mobile platform implementations

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
client/ios/NetBirdSDK/env_list.go Added two getter functions to export lazy connection environment variable keys for iOS gomobile binding
client/android/env_list.go Added two exported package variables for lazy connection environment variable keys for Android Java client

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

Comment thread client/android/env_list.go Outdated
@sonarqubecloud
Copy link
Copy Markdown

@doromaraujo doromaraujo merged commit 1024d45 into netbirdio:main Feb 16, 2026
39 of 40 checks passed
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