[PR #6724] Additional relay support. #29840

Open
opened 2026-08-05 08:09:07 -04:00 by saavagebueno · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/6724
Author: @PizzaLovingNerd
Created: 7/10/2026
Status: 🔄 Open

Base: mainHead: additional-relays


📝 Commits (4)

  • 1c0c7e2 Additional relay support.
  • 0e46843 Potential fix for pull request finding
  • 3a902b9 Added coderabbit suggested test
  • ae33fc2 switched to assert.ElementsMatch

📊 Changes

3 files changed (+131 additions, -6 deletions)

View changed files

📝 combined/cmd/config.go (+10 -5)
combined/cmd/config_test.go (+113 -0)
📝 combined/config.yaml.example (+8 -1)

📄 Description

Describe your changes

Add server.additionalRelays support to the combined server so operators can
advertise external relay servers without disabling the embedded relay and STUN
service.

The automatically generated embedded relay address remains first in the relay
list, followed by the configured additional relay addresses. The existing
server.relays replacement behavior is unchanged and continues to take
precedence when configured.

This change also:

  • documents the new setting in combined/config.yaml.example;
  • verifies that the embedded relay and STUN service remain enabled;
  • verifies relay address ordering and shared-secret configuration;
  • verifies that the existing server.relays override behavior is preserved;
  • verifies YAML loading and local relay secret validation.

The focused unit tests, race detector, go vet, and golangci-lint pass. The
configuration was also tested end-to-end with a combined server, two external
relays, and independent NetBird peers, including active-relay failover.

Closes https://github.com/netbirdio/netbird/issues/5351

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)
  • This change does not modify the public API, gRPC protocols, functionality behavior, CLI / service flags, or introduce a new feature — OR I have discussed it with the NetBird team beforehand (link the issue / Slack thread in the description). See CONTRIBUTING.md.

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)

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

Summary by CodeRabbit

  • New Features
    • Added support for advertising extra relays via additionalRelays while keeping the embedded/local relay enabled.
    • Client relay auto-configuration now includes the auto-detected local relay address followed by any configured additionalRelays.
  • Documentation
    • Clarified the difference between additionalRelays (augment) and relays (replace), including authSecret behavior and configuration examples.
  • Bug Fixes
    • Ensured relay configuration/validation requires the relay auth secret even when only additionalRelays are configured.
    • Confirmed that setting relays overrides additionalRelays (no augmentation).

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbirdio/netbird/pull/6724 **Author:** [@PizzaLovingNerd](https://github.com/PizzaLovingNerd) **Created:** 7/10/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `additional-relays` --- ### 📝 Commits (4) - [`1c0c7e2`](https://github.com/netbirdio/netbird/commit/1c0c7e27517e1adf0d8353cb7896e8b4d95bd6a1) Additional relay support. - [`0e46843`](https://github.com/netbirdio/netbird/commit/0e4684373b343d0814ced622337d8824ab99f797) Potential fix for pull request finding - [`3a902b9`](https://github.com/netbirdio/netbird/commit/3a902b94b80e5d1f85b96fd5fa6df9037f7bba65) Added coderabbit suggested test - [`ae33fc2`](https://github.com/netbirdio/netbird/commit/ae33fc258958da60e5cacf980dfd78811c0c053e) switched to assert.ElementsMatch ### 📊 Changes **3 files changed** (+131 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `combined/cmd/config.go` (+10 -5) ➕ `combined/cmd/config_test.go` (+113 -0) 📝 `combined/config.yaml.example` (+8 -1) </details> ### 📄 Description ## Describe your changes Add `server.additionalRelays` support to the combined server so operators can advertise external relay servers without disabling the embedded relay and STUN service. The automatically generated embedded relay address remains first in the relay list, followed by the configured additional relay addresses. The existing `server.relays` replacement behavior is unchanged and continues to take precedence when configured. This change also: - documents the new setting in `combined/config.yaml.example`; - verifies that the embedded relay and STUN service remain enabled; - verifies relay address ordering and shared-secret configuration; - verifies that the existing `server.relays` override behavior is preserved; - verifies YAML loading and local relay secret validation. The focused unit tests, race detector, `go vet`, and golangci-lint pass. The configuration was also tested end-to-end with a combined server, two external relays, and independent NetBird peers, including active-relay failover. ## Issue ticket number and link Closes https://github.com/netbirdio/netbird/issues/5351 ## Stack <!-- branch-stack --> ### Checklist - [ ] Is it a bug fix - [ ] Is a typo/documentation fix - [x] Is a feature enhancement - [ ] It is a refactor - [x] Created tests that fail without the change (if possible) - [x] This change does **not** modify the public API, gRPC protocols, functionality behavior, CLI / service flags, or introduce a new feature — **OR** I have discussed it with the NetBird team beforehand (link the issue / Slack thread in the description). See [CONTRIBUTING.md](https://github.com/netbirdio/netbird/blob/main/CONTRIBUTING.md#discuss-changes-with-the-netbird-team-first). > By submitting this pull request, you confirm that you have read and agree to the terms of the [Contributor License Agreement](https://github.com/netbirdio/netbird/blob/main/CONTRIBUTOR_LICENSE_AGREEMENT.md). ## Documentation Select exactly one: - [x] 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) https://github.com/netbirdio/docs/pull/847 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added support for advertising extra relays via `additionalRelays` while keeping the embedded/local relay enabled. * Client relay auto-configuration now includes the auto-detected local relay address followed by any configured `additionalRelays`. * **Documentation** * Clarified the difference between `additionalRelays` (augment) and `relays` (replace), including authSecret behavior and configuration examples. * **Bug Fixes** * Ensured relay configuration/validation requires the relay auth secret even when only `additionalRelays` are configured. * Confirmed that setting `relays` overrides `additionalRelays` (no augmentation). <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
saavagebueno added the pull-request label 2026-08-05 08:09:07 -04:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DYNR/netbird#29840