device: add API for on-demand configuration of peers
Updates tailscale/tailscale#17858 Signed-off-by: Brad Fitzpatrick <brad@danga.com>
This commit is contained in:
parent
70b09a6edd
commit
e924a91e99
5 changed files with 151 additions and 10 deletions
|
|
@ -129,6 +129,14 @@ func expiredNewHandshake(peer *Peer) {
|
|||
func expiredZeroKeyMaterial(peer *Peer) {
|
||||
peer.device.log.Verbosef("%s - Removing all keys, since we haven't received a new one in %d seconds", peer, int((RejectAfterTime * 3).Seconds()))
|
||||
peer.ZeroAndFlushAll()
|
||||
if peer.deleteOnIdle {
|
||||
peer.device.log.Verbosef("%s - Removing idle lazy peer", peer)
|
||||
// Remove the peer from the device in a new goroutine as we're currently
|
||||
// holding timer locks which RemovePeer also needs. This is TOCTOU, but
|
||||
// acceptable since the worst case is we remove the peer and the lazy
|
||||
// peerfunc created it again after. We might lose some packets.
|
||||
go peer.device.RemovePeer(peer.handshake.remoteStatic)
|
||||
}
|
||||
}
|
||||
|
||||
func expiredPersistentKeepalive(peer *Peer) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue