Skip to content

feat(ci): bump to upstream 1.76.0 #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 121 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
121 commits
Select commit Hold shift + click to select a range
3bee38d
VERSION.txt: this is v1.75.0 (#13454)
kari-ts Sep 12, 2024
aa15a63
derp: add new concurrent server benchmark
bradfitz Sep 12, 2024
93f61aa
tailcfg: add node attr for SSH environment variables (#13450)
mpminardi Sep 12, 2024
afec2d4
wgengine/magicsock: remove redundant deadline from netcheck report ca…
jwhited Sep 13, 2024
124ff3b
{api.md,publicapi}: remove old API docs (#13468)
mpminardi Sep 13, 2024
40833a7
wgengine/magicsock: disable raw disco by default; add envknob to enable
andrew-d Sep 16, 2024
f572286
gokrazy, various: use point versions of Go and update Nix deps
andrew-d Sep 16, 2024
7f1c193
licenses: update license notices
Sep 16, 2024
8012bb4
derp: refactor DERP server's peer-gone watch mechanism
bradfitz Sep 16, 2024
4084c61
wgengine/magicsock: add side-effect-free function for netcheck UDP se…
jwhited Sep 17, 2024
5f4a4c6
wgengine/magicsock: fix sendUDPStd docs (#13490)
jwhited Sep 17, 2024
8b962f2
cmd/natc: fix nil pointer
franbull Sep 17, 2024
951884b
net/netcheck,wgengine/magicsock: plumb OnlyTCP443 controlknob through…
jwhited Sep 17, 2024
5f89c93
safeweb: add a ListenAndServe method to the Server type (#13498)
creachadair Sep 17, 2024
3a467b6
go/toolchain: use ed9dc37b2b000f376a3e819cbb159e2c17a2dac6 (#13507)
agottardo Sep 18, 2024
af5a845
net/dns/resolver: fix dns-sd NXDOMAIN responses from quad-100
raggi Sep 19, 2024
d0a56a8
cmd/containerboot: split main.go (#13517)
tomhjp Sep 19, 2024
3e9ca6c
go.toolchain.rev: bump oss, test toolchain matches go.toolchain.rev
bradfitz Sep 20, 2024
dc86d35
types/views: add SliceView.All iterator (#13536)
dsnet Sep 20, 2024
8d50871
tailcfg: add AcceptEnv field to SSHRule (#13523)
mpminardi Sep 23, 2024
07991de
.github: pin actions/checkout to latest v3 or v4 as appropriate (#13551)
mpminardi Sep 23, 2024
2c1bbfb
.github: pin actions/setup-go usage to latest 5.x (#13553)
mpminardi Sep 23, 2024
22e98cf
.github: pin codeql actions to latest 3.x (#13552)
mpminardi Sep 23, 2024
a3f7e72
.github: use and pin slackapi/slack-github-action to latest 1.x (#13554)
mpminardi Sep 23, 2024
a8bd0cb
.github: update and pin actions/cache to latest 4.x (#13555)
mpminardi Sep 23, 2024
04bbef0
.github: update and pin actions/upload-artifact to latest 4.x (#13556)
mpminardi Sep 23, 2024
05d82fb
.github: pin re-actors/alls-green to latest 1.x (#13558)
mpminardi Sep 23, 2024
a98f75b
.github: Bump tibdex/github-app-token from 1.8.0 to 2.1.0 (#9529)
dependabot[bot] Sep 24, 2024
8a6f48b
cli: add `tailscale dns query` (#13368)
agottardo Sep 24, 2024
43f4131
{release,version}: add DSM7.2 specific synology builds (#13405)
mpminardi Sep 24, 2024
6f7e7a3
tool/gocross: make gocross-wrapper.sh keep multiple Go toolchains around
bradfitz Sep 17, 2024
e1bbe1b
derp: document the RunWatchConnectionLoop callback gotchas
bradfitz Sep 24, 2024
0e0e53d
util/usermetrics: make usermetrics non-global
kradalby Sep 23, 2024
c2f0c70
health: clean up updateBuiltinWarnablesLocked a bit, fix DERP warnings
bradfitz Sep 25, 2024
2fdbcbd
wgengine/magicsock: only used cached results for GetLastNetcheckReport
sailorfrag Sep 25, 2024
65c2635
cmd/k8s-operator, k8s-operator: fix outdated kb links (#13585)
clstokes Sep 25, 2024
717d589
metrics: revert changes to MultiLabelMap's String method
andrew-d Sep 25, 2024
9eb59c7
wgengine/magicsock: fix check for EPERM on macOS
raggi Sep 25, 2024
c90c993
ssh/tailssh: add logic for matching against AcceptEnv patterns (#13466)
mpminardi Sep 26, 2024
3dc33a0
net/tsaddr: add WithoutExitRoutes and IsExitRoute
kradalby Sep 25, 2024
0909431
cmd/tailscale: use tsaddr helpers
kradalby Sep 25, 2024
f03e82a
client/web: use tsaddr helpers
kradalby Sep 25, 2024
7d1160d
{ipn,net,tsnet}: use tsaddr helpers
kradalby Sep 25, 2024
5550a17
wgengine: make opts.Metrics mandatory
kradalby Sep 26, 2024
69be54c
net/captivedetection: exclude ipsec interfaces from captive portal de…
agottardo Sep 26, 2024
7ec8bdf
go.mod: upgrade golangci-lint
andrew-d Sep 26, 2024
cab2e6e
cmd/k8s-operator,k8s-operator: add ProxyGroup CRD (#13591)
tomhjp Sep 27, 2024
7783255
ipn/ipnlocal: add advertised and primary route metrics
kradalby Sep 25, 2024
c62b073
cmd/k8s-operator: remove auth key once proxy has logged in (#13612)
irbekrm Sep 27, 2024
096b090
cmd/containerboot,kube,util/linuxfw: configure kube egress proxies to…
irbekrm Sep 29, 2024
fb0f8fc
cmd/tsidp: add --dir flag
Sep 26, 2024
a70287d
logpolicy: don't create a filch buffer if logging is disabled
knyar Sep 28, 2024
dd6b808
.github: Bump peter-evans/create-pull-request from 7.0.1 to 7.0.5 (#1…
dependabot[bot] Oct 1, 2024
8f44ba1
ssh: Add logic to set accepted environment variables in SSH session (…
mpminardi Oct 1, 2024
d3f302d
cmd/tailscale/cli: make 'tailscale debug ts2021' try twice
bradfitz Oct 1, 2024
fd32f0d
control/controlhttp: factor out some code in prep for future change
bradfitz Oct 1, 2024
1eaad7d
control/controlhttp: fix connectivity on Alaska Air wifi
bradfitz Sep 26, 2024
16ef887
net/portmapper: don't return unspecified/local external IPs
andrew-d Oct 1, 2024
262c526
net/portmapper: don't treat 0.0.0.0 as a valid IP
bradfitz Oct 1, 2024
992ee6d
.github: Bump github/codeql-action from 3.26.8 to 3.26.9 (#13625)
dependabot[bot] Oct 2, 2024
e66fe1f
docs/windows/policy: add ADMX policy setting to configure the AuthKey
nickkhyl Oct 1, 2024
ed1ac79
net/captivedetection: set Timeout on net.Dialer (#13613)
agottardo Oct 2, 2024
30f0fa9
control/controlclient: bound ReportHealthChange context lifetime to D…
bradfitz Oct 2, 2024
f49d218
net/dnscache: don't fall back to an IPv6 dial if we don't have IPv6
bradfitz Oct 2, 2024
6b03e18
control/controlhttp: rename a param from addr to optAddr for clarity
bradfitz Oct 2, 2024
a01b545
control/control{client,http}: don't noise dial localhost:443 in http-…
bradfitz Oct 2, 2024
6de6ab0
net/dns: tweak DoH timeout, limit MaxConnsPerHost, require TLS 1.3 (#…
agottardo Oct 2, 2024
b8af933
tstest: add the start of a testing wishlist
bradfitz Oct 2, 2024
d837e02
wf/firewall: allow link-local multicast for permitted local routes wh…
nickkhyl Oct 2, 2024
383120c
ipn/ipnlocal: don't run portlist code unless service collection is on
bradfitz Oct 2, 2024
09ec2f3
tailcfg: add func to check for known valid ServiceProtos (#13668)
tendstofortytwo Oct 3, 2024
6f694da
wgengine/magicsock: avoid log spam from ReceiveFunc on shutdown
bradfitz Oct 3, 2024
1f8eea5
control/controlclient: include HTTP status string in error message too
bradfitz Oct 3, 2024
5f88b65
wgengine/netstack: check userspace ping success on Windows
bradfitz Oct 2, 2024
58c6bc2
logpolicy: force TLS 1.3 handshake
agottardo Oct 2, 2024
dc60c8d
ssh/tailssh: pass window size pixels in IoctlSetWinsize events
bradfitz Oct 3, 2024
a3c6a3a
safeweb: add StrictTransportSecurityOptions config (#13679)
patrickod Oct 3, 2024
9bd158c
cmd/containerboot,util/linuxfw: create a SNAT rule for dst/src only o…
irbekrm Oct 3, 2024
e8bb5d1
cmd/{k8s-operator,containerboot},k8s-operator,kube: reconcile Externa…
irbekrm Oct 4, 2024
f30d853
cmd/tailscale/cli: don't print disablement secrets if init fails (#13…
Erisa Oct 4, 2024
8fdffb8
hostinfo: update SetPackage doc with new Android values (#13537)
kari-ts Oct 4, 2024
4ad3f01
safeweb: allow passing http.Server in safeweb.Config (#13688)
patrickod Oct 4, 2024
12f1bc7
envknob: support disk-based envknobs on the macsys build
andrew-d Oct 4, 2024
c48cc08
wgengine: stop conntrack log spam about Canonical net probes
bradfitz Oct 5, 2024
1005cbc
tailscaleroot: panic if tailscale_go build tag but Go toolchain mismatch
bradfitz Oct 6, 2024
e48cddf
cmd/{containerboot,k8s-operator},k8s-operator,kube: add ProxyGroup co…
tomhjp Oct 7, 2024
cb10edd
tool/gocross: fix argument order to find
bradfitz Oct 7, 2024
c588c36
types/key: use tlpub: in error message (#13707)
Erisa Oct 7, 2024
38f236c
derp: add server metric for batch write sizes
bradfitz Oct 5, 2024
7f016ba
cmd/k8s-operator,k8s-operator: create ConfigMap for egress services +…
irbekrm Oct 7, 2024
f3de4e9
derp: fix omitted word in comment
bradfitz Oct 7, 2024
9a73462
types/lazy: add DeferredInit type
nickkhyl Oct 6, 2024
266c14d
.github: Bump actions/cache from 4.0.2 to 4.1.0 (#13711)
dependabot[bot] Oct 8, 2024
866714a
.github: Bump github/codeql-action from 3.26.9 to 3.26.11 (#13710)
dependabot[bot] Oct 8, 2024
cba2e76
cmd/containerboot: simplify k8s setup logic (#13627)
tomhjp Oct 8, 2024
36cb2e4
cmd/k8s-operator,k8s-operator: use default ProxyClass if set for Prox…
tomhjp Oct 8, 2024
8ee7f82
net/netcheck: don't panic if a region has no Nodes
andrew-d Oct 8, 2024
861dc36
cmd/{k8s-operator,containerboot},kube/egressservices: fix Pod IP chec…
irbekrm Oct 8, 2024
841eaac
net/sockstats: quiet some log spam in release builds
bradfitz Oct 8, 2024
83efade
kube/egressservices: improve egress ports config readability (#13722)
tomhjp Oct 8, 2024
07c157e
cmd/k8s-operator: base ProxyGroup StatefulSet on common proxy.yaml de…
tomhjp Oct 8, 2024
29cf59a
util/syspolicy/setting: update Snapshot to use Go 1.23 iterators
nickkhyl Oct 8, 2024
da40609
util/syspolicy, ipn: add "tailscale debug component-logs" support
nickkhyl Oct 8, 2024
60011e7
cmd/k8s-operator: fix Pod IP selection (#13743)
irbekrm Oct 9, 2024
f6d4d03
cmd/k8s-operator: don't error out if ProxyClass for ProxyGroup not fo…
irbekrm Oct 9, 2024
94c7965
types/views: add iterators to the three Map view types
bradfitz Oct 9, 2024
89ee6bb
cmd/k8s-operator,k8s-operator/apis: set a readiness condition on egre…
irbekrm Oct 9, 2024
910b4e8
syncs: add iterators to Map (#13739)
dsnet Oct 9, 2024
2cadb80
util/vizerror: add WrapWithMessage
oxtoacart Oct 9, 2024
c763b7a
syncs: delete Map.Range, update callers to iterators
bradfitz Oct 9, 2024
5b73038
syncs: allocate map with Map.WithLock (#13755)
dsnet Oct 9, 2024
52ef27a
taildrop: fix defer in loop (#13757)
dsnet Oct 9, 2024
367fba8
control/controlhttp: don't link ts2021 server + websocket code on iOS
bradfitz Oct 10, 2024
fb420be
safesocket: don't depend on go-ps on iOS
bradfitz Oct 10, 2024
2531065
clientupdate, ipn/localapi: don't use google/uuid, thin iOS deps
bradfitz Oct 10, 2024
db1519c
k8s-operator/apis: revert ProxyGroup readiness cond name change (#13770)
irbekrm Oct 10, 2024
1938685
clientupdate: don't link distsign on platforms that don't download
bradfitz Oct 10, 2024
91f58c5
tsnet: fix panic caused by logging after test finishes
andrew-d Oct 9, 2024
5089806
ipn/conffile: don't depend on hujson on iOS/Android
bradfitz Oct 10, 2024
51fb4ce
VERSION.txt: this is v1.76.0
barnstar Oct 10, 2024
582dc91
Merge branch 'release-branch/1.76' into cpierre/coreweave-1.76
ChandonPierre Oct 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.74.1
1.76.0
102 changes: 0 additions & 102 deletions api.md
Original file line number Diff line number Diff line change
@@ -1,104 +1,2 @@
> [!IMPORTANT]
> The Tailscale API documentation has moved to https://tailscale.com/api

# Tailscale API

The Tailscale API documentation is located in **[tailscale/publicapi](./publicapi/readme.md#tailscale-api)**.

# APIs

**[Overview](./publicapi/readme.md)**

**[Device](./publicapi/device.md#device)**

<a href="device-delete"></a>
<a href="expire-device-key"></a>
<a href="device-routes-get">
<a href="device-routes-post"></a>
<a href="#device-authorized-post"></a>
<a href="device-tags-post"></a>
<a href="device-key-post"></a>
<a href="tailnet-acl-get"></a>

- Get a device: [`GET /api/v2/device/{deviceid}`](./publicapi/device.md#get-device)
- Delete a device: [`DELETE /api/v2/device/{deviceID}`](./publicapi/device.md#delete-device)
- Expire device key: [`POST /api/v2/device/{deviceID}/expire`](./publicapi/device.md#expire-device-key)
- [**Routes**](./publicapi/device.md#routes)
- Get device routes: [`GET /api/v2/device/{deviceID}/routes`](./publicapi/device.md#get-device-routes)
- Set device routes: [`POST /api/v2/device/{deviceID}/routes`](./publicapi/device.md#set-device-routes)
- [**Authorize**](./publicapi/device.md#authorize)
- Authorize a device: [`POST /api/v2/device/{deviceID}/authorized`](./publicapi/device.md#authorize-device)
- [**Tags**](./publicapi/device.md#tags)
- Update tags: [`POST /api/v2/device/{deviceID}/tags`](./publicapi/device.md#update-device-tags)
- [**Keys**](./publicapi/device.md#keys)
- Update device key: [`POST /api/v2/device/{deviceID}/key`](./publicapi/device.md#update-device-key)
- [**IP Addresses**](./publicapi/device.md#ip-addresses)
- Set device IPv4 address: [`POST /api/v2/device/{deviceID}/ip`](./publicapi/device.md#set-device-ipv4-address)
- [**Device posture attributes**](./publicapi/device.md#device-posture-attributes)
- Get device posture attributes: [`GET /api/v2/device/{deviceID}/attributes`](./publicapi/device.md#get-device-posture-attributes)
- Set custom device posture attributes: [`POST /api/v2/device/{deviceID}/attributes/{attributeKey}`](./publicapi/device.md#set-device-posture-attributes)
- Delete custom device posture attributes: [`DELETE /api/v2/device/{deviceID}/attributes/{attributeKey}`](./publicapi/device.md#delete-custom-device-posture-attributes)
- [**Device invites**](./publicapi/device.md#invites-to-a-device)
- List device invites: [`GET /api/v2/device/{deviceID}/device-invites`](./publicapi/device.md#list-device-invites)
- Create device invites: [`POST /api/v2/device/{deviceID}/device-invites`](./publicapi/device.md#create-device-invites)

**[Tailnet](./publicapi/tailnet.md#tailnet)**

<a href="tailnet-acl-post"></a>
<a href="tailnet-acl-preview-post"></a>
<a href="tailnet-acl-validate-post"></a>
<a href="tailnet-devices"></a>
<a href="tailnet-keys-get"></a>
<a href="tailnet-keys-post"></a>
<a href="tailnet-keys-key-get"></a>
<a href="tailnet-keys-key-delete"></a>
<a href="tailnet-dns"></a>
<a href="tailnet-dns-nameservers-get"></a>
<a href="tailnet-dns-nameservers-post"></a>
<a href="tailnet-dns-preferences-get"></a>
<a href="tailnet-dns-preferences-post"></a>
<a href="tailnet-dns-searchpaths-get"></a>
<a href="tailnet-dns-searchpaths-post"></a>

- [**Policy File**](./publicapi/tailnet.md#policy-file)
- Get policy file: [`GET /api/v2/tailnet/{tailnet}/acl`](./publicapi/tailnet.md#get-policy-file)
- Update policy file: [`POST /api/v2/tailnet/{tailnet}/acl`](./publicapi/tailnet.md#update-policy-file)
- Preview rule matches: [`POST /api/v2/tailnet/{tailnet}/acl/preview`](./publicapi/tailnet.md#preview-policy-file-rule-matches)
- Validate and test policy file: [`POST /api/v2/tailnet/{tailnet}/acl/validate`](./publicapi/tailnet.md#validate-and-test-policy-file)
- [**Devices**](./publicapi/tailnet.md#devices)
- List tailnet devices: [`GET /api/v2/tailnet/{tailnet}/devices`](./publicapi/tailnet.md#list-tailnet-devices)
- [**Keys**](./publicapi/tailnet.md#tailnet-keys)
- List tailnet keys: [`GET /api/v2/tailnet/{tailnet}/keys`](./publicapi/tailnet.md#list-tailnet-keys)
- Create an auth key: [`POST /api/v2/tailnet/{tailnet}/keys`](./publicapi/tailnet.md#create-auth-key)
- Get a key: [`GET /api/v2/tailnet/{tailnet}/keys/{keyid}`](./publicapi/tailnet.md#get-key)
- Delete a key: [`DELETE /api/v2/tailnet/{tailnet}/keys/{keyid}`](./publicapi/tailnet.md#delete-key)
- [**DNS**](./publicapi/tailnet.md#dns)
- [**Nameservers**](./publicapi/tailnet.md#nameservers)
- Get nameservers: [`GET /api/v2/tailnet/{tailnet}/dns/nameservers`](./publicapi/tailnet.md#get-nameservers)
- Set nameservers: [`POST /api/v2/tailnet/{tailnet}/dns/nameservers`](./publicapi/tailnet.md#set-nameservers)
- [**Preferences**](./publicapi/tailnet.md#preferences)
- Get DNS preferences: [`GET /api/v2/tailnet/{tailnet}/dns/preferences`](./publicapi/tailnet.md#get-dns-preferences)
- Set DNS preferences: [`POST /api/v2/tailnet/{tailnet}/dns/preferences`](./publicapi/tailnet.md#set-dns-preferences)
- [**Search Paths**](./publicapi/tailnet.md#search-paths)
- Get search paths: [`GET /api/v2/tailnet/{tailnet}/dns/searchpaths`](./publicapi/tailnet.md#get-search-paths)
- Set search paths: [`POST /api/v2/tailnet/{tailnet}/dns/searchpaths`](./publicapi/tailnet.md#set-search-paths)
- [**Split DNS**](./publicapi/tailnet.md#split-dns)
- Get split DNS: [`GET /api/v2/tailnet/{tailnet}/dns/split-dns`](./publicapi/tailnet.md#get-split-dns)
- Update split DNS: [`PATCH /api/v2/tailnet/{tailnet}/dns/split-dns`](./publicapi/tailnet.md#update-split-dns)
- Set split DNS: [`PUT /api/v2/tailnet/{tailnet}/dns/split-dns`](./publicapi/tailnet.md#set-split-dns)
- [**User invites**](./publicapi/tailnet.md#tailnet-user-invites)
- List user invites: [`GET /api/v2/tailnet/{tailnet}/user-invites`](./publicapi/tailnet.md#list-user-invites)
- Create user invites: [`POST /api/v2/tailnet/{tailnet}/user-invites`](./publicapi/tailnet.md#create-user-invites)

**[User invites](./publicapi/userinvites.md#user-invites)**

- Get user invite: [`GET /api/v2/user-invites/{userInviteId}`](./publicapi/userinvites.md#get-user-invite)
- Delete user invite: [`DELETE /api/v2/user-invites/{userInviteId}`](./publicapi/userinvites.md#delete-user-invite)
- Resend user invite (by email): [`POST /api/v2/user-invites/{userInviteId}/resend`](#resend-user-invite)

**[Device invites](./publicapi/deviceinvites.md#device-invites)**

- Get device invite: [`GET /api/v2/device-invites/{deviceInviteId}`](./publicapi/deviceinvites.md#get-device-invite)
- Delete device invite: [`DELETE /api/v2/device-invites/{deviceInviteId}`](./publicapi/deviceinvites.md#delete-device-invite)
- Resend device invite (by email): [`POST /api/v2/device-invites/{deviceInviteId}/resend`](./publicapi/deviceinvites.md#resend-device-invite)
- Accept device invite [`POST /api/v2/device-invites/-/accept`](#accept-device-invite)
27 changes: 27 additions & 0 deletions assert_ts_toolchain_match.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Copyright (c) Tailscale Inc & AUTHORS
// SPDX-License-Identifier: BSD-3-Clause

//go:build tailscale_go

package tailscaleroot

import (
"fmt"
"os"
"strings"
)

func init() {
tsRev, ok := tailscaleToolchainRev()
if !ok {
panic("binary built with tailscale_go build tag but failed to read build info or find tailscale.toolchain.rev in build info")
}
want := strings.TrimSpace(GoToolchainRev)
if tsRev != want {
if os.Getenv("TS_PERMIT_TOOLCHAIN_MISMATCH") == "1" {
fmt.Fprintf(os.Stderr, "tailscale.toolchain.rev = %q, want %q; but ignoring due to TS_PERMIT_TOOLCHAIN_MISMATCH=1\n", tsRev, want)
return
}
panic(fmt.Sprintf("binary built with tailscale_go build tag but Go toolchain %q doesn't match github.com/tailscale/tailscale expected value %q; override this failure with TS_PERMIT_TOOLCHAIN_MISMATCH=1", tsRev, want))
}
}
13 changes: 12 additions & 1 deletion client/tailscale/apitype/apitype.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
// Package apitype contains types for the Tailscale LocalAPI and control plane API.
package apitype

import "tailscale.com/tailcfg"
import (
"tailscale.com/tailcfg"
"tailscale.com/types/dnstype"
)

// LocalAPIHost is the Host header value used by the LocalAPI.
const LocalAPIHost = "local-tailscaled.sock"
Expand Down Expand Up @@ -65,3 +68,11 @@ type DNSOSConfig struct {
SearchDomains []string
MatchDomains []string
}

// DNSQueryResponse is the response to a DNS query request sent via LocalAPI.
type DNSQueryResponse struct {
// Bytes is the raw DNS response bytes.
Bytes []byte
// Resolvers is the list of resolvers that the forwarder deemed able to resolve the query.
Resolvers []*dnstype.Resolver
}
18 changes: 18 additions & 0 deletions client/tailscale/localclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import (
"tailscale.com/safesocket"
"tailscale.com/tailcfg"
"tailscale.com/tka"
"tailscale.com/types/dnstype"
"tailscale.com/types/key"
"tailscale.com/types/tkatype"
)
Expand Down Expand Up @@ -813,6 +814,8 @@ func (lc *LocalClient) EditPrefs(ctx context.Context, mp *ipn.MaskedPrefs) (*ipn
return decodeJSON[*ipn.Prefs](body)
}

// GetDNSOSConfig returns the system DNS configuration for the current device.
// That is, it returns the DNS configuration that the system would use if Tailscale weren't being used.
func (lc *LocalClient) GetDNSOSConfig(ctx context.Context) (*apitype.DNSOSConfig, error) {
body, err := lc.get200(ctx, "/localapi/v0/dns-osconfig")
if err != nil {
Expand All @@ -825,6 +828,21 @@ func (lc *LocalClient) GetDNSOSConfig(ctx context.Context) (*apitype.DNSOSConfig
return &osCfg, nil
}

// QueryDNS executes a DNS query for a name (`google.com.`) and query type (`CNAME`).
// It returns the raw DNS response bytes and the resolvers that were used to answer the query
// (often just one, but can be more if we raced multiple resolvers).
func (lc *LocalClient) QueryDNS(ctx context.Context, name string, queryType string) (bytes []byte, resolvers []*dnstype.Resolver, err error) {
body, err := lc.get200(ctx, fmt.Sprintf("/localapi/v0/dns-query?name=%s&type=%s", url.QueryEscape(name), queryType))
if err != nil {
return nil, nil, err
}
var res apitype.DNSQueryResponse
if err := json.Unmarshal(body, &res); err != nil {
return nil, nil, fmt.Errorf("invalid query response: %w", err)
}
return res.Bytes, res.Resolvers, nil
}

// StartLoginInteractive starts an interactive login.
func (lc *LocalClient) StartLoginInteractive(ctx context.Context) error {
_, err := lc.send(ctx, "POST", "/localapi/v0/login-interactive", http.StatusNoContent, nil)
Expand Down
20 changes: 5 additions & 15 deletions client/web/web.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (
"os"
"path"
"path/filepath"
"slices"
"strings"
"sync"
"time"
Expand All @@ -35,6 +34,7 @@ import (
"tailscale.com/net/tsaddr"
"tailscale.com/tailcfg"
"tailscale.com/types/logger"
"tailscale.com/types/views"
"tailscale.com/util/httpm"
"tailscale.com/version"
"tailscale.com/version/distro"
Expand Down Expand Up @@ -113,11 +113,6 @@ const (
ManageServerMode ServerMode = "manage"
)

var (
exitNodeRouteV4 = netip.MustParsePrefix("0.0.0.0/0")
exitNodeRouteV6 = netip.MustParsePrefix("::/0")
)

// ServerOpts contains options for constructing a new Server.
type ServerOpts struct {
// Mode specifies the mode of web client being constructed.
Expand Down Expand Up @@ -927,10 +922,10 @@ func (s *Server) serveGetNodeData(w http.ResponseWriter, r *http.Request) {
return p == route
})
}
data.AdvertisingExitNodeApproved = routeApproved(exitNodeRouteV4) || routeApproved(exitNodeRouteV6)
data.AdvertisingExitNodeApproved = routeApproved(tsaddr.AllIPv4()) || routeApproved(tsaddr.AllIPv6())

for _, r := range prefs.AdvertiseRoutes {
if r == exitNodeRouteV4 || r == exitNodeRouteV6 {
if tsaddr.IsExitRoute(r) {
data.AdvertisingExitNode = true
} else {
data.AdvertisedRoutes = append(data.AdvertisedRoutes, subnetRoute{
Expand Down Expand Up @@ -1071,7 +1066,7 @@ func (s *Server) servePostRoutes(ctx context.Context, data postRoutesRequest) er
var currNonExitRoutes []string
var currAdvertisingExitNode bool
for _, r := range prefs.AdvertiseRoutes {
if r == exitNodeRouteV4 || r == exitNodeRouteV6 {
if tsaddr.IsExitRoute(r) {
currAdvertisingExitNode = true
continue
}
Expand All @@ -1092,12 +1087,7 @@ func (s *Server) servePostRoutes(ctx context.Context, data postRoutesRequest) er
return err
}

hasExitNodeRoute := func(all []netip.Prefix) bool {
return slices.Contains(all, exitNodeRouteV4) ||
slices.Contains(all, exitNodeRouteV6)
}

if !data.UseExitNode.IsZero() && hasExitNodeRoute(routes) {
if !data.UseExitNode.IsZero() && tsaddr.ContainsExitRoutes(views.SliceOf(routes)) {
return errors.New("cannot use and advertise exit node at same time")
}

Expand Down
Loading