mirror of
https://github.com/netbirdio/netbird.git
synced 2026-04-19 08:46:38 +00:00
Add user-agent to cmd and UI when calling daemon
This commit is contained in:
@@ -2,18 +2,15 @@ package system
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
"runtime"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"google.golang.org/grpc/metadata"
|
||||
)
|
||||
|
||||
func GetInfo(ctx context.Context) *Info {
|
||||
func GetInfo() *Info {
|
||||
info := _getInfo()
|
||||
for strings.Contains(info, "broken pipe") {
|
||||
info = _getInfo()
|
||||
@@ -48,15 +45,7 @@ func GetInfo(ctx context.Context) *Info {
|
||||
gio := &Info{Kernel: osInfo[0], Core: osInfo[1], Platform: osInfo[2], OS: osName, OSVersion: osVer, GoOS: runtime.GOOS, CPUs: runtime.NumCPU()}
|
||||
gio.Hostname, _ = os.Hostname()
|
||||
gio.WiretrusteeVersion = WiretrusteeVersion()
|
||||
|
||||
if ctx != nil {
|
||||
metadata, ok := metadata.FromIncomingContext(ctx)
|
||||
|
||||
if ok {
|
||||
gio.Caller = metadata["caller"][0]
|
||||
gio.CallerVersion = metadata["callerVersion"][0]
|
||||
}
|
||||
}
|
||||
gio.Caller = NetBirdCmdUserAgent()
|
||||
|
||||
return gio
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user