Skip to content
This repository was archived by the owner on Jul 13, 2025. It is now read-only.

Commit a5ddca4

Browse files
committed
Merge remote-tracking branch 'upstream/main'
2 parents 7efd102 + b70c0c5 commit a5ddca4

File tree

166 files changed

+8156
-3511
lines changed

Some content is hidden

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

166 files changed

+8156
-3511
lines changed

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ updatedeps: ## Update depaware deps
2323
tailscale.com/cmd/derper \
2424
tailscale.com/cmd/k8s-operator \
2525
tailscale.com/cmd/stund
26+
PATH="$$(./tool/go env GOROOT)/bin:$$PATH" ./tool/go run github.com/tailscale/depaware --update -goos=linux,darwin,windows,android,ios --internal \
27+
tailscale.com/tsnet
2628

2729
depaware: ## Run depaware checks
2830
# depaware (via x/tools/go/packages) shells back to "go", so make sure the "go"
@@ -33,6 +35,8 @@ depaware: ## Run depaware checks
3335
tailscale.com/cmd/derper \
3436
tailscale.com/cmd/k8s-operator \
3537
tailscale.com/cmd/stund
38+
PATH="$$(./tool/go env GOROOT)/bin:$$PATH" ./tool/go run github.com/tailscale/depaware --check --goos=linux,darwin,windows,android,ios --internal \
39+
tailscale.com/tsnet
3640

3741
buildwindows: ## Build tailscale CLI for windows/amd64
3842
GOOS=windows GOARCH=amd64 ./tool/go install tailscale.com/cmd/tailscale tailscale.com/cmd/tailscaled

build_dist.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ while [ "$#" -gt 1 ]; do
4141
fi
4242
shift
4343
ldflags="$ldflags -w -s"
44-
tags="${tags:+$tags,}ts_omit_aws,ts_omit_bird,ts_omit_tap,ts_omit_kube,ts_omit_completion,ts_omit_ssh,ts_omit_wakeonlan,ts_omit_capture,ts_omit_relayserver,ts_omit_taildrop"
44+
tags="${tags:+$tags,}ts_omit_aws,ts_omit_bird,ts_omit_tap,ts_omit_kube,ts_omit_completion,ts_omit_ssh,ts_omit_wakeonlan,ts_omit_capture,ts_omit_relayserver,ts_omit_taildrop,ts_omit_tpm"
4545
;;
4646
--box)
4747
if [ ! -z "${TAGS:-}" ]; then

