Add user-agent to cmd and UI when calling daemon

This commit is contained in:
braginini
2022-05-22 18:53:21 +02:00
parent 4a499530ee
commit f4ce8c9c4e
12 changed files with 181 additions and 171 deletions

View File

@@ -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
}