Skip to content

Commit

Permalink
use capver for .Online field
Browse files Browse the repository at this point in the history
Signed-off-by: Kristoffer Dalby <[email protected]>
  • Loading branch information
kradalby committed Sep 28, 2023
1 parent 484ad15 commit 7e9bead
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions hscontrol/mapper/tail.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,6 @@ func tailNode(

PrimaryRoutes: primaryPrefixes,

LastSeen: node.LastSeen,
Online: &online,
MachineAuthorized: !node.IsExpired(),
}

Expand Down Expand Up @@ -170,13 +168,19 @@ func tailNode(
tNode.Capabilities = append(tNode.Capabilities, tailcfg.NodeAttrDisableUPnP)
}

// TODO(kradalby): .Online is only available from capVer 18.
if online {
tNode.Online = &online
} else {
// .Online is only available from capVer 18.
if capVer < 18 {
// LastSeen is only set when node is
// not connected to the control server.
tNode.LastSeen = node.LastSeen
} else {
if online {
tNode.Online = &online
} else {
// LastSeen is only set when node is
// not connected to the control server.
tNode.LastSeen = node.LastSeen
}
}

return &tNode, nil
Expand Down

0 comments on commit 7e9bead

Please sign in to comment.