summaryrefslogtreecommitdiffhomepage
path: root/control/controlclient/auto.go
AgeCommit message (Collapse)AuthorFilesLines
2021-04-30ipnlocal: don't pause the controlclient until we get at least one netmap.apenwarr/statefixAvery Pennarun1-1/+2
Without this, macOS would fail to display its menu state correctly if you started it while !WantRunning. It relies on the netmap in order to show the logged-in username. Signed-off-by: Avery Pennarun <apenwarr@tailscale.com>
2021-04-30controlclient: extract a Client interface and rename Client->Auto.Avery Pennarun1-39/+35
This will let us create a mock or fake Client implementation for use with ipn.Backend. Signed-off-by: Avery Pennarun <apenwarr@tailscale.com>
2021-04-29controlclient: extract State and Status stuff into its own file.Avery Pennarun1-73/+0
No changes other than moving stuff around. Signed-off-by: Avery Pennarun <apenwarr@tailscale.com>
2021-04-21ipn/ipnlocal: on fresh lazy-connecting install, start in state NeedsLoginBrad Fitzpatrick1-0/+3
Fixes #1759 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-04-13tailcfg: add Endpoint, EndpointType, MapRequest.EndpointTypeBrad Fitzpatrick1-1/+1
Track endpoints internally with a new tailcfg.Endpoint type that includes a typed netaddr.IPPort (instead of just a string) and includes a type for how that endpoint was discovered (STUN, local, etc). Use []tailcfg.Endpoint instead of []string internally. At the last second, send it to the control server as the existing []string for endpoints, but also include a new parallel MapRequest.EndpointType []tailcfg.EndpointType, so the control server can start filtering out less-important endpoint changes from new-enough clients. Notably, STUN-discovered endpoints can be filtered out from 1.6+ clients, as they can discover them amongst each other via CallMeMaybe disco exchanges started over DERP. And STUN endpoints change a lot, causing a lot of MapResposne updates. But portmapped endpoints are worth keeping for now, as they they work right away without requiring the firewall traversal extra RTT dance. End result will be less control->client bandwidth. (despite negligible increase in client->control bandwidth) Updates tailscale/corp#1543 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-04-09ipn/{ipnlocal,localapi}, cmd/tailscale: add logout commandBrad Fitzpatrick1-8/+45
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-03-31control/controlclient: document a few thingsBrad Fitzpatrick1-1/+9
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-03-19control, ipn, tailcfg: remove golang.org/x/oauth2 dep, add tailcfg.Oauth2TokenBrad Fitzpatrick1-6/+5
golang.org/x/oauth2 pulls in App Engine and grpc module dependencies, screwing up builds that depend on this module. Some background on the problem: https://go.googlesource.com/proposal/+/master/design/36460-lazy-module-loading.md Fixes tailscale/corp#1471 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-03-18control/controlclient: remove redundant Hostinfo logBrad Fitzpatrick1-1/+0
The direct client already logs it in JSON form. Then it's immediately logged again in an unformatted dump, so this removes that unformatted one. Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-03-16health, ipn/ipnlocal: track, log overall healthBrad Fitzpatrick1-2/+5
Updates #1505 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-03-15health, controlclient, ipn, magicsock: tell health package state of thingsBrad Fitzpatrick1-0/+3
Not yet checking anything. Just plumbing states into the health package. Updates #1505 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-02-18health, control/controlclient, wgengine: report when router unhealthyBrad Fitzpatrick1-0/+11
Updates tailscale/corp#1338 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-02-05types/netmap: split controlclient.NetworkMap off into its own leaf packageBrad Fitzpatrick1-5/+6
Updates #1278 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-02-05types/persist: split controlclient.Persist into a small leaf packageBrad Fitzpatrick1-2/+3
This one alone doesn't modify the global dependency map much (depaware.txt if anything looks slightly worse), but it leave controlclient as only containing NetworkMap: bradfitz@tsdev:~/src/tailscale.com/ipn$ grep -F "controlclient." *.go backend.go: NetMap *controlclient.NetworkMap // new netmap received fake_test.go: b.notify(Notify{NetMap: &controlclient.NetworkMap{}}) fake_test.go: b.notify(Notify{NetMap: &controlclient.NetworkMap{}}) handle.go: netmapCache *controlclient.NetworkMap handle.go:func (h *Handle) NetMap() *controlclient.NetworkMap { Once that goes into a leaf package, then ipn doesn't depend on controlclient at all, and then the client gets smaller. Updates #1278
2021-02-05control/controlclient: don't call lite endpoint update path when logged outBrad Fitzpatrick1-1/+1
This was the other half of the #1271 problem. Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-01-08control/controlclient: use lite map request handler to avoid aborting streamsBrad Fitzpatrick1-13/+57
Previously, any change to endpoints or hostinfo (or hostinfo's netinfo) would result in the long-running map request HTTP stream being torn down and restarted, losing all compression context along with it. This change makes us instead send a lite map request (OmitPeers: true, Stream: false) that doesn't subscribe to anything, and then the coordination server knows to not close other streams for that node when it recives a lite request. Fixes tailscale/corp#797 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2020-12-30wgkey: new packageJosh Bleecher Snyder1-2/+2
This is a replacement for the key-related parts of the wireguard-go wgcfg package. This is almost a straight copy/paste from the wgcfg package. I have slightly changed some of the exported functions and types to avoid stutter, added and tweaked some comments, and removed some now-unused code. To avoid having wireguard-go depend on this new package, wgcfg will keep its key types. We translate into and out of those types at the last minute. These few remaining uses will be eliminated alongside the rest of the wgcfg package. Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
2020-12-21all: annotate log verbosity levels on most egregiously spammy log printsBrad Fitzpatrick1-10/+10
Fixes #924 Fixes #282 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2020-12-21control/controlclient: clarify a commentBrad Fitzpatrick1-1/+2
2020-12-14control/controlclient: don't spin when starting up when node key is expiredBrad Fitzpatrick1-47/+11
Fixes #1018 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2020-10-14control/controlclient: adjust some logging point namesBrad Fitzpatrick1-5/+5
The previous code read too explicitly like log.Printf("I am here1"), log.Printf("I am here2"). It still is with this change, but prettier, and less subject to code rearranging order.
2020-08-09control/controlclient: use less battery when stopped, stop map requestsBrad Fitzpatrick1-9/+66
Updates #604 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2020-08-09backoff: update to Go style, document a bit, make 30s explicitBrad Fitzpatrick1-2/+2
Also, bit of behavior change: on non-nil err but expired context, don't reset the consecutive failure count. I don't think the old behavior was intentional. Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2020-07-28control/controlclient: remove an 'unexpected' log that no longer isBrad Fitzpatrick1-1/+1
Fixes #611
2020-07-15control/controlclient: eliminate race in loginGoal access.Dmytro Shynkevych1-4/+5
This code is currently racy due to an incorrect assumption that goal is never modified in-place, so does not require extra locking. This change makes the assumption correct. Signed-off-by: Dmytro Shynkevych <dmytro@tailscale.com>
2020-05-27control/controlclient: move auto_test back to corp repo.David Anderson1-31/+64
It can't run without corp stuff anyway, and makes it harder to refactor the control server.
2020-05-13Add tstest.PanicOnLog(), and fix various problems detected by this.Avery Pennarun1-2/+2
If a test calls log.Printf, 'go test' horrifyingly rearranges the output to no longer be in chronological order, which makes debugging virtually impossible. Let's stop that from happening by making log.Printf panic if called from any module, no matter how deep, during tests. This required us to change the default error handler in at least one http.Server, as well as plumbing a bunch of logf functions around, especially in magicsock and wgengine, but also in logtail and backoff. To add insult to injury, 'go test' also rearranges the output when a parent test has multiple sub-tests (all the sub-test's t.Logf is always printed after all the parent tests t.Logf), so we need to screw around with a special Logf that can point at the "current" t (current_t.Logf) in some places. Probably our entire way of using subtests is wrong, since 'go test' would probably like to run them all in parallel if you called t.Parallel(), but it definitely can't because the're all manipulating the shared state created by the parent test. They should probably all be separate toplevel tests instead, with common setup/teardown logic. But that's a job for another time. Signed-off-by: Avery Pennarun <apenwarr@tailscale.com>
2020-05-03types/structs: add structs.Incomparable annotation, use it where applicableBrad Fitzpatrick1-0/+3
Shotizam before and output queries: sqlite> select sum(size) from bin where func like 'type..%'; 129067 => 120216
2020-04-11all: remove unnecessary trailing newlines in format patterns for consistencyBrad Fitzpatrick1-21/+21
And document on logger.Logf that it's unnecessary.
2020-04-02controlclient: do not send duplicate hostinfo/netinfoDavid Crawshaw1-2/+12
This should never happen, so log when it does so we can fix it. Signed-off-by: David Crawshaw <crawshaw@tailscale.com>
2020-03-08controlclient: set default TimeNow functionDavid Crawshaw1-0/+3
Panic on call to nil func found by expanded ipn/e2e_test. Signed-off-by: David Crawshaw <crawshaw@tailscale.com>
2020-03-04magicsock, wgengine, ipn, controlclient: plumb regular netchecks to map pollBrad Fitzpatrick1-0/+9
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2020-02-25control: make Hostinfo accessed by pointerBrad Fitzpatrick1-5/+8
Fix potential races in copying aliased slices by value. Also few little doc updates. Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2020-02-14Move "logger" package to under types, now that we have it.Brad Fitzpatrick1-1/+1
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2020-02-14types/empty: add Message, stop using mysterious *struct{}Brad Fitzpatrick1-3/+4
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2020-02-14control/controlclient, wgengine/magicsock: misc cleanupsBrad Fitzpatrick1-5/+4
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2020-02-11controlclient: handle nil Logf optioncrawshaw/br1David Crawshaw1-0/+3
2020-02-10controlclient: remove unnecessary comparison to bool.David Anderson1-1/+1
Signed-off-by: David Anderson <dave@natulte.net>
2020-02-09Move Linux client & common packages into a public repo.Earl Lee1-0/+594