-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[iOS] Add force relay connection on iOS #4928
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
e10bff7
[ios] Add a bogus test to check iOS behavior when setting environment…
doromaraujo 0d2bc3f
[ios] Revert "Add a bogus test to check iOS behavior when setting env…
doromaraujo 84d0cc5
[ios] Add EnvList struct to export and import environment variables
doromaraujo db28d6f
[ios] Add envList parameter to the iOS Client Run method
doromaraujo 1fd875a
[ios] Add some debug logging to exportEnvVarList
doromaraujo f2b2b49
Merge branch 'main' into feature/force-relay-connection-ios
doromaraujo 5bfdaab
Add "//go:build ios" to client/ios/NetBirdSDK files
doromaraujo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| //go:build ios | ||
|
|
||
| package NetBirdSDK | ||
|
|
||
| import "github.com/netbirdio/netbird/client/internal/peer" | ||
|
|
||
| // EnvList is an exported struct to be bound by gomobile | ||
| type EnvList struct { | ||
| data map[string]string | ||
| } | ||
|
|
||
| // NewEnvList creates a new EnvList | ||
| func NewEnvList() *EnvList { | ||
| return &EnvList{data: make(map[string]string)} | ||
| } | ||
|
|
||
| // Put adds a key-value pair | ||
| func (el *EnvList) Put(key, value string) { | ||
| el.data[key] = value | ||
| } | ||
|
|
||
| // Get retrieves a value by key | ||
| func (el *EnvList) Get(key string) string { | ||
| return el.data[key] | ||
| } | ||
|
|
||
| func (el *EnvList) AllItems() map[string]string { | ||
| return el.data | ||
| } | ||
|
|
||
| // GetEnvKeyNBForceRelay Exports the environment variable for the iOS client | ||
| func GetEnvKeyNBForceRelay() string { | ||
| return peer.EnvKeyNBForceRelay | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,5 @@ | ||
| //go:build ios | ||
|
|
||
| package NetBirdSDK | ||
|
|
||
| import _ "golang.org/x/mobile/bind" | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,5 @@ | ||
| //go:build ios | ||
|
|
||
| package NetBirdSDK | ||
|
|
||
| import ( | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,5 @@ | ||
| //go:build ios | ||
|
|
||
| package NetBirdSDK | ||
|
|
||
| import ( | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,5 @@ | ||
| //go:build ios | ||
|
|
||
| package NetBirdSDK | ||
|
|
||
| import ( | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,5 @@ | ||
| //go:build ios | ||
|
|
||
| package NetBirdSDK | ||
|
|
||
| import ( | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid logging environment variable values to prevent credential leakage.
Lines 446-447 log both the current and new values of environment variables. Environment variables in this context (e.g.,
NB_FORCE_RELAY) may contain sensitive information such as authentication tokens, API keys, or relay credentials. Debug logs can be captured by logging frameworks, persisted to disk, or forwarded to external systems, creating a security risk.Apply this diff to log only the key names without exposing values:
func exportEnvList(list *EnvList) { if list == nil { return } for k, v := range list.AllItems() { - log.Debugf("Env variable %s's value is currently: %s", k, os.Getenv(k)) - log.Debugf("Setting env variable %s: %s", k, v) + log.Debugf("Setting env variable: %s", k) if err := os.Setenv(k, v); err != nil { log.Errorf("could not set env variable %s: %v", k, err) } else { log.Debugf("Env variable %s was set successfully", k) } } }🤖 Prompt for AI Agents