feat: enables support for redirection over CIRA#826
Conversation
There was a problem hiding this comment.
Pull request overview
This PR encapsulates the global CIRA connections map behind thread-safe accessor functions and adds support for redirection (KVM/SOL) over CIRA tunnels. Previously, the Connections map was exported and accessed directly with inconsistent locking; now it's unexported with dedicated GetConnectionEntry, SetConnectionEntry, RemoveConnection, and HasConnections functions protected by a sync.RWMutex. The new WriteToConnection method and the CIRA redirection path in Redirector.SetupWsmanClient enable routing redirection sessions through existing APF tunnels.
Changes:
- Encapsulated the global connections map with thread-safe accessor functions and upgraded from
sync.Mutextosync.RWMutex - Added CIRA redirection support in
Redirector.SetupWsmanClientthat routes through APF tunnels usingwsman.NewCIRARedirectionMessages - Added
WriteToConnectionmethod andensureAPFChannelStoreusingsync.Oncefor lazy, thread-safe initialization of the APF channel store
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
internal/usecase/devices/wsman/message.go |
Encapsulated connections map, added exported accessors, WriteToConnection, ensureAPFChannelStore with sync.Once, and changed mutex to RWMutex |
internal/usecase/devices/redirection.go |
Added early return path for CIRA redirection using NewCIRARedirectionMessages |
internal/controller/tcp/cira/tunnel.go |
Migrated from direct map access to using exported accessor functions, removed local mutex |
internal/controller/tcp/cira/tunnel_test.go |
Updated tests to use new exported accessor functions |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #826 +/- ##
==========================================
+ Coverage 39.76% 39.79% +0.02%
==========================================
Files 114 114
Lines 10768 10769 +1
==========================================
+ Hits 4282 4285 +3
+ Misses 6087 6085 -2
Partials 399 399 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
management methods to handle concurrent CIRA connections
c5a6058 to
fa2c4a8
Compare
|
🎉 This PR is included in version 1.22.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
requires go-wsman-messages v2.37+
device-management-toolkit/go-wsman-messages#649