mirror of
https://github.com/netbirdio/netbird.git
synced 2025-06-21 10:18:50 +02:00
[client] fix privacy warning on macOS (#3350)
* fix: macos privacy warning Move GetDesktopUIUserAgent to its own package so UI does not have to import client/system package that reaches out to broadcasts address. Thus, fixing the network privacy warnings.
This commit is contained in:
parent
b64bee35fa
commit
559e673107
@ -9,7 +9,6 @@ import (
|
||||
"google.golang.org/grpc/metadata"
|
||||
|
||||
"github.com/netbirdio/netbird/management/proto"
|
||||
"github.com/netbirdio/netbird/version"
|
||||
)
|
||||
|
||||
// DeviceNameCtxKey context key for device name
|
||||
@ -119,11 +118,6 @@ func extractDeviceName(ctx context.Context, defaultName string) string {
|
||||
return v
|
||||
}
|
||||
|
||||
// GetDesktopUIUserAgent returns the Desktop ui user agent
|
||||
func GetDesktopUIUserAgent() string {
|
||||
return "netbird-desktop-ui/" + version.NetbirdVersion()
|
||||
}
|
||||
|
||||
func networkAddresses() ([]NetworkAddress, error) {
|
||||
interfaces, err := net.Interfaces()
|
||||
if err != nil {
|
||||
|
@ -33,7 +33,7 @@ import (
|
||||
|
||||
"github.com/netbirdio/netbird/client/internal"
|
||||
"github.com/netbirdio/netbird/client/proto"
|
||||
"github.com/netbirdio/netbird/client/system"
|
||||
"github.com/netbirdio/netbird/client/ui/desktop"
|
||||
"github.com/netbirdio/netbird/client/ui/event"
|
||||
"github.com/netbirdio/netbird/util"
|
||||
"github.com/netbirdio/netbird/version"
|
||||
@ -779,6 +779,7 @@ func normalizedVersion(version string) string {
|
||||
return versionString
|
||||
}
|
||||
|
||||
// onTrayExit is called when the tray icon is closed.
|
||||
func (s *serviceClient) onTrayExit() {
|
||||
for _, item := range s.mExitNodeItems {
|
||||
item.cancel()
|
||||
@ -799,7 +800,7 @@ func (s *serviceClient) getSrvClient(timeout time.Duration) (proto.DaemonService
|
||||
strings.TrimPrefix(s.addr, "tcp://"),
|
||||
grpc.WithTransportCredentials(insecure.NewCredentials()),
|
||||
grpc.WithBlock(),
|
||||
grpc.WithUserAgent(system.GetDesktopUIUserAgent()),
|
||||
grpc.WithUserAgent(desktop.GetUIUserAgent()),
|
||||
)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("dial service: %w", err)
|
||||
|
8
client/ui/desktop/desktop.go
Normal file
8
client/ui/desktop/desktop.go
Normal file
@ -0,0 +1,8 @@
|
||||
package desktop
|
||||
|
||||
import "github.com/netbirdio/netbird/version"
|
||||
|
||||
// GetUIUserAgent returns the Desktop ui user agent
|
||||
func GetUIUserAgent() string {
|
||||
return "netbird-desktop-ui/" + version.NetbirdVersion()
|
||||
}
|
@ -15,7 +15,7 @@ import (
|
||||
"google.golang.org/grpc/credentials/insecure"
|
||||
|
||||
"github.com/netbirdio/netbird/client/proto"
|
||||
"github.com/netbirdio/netbird/client/system"
|
||||
"github.com/netbirdio/netbird/client/ui/desktop"
|
||||
)
|
||||
|
||||
type Handler func(*proto.SystemEvent)
|
||||
@ -167,7 +167,7 @@ func getClient(addr string) (proto.DaemonServiceClient, error) {
|
||||
conn, err := grpc.NewClient(
|
||||
strings.TrimPrefix(addr, "tcp://"),
|
||||
grpc.WithTransportCredentials(insecure.NewCredentials()),
|
||||
grpc.WithUserAgent(system.GetDesktopUIUserAgent()),
|
||||
grpc.WithUserAgent(desktop.GetUIUserAgent()),
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
Loading…
x
Reference in New Issue
Block a user