tailcfg, control/controlclient: add GoArch, populate OSVersion on Linux

This commit is contained in:
Brad Fitzpatrick
2020-07-27 21:14:28 -07:00
parent 58b721f374
commit cd21ba0a71
5 changed files with 105 additions and 1 deletions

View File

@@ -19,6 +19,7 @@ import (
"net/url"
"os"
"reflect"
"runtime"
"strconv"
"strings"
"sync"
@@ -165,12 +166,20 @@ func NewDirect(opts Options) (*Direct, error) {
return c, nil
}
var osVersion func() string // non-nil on some platforms
func NewHostinfo() *tailcfg.Hostinfo {
hostname, _ := os.Hostname()
var osv string
if osVersion != nil {
osv = osVersion()
}
return &tailcfg.Hostinfo{
IPNVersion: version.LONG,
Hostname: hostname,
OS: version.OS(),
OSVersion: osv,
GoArch: runtime.GOARCH,
}
}