[PR #5695] [MERGED] [client] Add Expose support to embed library #23669

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

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/5695
Author: @pappz
Created: 3/25/2026
Status: Merged
Merged: 3/30/2026
Merged by: @pappz

Base: mainHead: feature/embed-expose


📝 Commits (8)

  • 1c80258 [client] Add Expose support to embed library
  • 5582489 Fix TestNewRequest assertion to use ProtocolType instead of int
  • d9f54d5 Add documentation for Request and KeepAlive in expose manager
  • 1d8a2f6 Refactor ExposeSession to pass context explicitly in Wait method
  • 40cc469 Refactor ExposeSession Wait method to explicitly pass context
  • 3989f80 Update client/embed/expose.go
  • b1a8fa6 Fix build
  • 2cb2aeb Update client/embed/expose.go

📊 Changes

7 files changed (+140 additions, -16 deletions)

View changed files

📝 client/cmd/expose.go (+13 -7)
📝 client/embed/embed.go (+29 -3)
client/embed/expose.go (+45 -0)
📝 client/internal/expose/manager.go (+10 -3)
📝 client/internal/expose/manager_test.go (+1 -1)
client/internal/expose/protocol.go (+40 -0)
📝 client/internal/expose/request.go (+2 -2)

📄 Description

Describe your changes

Add Expose API to the embed library, allowing programmatic creation and
management of service exposures (HTTP, HTTPS, TCP, UDP, TLS) from embedded
client code.

Introduces ExposeSession with a blocking Wait method that keeps the exposure
alive until the context is cancelled. Extracts ProtocolType into a shared
expose package for reuse across CLI and embed layers.

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

    • Expose local services publicly with support for HTTP, HTTPS, TCP, UDP, and TLS.
    • Client API to create and manage exposures, returning sessions with domain, service name, and service URL.
    • Session "wait" to keep exposures alive until explicitly stopped.
  • Bug Fixes / Improvements

    • Improved protocol parsing using a typed protocol enum and clearer validation errors for unsupported protocol values.

🔄 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/5695 **Author:** [@pappz](https://github.com/pappz) **Created:** 3/25/2026 **Status:** ✅ Merged **Merged:** 3/30/2026 **Merged by:** [@pappz](https://github.com/pappz) **Base:** `main` ← **Head:** `feature/embed-expose` --- ### 📝 Commits (8) - [`1c80258`](https://github.com/netbirdio/netbird/commit/1c80258f49731083cd748fcdc34a9ca9e31392da) [client] Add Expose support to embed library - [`5582489`](https://github.com/netbirdio/netbird/commit/55824890da84546fee92aa0ab5dd15406b77ce08) Fix TestNewRequest assertion to use ProtocolType instead of int - [`d9f54d5`](https://github.com/netbirdio/netbird/commit/d9f54d50581dd083f8873dd78337ebbd1ad4e2e1) Add documentation for Request and KeepAlive in expose manager - [`1d8a2f6`](https://github.com/netbirdio/netbird/commit/1d8a2f6d71f59a5215fea8973a2f2721a04e2990) Refactor ExposeSession to pass context explicitly in Wait method - [`40cc469`](https://github.com/netbirdio/netbird/commit/40cc469a9eff165daeacf591a6bcf9a21d6b7dac) Refactor ExposeSession Wait method to explicitly pass context - [`3989f80`](https://github.com/netbirdio/netbird/commit/3989f804412dc86d2b58a53d7fce34d5fa6bc25b) Update client/embed/expose.go - [`b1a8fa6`](https://github.com/netbirdio/netbird/commit/b1a8fa69fb35784e43c030e5e0f5c21249b2f667) Fix build - [`2cb2aeb`](https://github.com/netbirdio/netbird/commit/2cb2aeb3dc440709bdaa7921f71235ef454b3233) Update client/embed/expose.go ### 📊 Changes **7 files changed** (+140 additions, -16 deletions) <details> <summary>View changed files</summary> 📝 `client/cmd/expose.go` (+13 -7) 📝 `client/embed/embed.go` (+29 -3) ➕ `client/embed/expose.go` (+45 -0) 📝 `client/internal/expose/manager.go` (+10 -3) 📝 `client/internal/expose/manager_test.go` (+1 -1) ➕ `client/internal/expose/protocol.go` (+40 -0) 📝 `client/internal/expose/request.go` (+2 -2) </details> ### 📄 Description ## Describe your changes Add Expose API to the embed library, allowing programmatic creation and management of service exposures (HTTP, HTTPS, TCP, UDP, TLS) from embedded client code. Introduces ExposeSession with a blocking Wait method that keeps the exposure alive until the context is cancelled. Extracts ProtocolType into a shared expose package for reuse across CLI and embed layers. ## Issue ticket number and link ## Stack <!-- branch-stack --> ### Checklist - [ ] Is it a bug fix - [ ] Is a typo/documentation fix - [x] 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](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** * Expose local services publicly with support for HTTP, HTTPS, TCP, UDP, and TLS. * Client API to create and manage exposures, returning sessions with domain, service name, and service URL. * Session "wait" to keep exposures alive until explicitly stopped. * **Bug Fixes / Improvements** * Improved protocol parsing using a typed protocol enum and clearer validation errors for unsupported protocol values. <!-- 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 06:07:39 -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#23669