[PR #5612] [MERGED] [management] Accept domain target type for L4 reverse proxy services #26273

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

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/5612
Author: @lixmal
Created: 3/17/2026
Status: Merged
Merged: 3/17/2026
Merged by: @lixmal

Base: mainHead: fix/l4-domain-target-type


📝 Commits (2)

  • 63c2611 Accept domain target type for L4 services and validate resource type matches
  • 8d15835 Fix UDP test protocol and reduce validateTargetReferences complexity

📊 Changes

4 files changed (+124 additions, -11 deletions)

View changed files

📝 management/internals/modules/reverseproxy/service/manager/manager.go (+39 -10)
📝 management/internals/modules/reverseproxy/service/manager/manager_test.go (+58 -0)
📝 management/internals/modules/reverseproxy/service/service.go (+1 -1)
📝 management/internals/modules/reverseproxy/service/service_test.go (+26 -0)

📄 Description

Describe your changes

L4 services (TCP/TLS/UDP) rejected target_type: "domain" even though HTTP services accepted it. This caused domain-backed resources to fail when used as targets for L4 services. Additionally, there was no validation that target_type matched the actual network resource type, so sending target_type: "host" for a domain resource would silently produce an invalid backend address.

This PR adds TargetTypeDomain to L4 validation and cross-validates that the declared target_type matches the actual resource type during validateTargetReferences.

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

    • Domain targets are now supported in Layer 4 services (TCP, TLS, UDP).
  • Improvements

    • Target validation now centralizes checks and enforces that configured target types match the actual resource types, producing clearer errors for mismatches.
  • Tests

    • Added tests covering target type validation and Layer 4 domain target acceptance.

🔄 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/5612 **Author:** [@lixmal](https://github.com/lixmal) **Created:** 3/17/2026 **Status:** ✅ Merged **Merged:** 3/17/2026 **Merged by:** [@lixmal](https://github.com/lixmal) **Base:** `main` ← **Head:** `fix/l4-domain-target-type` --- ### 📝 Commits (2) - [`63c2611`](https://github.com/netbirdio/netbird/commit/63c26116d978e76470b32e0f748470f3551d6a53) Accept domain target type for L4 services and validate resource type matches - [`8d15835`](https://github.com/netbirdio/netbird/commit/8d158352fb8fc28c8c8162221d3711d51e83bbce) Fix UDP test protocol and reduce validateTargetReferences complexity ### 📊 Changes **4 files changed** (+124 additions, -11 deletions) <details> <summary>View changed files</summary> 📝 `management/internals/modules/reverseproxy/service/manager/manager.go` (+39 -10) 📝 `management/internals/modules/reverseproxy/service/manager/manager_test.go` (+58 -0) 📝 `management/internals/modules/reverseproxy/service/service.go` (+1 -1) 📝 `management/internals/modules/reverseproxy/service/service_test.go` (+26 -0) </details> ### 📄 Description ## Describe your changes L4 services (TCP/TLS/UDP) rejected `target_type: "domain"` even though HTTP services accepted it. This caused domain-backed resources to fail when used as targets for L4 services. Additionally, there was no validation that `target_type` matched the actual network resource type, so sending `target_type: "host"` for a domain resource would silently produce an invalid backend address. This PR adds `TargetTypeDomain` to L4 validation and cross-validates that the declared `target_type` matches the actual resource type during `validateTargetReferences`. ## Issue ticket number and link ## Stack <!-- branch-stack --> ### Checklist - [x] Is it a bug fix - [ ] Is a typo/documentation fix - [ ] Is a feature enhancement - [ ] It is a refactor - [x] 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](https://github.com/netbirdio/netbird/blob/main/CONTRIBUTOR_LICENSE_AGREEMENT.md). ## Documentation Select exactly one: - [ ] I added/updated documentation for this change - [x] 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/__ <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Domain targets are now supported in Layer 4 services (TCP, TLS, UDP). * **Improvements** * Target validation now centralizes checks and enforces that configured target types match the actual resource types, producing clearer errors for mismatches. * **Tests** * Added tests covering target type validation and Layer 4 domain target acceptance. <!-- 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 07:07: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#26273