summaryrefslogtreecommitdiffhomepage
path: root/cmd/derper
AgeCommit message (Collapse)AuthorFilesLines
2021-02-26 cmd/derper: add /bootstrap-dns handlerBrad Fitzpatrick2-0/+72
For option (d) of #1405. For an HTTPS request of /bootstrap-dns, this returns e.g.: { "log.tailscale.io": [ "2600:1f14:436:d603:342:4c0d:2df9:191b", "34.210.105.16" ], "login.tailscale.com": [ "2a05:d014:386:203:f8b4:1d5a:f163:e187", "3.121.18.47" ] } Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-02-26cmd/derper: update a link from godoc.org to pkg.go.devBrad Fitzpatrick1-1/+1
Save a redirect. Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-02-12derp/derphttp: add a context and infoLogger option to RunWatchConnectionLoopBrad Fitzpatrick1-1/+2
2021-01-11all: adjust Unix permissions for those without umasksBrad Fitzpatrick1-1/+1
Fixes tailscale/corp#1165 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2020-12-30wgkey: new packageJosh Bleecher Snyder1-4/+4
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-11-02Change some os.IsNotExist to errors.Is(err, os.ErrNotExist) for non-os errors.Brad Fitzpatrick1-1/+1
os.IsNotExist doesn't unwrap errors. errors.Is does. The ioutil.ReadFile ones happened to be fine but I changed them so we're consistent with the rule: if the error comes from os, you can use os.IsNotExist, but from any other package, use errors.Is. (errors.Is always would also work, but not worth updating all the code) The motivation here was that we were logging about failure to migrate legacy relay node prefs file on startup, even though the code tried to avoid that. See golang/go#41122
2020-10-28version: use OSS repo's version when building.David Anderson1-1/+1
When building with redo, also include the git commit hash from the proprietary repo, so that we have a precise commit that identifies all build info (including Go toolchain version). Add a top-level build script demonstrating to downstream distros how to burn the right information into builds. Adjust `tailscale version` to print commit hashes when available. Fixes #841. Signed-off-by: David Anderson <danderson@tailscale.com>
2020-09-15cmd/derper: add missing html.EscapeString calls in /debug pageJosh Bleecher Snyder1-2/+3
Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
2020-08-20derp, derp/derphttp: remove one RTT from DERP setupBrad Fitzpatrick1-0/+10
* advertise server's DERP public key following its ServerHello * have client look for that DEPR public key in the response PeerCertificates * let client advertise it's going into a "fast start" mode if it finds it * modify server to support that fast start mode, just not sending the HTTP response header Cuts down another round trip, bringing the latency of being able to write our first DERP frame from SF to Bangalore from ~725ms (3 RTT) to ~481ms (2 RTT: TCP and TLS). Fixes #693 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2020-08-07derp: add server version to /debug, expvarsJosh Bleecher Snyder1-0/+2
This will make it easier for a human to tell what version is deployed, for (say) correlating line numbers in profiles or panics to corresponding source code. It'll also let us observe version changes in prometheus. Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
2020-07-16all: fix vet warningsBrad Fitzpatrick1-1/+1
2020-06-24cmd/derper: fix embarassing bug introduced in earlier refactorBrad Fitzpatrick1-1/+1
The remove hook implementation was copy/pasted from the line above and I didn't change the body, resulting in packet forwarding routes never being removed. Fortunately we weren't using this path yet, but it led to stats being off, and (very) slow memory growth.
2020-06-23cmd/derper, derp: add some more varz and consistency check handlerBrad Fitzpatrick1-0/+10
I'm trying to hunt down a slow drift in numbers not agreeing.
2020-06-15cmd/derper, derp/derphttp: move bulk of derp mesh code into derphttpBrad Fitzpatrick1-104/+3
To be reused in various other tools.
2020-06-15cmd/derper: remove unused parameter in runMeshClientBrad Fitzpatrick1-2/+2
2020-06-15derp: reduce DERP memory use; don't require callers to pass in memory to useBrad Fitzpatrick1-2/+1
The magicsock derpReader was holding onto 65KB for each DERP connection forever, just in case. Make the derp{,http}.Client be in charge of memory instead. It can reuse its bufio.Reader buffer space.
2020-06-05cmd/derper: support forwarding packets amongst set of peer DERP serversBrad Fitzpatrick2-4/+150
Updates #388 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2020-06-04cmd/derper: treat self-connection connection watch as no-opBrad Fitzpatrick1-1/+1
Updates #388
2020-06-04cmd/derper: add /home/bradfitz/keys to default mesh key search listBrad Fitzpatrick1-3/+8
2020-06-03derp, cmd/derper: add frameWatchConns, framePeerPresent for inter-DERP routingBrad Fitzpatrick2-2/+32
This lets a trusted DERP client that knows a pre-shared key subscribe to the connection list. Upon subscribing, they get the current set of connected public keys, and then all changes over time. This lets a set of DERP server peers within a region all stay connected to each other and know which clients are connected to which nodes. Updates #388 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2020-05-25stun, netcheck: move under netBrad Fitzpatrick1-1/+1
2020-03-20derp: move write timeout to package constant.David Anderson1-1/+0
Signed-off-by: David Anderson <dave@natulte.net>
2020-03-20derp: add short queues between reader and writer, drop on overload.David Anderson1-5/+0
This avoids the server blocking on misbehaving or heavily contended clients. We attempt to drop from the head of the queue to keep overall queueing time lower. Also: - fixes server->client keepalives, which weren't happening. - removes read rate-limiter, deferring instead to kernel-level global limiter/fair queuer. Signed-off-by: David Anderson <dave@natulte.net>
2020-03-12cmd/derper: set a write timeoutDavid Crawshaw1-0/+1
Signed-off-by: David Crawshaw <crawshaw@tailscale.com>
2020-03-06cmd/derper: also link to /debug/varzBrad Fitzpatrick1-1/+2
2020-03-04metrics: add a LabelMap type for variables with 1 label dimension.David Anderson1-15/+25
This lets us publish sets of vars that are breakdowns along one dimension in a format that Prometheus and Grafana natively know how to do useful things with. Signed-off-by: David Anderson <dave@natulte.net>
2020-03-03tsweb, derp: add expvar http.Handler for Prometheus's formatBrad Fitzpatrick1-7/+8
And add some opinions. Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2020-03-03cmd/derper: set autocert EmailBrad Fitzpatrick1-0/+1
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2020-03-02cmd/derper: appease staticcheckBrad Fitzpatrick1-2/+5
2020-03-02cmd/derper: accept more LetsEncrypt hostnames without explicit configBrad Fitzpatrick2-0/+46
2020-02-26cmd/derper: add a STUN serverBrad Fitzpatrick1-0/+63
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2020-02-25tsweb, cmd/derper: move common web/debug stuff from derper to new tswebBrad Fitzpatrick1-86/+7
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2020-02-21cmd/derper: provide debug access over port 80 to trusted (tailscale) IPsBrad Fitzpatrick1-1/+30
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2020-02-21derp, cmd/derper: add debug handlers, statsBrad Fitzpatrick1-6/+95
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2020-02-21cmd/derper: support logging to logtailBrad Fitzpatrick1-5/+13
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2020-02-20derp, cmd/derper: add rate limiting support, add default 5Mbps limitBrad Fitzpatrick1-4/+8
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2020-02-18cmd/derper: add a basic DERP serverBrad Fitzpatrick1-0/+141
Mostly Crawshaw's earlier code, refactored a bit. Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>