mirror of
https://github.com/tailscale/tailscale.git
synced 2025-08-11 21:27:31 +00:00
ipn/ipnstate: add PeerStatus.KeyExpiry for tailscale status --json
Fixes #6712 Change-Id: I817cd5342fac8a956fcefda2d63158fa488f3395 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:

committed by
Brad Fitzpatrick

parent
b6aa1c1f22
commit
06fff461dc
@@ -723,6 +723,10 @@ func peerStatusFromNode(ps *ipnstate.PeerStatus, n *tailcfg.Node) {
|
||||
if n.Expired {
|
||||
ps.Expired = true
|
||||
}
|
||||
if t := n.KeyExpiry; !t.IsZero() {
|
||||
t = t.Round(time.Second)
|
||||
ps.KeyExpiry = &t
|
||||
}
|
||||
}
|
||||
|
||||
// WhoIs reports the node and user who owns the node with the given IP:port.
|
||||
|
@@ -20,6 +20,7 @@ import (
|
||||
|
||||
"tailscale.com/tailcfg"
|
||||
"tailscale.com/types/key"
|
||||
"tailscale.com/types/ptr"
|
||||
"tailscale.com/types/views"
|
||||
"tailscale.com/util/dnsname"
|
||||
)
|
||||
@@ -251,6 +252,10 @@ type PeerStatus struct {
|
||||
// information from control or optimisically set on the client if the
|
||||
// expiration time has passed.
|
||||
Expired bool `json:",omitempty"`
|
||||
|
||||
// KeyExpiry, if present, is the time at which the node key expired or
|
||||
// will expire.
|
||||
KeyExpiry *time.Time `json:",omitempty"`
|
||||
}
|
||||
|
||||
type StatusBuilder struct {
|
||||
@@ -435,6 +440,9 @@ func (sb *StatusBuilder) AddPeer(peer key.NodePublic, st *PeerStatus) {
|
||||
if st.Expired {
|
||||
e.Expired = true
|
||||
}
|
||||
if t := st.KeyExpiry; t != nil {
|
||||
e.KeyExpiry = ptr.To(*t)
|
||||
}
|
||||
}
|
||||
|
||||
type StatusUpdater interface {
|
||||
|
Reference in New Issue
Block a user