summaryrefslogtreecommitdiffhomepage
path: root/internal
AgeCommit message (Collapse)AuthorFilesLines
2025-07-21all-kube: create Tailscale Service for HA kube-apiserver ProxyGroup (#16572)Tom Proctor1-0/+28
Adds a new reconciler for ProxyGroups of type kube-apiserver that will provision a Tailscale Service for each replica to advertise. Adds two new condition types to the ProxyGroup, TailscaleServiceValid and TailscaleServiceConfigured, to post updates on the state of that reconciler in a way that's consistent with the service-pg reconciler. The created Tailscale Service name is configurable via a new ProxyGroup field spec.kubeAPISserver.ServiceName, which expects a string of the form "svc:<dns-label>". Lots of supporting changes were needed to implement this in a way that's consistent with other operator workflows, including: * Pulled containerboot's ensureServicesUnadvertised and certManager into kube/ libraries to be shared with k8s-proxy. Use those in k8s-proxy to aid Service cert sharing between replicas and graceful Service shutdown. * For certManager, add an initial wait to the cert loop to wait until the domain appears in the devices's netmap to avoid a guaranteed error on the first issue attempt when it's quick to start. * Made several methods in ingress-for-pg.go and svc-for-pg.go into functions to share with the new reconciler * Added a Resource struct to the owner refs stored in Tailscale Service annotations to be able to distinguish between Ingress- and ProxyGroup- based Services that need cleaning up in the Tailscale API. * Added a ListVIPServices method to the internal tailscale client to aid cleaning up orphaned Services * Support for reading config from a kube Secret, and partial support for config reloading, to prevent us having to force Pod restarts when config changes. * Fixed up the zap logger so it's possible to set debug log level. Updates #13358 Change-Id: Ia9607441157dd91fb9b6ecbc318eecbef446e116 Signed-off-by: Tom Proctor <tomhjp@users.noreply.github.com>
2025-03-21cmd/k8s-operator,internal/client/tailscale: use VIPService annotations for ↵Tom Proctor1-0/+2
ownership tracking (#15356) Switch from using the Comment field to a ts-scoped annotation for tracking which operators are cooperating over ownership of a VIPService. Updates tailscale/corp#24795 Change-Id: I72d4a48685f85c0329aa068dc01a1a3c749017bf Signed-off-by: Tom Proctor <tomhjp@users.noreply.github.com>
2025-02-18client/tailscale,cmd/k8s-operator,internal/client/tailscale: move VIP ↵Percy Wegmann2-0/+134
service client methods into internal control client Updates tailscale/corp#22748 Signed-off-by: Percy Wegmann <percy@tailscale.com>
2025-02-18internal/client/tailscale: change Client from alias into wrapperPercy Wegmann1-4/+8
This will allow Client to be extended with additional functions for internal use. Updates tailscale/corp#22748 Signed-off-by: Percy Wegmann <percy@tailscale.com>
2025-02-18cmd,tsnet,internal/client: create internal shim to deprecated control plane APIPercy Wegmann1-0/+48
Even after we remove the deprecated API, we will want to maintain a minimal API for internal use, in order to avoid importing the external tailscale.com/client/tailscale/v2 package. This shim exposes only the necessary parts of the deprecated API for internal use, which gains us the following: 1. It removes deprecation warnings for internal use of the API. 2. It gives us an inventory of which parts we will want to keep for internal use. Updates tailscale/corp#22748 Signed-off-by: Percy Wegmann <percy@tailscale.com>
2024-07-10all: add test for package comments, fix, add comments as neededBrad Fitzpatrick1-0/+2
Updates #cleanup Change-Id: Ic4304e909d2131a95a38b26911f49e7b1729aaef Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2024-06-19cmd/tailscale/cli: actually perform Noise request in 'debug ts2021'Andrew Dunham1-24/+41
This actually performs a Noise request in the 'debug ts2021' command, instead of just exiting once we've dialed a connection. This can help debug certain forms of captive portals and deep packet inspection that will allow a connection, but will RST the connection when trying to send data on the post-upgraded TCP connection. Updates #1634 Signed-off-by: Andrew Dunham <andrew@du.nham.ca> Change-Id: I1e46ca9c9a0751c55f16373a6a76cdc24fec1f18
2024-06-19control/controlclient: move noiseConn to internal packageAndrew Dunham1-0/+170
So that it can be later used in the 'tailscale debug ts2021' function in the CLI, to aid in debugging captive portals/WAFs/etc. Updates #1634 Signed-off-by: Andrew Dunham <andrew@du.nham.ca> Change-Id: Iec9423f5e7570f2c2c8218d27fc0902137e73909
2023-04-17various: add golangci-lint, fix issues (#7905)Andrew Dunham1-0/+1
This adds an initial and intentionally minimal configuration for golang-ci, fixes the issues reported, and adds a GitHub Action to check new pull requests against this linter configuration. Signed-off-by: Andrew Dunham <andrew@du.nham.ca> Change-Id: I8f38fbc315836a19a094d0d3e986758b9313f163
2023-01-27all: update copyright and license headersWill Norris1-3/+2
This updates all source files to use a new standard header for copyright and license declaration. Notably, copyright no longer includes a date, and we now use the standard SPDX-License-Identifier header. This commit was done almost entirely mechanically with perl, and then some minimal manual fixes. Updates #6865 Signed-off-by: Will Norris <will@tailscale.com>
2022-11-04all: remove old +build tagsBrad Fitzpatrick1-1/+0
The //go:build syntax was introduced in Go 1.17: https://go.dev/doc/go1.17#build-lines gofmt has kept the +build and go:build lines in sync since then, but enough time has passed. Time to remove them. Done with: perl -i -npe 's,^// \+build.*\n,,' $(git grep -l -F '+build') Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2022-07-26.github/workflows: add gofmt (goimports) checkBrad Fitzpatrick1-0/+4
Change-Id: Iceb3182827b9c65f28f0351e0e254abe4a95e4de Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-07-02util/deephash: move internal/deephash to util/deephashBrad Fitzpatrick5-680/+0
No code changes. Just a minor package doc addition about lack of API stability.
2021-07-02internal/deephash: 8 bits of output is not enoughJosh Bleecher Snyder2-2/+17
Running hex.Encode(b, b) is a bad idea. The first byte of input will overwrite the first two bytes of output. Subsequent bytes have no impact on the output. Not related to today's IPv6 bug, but...wh::ps. This caused us to spuriously ignore some wireguard config updates. Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
2021-05-24internal/deephash: remove remaining type special casesJosh Bleecher Snyder1-39/+1
Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
2021-05-24internal/deephash: increase scratch space sizeJosh Bleecher Snyder1-1/+1
e66d4e4c8131f89e85f372f6f41ff9580fedf140 added AppendTo methods to some key types. Their marshaled form is longer than 64 bytes. name old time/op new time/op delta Hash-8 15.5µs ± 1% 14.8µs ± 1% -4.17% (p=0.000 n=9+9) name old alloc/op new alloc/op delta Hash-8 1.18kB ± 0% 0.47kB ± 0% -59.87% (p=0.000 n=10+10) name old allocs/op new allocs/op delta Hash-8 12.0 ± 0% 6.0 ± 0% -50.00% (p=0.000 n=10+10) This is still a bit worse than explicitly handling the types, but much nicer. Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
2021-05-24internal/deephash: reset scratch before appending to itJosh Bleecher Snyder1-1/+1
Oops. In practice this doesn't matter, but it's still wrong. Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
2021-05-24internal/deephash: remove netaddr special casesJosh Bleecher Snyder1-37/+12
All netaddr types that we are concerned with now implement AppendTo. Use the AppendTo method if available, and remove all references to netaddr. This is slower but cleaner, and more readily re-usable by others. name old time/op new time/op delta Hash-8 12.6µs ± 0% 14.8µs ± 1% +18.05% (p=0.000 n=8+10) HashMapAcyclic-8 21.4µs ± 1% 21.9µs ± 1% +2.39% (p=0.000 n=10+9) name old alloc/op new alloc/op delta Hash-8 408B ± 0% 408B ± 0% ~ (p=1.000 n=10+10) HashMapAcyclic-8 1.00B ± 0% 1.00B ± 0% ~ (all equal) name old allocs/op new allocs/op delta Hash-8 6.00 ± 0% 6.00 ± 0% ~ (all equal) HashMapAcyclic-8 0.00 0.00 ~ (all equal) Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
2021-05-24internal/deephash: re-use MapIterJosh Bleecher Snyder3-1/+31
name old time/op new time/op delta Hash-8 12.4µs ± 0% 12.4µs ± 0% -0.33% (p=0.002 n=10+9) HashMapAcyclic-8 21.2µs ± 0% 21.3µs ± 0% +0.45% (p=0.000 n=8+8) name old alloc/op new alloc/op delta Hash-8 793B ± 0% 408B ± 0% -48.55% (p=0.000 n=10+10) HashMapAcyclic-8 128B ± 0% 0B -100.00% (p=0.000 n=10+10) name old allocs/op new allocs/op delta Hash-8 9.00 ± 0% 6.00 ± 0% -33.33% (p=0.000 n=10+10) HashMapAcyclic-8 1.00 ± 0% 0.00 -100.00% (p=0.000 n=10+10) Depends on https://github.com/golang/go/issues/46293. Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
2021-05-24internal/deephash: document MapIter shimsJosh Bleecher Snyder2-2/+18
These exist so we can use the optimized MapIter APIs while still working with released versions of Go. They're pretty simple, but some docs won't hurt. Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
2021-05-24internal/deephash: use hash.BlockSize instead of a constantJosh Bleecher Snyder1-2/+1
Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
2021-05-24internal/deephash: add re-usable scratch spaceJosh Bleecher Snyder2-45/+40
name old time/op new time/op delta Hash-8 13.9µs ± 0% 12.5µs ± 0% -10.10% (p=0.008 n=5+5) name old alloc/op new alloc/op delta Hash-8 793B ± 0% 793B ± 0% ~ (all equal) name old allocs/op new allocs/op delta Hash-8 14.0 ± 0% 12.0 ± 0% -14.29% (p=0.008 n=5+5) Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
2021-05-24internal/deephash: simplify APIJosh Bleecher Snyder2-8/+8
Reduce to just a single external endpoint. Convert from a variadic number of interfaces to a slice there. name old time/op new time/op delta Hash-8 14.4µs ± 0% 14.0µs ± 1% -3.08% (p=0.000 n=9+9) name old alloc/op new alloc/op delta Hash-8 873B ± 0% 793B ± 0% -9.16% (p=0.000 n=9+6) name old allocs/op new allocs/op delta Hash-8 18.0 ± 0% 14.0 ± 0% -22.22% (p=0.000 n=10+10) Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
2021-05-24internal/deephash: use netaddr AppendTo methodsJosh Bleecher Snyder1-24/+28
Slightly slower, but lots less garbage. We will recover the speed lost in a follow-up commit. name old time/op new time/op delta Hash-8 13.5µs ± 1% 14.3µs ± 0% +5.84% (p=0.000 n=10+9) name old alloc/op new alloc/op delta Hash-8 1.46kB ± 0% 0.87kB ± 0% -40.10% (p=0.000 n=7+10) name old allocs/op new allocs/op delta Hash-8 43.0 ± 0% 18.0 ± 0% -58.14% (p=0.000 n=10+10) Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
2021-05-24internal/deephash: re-use map iteration valuesJosh Bleecher Snyder1-2/+15
This requires changes to the Go toolchain. The changes are upstream at https://golang.org/cl/320929. They haven't been pulled into our fork yet. No need to allocate new iteration scratch values for every map. name old time/op new time/op delta Hash-8 13.6µs ± 0% 13.5µs ± 0% -1.01% (p=0.008 n=5+5) HashMapAcyclic-8 21.2µs ± 1% 21.1µs ± 2% ~ (p=0.310 n=5+5) name old alloc/op new alloc/op delta Hash-8 1.58kB ± 0% 1.46kB ± 0% -7.60% (p=0.008 n=5+5) HashMapAcyclic-8 152B ± 0% 128B ± 0% -15.79% (p=0.008 n=5+5) name old allocs/op new allocs/op delta Hash-8 49.0 ± 0% 43.0 ± 0% -12.24% (p=0.008 n=5+5) HashMapAcyclic-8 4.00 ± 0% 2.00 ± 0% -50.00% (p=0.008 n=5+5) Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
2021-05-24internal/deephash: use MapIter.Set{Key,Value}Josh Bleecher Snyder3-2/+42
To get the benefit of this optimization requires help from the Go toolchain. The changes are upstream at https://golang.org/cl/320929, and have been pulled into the Tailscale fork at https://github.com/tailscale/go/commit/728ecc58fd5c010c04bb7c8a56d238167e7d888f. It also requires building with the build tag tailscale_go. name old time/op new time/op delta Hash-8 14.0µs ± 0% 13.6µs ± 0% -2.88% (p=0.008 n=5+5) HashMapAcyclic-8 24.3µs ± 1% 21.2µs ± 1% -12.47% (p=0.008 n=5+5) name old alloc/op new alloc/op delta Hash-8 2.16kB ± 0% 1.58kB ± 0% -27.01% (p=0.008 n=5+5) HashMapAcyclic-8 2.53kB ± 0% 0.15kB ± 0% -93.99% (p=0.008 n=5+5) name old allocs/op new allocs/op delta Hash-8 77.0 ± 0% 49.0 ± 0% -36.36% (p=0.008 n=5+5) HashMapAcyclic-8 202 ± 0% 4 ± 0% -98.02% (p=0.008 n=5+5) Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com> setkey
2021-05-24internal/deephash: add special handling for netaddr.IPPortJosh Bleecher Snyder1-0/+15
The acyclic map code interacts badly with netaddr.IPs. One of the netaddr.IP fields is an *intern.Value, and we use a few sentinel values. Those sentinel values make many of the netaddr data structures appear cyclic. One option would be to replace the cycle-detection code with a Floyd-Warshall style algorithm. The downside is that this will take longer to detect cycles, particularly if the cycle is long. This problem is exacerbated by the fact that the acyclic cycle detection code shares a single visited map for the entire data structure, not just the subsection of the data structure localized to the map. Unfortunately, the extra allocations and work (and code) to use per-map visited maps make this option not viable. Instead, continue to special-case netaddr data types. name old time/op new time/op delta Hash-8 22.4µs ± 0% 14.0µs ± 0% -37.59% (p=0.008 n=5+5) HashMapAcyclic-8 23.8µs ± 0% 24.3µs ± 1% +1.75% (p=0.008 n=5+5) name old alloc/op new alloc/op delta Hash-8 2.49kB ± 0% 2.16kB ± 0% ~ (p=0.079 n=4+5) HashMapAcyclic-8 2.53kB ± 0% 2.53kB ± 0% ~ (all equal) name old allocs/op new allocs/op delta Hash-8 86.0 ± 0% 77.0 ± 0% -10.47% (p=0.008 n=5+5) HashMapAcyclic-8 202 ± 0% 202 ± 0% ~ (all equal) Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
2021-05-24internal/deephash: fix accidental naked returnJosh Bleecher Snyder1-1/+1
name old time/op new time/op delta Hash-8 23.0µs ± 1% 22.4µs ± 0% -2.43% (p=0.008 n=5+5) HashMapAcyclic-8 24.0µs ± 0% 23.8µs ± 0% -0.56% (p=0.008 n=5+5) name old alloc/op new alloc/op delta Hash-8 2.92kB ± 0% 2.49kB ± 0% -14.80% (p=0.000 n=5+4) HashMapAcyclic-8 2.53kB ± 0% 2.53kB ± 0% ~ (all equal) name old allocs/op new allocs/op delta Hash-8 93.0 ± 0% 86.0 ± 0% -7.53% (p=0.008 n=5+5) HashMapAcyclic-8 202 ± 0% 202 ± 0% ~ (all equal) Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
2021-05-24internal/deephash: hash maps without sorting in the acyclic common caseBrad Fitzpatrick2-21/+158
Hash and xor each entry instead, then write final xor'ed result. name old time/op new time/op delta Hash-4 33.6µs ± 4% 34.6µs ± 3% +3.03% (p=0.013 n=10+9) name old alloc/op new alloc/op delta Hash-4 1.86kB ± 0% 1.77kB ± 0% -5.10% (p=0.000 n=10+9) name old allocs/op new allocs/op delta Hash-4 51.0 ± 0% 49.0 ± 0% -3.92% (p=0.000 n=10+10) Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-05-19internal/deephash: add a few more benchmarking map entriesJosh Bleecher Snyder1-0/+9
Typical maps in production are considerably longer. This helps benchmarks more accurately reflect the costs per key vs the costs per map in deephash. Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
2021-05-16all: adapt to opaque netaddr typesJosh Bleecher Snyder1-1/+1
This commit is a mishmash of automated edits using gofmt: gofmt -r 'netaddr.IPPort{IP: a, Port: b} -> netaddr.IPPortFrom(a, b)' -w . gofmt -r 'netaddr.IPPrefix{IP: a, Port: b} -> netaddr.IPPrefixFrom(a, b)' -w . gofmt -r 'a.IP.Is4 -> a.IP().Is4' -w . gofmt -r 'a.IP.As16 -> a.IP().As16' -w . gofmt -r 'a.IP.Is6 -> a.IP().Is6' -w . gofmt -r 'a.IP.As4 -> a.IP().As4' -w . gofmt -r 'a.IP.String -> a.IP().String' -w . And regexps: \w*(.*)\.Port = (.*) -> $1 = $1.WithPort($2) \w*(.*)\.IP = (.*) -> $1 = $1.WithIP($2) And lots of manual fixups. Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
2021-05-11all: add extra information to serialized endpointsJosh Bleecher Snyder1-1/+3
magicsock.Conn.ParseEndpoint requires a peer's public key, disco key, and legacy ip/ports in order to do its job. We currently accomplish that by: * adding the public key in our wireguard-go fork * encoding the disco key as magic hostname * using a bespoke comma-separated encoding It's a bit messy. Instead, switch to something simpler: use a json-encoded struct containing exactly the information we need, in the form we use it. Our wireguard-go fork still adds the public key to the address when it passes it to ParseEndpoint, but now the code compensating for that is just a couple of simple, well-commented lines. Once this commit is in, we can remove that part of the fork and remove the compensating code. Signed-off-by: Josh Bleecher Snyder <josharian@gmail.com>
2021-05-11internal/deephash: rename from deepprintBrad Fitzpatrick3-10/+5
Yes, it printed, but that was an implementation detail for hashing. And coming optimization will make it print even less. Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-05-11internal/deepprint: improve benchmarkJosh Bleecher Snyder1-10/+13
This more closely matches our real usage of deepprint. Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
2021-05-11internal/deepprint: close struct curly parensJosh Bleecher Snyder1-0/+1
Not that it matters, but we were missing a close parens. It's cheap, so add it. name old time/op new time/op delta Hash-8 6.64µs ± 0% 6.67µs ± 1% +0.42% (p=0.008 n=9+10) name old alloc/op new alloc/op delta Hash-8 1.54kB ± 0% 1.54kB ± 0% ~ (all equal) name old allocs/op new allocs/op delta Hash-8 37.0 ± 0% 37.0 ± 0% ~ (all equal) Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
2021-05-11internal/deepprint: stop printing struct field namesJosh Bleecher Snyder1-4/+1
The struct field names don't change within a single run, so they are irrelevant. Use the field index instead. name old time/op new time/op delta Hash-8 6.52µs ± 0% 6.64µs ± 0% +1.91% (p=0.000 n=6+9) name old alloc/op new alloc/op delta Hash-8 1.67kB ± 0% 1.54kB ± 0% -7.66% (p=0.000 n=10+10) name old allocs/op new allocs/op delta Hash-8 53.0 ± 0% 37.0 ± 0% -30.19% (p=0.000 n=10+10) Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
2021-05-11internal/deepprint: replace Fprintf(w, const) with w.WriteStringJosh Bleecher Snyder1-8/+7
name old time/op new time/op delta Hash-8 7.77µs ± 0% 6.29µs ± 1% -19.11% (p=0.000 n=9+10) name old alloc/op new alloc/op delta Hash-8 1.67kB ± 0% 1.67kB ± 0% ~ (all equal) name old allocs/op new allocs/op delta Hash-8 53.0 ± 0% 53.0 ± 0% ~ (all equal) Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
2021-05-11internal/deepprint: special-case some common typesJosh Bleecher Snyder1-0/+75
These show up a lot in our data structures. name old time/op new time/op delta Hash-8 11.5µs ± 1% 7.8µs ± 1% -32.17% (p=0.000 n=10+10) name old alloc/op new alloc/op delta Hash-8 1.98kB ± 0% 1.67kB ± 0% -15.73% (p=0.000 n=10+10) name old allocs/op new allocs/op delta Hash-8 82.0 ± 0% 53.0 ± 0% -35.37% (p=0.000 n=10+10) Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
2021-05-11internal/deepprint: buffer writesJosh Bleecher Snyder2-11/+10
The sha256 hash writer doesn't implement WriteString. (See https://github.com/golang/go/issues/38776.) As a consequence, we end up converting many strings to []byte. Wrapping a bufio.Writer around the hash writer lets us avoid these conversions by using WriteString. Using a bufio.Writer is, perhaps surprisingly, almost as cheap as using unsafe. The reason is that the sha256 writer does internal buffering, but doesn't do any when handed larger writers. Using a bufio.Writer merely shifts the data copying from one buffer to a different one. Using a concrete type for Print and print cuts 10% off of the execution time. name old time/op new time/op delta Hash-8 15.3µs ± 0% 11.5µs ± 0% -24.84% (p=0.000 n=10+10) name old alloc/op new alloc/op delta Hash-8 2.82kB ± 0% 1.98kB ± 0% -29.57% (p=0.000 n=10+10) name old allocs/op new allocs/op delta Hash-8 140 ± 0% 82 ± 0% -41.43% (p=0.000 n=10+10) Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
2021-05-11internal/deepprint: add BenchmarkHashJosh Bleecher Snyder1-0/+8
deepprint currently accounts for 15% of allocs in tailscaled. This is a useful benchmark to have. Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
2021-04-05wgengine: move DNS configuration out of wgengine/router.David Anderson1-4/+3
Signed-off-by: David Anderson <danderson@tailscale.com>
2021-04-03wgengine/wgcfg: remove Config.ListenPortJosh Bleecher Snyder1-3/+2
We don't use the port that wireguard-go passes to us (via magicsock.connBind.Open). We ignore it entirely and use the port we selected. When we tell wireguard-go that we're changing the listen_port, it calls connBind.Close and then connBind.Open. And in the meantime, it stops calling the receive functions, which means that we stop receiving and processing UDP and DERP packets. And that is Very Bad. That was never a problem prior to b3ceca1dd7d7a1a6f9ddab136a4e12900e976333, because we passed the SkipBindUpdate flag to our wireguard-go fork, which told wireguard-go not to re-bind on listen_port changes. That commit eliminated the SkipBindUpdate flag. We could write a bunch of code to work around the gap. We could add background readers that process UDP and DERP packets when wireguard-go isn't. But it's simpler to never create the conditions in which wireguard-go rebinds. The other scenario in which wireguard-go re-binds is device.Down. Conveniently, we never call device.Down. We go from device.Up to device.Close, and the latter only when we're shutting down a magicsock.Conn completely. Rubber-ducked-by: Avery Pennarun <apenwarr@tailscale.com> Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
2021-04-02net/dns: rename Config to OSConfig.David Anderson1-1/+1
Making way for a new higher level config struct. Signed-off-by: David Anderson <danderson@tailscale.com>
2021-03-25many: gofmt.David Anderson1-1/+1
Signed-off-by: David Anderson <danderson@tailscale.com>
2021-03-25wgengine/router/dns: move to net/dns.David Anderson1-1/+1
Preparation for merging the APIs and whatnot. Signed-off-by: David Anderson <danderson@tailscale.com>
2021-01-29all: move wgcfg from wireguard-goJosh Bleecher Snyder1-1/+1
This is mostly code movement from the wireguard-go repo. Most of the new wgcfg package corresponds to the wireguard-go wgcfg package. wgengine/wgcfg/device{_test}.go was device/config{_test}.go. There were substantive but simple changes to device_test.go to remove internal package device references. The API of device.Config (now wgcfg.DeviceConfig) grew an error return; we previously logged the error and threw it away. Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
2021-01-14all: convert from []wgcfg.Endpoint to stringJosh Bleecher Snyder1-6/+1
This eliminates a dependency on wgcfg.Endpoint, as part of the effort to eliminate our wireguard-go fork. Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
2020-12-28all: replace wgcfg.IP and wgcfg.CIDR with netaddr typesJosh Bleecher Snyder1-1/+1
Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
2020-09-09Add tooldeps package to keep depaware pinned in go.mod.Brad Fitzpatrick1-0/+9
2020-07-31all: dns refactor, add Proxied and PerDomain flags from control (#615)Dmytro Shynkevych1-1/+2
Signed-off-by: Dmytro Shynkevych <dmytro@tailscale.com>