WIP: rebase fork onto upstream/main (v1.103.0) #15

Closed
codinget wants to merge 670 commits from webnet into save/webnet-2026-07-29
2 changed files with 4 additions and 13 deletions
Showing only changes of commit b228748a22 - Show all commits
+3 -3
View File
@@ -79,7 +79,7 @@ func (a *addrAssignments) insertWithExpiry(as *addrs, d time.Duration) error {
func (a *addrAssignments) lookupByDomainDst(domain dnsname.FQDN, dst netip.Addr) (*addrs, bool) {
v, ok := a.byDomainDst[domainDst{domain: domain, dst: dst}]
if !ok || v.expiresAt.Before(a.clock.Now()) {
if !ok {
return &addrs{}, false
}
return v, true
@@ -87,7 +87,7 @@ func (a *addrAssignments) lookupByDomainDst(domain dnsname.FQDN, dst netip.Addr)
func (a *addrAssignments) lookupByMagicIP(mip netip.Addr) (*addrs, bool) {
v, ok := a.byMagicIP[mip]
if !ok || v.expiresAt.Before(a.clock.Now()) {
if !ok {
return &addrs{}, false
}
return v, true
@@ -95,7 +95,7 @@ func (a *addrAssignments) lookupByMagicIP(mip netip.Addr) (*addrs, bool) {
func (a *addrAssignments) lookupByTransitIP(tip netip.Addr) (*addrs, bool) {
v, ok := a.byTransitIP[tip]
if !ok || v.expiresAt.Before(a.clock.Now()) {
if !ok {
return &addrs{}, false
}
return v, true
+1 -10
View File
@@ -41,17 +41,8 @@ func TestAssignmentsExpire(t *testing.T) {
if err == nil {
t.Fatal("expected an error but got nil")
}
// After a time greater than the default expiry passes, the assignment should
// not be returned.
clock.Advance(defaultExpiry * 2)
foundAsAfter, okAfter := assignments.lookupByMagicIP(as.magic)
if okAfter {
t.Fatal("expected not to find (expired)")
}
if foundAsAfter.isValid() {
t.Fatal("expected zero val")
}
// We should only be able to write old addresses again if they've been removed from the maps (eg with popExpired).
clock.Advance(defaultExpiry * 2)
err = assignments.insert(as)
if err == nil {
t.Fatal("expected an error but got nil")