Skip to content

Commit 4fa0aef

Browse files
feat(ci): Bump to upstream v1.80 (#20)
https://tailscale.com/changelog#2025-01-30
2 parents a879b4c + bcc4a6a commit 4fa0aef

File tree

346 files changed

+22968
-4922
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

346 files changed

+22968
-4922
lines changed

Makefile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ lint: ## Run golangci-lint
1717
updatedeps: ## Update depaware deps
1818
# depaware (via x/tools/go/packages) shells back to "go", so make sure the "go"
1919
# it finds in its $$PATH is the right one.
20-
PATH="$$(./tool/go env GOROOT)/bin:$$PATH" ./tool/go run github.com/tailscale/depaware --update \
20+
PATH="$$(./tool/go env GOROOT)/bin:$$PATH" ./tool/go run github.com/tailscale/depaware --update --internal \
2121
tailscale.com/cmd/tailscaled \
2222
tailscale.com/cmd/tailscale \
2323
tailscale.com/cmd/derper \
@@ -27,7 +27,7 @@ updatedeps: ## Update depaware deps
2727
depaware: ## Run depaware checks
2828
# depaware (via x/tools/go/packages) shells back to "go", so make sure the "go"
2929
# it finds in its $$PATH is the right one.
30-
PATH="$$(./tool/go env GOROOT)/bin:$$PATH" ./tool/go run github.com/tailscale/depaware --check \
30+
PATH="$$(./tool/go env GOROOT)/bin:$$PATH" ./tool/go run github.com/tailscale/depaware --check --internal \
3131
tailscale.com/cmd/tailscaled \
3232
tailscale.com/cmd/tailscale \
3333
tailscale.com/cmd/derper \
@@ -116,7 +116,6 @@ sshintegrationtest: ## Run the SSH integration tests in various Docker container
116116
GOOS=linux GOARCH=amd64 ./tool/go build -o ssh/tailssh/testcontainers/tailscaled ./cmd/tailscaled && \
117117
echo "Testing on ubuntu:focal" && docker build --build-arg="BASE=ubuntu:focal" -t ssh-ubuntu-focal ssh/tailssh/testcontainers && \
118118
echo "Testing on ubuntu:jammy" && docker build --build-arg="BASE=ubuntu:jammy" -t ssh-ubuntu-jammy ssh/tailssh/testcontainers && \
119-
echo "Testing on ubuntu:mantic" && docker build --build-arg="BASE=ubuntu:mantic" -t ssh-ubuntu-mantic ssh/tailssh/testcontainers && \
120119
echo "Testing on ubuntu:noble" && docker build --build-arg="BASE=ubuntu:noble" -t ssh-ubuntu-noble ssh/tailssh/testcontainers && \
121120
echo "Testing on alpine:latest" && docker build --build-arg="BASE=alpine:latest" -t ssh-alpine-latest ssh/tailssh/testcontainers
122121

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ Origin](https://en.wikipedia.org/wiki/Developer_Certificate_of_Origin)
7272
`Signed-off-by` lines in commits.
7373

7474
See `git log` for our commit message style. It's basically the same as
75-
[Go's style](https://github.com/golang/go/wiki/CommitMessage).
75+
[Go's style](https://go.dev/wiki/CommitMessage).
7676

7777
## About Us
7878

VERSION.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.78.3
1+
1.80.0

appc/appconnector.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import (
1818
"sync"
1919
"time"
2020

21-
xmaps "golang.org/x/exp/maps"
2221
"golang.org/x/net/dns/dnsmessage"
2322
"tailscale.com/types/logger"
2423
"tailscale.com/types/views"
@@ -291,11 +290,11 @@ func (e *AppConnector) updateDomains(domains []string) {
291290
}
292291
}
293292
if err := e.routeAdvertiser.UnadvertiseRoute(toRemove...); err != nil {
294-
e.logf("failed to unadvertise routes on domain removal: %v: %v: %v", xmaps.Keys(oldDomains), toRemove, err)
293+
e.logf("failed to unadvertise routes on domain removal: %v: %v: %v", slicesx.MapKeys(oldDomains), toRemove, err)
295294
}
296295
}
297296

298-
e.logf("handling domains: %v and wildcards: %v", xmaps.Keys(e.domains), e.wildcards)
297+
e.logf("handling domains: %v and wildcards: %v", slicesx.MapKeys(e.domains), e.wildcards)
299298
}
300299

301300
// updateRoutes merges the supplied routes into the currently configured routes. The routes supplied
@@ -354,7 +353,7 @@ func (e *AppConnector) Domains() views.Slice[string] {
354353
e.mu.Lock()
355354
defer e.mu.Unlock()
356355

357-
return views.SliceOf(xmaps.Keys(e.domains))
356+
return views.SliceOf(slicesx.MapKeys(e.domains))
358357
}
359358

360359
// DomainRoutes returns a map of domains to resolved IP
@@ -375,13 +374,13 @@ func (e *AppConnector) DomainRoutes() map[string][]netip.Addr {
375374
// response is being returned over the PeerAPI. The response is parsed and
376375
// matched against the configured domains, if matched the routeAdvertiser is
377376
// advised to advertise the discovered route.
378-
func (e *AppConnector) ObserveDNSResponse(res []byte) {
377+
func (e *AppConnector) ObserveDNSResponse(res []byte) error {
379378
var p dnsmessage.Parser
380379
if _, err := p.Start(res); err != nil {
381-
return
380+
return err
382381
}
383382
if err := p.SkipAllQuestions(); err != nil {
384-
return
383+
return err
385384
}
386385

387386
// cnameChain tracks a chain of CNAMEs for a given query in order to reverse
@@ -400,12 +399,12 @@ func (e *AppConnector) ObserveDNSResponse(res []byte) {
400399
break
401400
}
402401
if err != nil {
403-
return
402+
return err
404403
}
405404

406405
if h.Class != dnsmessage.ClassINET {
407406
if err := p.SkipAnswer(); err != nil {
408-
return
407+
return err
409408
}
410409
continue
411410
}
@@ -414,7 +413,7 @@ func (e *AppConnector) ObserveDNSResponse(res []byte) {
414413
case dnsmessage.TypeCNAME, dnsmessage.TypeA, dnsmessage.TypeAAAA:
415414
default:
416415
if err := p.SkipAnswer(); err != nil {
417-
return
416+
return err
418417
}
419418
continue
420419

@@ -428,7 +427,7 @@ func (e *AppConnector) ObserveDNSResponse(res []byte) {
428427
if h.Type == dnsmessage.TypeCNAME {
429428
res, err := p.CNAMEResource()
430429
if err != nil {
431-
return
430+
return err
432431
}
433432
cname := strings.TrimSuffix(strings.ToLower(res.CNAME.String()), ".")
434433
if len(cname) == 0 {
@@ -442,20 +441,20 @@ func (e *AppConnector) ObserveDNSResponse(res []byte) {
442441
case dnsmessage.TypeA:
443442
r, err := p.AResource()
444443
if err != nil {
445-
return
444+
return err
446445
}
447446
addr := netip.AddrFrom4(r.A)
448447
mak.Set(&addressRecords, domain, append(addressRecords[domain], addr))
449448
case dnsmessage.TypeAAAA:
450449
r, err := p.AAAAResource()
451450
if err != nil {
452-
return
451+
return err
453452
}
454453
addr := netip.AddrFrom16(r.AAAA)
455454
mak.Set(&addressRecords, domain, append(addressRecords[domain], addr))
456455
default:
457456
if err := p.SkipAnswer(); err != nil {
458-
return
457+
return err
459458
}
460459
continue
461460
}
@@ -486,6 +485,7 @@ func (e *AppConnector) ObserveDNSResponse(res []byte) {
486485
e.scheduleAdvertisement(domain, toAdvertise...)
487486
}
488487
}
488+
return nil
489489
}
490490

491491
// starting from the given domain that resolved to an address, find it, or any

appc/appconnector_test.go

Lines changed: 55 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ import (
1111
"testing"
1212
"time"
1313

14-
xmaps "golang.org/x/exp/maps"
1514
"golang.org/x/net/dns/dnsmessage"
1615
"tailscale.com/appc/appctest"
1716
"tailscale.com/tstest"
1817
"tailscale.com/util/clientmetric"
1918
"tailscale.com/util/mak"
2019
"tailscale.com/util/must"
20+
"tailscale.com/util/slicesx"
2121
)
2222

2323
func fakeStoreRoutes(*RouteInfo) error { return nil }
@@ -50,7 +50,7 @@ func TestUpdateDomains(t *testing.T) {
5050
// domains are explicitly downcased on set.
5151
a.UpdateDomains([]string{"UP.EXAMPLE.COM"})
5252
a.Wait(ctx)
53-
if got, want := xmaps.Keys(a.domains), []string{"up.example.com"}; !slices.Equal(got, want) {
53+
if got, want := slicesx.MapKeys(a.domains), []string{"up.example.com"}; !slices.Equal(got, want) {
5454
t.Errorf("got %v; want %v", got, want)
5555
}
5656
}
@@ -69,15 +69,19 @@ func TestUpdateRoutes(t *testing.T) {
6969
a.updateDomains([]string{"*.example.com"})
7070

7171
// This route should be collapsed into the range
72-
a.ObserveDNSResponse(dnsResponse("a.example.com.", "192.0.2.1"))
72+
if err := a.ObserveDNSResponse(dnsResponse("a.example.com.", "192.0.2.1")); err != nil {
73+
t.Errorf("ObserveDNSResponse: %v", err)
74+
}
7375
a.Wait(ctx)
7476

7577
if !slices.Equal(rc.Routes(), []netip.Prefix{netip.MustParsePrefix("192.0.2.1/32")}) {
7678
t.Fatalf("got %v, want %v", rc.Routes(), []netip.Prefix{netip.MustParsePrefix("192.0.2.1/32")})
7779
}
7880

7981
// This route should not be collapsed or removed
80-
a.ObserveDNSResponse(dnsResponse("b.example.com.", "192.0.0.1"))
82+
if err := a.ObserveDNSResponse(dnsResponse("b.example.com.", "192.0.0.1")); err != nil {
83+
t.Errorf("ObserveDNSResponse: %v", err)
84+
}
8185
a.Wait(ctx)
8286

8387
routes := []netip.Prefix{netip.MustParsePrefix("192.0.2.0/24"), netip.MustParsePrefix("192.0.0.1/32")}
@@ -130,7 +134,9 @@ func TestDomainRoutes(t *testing.T) {
130134
a = NewAppConnector(t.Logf, rc, nil, nil)
131135
}
132136
a.updateDomains([]string{"example.com"})
133-
a.ObserveDNSResponse(dnsResponse("example.com.", "192.0.0.8"))
137+
if err := a.ObserveDNSResponse(dnsResponse("example.com.", "192.0.0.8")); err != nil {
138+
t.Errorf("ObserveDNSResponse: %v", err)
139+
}
134140
a.Wait(context.Background())
135141

136142
want := map[string][]netip.Addr{
@@ -155,15 +161,19 @@ func TestObserveDNSResponse(t *testing.T) {
155161
}
156162

157163
// a has no domains configured, so it should not advertise any routes
158-
a.ObserveDNSResponse(dnsResponse("example.com.", "192.0.0.8"))
164+
if err := a.ObserveDNSResponse(dnsResponse("example.com.", "192.0.0.8")); err != nil {
165+
t.Errorf("ObserveDNSResponse: %v", err)
166+
}
159167
if got, want := rc.Routes(), ([]netip.Prefix)(nil); !slices.Equal(got, want) {
160168
t.Errorf("got %v; want %v", got, want)
161169
}
162170

163171
wantRoutes := []netip.Prefix{netip.MustParsePrefix("192.0.0.8/32")}
164172

165173
a.updateDomains([]string{"example.com"})
166-
a.ObserveDNSResponse(dnsResponse("example.com.", "192.0.0.8"))
174+
if err := a.ObserveDNSResponse(dnsResponse("example.com.", "192.0.0.8")); err != nil {
175+
t.Errorf("ObserveDNSResponse: %v", err)
176+
}
167177
a.Wait(ctx)
168178
if got, want := rc.Routes(), wantRoutes; !slices.Equal(got, want) {
169179
t.Errorf("got %v; want %v", got, want)
@@ -172,7 +182,9 @@ func TestObserveDNSResponse(t *testing.T) {
172182
// a CNAME record chain should result in a route being added if the chain
173183
// matches a routed domain.
174184
a.updateDomains([]string{"www.example.com", "example.com"})
175-
a.ObserveDNSResponse(dnsCNAMEResponse("192.0.0.9", "www.example.com.", "chain.example.com.", "example.com."))
185+
if err := a.ObserveDNSResponse(dnsCNAMEResponse("192.0.0.9", "www.example.com.", "chain.example.com.", "example.com.")); err != nil {
186+
t.Errorf("ObserveDNSResponse: %v", err)
187+
}
176188
a.Wait(ctx)
177189
wantRoutes = append(wantRoutes, netip.MustParsePrefix("192.0.0.9/32"))
178190
if got, want := rc.Routes(), wantRoutes; !slices.Equal(got, want) {
@@ -181,7 +193,9 @@ func TestObserveDNSResponse(t *testing.T) {
181193

182194
// a CNAME record chain should result in a route being added if the chain
183195
// even if only found in the middle of the chain
184-
a.ObserveDNSResponse(dnsCNAMEResponse("192.0.0.10", "outside.example.org.", "www.example.com.", "example.org."))
196+
if err := a.ObserveDNSResponse(dnsCNAMEResponse("192.0.0.10", "outside.example.org.", "www.example.com.", "example.org.")); err != nil {
197+
t.Errorf("ObserveDNSResponse: %v", err)
198+
}
185199
a.Wait(ctx)
186200
wantRoutes = append(wantRoutes, netip.MustParsePrefix("192.0.0.10/32"))
187201
if got, want := rc.Routes(), wantRoutes; !slices.Equal(got, want) {
@@ -190,14 +204,18 @@ func TestObserveDNSResponse(t *testing.T) {
190204

191205
wantRoutes = append(wantRoutes, netip.MustParsePrefix("2001:db8::1/128"))
192206

193-
a.ObserveDNSResponse(dnsResponse("example.com.", "2001:db8::1"))
207+
if err := a.ObserveDNSResponse(dnsResponse("example.com.", "2001:db8::1")); err != nil {
208+
t.Errorf("ObserveDNSResponse: %v", err)
209+
}
194210
a.Wait(ctx)
195211
if got, want := rc.Routes(), wantRoutes; !slices.Equal(got, want) {
196212
t.Errorf("got %v; want %v", got, want)
197213
}
198214

199215
// don't re-advertise routes that have already been advertised
200-
a.ObserveDNSResponse(dnsResponse("example.com.", "2001:db8::1"))
216+
if err := a.ObserveDNSResponse(dnsResponse("example.com.", "2001:db8::1")); err != nil {
217+
t.Errorf("ObserveDNSResponse: %v", err)
218+
}
201219
a.Wait(ctx)
202220
if !slices.Equal(rc.Routes(), wantRoutes) {
203221
t.Errorf("rc.Routes(): got %v; want %v", rc.Routes(), wantRoutes)
@@ -207,7 +225,9 @@ func TestObserveDNSResponse(t *testing.T) {
207225
pfx := netip.MustParsePrefix("192.0.2.0/24")
208226
a.updateRoutes([]netip.Prefix{pfx})
209227
wantRoutes = append(wantRoutes, pfx)
210-
a.ObserveDNSResponse(dnsResponse("example.com.", "192.0.2.1"))
228+
if err := a.ObserveDNSResponse(dnsResponse("example.com.", "192.0.2.1")); err != nil {
229+
t.Errorf("ObserveDNSResponse: %v", err)
230+
}
211231
a.Wait(ctx)
212232
if !slices.Equal(rc.Routes(), wantRoutes) {
213233
t.Errorf("rc.Routes(): got %v; want %v", rc.Routes(), wantRoutes)
@@ -230,7 +250,9 @@ func TestWildcardDomains(t *testing.T) {
230250
}
231251

232252
a.updateDomains([]string{"*.example.com"})
233-
a.ObserveDNSResponse(dnsResponse("foo.example.com.", "192.0.0.8"))
253+
if err := a.ObserveDNSResponse(dnsResponse("foo.example.com.", "192.0.0.8")); err != nil {
254+
t.Errorf("ObserveDNSResponse: %v", err)
255+
}
234256
a.Wait(ctx)
235257
if got, want := rc.Routes(), []netip.Prefix{netip.MustParsePrefix("192.0.0.8/32")}; !slices.Equal(got, want) {
236258
t.Errorf("routes: got %v; want %v", got, want)
@@ -438,10 +460,16 @@ func TestUpdateDomainRouteRemoval(t *testing.T) {
438460
// adding domains doesn't immediately cause any routes to be advertised
439461
assertRoutes("update domains", []netip.Prefix{}, []netip.Prefix{})
440462

441-
a.ObserveDNSResponse(dnsResponse("a.example.com.", "1.2.3.1"))
442-
a.ObserveDNSResponse(dnsResponse("a.example.com.", "1.2.3.2"))
443-
a.ObserveDNSResponse(dnsResponse("b.example.com.", "1.2.3.3"))
444-
a.ObserveDNSResponse(dnsResponse("b.example.com.", "1.2.3.4"))
463+
for _, res := range [][]byte{
464+
dnsResponse("a.example.com.", "1.2.3.1"),
465+
dnsResponse("a.example.com.", "1.2.3.2"),
466+
dnsResponse("b.example.com.", "1.2.3.3"),
467+
dnsResponse("b.example.com.", "1.2.3.4"),
468+
} {
469+
if err := a.ObserveDNSResponse(res); err != nil {
470+
t.Errorf("ObserveDNSResponse: %v", err)
471+
}
472+
}
445473
a.Wait(ctx)
446474
// observing dns responses causes routes to be advertised
447475
assertRoutes("observed dns", prefixes("1.2.3.1/32", "1.2.3.2/32", "1.2.3.3/32", "1.2.3.4/32"), []netip.Prefix{})
@@ -487,10 +515,16 @@ func TestUpdateWildcardRouteRemoval(t *testing.T) {
487515
// adding domains doesn't immediately cause any routes to be advertised
488516
assertRoutes("update domains", []netip.Prefix{}, []netip.Prefix{})
489517

490-
a.ObserveDNSResponse(dnsResponse("a.example.com.", "1.2.3.1"))
491-
a.ObserveDNSResponse(dnsResponse("a.example.com.", "1.2.3.2"))
492-
a.ObserveDNSResponse(dnsResponse("1.b.example.com.", "1.2.3.3"))
493-
a.ObserveDNSResponse(dnsResponse("2.b.example.com.", "1.2.3.4"))
518+
for _, res := range [][]byte{
519+
dnsResponse("a.example.com.", "1.2.3.1"),
520+
dnsResponse("a.example.com.", "1.2.3.2"),
521+
dnsResponse("1.b.example.com.", "1.2.3.3"),
522+
dnsResponse("2.b.example.com.", "1.2.3.4"),
523+
} {
524+
if err := a.ObserveDNSResponse(res); err != nil {
525+
t.Errorf("ObserveDNSResponse: %v", err)
526+
}
527+
}
494528
a.Wait(ctx)
495529
// observing dns responses causes routes to be advertised
496530
assertRoutes("observed dns", prefixes("1.2.3.1/32", "1.2.3.2/32", "1.2.3.3/32", "1.2.3.4/32"), []netip.Prefix{})

atomicfile/atomicfile.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@ import (
1515
)
1616

1717
// WriteFile writes data to filename+some suffix, then renames it into filename.
18-
// The perm argument is ignored on Windows. If the target filename already
19-
// exists but is not a regular file, WriteFile returns an error.
18+
// The perm argument is ignored on Windows, but if the target filename already
19+
// exists then the target file's attributes and ACLs are preserved. If the target
20+
// filename already exists but is not a regular file, WriteFile returns an error.
2021
func WriteFile(filename string, data []byte, perm os.FileMode) (err error) {
2122
fi, err := os.Stat(filename)
2223
if err == nil && !fi.Mode().IsRegular() {
@@ -47,5 +48,5 @@ func WriteFile(filename string, data []byte, perm os.FileMode) (err error) {
4748
if err := f.Close(); err != nil {
4849
return err
4950
}
50-
return os.Rename(tmpName, filename)
51+
return rename(tmpName, filename)
5152
}

atomicfile/atomicfile_notwindows.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Copyright (c) Tailscale Inc & AUTHORS
2+
// SPDX-License-Identifier: BSD-3-Clause
3+
4+
//go:build !windows
5+
6+
package atomicfile
7+
8+
import (
9+
"os"
10+
)
11+
12+
func rename(srcFile, destFile string) error {
13+
return os.Rename(srcFile, destFile)
14+
}

0 commit comments

Comments
 (0)