client/local/local.go

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ func (lc *Client) get200(ctx context.Context, path string) ([]byte, error) {
294294

295295
// WhoIs returns the owner of the remoteAddr, which must be an IP or IP:port.
296296
//
297-
// Deprecated: use Client.WhoIs.
297+
// Deprecated: use [Client.WhoIs].
298298
func WhoIs(ctx context.Context, remoteAddr string) (*apitype.WhoIsResponse, error) {
299299
return defaultClient.WhoIs(ctx, remoteAddr)
300300
}
@@ -309,7 +309,7 @@ func decodeJSON[T any](b []byte) (ret T, err error) {
309309

310310
// WhoIs returns the owner of the remoteAddr, which must be an IP or IP:port.
311311
//
312-
// If not found, the error is ErrPeerNotFound.
312+
// If not found, the error is [ErrPeerNotFound].
313313
//
314314
// For connections proxied by tailscaled, this looks up the owner of the given
315315
// address as TCP first, falling back to UDP; if you want to only check a
@@ -325,7 +325,8 @@ func (lc *Client) WhoIs(ctx context.Context, remoteAddr string) (*apitype.WhoIsR
325325
return decodeJSON[*apitype.WhoIsResponse](body)
326326
}
327327

328-
// ErrPeerNotFound is returned by WhoIs and WhoIsNodeKey when a peer is not found.
328+
// ErrPeerNotFound is returned by [Client.WhoIs], [Client.WhoIsNodeKey] and
329+
// [Client.WhoIsProto] when a peer is not found.
329330
var ErrPeerNotFound = errors.New("peer not found")
330331

331332
// WhoIsNodeKey returns the owner of the given wireguard public key.
@@ -345,7 +346,7 @@ func (lc *Client) WhoIsNodeKey(ctx context.Context, key key.NodePublic) (*apityp
345346
// WhoIsProto returns the owner of the remoteAddr, which must be an IP or
346347
// IP:port, for the given protocol (tcp or udp).
347348
//
348-
// If not found, the error is ErrPeerNotFound.
349+
// If not found, the error is [ErrPeerNotFound].
349350
func (lc *Client) WhoIsProto(ctx context.Context, proto, remoteAddr string) (*apitype.WhoIsResponse, error) {
350351
body, err := lc.get200(ctx, "/localapi/v0/whois?proto="+url.QueryEscape(proto)+"&addr="+url.QueryEscape(remoteAddr))
351352
if err != nil {
@@ -490,7 +491,7 @@ func (lc *Client) BugReportWithOpts(ctx context.Context, opts BugReportOpts) (st
490491

491492
// BugReport logs and returns a log marker that can be shared by the user with support.
492493
//
493-
// This is the same as calling BugReportWithOpts and only specifying the Note
494+
// This is the same as calling [Client.BugReportWithOpts] and only specifying the Note
494495
// field.
495496
func (lc *Client) BugReport(ctx context.Context, note string) (string, error) {
496497
return lc.BugReportWithOpts(ctx, BugReportOpts{Note: note})
@@ -531,7 +532,7 @@ func (lc *Client) DebugResultJSON(ctx context.Context, action string) (any, erro
531532
return x, nil
532533
}
533534

534-
// DebugPortmapOpts contains options for the DebugPortmap command.
535+
// DebugPortmapOpts contains options for the [Client.DebugPortmap] command.
535536
type DebugPortmapOpts struct {
536537
// Duration is how long the mapping should be created for. It defaults
537538
// to 5 seconds if not set.
@@ -677,7 +678,7 @@ func (lc *Client) WaitingFiles(ctx context.Context) ([]apitype.WaitingFile, erro
677678
return lc.AwaitWaitingFiles(ctx, 0)
678679
}
679680

680-
// AwaitWaitingFiles is like WaitingFiles but takes a duration to await for an answer.
681+
// AwaitWaitingFiles is like [Client.WaitingFiles] but takes a duration to await for an answer.
681682
// If the duration is 0, it will return immediately. The duration is respected at second
682683
// granularity only. If no files are available, it returns (nil, nil).
683684
func (lc *Client) AwaitWaitingFiles(ctx context.Context, d time.Duration) ([]apitype.WaitingFile, error) {
@@ -946,7 +947,7 @@ func (lc *Client) SetDNS(ctx context.Context, name, value string) error {
946947
// The host may be a base DNS name (resolved from the netmap inside
947948
// tailscaled), a FQDN, or an IP address.
948949
//
949-
// The ctx is only used for the duration of the call, not the lifetime of the net.Conn.
950+
// The ctx is only used for the duration of the call, not the lifetime of the [net.Conn].
950951
func (lc *Client) DialTCP(ctx context.Context, host string, port uint16) (net.Conn, error) {
951952
return lc.UserDial(ctx, "tcp", host, port)
952953
}
@@ -957,7 +958,7 @@ func (lc *Client) DialTCP(ctx context.Context, host string, port uint16) (net.Co
957958
// a FQDN, or an IP address.
958959
//
959960
// The ctx is only used for the duration of the call, not the lifetime of the
960-
// net.Conn.
961+
// [net.Conn].
961962
func (lc *Client) UserDial(ctx context.Context, network, host string, port uint16) (net.Conn, error) {
962963
connCh := make(chan net.Conn, 1)
963964
trace := httptrace.ClientTrace{
@@ -1025,7 +1026,7 @@ func (lc *Client) CurrentDERPMap(ctx context.Context) (*tailcfg.DERPMap, error)
10251026
//
10261027
// It returns a cached certificate from disk if it's still valid.
10271028
//
1028-
// Deprecated: use Client.CertPair.
1029+
// Deprecated: use [Client.CertPair].
10291030
func CertPair(ctx context.Context, domain string) (certPEM, keyPEM []byte, err error) {
10301031
return defaultClient.CertPair(ctx, domain)
10311032
}
@@ -1072,9 +1073,9 @@ func (lc *Client) CertPairWithValidity(ctx context.Context, domain string, minVa
10721073
// It returns a cached certificate from disk if it's still valid.
10731074
//
10741075
// It's the right signature to use as the value of
1075-
// tls.Config.GetCertificate.
1076+
// [tls.Config.GetCertificate].
10761077
//
1077-
// Deprecated: use Client.GetCertificate.
1078+
// Deprecated: use [Client.GetCertificate].
10781079
func GetCertificate(hi *tls.ClientHelloInfo) (*tls.Certificate, error) {
10791080
return defaultClient.GetCertificate(hi)
10801081
}
@@ -1084,7 +1085,7 @@ func GetCertificate(hi *tls.ClientHelloInfo) (*tls.Certificate, error) {
10841085
// It returns a cached certificate from disk if it's still valid.
10851086
//
10861087
// It's the right signature to use as the value of
1087-
// tls.Config.GetCertificate.
1088+
// [tls.Config.GetCertificate].
10881089
//
10891090
// API maturity: this is considered a stable API.
10901091
func (lc *Client) GetCertificate(hi *tls.ClientHelloInfo) (*tls.Certificate, error) {
@@ -1113,7 +1114,7 @@ func (lc *Client) GetCertificate(hi *tls.ClientHelloInfo) (*tls.Certificate, err
11131114

11141115
// ExpandSNIName expands bare label name into the most likely actual TLS cert name.
11151116
//
1116-
// Deprecated: use Client.ExpandSNIName.
1117+
// Deprecated: use [Client.ExpandSNIName].
11171118
func ExpandSNIName(ctx context.Context, name string) (fqdn string, ok bool) {
11181119
return defaultClient.ExpandSNIName(ctx, name)
11191120
}
@@ -1502,7 +1503,7 @@ func (lc *Client) SwitchProfile(ctx context.Context, profile ipn.ProfileID) erro
15021503

15031504
// DeleteProfile removes the profile with the given ID.
15041505
// If the profile is the current profile, an empty profile
1505-
// will be selected as if SwitchToEmptyProfile was called.
1506+
// will be selected as if [Client.SwitchToEmptyProfile] was called.
15061507
func (lc *Client) DeleteProfile(ctx context.Context, profile ipn.ProfileID) error {
15071508
_, err := lc.send(ctx, "DELETE", "/localapi/v0/profiles/"+url.PathEscape(string(profile)), http.StatusNoContent, nil)
15081509
return err
@@ -1559,7 +1560,7 @@ func (lc *Client) DebugSetExpireIn(ctx context.Context, d time.Duration) error {
15591560
// StreamDebugCapture streams a pcap-formatted packet capture.
15601561
//
15611562
// The provided context does not determine the lifetime of the
1562-
// returned io.ReadCloser.
1563+
// returned [io.ReadCloser].
15631564
func (lc *Client) StreamDebugCapture(ctx context.Context) (io.ReadCloser, error) {
15641565
req, err := http.NewRequestWithContext(ctx, "POST", "http://"+apitype.LocalAPIHost+"/localapi/v0/debug-capture", nil)
15651566
if err != nil {
@@ -1582,7 +1583,7 @@ func (lc *Client) StreamDebugCapture(ctx context.Context) (io.ReadCloser, error)
15821583
// The context is used for the life of the watch, not just the call to
15831584
// WatchIPNBus.
15841585
//
1585-
// The returned IPNBusWatcher's Close method must be called when done to release
1586+
// The returned [IPNBusWatcher]'s Close method must be called when done to release
15861587
// resources.
15871588
//
15881589
// A default set of ipn.Notify messages are returned but the set can be modified by mask.
@@ -1609,7 +1610,7 @@ func (lc *Client) WatchIPNBus(ctx context.Context, mask ipn.NotifyWatchOpt) (*IP
16091610
}, nil
16101611
}
16111612

1612-
// CheckUpdate returns a tailcfg.ClientVersion indicating whether or not an update is available
1613+
// CheckUpdate returns a [*tailcfg.ClientVersion] indicating whether or not an update is available
16131614
// to be installed via the LocalAPI. In case the LocalAPI can't install updates, it returns a
16141615
// ClientVersion that says that we are up to date.
16151616
func (lc *Client) CheckUpdate(ctx context.Context) (*tailcfg.ClientVersion, error) {
@@ -1685,7 +1686,7 @@ func (lc *Client) DriveShareList(ctx context.Context) ([]*drive.Share, error) {
16851686
}
16861687

16871688
// IPNBusWatcher is an active subscription (watch) of the local tailscaled IPN bus.
1688-
// It's returned by Client.WatchIPNBus.
1689+
// It's returned by [Client.WatchIPNBus].
16891690
//
16901691
// It must be closed when done.
16911692
type IPNBusWatcher struct {

client/tailscale/localclient_aliases.go

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -12,95 +12,95 @@ import (
1212
"tailscale.com/ipn/ipnstate"
1313
)
1414

15-
// ErrPeerNotFound is an alias for tailscale.com/client/local.
15+
// ErrPeerNotFound is an alias for [tailscale.com/client/local.ErrPeerNotFound].
1616
//
17-
// Deprecated: import tailscale.com/client/local instead.
17+
// Deprecated: import [tailscale.com/client/local] instead.
1818
var ErrPeerNotFound = local.ErrPeerNotFound
1919

20-
// LocalClient is an alias for tailscale.com/client/local.
20+
// LocalClient is an alias for [tailscale.com/client/local.Client].
2121
//
22-
// Deprecated: import tailscale.com/client/local instead.
22+
// Deprecated: import [tailscale.com/client/local] instead.
2323
type LocalClient = local.Client
2424

25-
// IPNBusWatcher is an alias for tailscale.com/client/local.
25+
// IPNBusWatcher is an alias for [tailscale.com/client/local.IPNBusWatcher].
2626
//
27-
// Deprecated: import tailscale.com/client/local instead.
27+
// Deprecated: import [tailscale.com/client/local] instead.
2828
type IPNBusWatcher = local.IPNBusWatcher
2929

30-
// BugReportOpts is an alias for tailscale.com/client/local.
30+
// BugReportOpts is an alias for [tailscale.com/client/local.BugReportOpts].
3131
//
32-
// Deprecated: import tailscale.com/client/local instead.
32+
// Deprecated: import [tailscale.com/client/local] instead.
3333
type BugReportOpts = local.BugReportOpts
3434

35-
// DebugPortMapOpts is an alias for tailscale.com/client/local.
35+
// DebugPortmapOpts is an alias for [tailscale.com/client/local.DebugPortmapOpts].
3636
//
37-
// Deprecated: import tailscale.com/client/local instead.
37+
// Deprecated: import [tailscale.com/client/local] instead.
3838
type DebugPortmapOpts = local.DebugPortmapOpts
3939

40-
// PingOpts is an alias for tailscale.com/client/local.
40+
// PingOpts is an alias for [tailscale.com/client/local.PingOpts].
4141
//
42-
// Deprecated: import tailscale.com/client/local instead.
42+
// Deprecated: import [tailscale.com/client/local] instead.
4343
type PingOpts = local.PingOpts
4444

45-
// GetCertificate is an alias for tailscale.com/client/local.
45+
// GetCertificate is an alias for [tailscale.com/client/local.GetCertificate].
4646
//
47-
// Deprecated: import tailscale.com/client/local instead.
47+
// Deprecated: import [tailscale.com/client/local] instead and use [local.Client.GetCertificate].
4848
func GetCertificate(hi *tls.ClientHelloInfo) (*tls.Certificate, error) {
4949
return local.GetCertificate(hi)
5050
}
5151

52-
// SetVersionMismatchHandler is an alias for tailscale.com/client/local.
52+
// SetVersionMismatchHandler is an alias for [tailscale.com/client/local.SetVersionMismatchHandler].
5353
//
54-
// Deprecated: import tailscale.com/client/local instead.
54+
// Deprecated: import [tailscale.com/client/local] instead.
5555
func SetVersionMismatchHandler(f func(clientVer, serverVer string)) {
5656
local.SetVersionMismatchHandler(f)
5757
}
5858

59-
// IsAccessDeniedError is an alias for tailscale.com/client/local.
59+
// IsAccessDeniedError is an alias for [tailscale.com/client/local.IsAccessDeniedError].
6060
//
61-
// Deprecated: import tailscale.com/client/local instead.
61+
// Deprecated: import [tailscale.com/client/local] instead.
6262
func IsAccessDeniedError(err error) bool {
6363
return local.IsAccessDeniedError(err)
6464
}
6565

66-
// IsPreconditionsFailedError is an alias for tailscale.com/client/local.
66+
// IsPreconditionsFailedError is an alias for [tailscale.com/client/local.IsPreconditionsFailedError].
6767
//
68-
// Deprecated: import tailscale.com/client/local instead.
68+
// Deprecated: import [tailscale.com/client/local] instead.
6969
func IsPreconditionsFailedError(err error) bool {
7070
return local.IsPreconditionsFailedError(err)
7171
}
7272

73-
// WhoIs is an alias for tailscale.com/client/local.
73+
// WhoIs is an alias for [tailscale.com/client/local.WhoIs].
7474
//
75-
// Deprecated: import tailscale.com/client/local instead.
75+
// Deprecated: import [tailscale.com/client/local] instead and use [local.Client.WhoIs].
7676
func WhoIs(ctx context.Context, remoteAddr string) (*apitype.WhoIsResponse, error) {
7777
return local.WhoIs(ctx, remoteAddr)
7878
}
7979

80-
// Status is an alias for tailscale.com/client/local.
80+
// Status is an alias for [tailscale.com/client/local.Status].
8181
//
82-
// Deprecated: import tailscale.com/client/local instead.
82+
// Deprecated: import [tailscale.com/client/local] instead.
8383
func Status(ctx context.Context) (*ipnstate.Status, error) {
8484
return local.Status(ctx)
8585
}
8686

87-
// StatusWithoutPeers is an alias for tailscale.com/client/local.
87+
// StatusWithoutPeers is an alias for [tailscale.com/client/local.StatusWithoutPeers].
8888
//
89-
// Deprecated: import tailscale.com/client/local instead.
89+
// Deprecated: import [tailscale.com/client/local] instead.
9090
func StatusWithoutPeers(ctx context.Context) (*ipnstate.Status, error) {
9191
return local.StatusWithoutPeers(ctx)
9292
}
9393

94-
// CertPair is an alias for tailscale.com/client/local.
94+
// CertPair is an alias for [tailscale.com/client/local.CertPair].
9595
//
96-
// Deprecated: import tailscale.com/client/local instead.
96+
// Deprecated: import [tailscale.com/client/local] instead and use [local.Client.CertPair].
9797
func CertPair(ctx context.Context, domain string) (certPEM, keyPEM []byte, err error) {
9898
return local.CertPair(ctx, domain)
9999
}
100100

101-
// ExpandSNIName is an alias for tailscale.com/client/local.
101+
// ExpandSNIName is an alias for [tailscale.com/client/local.ExpandSNIName].
102102
//
103-
// Deprecated: import tailscale.com/client/local instead.
103+
// Deprecated: import [tailscale.com/client/local] instead and use [local.Client.ExpandSNIName].
104104
func ExpandSNIName(ctx context.Context, name string) (fqdn string, ok bool) {
105105
return local.ExpandSNIName(ctx, name)
106106
}

client/tailscale/tailscale.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// This package is only intended for internal and transitional use.
99
//
1010
// Deprecated: the official control plane client is available at
11-
// tailscale.com/client/tailscale/v2.
11+
// [tailscale.com/client/tailscale/v2].
1212
package tailscale
1313

1414
import (
@@ -22,7 +22,7 @@ import (
2222
)
2323

2424
// I_Acknowledge_This_API_Is_Unstable must be set true to use this package
25-
// for now. This package is being replaced by tailscale.com/client/tailscale/v2.
25+
// for now. This package is being replaced by [tailscale.com/client/tailscale/v2].
2626
var I_Acknowledge_This_API_Is_Unstable = false
2727

2828
// TODO: use url.PathEscape() for deviceID and tailnets when constructing requests.
@@ -34,10 +34,10 @@ const maxReadSize = 10 << 20
3434

3535
// Client makes API calls to the Tailscale control plane API server.
3636
//
37-
// Use NewClient to instantiate one. Exported fields should be set before
37+
// Use [NewClient] to instantiate one. Exported fields should be set before
3838
// the client is used and not changed thereafter.
3939
//
40-
// Deprecated: use tailscale.com/client/tailscale/v2 instead.
40+
// Deprecated: use [tailscale.com/client/tailscale/v2] instead.
4141
type Client struct {
4242
// tailnet is the globally unique identifier for a Tailscale network, such
4343
// as "example.com" or "user@gmail.com".
@@ -51,7 +51,7 @@ type Client struct {
5151
BaseURL string
5252

5353
// HTTPClient optionally specifies an alternate HTTP client to use.
54-
// If nil, http.DefaultClient is used.
54+
// If nil, [http.DefaultClient] is used.
5555
HTTPClient *http.Client
5656

5757
// UserAgent optionally specifies an alternate User-Agent header
@@ -119,7 +119,7 @@ type AuthMethod interface {
119119
modifyRequest(req *http.Request)
120120
}
121121

122-
// APIKey is an AuthMethod for NewClient that authenticates requests
122+
// APIKey is an [AuthMethod] for [NewClient] that authenticates requests
123123
// using an authkey.
124124
type APIKey string
125125

@@ -133,15 +133,15 @@ func (c *Client) setAuth(r *http.Request) {
133133
}
134134
}
135135

136-
// NewClient is a convenience method for instantiating a new Client.
136+
// NewClient is a convenience method for instantiating a new [Client].
137137
//
138138
// tailnet is the globally unique identifier for a Tailscale network, such
139139
// as "example.com" or "user@gmail.com".
140-
// If httpClient is nil, then http.DefaultClient is used.
140+
// If httpClient is nil, then [http.DefaultClient] is used.
141141
// "api.tailscale.com" is set as the BaseURL for the returned client
142142
// and can be changed manually by the user.
143143
//
144-
// Deprecated: use tailscale.com/client/tailscale/v2 instead.
144+
// Deprecated: use [tailscale.com/client/tailscale/v2] instead.
145145
func NewClient(tailnet string, auth AuthMethod) *Client {
146146
return &Client{
147147
tailnet: tailnet,
@@ -193,9 +193,9 @@ func (e ErrResponse) Error() string {
193193
}
194194

195195
// HandleErrorResponse decodes the error message from the server and returns
196-
// an ErrResponse from it.
196+
// an [ErrResponse] from it.
197197
//
198-
// Deprecated: use tailscale.com/client/tailscale/v2 instead.
198+
// Deprecated: use [tailscale.com/client/tailscale/v2] instead.
199199
func HandleErrorResponse(b []byte, resp *http.Response) error {
200200
var errResp ErrResponse
201201
if err := json.Unmarshal(b, &errResp); err != nil {

0 commit comments

Comments
 (0)