tailscale: Expose more peer info fields

This commit is contained in:
世界
2026-05-21 14:20:48 +08:00
parent 9afbd45d4b
commit 3bc481a845
6 changed files with 72 additions and 2 deletions
@@ -58,19 +58,27 @@ type TailscalePeer struct {
DNSName string
OS string
tailscaleIPs []string
sshHostKeys []string
Online bool
ExitNode bool
ExitNodeOption bool
ShareeNode bool
Expired bool
Active bool
RxBytes int64
TxBytes int64
KeyExpiry int64
LastSeen int64
}
func (p *TailscalePeer) TailscaleIPs() StringIterator {
return newIterator(p.tailscaleIPs)
}
func (p *TailscalePeer) SSHHostKeys() StringIterator {
return newIterator(p.sshHostKeys)
}
type TailscaleStatusHandler interface {
OnStatusUpdate(status *TailscaleStatusUpdate)
OnError(message string)
@@ -127,12 +135,16 @@ func tailscalePeerFromGRPC(peer *daemon.TailscalePeer) *TailscalePeer {
DNSName: peer.DnsName,
OS: peer.Os,
tailscaleIPs: peer.TailscaleIPs,
sshHostKeys: peer.SshHostKeys,
Online: peer.Online,
ExitNode: peer.ExitNode,
ExitNodeOption: peer.ExitNodeOption,
ShareeNode: peer.ShareeNode,
Expired: peer.Expired,
Active: peer.Active,
RxBytes: peer.RxBytes,
TxBytes: peer.TxBytes,
KeyExpiry: peer.KeyExpiry,
LastSeen: peer.LastSeen,
}
}