summaryrefslogtreecommitdiffhomepage
path: root/cmd/hello/hello.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/hello/hello.go')
-rw-r--r--cmd/hello/hello.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/cmd/hello/hello.go b/cmd/hello/hello.go
index 86f885f54..fa116b28b 100644
--- a/cmd/hello/hello.go
+++ b/cmd/hello/hello.go
@@ -20,6 +20,7 @@ import (
"tailscale.com/client/local"
"tailscale.com/client/tailscale/apitype"
+ "tailscale.com/tailcfg"
)
var (
@@ -134,6 +135,10 @@ func tailscaleIP(who *apitype.WhoIsResponse) string {
if who == nil {
return ""
}
+ vals, err := tailcfg.UnmarshalNodeCapJSON[string](who.Node.CapMap, tailcfg.NodeAttrNativeIPV4)
+ if err == nil && len(vals) > 0 {
+ return vals[0]
+ }
for _, nodeIP := range who.Node.Addresses {
if nodeIP.Addr().Is4() && nodeIP.IsSingleIP() {
return nodeIP.Addr().String()