cmd/tailscale: use node.DisplayName for machine names

Update to tailscale 1.4.0 while here.

Signed-off-by: Sonia Appasamy <sonia@tailscale.com>
pull/7/head
Sonia Appasamy 4 years ago committed by Elias Naur
parent ba38a9bb59
commit c4f626c5a7

@ -704,8 +704,9 @@ func (a *App) updateState(act jni.Object, state *clientState) {
if rp == nil {
return false
}
return lp.Hostinfo.Hostname < rp.Hostinfo.Hostname ||
lp.Hostinfo.Hostname == rp.Hostinfo.Hostname && lp.ID < rp.ID
lName := lp.DisplayName(lp.User == myID)
rName := rp.DisplayName(rp.User == myID)
return lName < rName || lName == rName && lp.ID < rp.ID
})
state.Peers = peers
}

@ -25,6 +25,7 @@ import (
"gioui.org/widget"
"gioui.org/widget/material"
"golang.org/x/exp/shiny/materialdesign/icons"
"tailscale.com/control/controlclient"
"tailscale.com/ipn"
"tailscale.com/tailcfg"
@ -202,7 +203,7 @@ func (ui *UI) layout(gtx layout.Context, sysIns system.Insets, state *clientStat
var expiry time.Time
if netmap != nil {
expiry = netmap.Expiry
localName = netmap.Hostinfo.Hostname
localName = netmap.SelfNode.DisplayName(false)
if addrs := netmap.Addresses; len(addrs) > 0 {
localAddr = addrs[0].IP.String()
}
@ -285,7 +286,7 @@ func (ui *UI) layout(gtx layout.Context, sysIns system.Insets, state *clientStat
return ui.layoutSection(gtx, sysIns, name)
} else {
clk := &ui.peers[pidx]
return ui.layoutPeer(gtx, sysIns, p, clk)
return ui.layoutPeer(gtx, sysIns, p, netmap, clk)
}
}
})
@ -626,7 +627,7 @@ func (ui *UI) showMessage(gtx layout.Context, msg string) {
// layoutPeer lays out a peer name and IP address (e.g.
// "localhost\n100.100.100.101")
func (ui *UI) layoutPeer(gtx layout.Context, sysIns system.Insets, p *UIPeer, clk *widget.Clickable) layout.Dimensions {
func (ui *UI) layoutPeer(gtx layout.Context, sysIns system.Insets, p *UIPeer, netmap *controlclient.NetworkMap, clk *widget.Clickable) layout.Dimensions {
for clk.Clicked() {
if addrs := p.Peer.Addresses; len(addrs) > 0 {
ui.copyAddress(gtx, addrs[0].IP.String())
@ -643,10 +644,7 @@ func (ui *UI) layoutPeer(gtx layout.Context, sysIns system.Insets, p *UIPeer, cl
return layout.Flex{Axis: layout.Vertical}.Layout(gtx,
layout.Rigid(func(gtx C) D {
return layout.Inset{Bottom: unit.Dp(4)}.Layout(gtx, func(gtx C) D {
name := p.Peer.Hostinfo.Hostname
if name == "" {
name = p.Peer.ID.String()
}
name := p.Peer.DisplayName(p.Peer.User == netmap.User)
return material.H6(ui.theme, name).Layout(gtx)
})
}),
@ -809,7 +807,7 @@ func (ui *UI) layoutSearchbar(gtx layout.Context, sysIns system.Insets) layout.D
return ui.icons.search.Layout(gtx, unit.Dp(24))
}),
layout.Flexed(1,
material.Editor(ui.theme, &ui.search, "Search by hostname...").Layout,
material.Editor(ui.theme, &ui.search, "Search by machine name...").Layout,
),
)
})

@ -7,10 +7,10 @@ require (
gioui.org v0.0.0-20210103130323-7bfdafb7b15d
gioui.org/cmd v0.0.0-20201126101740-9b54892cc4e3
github.com/go-bindata/go-bindata v3.1.2+incompatible
github.com/tailscale/wireguard-go v0.0.0-20210116013233-4cd297ed5a7d
github.com/tailscale/wireguard-go v0.0.0-20210120212909-7ad8a0443bd3
golang.org/x/exp v0.0.0-20191227195350-da58074b4299
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d
golang.org/x/sys v0.0.0-20201218084310-7d0127a74742
inet.af/netaddr v0.0.0-20210105212526-648fbc18a69d
tailscale.com v1.1.1-0.20210118213216-9936cffc1a07
tailscale.com v1.4.0
)

@ -274,8 +274,8 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/syndtr/gocapability v0.0.0-20180916011248-d98352740cb2/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww=
github.com/tailscale/depaware v0.0.0-20201214215404-77d1e9757027/go.mod h1:p9lPsd+cx33L3H9nNoecRRxPssFKUwwI50I3pZ0yT+8=
github.com/tailscale/wireguard-go v0.0.0-20210116013233-4cd297ed5a7d h1:8GcGtZ4Ui+lzHm6gOq7s2Oe4ksxkbUYtS/JuoJ2Nce8=
github.com/tailscale/wireguard-go v0.0.0-20210116013233-4cd297ed5a7d/go.mod h1:K/wyv4+3PcdVVTV7szyoiEjJ1nVHonM8cJ2mQwG5Fl8=
github.com/tailscale/wireguard-go v0.0.0-20210120212909-7ad8a0443bd3 h1:wpgSErXul2ysBGZVVM0fKISMgZ9BZRXuOYAyn8MxAbY=
github.com/tailscale/wireguard-go v0.0.0-20210120212909-7ad8a0443bd3/go.mod h1:K/wyv4+3PcdVVTV7szyoiEjJ1nVHonM8cJ2mQwG5Fl8=
github.com/tcnksm/go-httpstat v0.2.0 h1:rP7T5e5U2HfmOBmZzGgGZjBQ5/GluWUylujl0tJ04I0=
github.com/tcnksm/go-httpstat v0.2.0/go.mod h1:s3JVJFtQxtBEBC9dwcdTTXS9xFnM3SXAZwPG41aurT8=
github.com/toqueteos/webbrowser v1.2.0/go.mod h1:XWoZq4cyp9WeUeak7w7LXRUQf1F1ATJMir8RTqb4ayM=
@ -545,5 +545,5 @@ rsc.io/goversion v1.2.0 h1:SPn+NLTiAG7w30IRK/DKp1BjvpWabYgxlLp/+kx5J8w=
rsc.io/goversion v1.2.0/go.mod h1:Eih9y/uIBS3ulggl7KNJ09xGSLcuNaLgmvvqa07sgfo=
sigs.k8s.io/structured-merge-diff v0.0.0-20190525122527-15d366b2352e/go.mod h1:wWxsB5ozmmv/SG7nM11ayaAW51xMvak/t1r0CSlcokI=
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
tailscale.com v1.1.1-0.20210118213216-9936cffc1a07 h1:mj9VDSrBd/NsI2c0cpOcgUIda3rU1cBltLO+yekbwUc=
tailscale.com v1.1.1-0.20210118213216-9936cffc1a07/go.mod h1:bihFDjka7leYyag2wUeB+zTUMMJbXhZNxhHSe4CIt1s=
tailscale.com v1.4.0 h1:sREPCn8PSkbAxUeSphB3TGRyH6b0XtMrCON5MC3mPj0=
tailscale.com v1.4.0/go.mod h1:ywtIckegnVsMwW5489OqLdjl0WEixioHdIzInulBSgs=

Loading…
Cancel
Save