feature/conn25: extend assignment expiry on use
When we use assigned addresses in response to a DNS request, extend the expiry on the assignment. Updates tailscale/corp#39975 Signed-off-by: Fran Bull <fran@tailscale.com>
This commit is contained in:
@@ -1208,6 +1208,16 @@ func TestMapDNSResponseSetsExpiryBasedOnTTL(t *testing.T) {
|
||||
|
||||
assertExpiresAt(ipThree, clock.Now().Add(301*time.Second))
|
||||
assertExpiresAt(ipFour, clock.Now().Add(61*time.Second))
|
||||
|
||||
elapsed := time.Second * 30
|
||||
clock.Advance(elapsed)
|
||||
assertExpiresAt(ipThree, clock.Now().Add(301*time.Second).Add(-1*elapsed))
|
||||
assertExpiresAt(ipFour, clock.Now().Add(61*time.Second).Add(-1*elapsed))
|
||||
c.mapDNSResponse(dnsRespV6)
|
||||
// after seeing the addresses again, the expiry time is pushed out.
|
||||
assertExpiresAt(ipThree, clock.Now().Add(301*time.Second))
|
||||
assertExpiresAt(ipFour, clock.Now().Add(61*time.Second))
|
||||
|
||||
}
|
||||
|
||||
func TestNormalizedDNSNames(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user