Skip to content

Commit b37b6b1

Browse files
committed
tailscale: Expose more peer info fields
1 parent f3458a9 commit b37b6b1

6 files changed

Lines changed: 72 additions & 2 deletions

File tree

adapter/tailscale.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,16 @@ type TailscalePeer struct {
4141
DNSName string
4242
OS string
4343
TailscaleIPs []string
44+
SSHHostKeys []string
4445
Online bool
4546
ExitNode bool
4647
ExitNodeOption bool
48+
ShareeNode bool
49+
Expired bool
4750
Active bool
4851
RxBytes int64
4952
TxBytes int64
5053
UserID int64
5154
KeyExpiry int64
55+
LastSeen int64
5256
}

daemon/started_service.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1397,13 +1397,17 @@ func tailscalePeerToProto(peer *adapter.TailscalePeer) *TailscalePeer {
13971397
DnsName: peer.DNSName,
13981398
Os: peer.OS,
13991399
TailscaleIPs: peer.TailscaleIPs,
1400+
SshHostKeys: peer.SSHHostKeys,
14001401
Online: peer.Online,
14011402
ExitNode: peer.ExitNode,
14021403
ExitNodeOption: peer.ExitNodeOption,
1404+
ShareeNode: peer.ShareeNode,
1405+
Expired: peer.Expired,
14031406
Active: peer.Active,
14041407
RxBytes: peer.RxBytes,
14051408
TxBytes: peer.TxBytes,
14061409
KeyExpiry: peer.KeyExpiry,
1410+
LastSeen: peer.LastSeen,
14071411
}
14081412
}
14091413

daemon/started_service.pb.go

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2482,6 +2482,10 @@ type TailscalePeer struct {
24822482
TxBytes int64 `protobuf:"varint,10,opt,name=txBytes,proto3" json:"txBytes,omitempty"`
24832483
KeyExpiry int64 `protobuf:"varint,11,opt,name=keyExpiry,proto3" json:"keyExpiry,omitempty"`
24842484
StableID string `protobuf:"bytes,12,opt,name=stableID,proto3" json:"stableID,omitempty"`
2485+
Expired bool `protobuf:"varint,13,opt,name=expired,proto3" json:"expired,omitempty"`
2486+
SshHostKeys []string `protobuf:"bytes,14,rep,name=sshHostKeys,proto3" json:"sshHostKeys,omitempty"`
2487+
ShareeNode bool `protobuf:"varint,15,opt,name=shareeNode,proto3" json:"shareeNode,omitempty"`
2488+
LastSeen int64 `protobuf:"varint,16,opt,name=lastSeen,proto3" json:"lastSeen,omitempty"`
24852489
unknownFields protoimpl.UnknownFields
24862490
sizeCache protoimpl.SizeCache
24872491
}
@@ -2600,6 +2604,34 @@ func (x *TailscalePeer) GetStableID() string {
26002604
return ""
26012605
}
26022606

2607+
func (x *TailscalePeer) GetExpired() bool {
2608+
if x != nil {
2609+
return x.Expired
2610+
}
2611+
return false
2612+
}
2613+
2614+
func (x *TailscalePeer) GetSshHostKeys() []string {
2615+
if x != nil {
2616+
return x.SshHostKeys
2617+
}
2618+
return nil
2619+
}
2620+
2621+
func (x *TailscalePeer) GetShareeNode() bool {
2622+
if x != nil {
2623+
return x.ShareeNode
2624+
}
2625+
return false
2626+
}
2627+
2628+
func (x *TailscalePeer) GetLastSeen() int64 {
2629+
if x != nil {
2630+
return x.LastSeen
2631+
}
2632+
return 0
2633+
}
2634+
26032635
type TailscalePingRequest struct {
26042636
state protoimpl.MessageState `protogen:"open.v1"`
26052637
EndpointTag string `protobuf:"bytes,1,opt,name=endpointTag,proto3" json:"endpointTag,omitempty"`
@@ -3031,7 +3063,7 @@ const file_daemon_started_service_proto_rawDesc = "" +
30313063
"\tloginName\x18\x02 \x01(\tR\tloginName\x12 \n" +
30323064
"\vdisplayName\x18\x03 \x01(\tR\vdisplayName\x12$\n" +
30333065
"\rprofilePicURL\x18\x04 \x01(\tR\rprofilePicURL\x12+\n" +
3034-
"\x05peers\x18\x05 \x03(\v2\x15.daemon.TailscalePeerR\x05peers\"\xdb\x02\n" +
3066+
"\x05peers\x18\x05 \x03(\v2\x15.daemon.TailscalePeerR\x05peers\"\xd3\x03\n" +
30353067
"\rTailscalePeer\x12\x1a\n" +
30363068
"\bhostName\x18\x01 \x01(\tR\bhostName\x12\x18\n" +
30373069
"\adnsName\x18\x02 \x01(\tR\adnsName\x12\x0e\n" +
@@ -3045,7 +3077,13 @@ const file_daemon_started_service_proto_rawDesc = "" +
30453077
"\atxBytes\x18\n" +
30463078
" \x01(\x03R\atxBytes\x12\x1c\n" +
30473079
"\tkeyExpiry\x18\v \x01(\x03R\tkeyExpiry\x12\x1a\n" +
3048-
"\bstableID\x18\f \x01(\tR\bstableID\"P\n" +
3080+
"\bstableID\x18\f \x01(\tR\bstableID\x12\x18\n" +
3081+
"\aexpired\x18\r \x01(\bR\aexpired\x12 \n" +
3082+
"\vsshHostKeys\x18\x0e \x03(\tR\vsshHostKeys\x12\x1e\n" +
3083+
"\n" +
3084+
"shareeNode\x18\x0f \x01(\bR\n" +
3085+
"shareeNode\x12\x1a\n" +
3086+
"\blastSeen\x18\x10 \x01(\x03R\blastSeen\"P\n" +
30493087
"\x14TailscalePingRequest\x12 \n" +
30503088
"\vendpointTag\x18\x01 \x01(\tR\vendpointTag\x12\x16\n" +
30513089
"\x06peerIP\x18\x02 \x01(\tR\x06peerIP\"\xcf\x01\n" +

daemon/started_service.proto

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,10 @@ message TailscalePeer {
317317
int64 txBytes = 10;
318318
int64 keyExpiry = 11;
319319
string stableID = 12;
320+
bool expired = 13;
321+
repeated string sshHostKeys = 14;
322+
bool shareeNode = 15;
323+
int64 lastSeen = 16;
320324
}
321325

322326
message TailscalePingRequest {

experimental/libbox/command_types_tailscale.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,19 +58,27 @@ type TailscalePeer struct {
5858
DNSName string
5959
OS string
6060
tailscaleIPs []string
61+
sshHostKeys []string
6162
Online bool
6263
ExitNode bool
6364
ExitNodeOption bool
65+
ShareeNode bool
66+
Expired bool
6467
Active bool
6568
RxBytes int64
6669
TxBytes int64
6770
KeyExpiry int64
71+
LastSeen int64
6872
}
6973

7074
func (p *TailscalePeer) TailscaleIPs() StringIterator {
7175
return newIterator(p.tailscaleIPs)
7276
}
7377

78+
func (p *TailscalePeer) SSHHostKeys() StringIterator {
79+
return newIterator(p.sshHostKeys)
80+
}
81+
7482
type TailscaleStatusHandler interface {
7583
OnStatusUpdate(status *TailscaleStatusUpdate)
7684
OnError(message string)
@@ -127,12 +135,16 @@ func tailscalePeerFromGRPC(peer *daemon.TailscalePeer) *TailscalePeer {
127135
DNSName: peer.DnsName,
128136
OS: peer.Os,
129137
tailscaleIPs: peer.TailscaleIPs,
138+
sshHostKeys: peer.SshHostKeys,
130139
Online: peer.Online,
131140
ExitNode: peer.ExitNode,
132141
ExitNodeOption: peer.ExitNodeOption,
142+
ShareeNode: peer.ShareeNode,
143+
Expired: peer.Expired,
133144
Active: peer.Active,
134145
RxBytes: peer.RxBytes,
135146
TxBytes: peer.TxBytes,
136147
KeyExpiry: peer.KeyExpiry,
148+
LastSeen: peer.LastSeen,
137149
}
138150
}

protocol/tailscale/status.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,19 +109,27 @@ func convertTailscalePeer(peer *ipnstate.PeerStatus) *adapter.TailscalePeer {
109109
if peer.KeyExpiry != nil {
110110
keyExpiry = peer.KeyExpiry.Unix()
111111
}
112+
var lastSeen int64
113+
if !peer.LastSeen.IsZero() {
114+
lastSeen = peer.LastSeen.Unix()
115+
}
112116
return &adapter.TailscalePeer{
113117
StableID: string(peer.ID),
114118
HostName: peer.HostName,
115119
DNSName: peer.DNSName,
116120
OS: peer.OS,
117121
TailscaleIPs: ips,
122+
SSHHostKeys: peer.SSH_HostKeys,
118123
Online: peer.Online,
119124
ExitNode: peer.ExitNode,
120125
ExitNodeOption: peer.ExitNodeOption,
126+
ShareeNode: peer.ShareeNode,
127+
Expired: peer.Expired,
121128
Active: peer.Active,
122129
RxBytes: peer.RxBytes,
123130
TxBytes: peer.TxBytes,
124131
UserID: int64(peer.UserID),
125132
KeyExpiry: keyExpiry,
133+
LastSeen: lastSeen,
126134
}
127135
}

0 commit comments

Comments
 (0)