Skip to content

Revert ForceRelay default to false now that P2P issues are fixed#94

Closed
MichaelUray wants to merge 1 commit intonetbirdio:mainfrom
MichaelUray:fix/force-relay-default-false
Closed

Revert ForceRelay default to false now that P2P issues are fixed#94
MichaelUray wants to merge 1 commit intonetbirdio:mainfrom
MichaelUray:fix/force-relay-default-false

Conversation

@MichaelUray
Copy link
Copy Markdown

Summary

The ForceRelay default was set to true on iOS as a workaround for P2P stability issues. Now that the underlying ICE issues have been fixed upstream (netbirdio/netbird: guard loop fix #5805, candidate buffering, network address discovery #5807), P2P connections work reliably and should be enabled by default.

P2P connections are more efficient than relay for both performance and battery life, making the previous "battery optimization" rationale for forcing relay incorrect.

Changes

  • NetbirdKit/EnvVarPackager.swift: Remove iOS-specific #if os(iOS) block, set defaultForceRelay = false for all platforms
  • NetBird/Source/App/ViewModels/MainViewModel.swift: Change default from true to false, simplify getForcedRelayConnectionEnabled() to remove iOS-specific branch
  • NetBirdTests/SharedUserDefaultsTests.swift: Update test to assert false is the default

Users who have explicitly toggled this setting will not be affected as their preference is persisted in UserDefaults.

Related Issues

Related netbirdio/netbird#5589 — Default Force Relay to Off
Related netbirdio/netbird#3968 — Posture checks peer network range failed on iPhone
Related netbirdio/netbird#4657 — iOS Client loses all routes when Posture Checks are enabled

The default was set to true as a workaround for P2P stability issues
on iOS. Now that the underlying ICE issues are fixed upstream
(netbirdio/netbird: guard loop fix, candidate buffering, network
address discovery), P2P connections work reliably and should be
enabled by default.

P2P connections are more efficient than relay for both performance
and battery life, making the previous "battery optimization" rationale
for forcing relay incorrect.

Users who have explicitly toggled this setting will not be affected
as their preference is persisted in UserDefaults.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 16, 2026

Warning

Rate limit exceeded

@MichaelUray has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 30 minutes and 22 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 30 minutes and 22 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 23d675d1-5f9c-4910-b423-f1ef4f791a4b

📥 Commits

Reviewing files that changed from the base of the PR and between 7287988 and f8b1d68.

📒 Files selected for processing (3)
  • NetBird/Source/App/ViewModels/MainViewModel.swift
  • NetBirdTests/SharedUserDefaultsTests.swift
  • NetbirdKit/EnvVarPackager.swift
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@MichaelUray
Copy link
Copy Markdown
Author

MichaelUray commented Apr 25, 2026

Closing in favor of the broader proposal at netbirdio/netbird#5989, which replaces the binary ForceRelay flag with a 5-valued connection-mode enum and introduces two new modes (p2p-dynamic, p2p-dynamic-lazy) — always-on relay baseline + on-demand P2P upgrade per active peer.

This is the iOS sibling of netbirdio/android-client#152 (also closed in favor of the broader proposal); both PRs were straightforward ForceRelay default reverts that the new dynamic modes obsolete.

Rationale: the simple revert in this PR would address same-LAN P2P but reintroduce the battery cost of eager ICE for many idle peers — the original reason ForceRelay was set to true on mobile (netbirdio/netbird#1354, netbirdio/netbird#2138). The new dynamic modes give the same-LAN P2P benefit without that battery trade-off, while the proposal's phased framing avoids relitigating the default-flip question until field telemetry exists.

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.

1 participant