Brad Fitzpatrick
0f64d7f9cc
wgengine: remove a tiny allocation
...
Drop in the bucket compared to the larger issues, but noticed it
when looking at pprof.
2020-04-07 22:23:40 -07:00
Brad Fitzpatrick
59800138ff
bump wireguard dep
2020-04-07 10:02:34 -07:00
Brad Fitzpatrick
277fe84c6b
version: don't depend on goversion on ios
2020-04-07 09:28:09 -07:00
Brad Fitzpatrick
2776209e49
portlist: don't depend on osexec package on ios, even if it's unused
...
Continuation of 5bb14c07dc
.
The earlier commit provided the space savings (as the linker could see
through that osexec was unused at runtime), but it didn't clean up the
dep graph (from go list -json or godepgraph).
This removes the netstat.go file from the build too, just so the dep list
looks more reasonable.
2020-04-07 08:09:13 -07:00
Brad Fitzpatrick
5bb14c07dc
portlist: don't depend on tempfork/osexec on iOS, saves 90KB
...
This gives us 90KB more of memory on iOS, as it shrinks the
NetworkExtension binary by 90KB.
The netstat binary isn't available in the network extension anyway, so
no point pulling in the osexec package which'll just fail to find
netstat anyway.
2020-04-07 07:58:09 -07:00
Brad Fitzpatrick
ec0cd60fc3
portlist: fail earlier, more nicely on iOS
2020-04-06 20:11:24 -07:00
David Anderson
96b2f20c5b
types/logger: add Discard helper.
2020-04-06 19:15:19 -07:00
Dmitry Adamushko
44434fdc82
derp/derp_server: fixed unbalanced {register,unregister}Client() calls.
...
Signed-off-by: Dmitry Adamushko <da@stablebits.net>
2020-04-06 15:13:47 -07:00
Blake Gentry
e19287f60f
wgengine/magicsock: fix Conn docs type reference
...
The docs on magicsock.Conn stated that they implemented the
wireguard/device.Bind interface, yet this type does not exist. In
reality, the Conn type implements the wireguard/conn.Bind interface.
I also fixed a small typo in the same file.
Signed-off-by: Blake Gentry <blakesgentry@gmail.com>
2020-04-06 15:11:56 -07:00
Brad Fitzpatrick
71d6738333
tstime: change an Errorf+return to Fatalf in subtest
...
Forgot to git add this during review. Fail.
2020-04-06 08:20:15 -07:00
Brad Fitzpatrick
febdac0499
tstime: write Parse3339 parse that doesn't use time.Parse
...
It doesn't allocate and it's half the time of time.Parse (which
allocates), and 2/3rds the time of time.ParseInLocation (which
doesn't).
Go with a UTC time:
BenchmarkGoParse3339/Z-8 2200995 534 ns/op 0 B/op 0 allocs/op
BenchmarkGoParse3339/Z-8 2254816 554 ns/op 0 B/op 0 allocs/op
BenchmarkGoParse3339/Z-8 2159504 522 ns/op 0 B/op 0 allocs/op
Go allocates with a "-08:00" suffix instead of ending in "Z":
BenchmarkGoParse3339/TZ-8 1276491 884 ns/op 144 B/op 3 allocs/op
BenchmarkGoParse3339/TZ-8 1355858 942 ns/op 144 B/op 3 allocs/op
BenchmarkGoParse3339/TZ-8 1385484 911 ns/op 144 B/op 3 allocs/op
Go doesn't allocate if you use time.ParseInLocation, but then you need
to parse the string to find the location anyway, so might as well go
all the way (below).
BenchmarkGoParse3339InLocation-8 1912254 597 ns/op 0 B/op 0 allocs/op
BenchmarkGoParse3339InLocation-8 1980043 612 ns/op 0 B/op 0 allocs/op
BenchmarkGoParse3339InLocation-8 1891366 612 ns/op 0 B/op 0 allocs/op
Parsing RFC3339 ourselves, UTC:
BenchmarkParse3339/Z-8 3889220 307 ns/op 0 B/op 0 allocs/op
BenchmarkParse3339/Z-8 3718500 309 ns/op 0 B/op 0 allocs/op
BenchmarkParse3339/Z-8 3621231 303 ns/op 0 B/op 0 allocs/op
Parsing RFC3339 ourselves, with timezone (w/ *time.Location fetched
from sync.Map)
BenchmarkParse3339/TZ-8 3019612 418 ns/op 0 B/op 0 allocs/op
BenchmarkParse3339/TZ-8 2921618 401 ns/op 0 B/op 0 allocs/op
BenchmarkParse3339/TZ-8 3031671 408 ns/op 0 B/op 0 allocs/op
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2020-04-06 08:19:17 -07:00
Brad Fitzpatrick
02948d2c86
Dockerfile: add some usage docs, bump to Go 1.14
2020-04-06 07:57:47 -07:00
Brad Fitzpatrick
d503dee6f1
tstime: add new package for time utilities, starting with Parse3339
...
Go's time.Parse always allocates a FixedZone for time strings not in
UTC (ending in "Z"). This avoids that allocation, at the cost of
adding a cache.
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2020-04-05 20:05:49 -07:00
David Anderson
4e0ee141e8
derp/derpmap: add derp5 (Sydney) to prod map.
...
Signed-off-by: David Anderson <dave@natulte.net>
2020-04-05 18:55:29 -07:00
Brad Fitzpatrick
996bf9cae7
logtail: don't send a User-Agent
...
Just useless bytes on the wire. Especially with HTTP/1.
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2020-04-05 13:16:56 -07:00
Brad Fitzpatrick
7bf436ba30
tsweb: add some Benchmarks
...
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2020-04-05 13:16:36 -07:00
Brad Fitzpatrick
64334143a1
tsweb: rename Handler to ReturnHandler
...
The name's been bugging me for a long time.
I liked neither the overlap between tsweb.Handler and http.Handler,
nor the name "ServeHTTPErr" which sounds like it's an error being
returned, like it's an error handler and not sometimes a happy path.
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2020-04-05 13:16:36 -07:00
Brad Fitzpatrick
bdc55d7091
logtail: add ParsePrivateID
2020-04-05 09:15:15 -07:00
Brad Fitzpatrick
50aeb5b9ad
wgengine: unexport some windows funcs
2020-04-05 08:23:53 -07:00
David Anderson
b446de103a
tsweb: fix tests.
...
Signed-off-by: David Anderson <dave@natulte.net>
2020-04-05 00:22:03 -07:00
David Anderson
af3a9dfad6
tsweb: add a StdHandler that doesn't log 200 responses.
...
Signed-off-by: David Anderson <dave@natulte.net>
2020-04-05 00:14:38 -07:00
David Anderson
ba2774ea27
cmd/mkpkg: support depending on stuff.
...
Signed-off-by: David Anderson <dave@natulte.net>
2020-04-04 18:38:09 -07:00
David Anderson
362d6af4e2
cmd/tailscaled: set CacheDirectory in service.
...
Signed-off-by: David Anderson <dave@natulte.net>
2020-04-04 16:52:05 -07:00
Brad Fitzpatrick
e71a7c7a2c
logtail: read to EOF on chunked response
...
We'll be fixing the server so this won't trigger in practice,
but it demos the connection reuse problem.
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2020-04-04 16:12:15 -07:00
Brad Fitzpatrick
fcb6a34f4b
logtail: reduce allocations encoding text
...
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2020-04-04 16:12:02 -07:00
Brad Fitzpatrick
2863e49db9
tsweb: don't flush, treat no-op Handler as 200, like Go
...
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2020-04-04 16:11:53 -07:00
Brad Fitzpatrick
3b4b17d239
logpolicy: log on dials, add knob to force HTTP/1 for log uploads
...
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2020-04-04 14:46:41 -07:00
David Anderson
5d995d9d6b
tsweb: add a test case for nil child errors in tsweb.Error.
...
Signed-off-by: David Anderson <dave@natulte.net>
2020-04-03 10:37:39 -07:00
David Anderson
2c2dff9559
tsweb: don't panic if we get a tsweb.Error with no embedded error.
...
It's technically weird to return a tsweb.Error with no child err,
but it's a sensible thing to want to do, and we shouldn't panic
if it happens.
Signed-off-by: David Anderson <dave@natulte.net>
2020-04-03 10:36:21 -07:00
David Crawshaw
2f8719741e
controlclient: do not send duplicate hostinfo/netinfo
...
This should never happen, so log when it does so we can fix it.
Signed-off-by: David Crawshaw <crawshaw@tailscale.com>
2020-04-02 13:12:29 +11:00
David Anderson
48d7ee1c6a
cmd/microproxy: adjust to export node stats and a Go expvar server's stats.
...
This is a temporary specialization to what tailscale prod needs right now,
it'll go back to something more generic later.
2020-04-01 16:50:02 -07:00
Brad Fitzpatrick
8ca796d144
ipn, ipn/policy: filter portlist to a short list of "interesting" ports
...
Adds new package ipn/policy to be shared between node client & control server.
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2020-04-01 10:03:44 -07:00
Brad Fitzpatrick
c6aa5b639f
tailcfg: clarify Hostinfo.OS doc
2020-04-01 09:27:35 -07:00
Brad Fitzpatrick
4524dcf51e
version: move runtime.OS to tailscale OS mapping func to version
...
So other code can use this without duplicating the policy.
2020-04-01 08:50:56 -07:00
David Anderson
c14bc028ac
cmd/microproxy: tiny TLS proxy that borrows autocert x509 certs.
2020-03-31 12:24:33 -07:00
Brad Fitzpatrick
1df3c8d02a
derp, netcheck: make tests listen on localhost only
...
avoid macOS firewall pop-ups
2020-03-30 11:29:08 -07:00
Brad Fitzpatrick
5362e952e1
safesocket: gofmt
...
Was developed on a random machine without my normal environment.
2020-03-30 11:23:18 -07:00
Brad Fitzpatrick
fee2d9fad4
safesocket: connect to the macOS network extension on darwin (as last resort)
...
(For cmd/tailscale CLI support on macOS)
Signed-off-by: Brad Fitzpatrick <brad@danga.com>
2020-03-29 22:15:28 -07:00
David Crawshaw
0590ad68be
controlclient, ipn: adjust tests for authURL semantic changes
...
The tests cheat at filling out web forms by directly POSTing to
the target. The target for authURLs has changed slightly, the base
authURL now redirects the user to the login page.
Additionally, the authURL cycle now checks the cookie is set
correctly, so we add cookie jars where necessary to pass the
cookie through.
2020-03-30 15:51:46 +11:00
Brad Fitzpatrick
a4ef345737
cmd/tailscale: add status subcommand
...
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2020-03-27 20:34:36 -07:00
Brad Fitzpatrick
810c1e9704
types/key: make Public implement TextMarshaler, TextUnmarshaler
...
So it can be a map key with encoding/json
2020-03-27 13:03:35 -07:00
Brad Fitzpatrick
f51f18b42b
ipn: move FakeBackend to a test-only file
2020-03-27 13:02:33 -07:00
Brad Fitzpatrick
8ebee05fbd
cmd/tailscale: remove unnecessary logpolicy/logtail logging
2020-03-27 08:27:36 -07:00
David Anderson
80261b02ba
testy: make safe for concurrent use.
...
Signed-off-by: David Anderson <dave@natulte.net>
2020-03-27 03:05:34 -07:00
David Anderson
1fdadf06f1
testy: don't give Clock.Step==0 magical behavior.
...
Turns out it's sometimes useful to stop time entirely.
Signed-off-by: David Anderson <dave@natulte.net>
2020-03-27 00:38:39 -07:00
Brad Fitzpatrick
8b3f6be008
control/controlclient: flip IPv6 to be on by default
...
The DEBUG_INCLUDE_IPV6 environment variable is now an opt-out.
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2020-03-26 22:02:56 -07:00
Brad Fitzpatrick
322499473e
cmd/tailscaled, wgengine, ipn: add /debug/ipn handler with world state
...
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2020-03-26 14:26:24 -07:00
David Anderson
dbca186a64
stunner: fix data race.
...
In very low-latency conditions, a STUN request can complete before
the startup loop has finished firing off goroutines, leading to
a concurrent map mutation.
2020-03-25 23:11:22 -07:00
Brad Fitzpatrick
7fb8d873ac
logpolicy: don't log timestamp when running under systemd
...
It'll do it anyway.
Makes journalctl -fu cleaner.
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2020-03-25 21:03:06 -07:00
Brad Fitzpatrick
2d48f92a82
wgengine/magicsock: re-stun every [20,27] sec, not 28
...
28 is cutting it close, and we think jitter will help some spikes
we're seeing.
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2020-03-25 14:25:33 -07:00