[PR #6270] [MERGED] [client] Add iOS debug bundle support in Go #25233

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

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/6270
Author: @pappz
Created: 5/27/2026
Status: Merged
Merged: 6/16/2026
Merged by: @pappz

Base: mainHead: fix/ios-debug-bundle


📝 Commits (7)

  • 485fa06 Add iOS debug bundle support in Go
  • 557b611 Include the iOS state file in the debug bundle
  • a3352c8 Merge tag 'v0.71.4' into fix/ios-debug-bundle
  • 56c958b Merge branch 'main' into fix/ios-debug-bundle
  • c5ea58c ios: enable sync response persistence for debug bundle
  • 7470fbd ios: pass log file path through NewClient constructor (#6393)
  • 3446f37 ios: pass log file path to engine for remote debug bundles

📊 Changes

5 files changed (+170 additions, -14 deletions)

View changed files

📝 client/internal/connect.go (+4 -1)
📝 client/internal/debug/debug.go (+8 -2)
client/internal/debug/debug_ios.go (+36 -0)
📝 client/internal/debug/debug_nonandroid.go (+1 -1)
📝 client/ios/NetBirdSDK/client.go (+121 -10)

📄 Description

Describe your changes

Thread cacheDir through NewClient -> RunOniOS -> MobileDependency.TempDir so the iOS client can pass its sandbox-writable cache directory for debug bundle zip file creation instead of os.TempDir().

Move log collection into platform-dispatched addPlatformLog():

  • iOS: adds the file-based Go client log (with rotation, stderr/stdout companions and anonymization handled by addLogfile) plus the Swift app log (swift-log.log) written by the iOS app into the same log directory
  • Other non-Android platforms: existing file-based log + systemd fallback

Narrow the debug_nonandroid.go build tag to !android && !ios so iOS no longer attempts the systemd journal fallback.

Add a DebugBundle() entry point to the iOS Go client that generates a bundle, uploads it and returns the upload key. It works with or without a running engine: when the engine is up it reuses the live config, sync response and client metrics; otherwise it loads the config from disk (or the preloaded tvOS config). Guard the live config/ConnectClient behind a state mutex since DebugBundle may run on a different thread.

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)

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

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

Summary by CodeRabbit

  • New Features

    • iOS debug bundle API to create, upload, and optionally anonymize diagnostic bundles.
    • Debug collection includes app-written Swift logs on iOS when available.
  • Improvements

    • iOS client accepts a configurable cache directory for temporary/debug workspace.
    • Debug bundle creation can use an explicit state file path.
    • Runtime state is cached safely; route selection reports "not connected" when the engine is unavailable.

🔄 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/6270 **Author:** [@pappz](https://github.com/pappz) **Created:** 5/27/2026 **Status:** ✅ Merged **Merged:** 6/16/2026 **Merged by:** [@pappz](https://github.com/pappz) **Base:** `main` ← **Head:** `fix/ios-debug-bundle` --- ### 📝 Commits (7) - [`485fa06`](https://github.com/netbirdio/netbird/commit/485fa06c949e871d5ed4352bc872515388253444) Add iOS debug bundle support in Go - [`557b611`](https://github.com/netbirdio/netbird/commit/557b611b02722007c1f9e6722956f659422bced3) Include the iOS state file in the debug bundle - [`a3352c8`](https://github.com/netbirdio/netbird/commit/a3352c8402cc282cde83e5263184ec7c35dec2d9) Merge tag 'v0.71.4' into fix/ios-debug-bundle - [`56c958b`](https://github.com/netbirdio/netbird/commit/56c958b4367296cdc1d28818ddfb3b0b1975a1c9) Merge branch 'main' into fix/ios-debug-bundle - [`c5ea58c`](https://github.com/netbirdio/netbird/commit/c5ea58c5adb0769aed4047f123b20ec704198bc0) ios: enable sync response persistence for debug bundle - [`7470fbd`](https://github.com/netbirdio/netbird/commit/7470fbddd7ab8c3ce8ecdb535034daf64aa2c4b6) ios: pass log file path through NewClient constructor (#6393) - [`3446f37`](https://github.com/netbirdio/netbird/commit/3446f37283566c469769b1091883e7f0e95f7ede) ios: pass log file path to engine for remote debug bundles ### 📊 Changes **5 files changed** (+170 additions, -14 deletions) <details> <summary>View changed files</summary> 📝 `client/internal/connect.go` (+4 -1) 📝 `client/internal/debug/debug.go` (+8 -2) ➕ `client/internal/debug/debug_ios.go` (+36 -0) 📝 `client/internal/debug/debug_nonandroid.go` (+1 -1) 📝 `client/ios/NetBirdSDK/client.go` (+121 -10) </details> ### 📄 Description ## Describe your changes Thread cacheDir through NewClient -> RunOniOS -> MobileDependency.TempDir so the iOS client can pass its sandbox-writable cache directory for debug bundle zip file creation instead of os.TempDir(). Move log collection into platform-dispatched addPlatformLog(): - iOS: adds the file-based Go client log (with rotation, stderr/stdout companions and anonymization handled by addLogfile) plus the Swift app log (swift-log.log) written by the iOS app into the same log directory - Other non-Android platforms: existing file-based log + systemd fallback Narrow the debug_nonandroid.go build tag to !android && !ios so iOS no longer attempts the systemd journal fallback. Add a DebugBundle() entry point to the iOS Go client that generates a bundle, uploads it and returns the upload key. It works with or without a running engine: when the engine is up it reuses the live config, sync response and client metrics; otherwise it loads the config from disk (or the preloaded tvOS config). Guard the live config/ConnectClient behind a state mutex since DebugBundle may run on a different thread. ## Issue ticket number and link ## Stack <!-- branch-stack --> ### Checklist - [ ] Is it a bug fix - [ ] Is a typo/documentation fix - [ ] Is a feature enhancement - [x] 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](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: - [ ] 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** * iOS debug bundle API to create, upload, and optionally anonymize diagnostic bundles. * Debug collection includes app-written Swift logs on iOS when available. * **Improvements** * iOS client accepts a configurable cache directory for temporary/debug workspace. * Debug bundle creation can use an explicit state file path. * Runtime state is cached safely; route selection reports "not connected" when the engine is unavailable. <!-- 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:05:44 -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#25233