summaryrefslogtreecommitdiffhomepage
path: root/client
AgeCommit message (Collapse)AuthorFilesLines
2022-09-15refactor: move from io/ioutil to io and os packagesEng Zer Jun2-6/+4
The io/ioutil package has been deprecated as of Go 1.16 [1]. This commit replaces the existing io/ioutil functions with their new definitions in io and os packages. Reference: https://golang.org/doc/go1.16#ioutil Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2022-08-22client,cmd/tailscale,ipn,tka,types: implement tka initialization flowTom DNetto1-0/+37
This PR implements the client-side of initializing network-lock with the Coordination server. Signed-off-by: Tom DNetto <tom@tailscale.com>
2022-08-02all: require Go 1.19Brad Fitzpatrick8-17/+17
Updates #5210 Change-Id: I2e950b4776636b4ea89b6566b60e4a87596a3a43 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2022-07-25all: convert more code to use net/netip directlyBrad Fitzpatrick3-11/+9
perl -i -npe 's,netaddr.IPPrefixFrom,netip.PrefixFrom,' $(git grep -l -F netaddr.) perl -i -npe 's,netaddr.IPPortFrom,netip.AddrPortFrom,' $(git grep -l -F netaddr. ) perl -i -npe 's,netaddr.IPPrefix,netip.Prefix,g' $(git grep -l -F netaddr. ) perl -i -npe 's,netaddr.IPPort,netip.AddrPort,g' $(git grep -l -F netaddr. ) perl -i -npe 's,netaddr.IP\b,netip.Addr,g' $(git grep -l -F netaddr. ) perl -i -npe 's,netaddr.IPv6Raw\b,netip.AddrFrom16,g' $(git grep -l -F netaddr. ) goimports -w . Then delete some stuff from the net/netaddr shim package which is no longer neeed. Updates #5162 Change-Id: Ia7a86893fe21c7e3ee1ec823e8aba288d4566cd8 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2022-07-25all: use various net/netip parse funcs directlyBrad Fitzpatrick1-1/+1
Mechanical change with perl+goimports. Changed {Must,}Parse{IP,IPPrefix,IPPort} to their netip variants, then goimports -d . Finally, removed the net/netaddr wrappers, to prevent future use. Updates #5162 Change-Id: I59c0e38b5fbca5a935d701645789cddf3d7863ad Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2022-07-25net/netaddr: start migrating to net/netip via new netaddr adapter packageBrad Fitzpatrick3-4/+4
Updates #5162 Change-Id: Id7bdec303b25471f69d542f8ce43805328d56c12 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2022-06-24client/tailscale: update ACLRow and ACLTest with new ACL fieldsMaisem Ali1-7/+16
Signed-off-by: Maisem Ali <maisem@tailscale.com> Co-authored-by: Will Norris <will@tailscale.com>
2022-05-05client/tailscale: fix ExpandSNIName on non-default LocalClientBrad Fitzpatrick1-1/+1
It was using a mix. Found by @maisem. Change-Id: Ieb79d78608474ac13c2f44e0f3d8997a5665eb13 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2022-05-03ipn/ipnlocal: move Ping method from IPN bus to LocalBackend (HTTP)Brad Fitzpatrick1-0/+18
Change-Id: I61759f1dae8d9d446353db54c8b1e13bfffb3287 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2022-05-03client/tailscale: update Client API a bitBrad Fitzpatrick7-44/+92
Change-Id: I81aa29a8b042a247eac1941038f5d90259569941 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2022-04-30client/tailscale: move API client for the control admin APIBrad Fitzpatrick8-1/+1238
This was work done Nov-Dec 2020 by @c22wen and @chungdaniel. This is just moving it to another repo. Co-Authored-By: Christina Wen <37028905+c22wen@users.noreply.github.com> Co-Authored-By: Christina Wen <christina@tailscale.com> Co-Authored-By: Daniel Chung <chungdaniel@users.noreply.github.com> Co-Authored-By: Daniel Chung <daniel@tailscale.com> Change-Id: I6da3b05b972b54771f796b5be82de5aa463635ca Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2022-04-29client/tailscale: rename tailscale.go -> localclient.goBrad Fitzpatrick1-0/+0
In prep for other stuff. Change-Id: I82c24946d062d668cab48ca6749776b6ae7025ac Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2022-04-29client/tailscale: move/copy all package funcs to new LocalClient typeBrad Fitzpatrick1-78/+157
Remove all global variables, and clean up tsnet and cmd/tailscale's usage. This is in prep for using this package for the web API too (it has the best package name). RELNOTE=tailscale.com/client/tailscale package refactored w/ LocalClient type Change-Id: Iba9f162fff0c520a09d1d4bd8862f5c5acc9d7cd Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2022-04-25ipn: add IPCVersion override funcBrad Fitzpatrick1-3/+2
I've done this a handful of times in the past and again today. Time to make it a supported thing for the future. Used while debugging tailscale/corp#4559 (macsys CLI issues) Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2022-04-18cmd/tailscale, etc: make "tailscale up --ssh" fail fast when unavailableBrad Fitzpatrick1-0/+15
Fail on unsupported platforms (must be Linux or macOS tailscaled with WIP env) or when disabled by admin (with TS_DISABLE_SSH_SERVER=1) Updates #3802 Change-Id: I5ba191ed0d8ba4ddabe9b8fc1c6a0ead8754b286 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2022-04-17all: add arbitrary capability supportBrad Fitzpatrick1-0/+3
Updates #4217 RELNOTE=start of WhoIsResponse capability support Change-Id: I6522998a911fe49e2f003077dad6164c017eed9b Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2022-04-12cmd/tailscale: add id-token subcommandMaisem Ali1-0/+15
RELNOTE=Initial support for getting OIDC ID Tokens Updates tailscale/corp#4347 Signed-off-by: Maisem Ali <maisem@tailscale.com>
2022-03-24client/tailscale, cmd/tailscale, localapi: add 'tailscale nc'Brad Fitzpatrick1-0/+56
This adds a "tailscale nc" command that acts a bit like "nc", but dials out via tailscaled via localapi. This is a step towards a "tailscale ssh", as we'll use "tailscale nc" as a ProxyCommand for in some cases (notably in userspace mode). But this is also just useful for debugging & scripting. Updates #3802 RELNOTE=tailscale nc Change-Id: Ia5c37af2d51dd0259d5833d80264d3ad5f68446a Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2022-03-23envknob, ipn/ipnlocal: add SSH admin kill switchBrad Fitzpatrick1-0/+1
Updates #3802 Change-Id: I6127907446d1a6be1b097d9ba3b534f2b8eb707f Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2022-03-19all: use strings.Cut even moreBrad Fitzpatrick1-6/+3
Change-Id: I943ce72c6f339589235bddbe10d07799c4e37979 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2022-03-18cmd/tailscaled: make build fail nicely on older Go versionsBrad Fitzpatrick2-0/+15
Due to a bug in Go (golang/go#51778), cmd/go doesn't warn about your Go version being older than the go.mod's declared Go version in that case that package loading fails before the build starts, such as when you use packages that are only in the current version of Go, like our use of net/netip. This change works around that Go bug by adding build tags and a pre-Go1.18-only file that will cause Go 1.17 and earlier to fail like: $ ~/sdk/go1.17/bin/go install ./cmd/tailscaled # tailscale.com/cmd/tailscaled ./required_version.go:11:2: undefined: you_need_Go_1_18_to_compile_Tailscale note: module requires Go 1.18 Change-Id: I39f5820de646703e19dde448dd86a7022252f75c Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2022-01-25cmd/tailscale: propagate tailscaled 403s as AccessDeniedErrorsdavideger1-6/+6
So Linux/etc CLI users get helpful advice to run tailscale with --operator=$USER when they try to 'tailscale file {cp,get}' but are mysteriously forbidden. Signed-off-by: David Eger <eger@google.com> Signed-off-by: David Eger <david.eger@gmail.com>
2021-12-28cmd/tailscale: add debug restun, rebind subcommandsBrad Fitzpatrick1-0/+10
In the hidden debug menu. Change-Id: I20213f1f4e2290d36f9ff561bac0cc767400d5fd Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-12-09safesocket: add ConnectionStrategy, provide control over fallbacksJosh Bleecher Snyder1-2/+10
fee2d9fad added support for cmd/tailscale to connect to IPNExtension. It came in two parts: If no socket was provided, dial IPNExtension first, and also, if dialing the socket failed, fall back to IPNExtension. The second half of that support caused the integration tests to fail when run on a machine that was also running IPNExtension. The integration tests want to wait until the tailscaled instances that they spun up are listening. They do that by dialing the new instance. But when that dial failed, it was falling back to IPNExtension, so it appeared (incorrectly) that tailscaled was running. Hilarity predictably ensued. If a user (or a test) explicitly provides a socket to dial, it is a reasonable assumption that they have a specific tailscaled in mind and don't want to fall back to IPNExtension. It is certainly true of the integration tests. Instead of adding a bool to Connect, split out the notion of a connection strategy. For now, the implementation remains the same, but with the details hidden a bit. Later, we can improve that. Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
2021-11-30godoc fix: StatusWithPeers -> StatusWithoutPeersDanny Hermes1-1/+1
Signed-off-by: Danny Hermes <daniel.j.hermes@gmail.com>
2021-11-30cmd/tailscale: make file cp send files via tailscaled localapiBrad Fitzpatrick1-13/+46
So Taildrop sends work even if the local tailscaled is running in netstack mode, as it often is on Synology, etc. Updates #2179 (which is primarily about receiving, but both important) Change-Id: I9bd1afdc8d25717e0ab6802c7cf2f5e0bd89a3b2 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-11-15cmd/tailscale/cli: add "debug metrics" subcommandBrad Fitzpatrick1-0/+6
To let users inspect the tailscaled metrics easily. Updates #3307 Change-Id: I922126ca0626659948c57de74c6ef62f40ef5f5f Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-11-05safesocket: add WindowsLocalPort constBrad Fitzpatrick1-1/+1
Remove all the 41112 references. Change-Id: I2d7ed330d457e3bb91b7e6416cfb2667611e50c4 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-10-07tsnet: run the LocalAPI handlerMaisem Ali1-21/+38
Signed-off-by: Maisem Ali <maisem@tailscale.com>
2021-10-01cmd/tailscale: make cert subcommand give hints on access deniedBrad Fitzpatrick1-0/+25
Lot of people have been hitting this. Now it says: $ tailscale cert tsdev.corp.ts.net Access denied: cert access denied Use 'sudo tailscale cert' or 'tailscale up --operator=$USER' to not require root. Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-09-23ipn/localapi, cmd/tailscale: add CPU & memory profile support, debug commandBrad Fitzpatrick1-0/+12
This was already possible on Linux if you ran tailscaled with --debug (which runs net/http/pprof), but it requires the user have the Go toolchain around. Also, it wasn't possible on macOS, as there's no way to run the IPNExtension with a debug server (it doesn't run tailscaled). And on Windows it's super tedious: beyond what users want to do or what we want to explain. Instead, put it in "tailscale debug" so it works and works the same on all platforms. Then we can ask users to run it when we're debugging something and they can email us the output files. Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-09-21client/tailscale/example/servetls: add demo program for docsBrad Fitzpatrick1-0/+29
Updates #1235 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-09-14cmd/tailscale: provide a better error message when tailscaled isn't runningBrad Fitzpatrick1-0/+41
Fixes #2797 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-08-31client/tailscale, cmd/tailscale/cli: move version mismatch check to CLIBrad Fitzpatrick1-3/+11
So people can use the package for whois checks etc without version skew errors. The earlier change faa891c1f2ff759f4e5cbc158f310b3201d91b59 for #1905 was a bit too aggressive. Fixes #2757 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-08-19client/tailscale,ipn/localapi: warn on tailscale/tailscaled version skewBrad Fitzpatrick1-0/+5
Fixes #1905 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-08-18client/tailscale: make GetCertificate guess cert if SNI lacks dotsBrad Fitzpatrick1-1/+22
Updates #1235 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-08-17ipn/localapi: move cert fetching code to localapi, cache, add cert subcommandBrad Fitzpatrick1-0/+48
Updates #1235 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-06-28cmd/tailscale: make netcheck use active DERP map, delete static copyjulianknodt1-0/+15
After allowing for custom DERP maps, it's convenient to be able to see their latency in netcheck. This adds a query to the local tailscaled for the current DERPMap. Updates #1264 Signed-off-by: julianknodt <julianknodt@gmail.com>
2021-06-08client/tailscale: document SetDNS moreBrad Fitzpatrick1-1/+14
Updates #1235 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-06-08client/tailscale: add SetDNS funcBrad Fitzpatrick1-0/+9
Updates #1235 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-04-16ipn/ipnlocal, etc: require file sharing capability to send/recv filesBrad Fitzpatrick1-1/+16
tailscale/corp#1582 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-04-13client/tailscale/apitype: move local API types to new apitype packageBrad Fitzpatrick2-10/+46
They were scattered/duplicated in misc places before. It can't be in the client package itself for circular dep reasons. This new package is basically tailcfg but for localhost communications, instead of to control. Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-04-11ipn/ipnlocal: use PATCH for EditPrefs, not POSTBrad Fitzpatrick1-1/+1
Addendum to earlier 00d641d9fc69557fdac6500eb889088520010705. Reserve POST for SetPrefs in the future. Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-04-11ipn/localapi: move EditPrefs to localapiBrad Fitzpatrick1-1/+18
Follow-up/revision to recent 53cfff109b01baa3d219697a1a9e2ea16c4b0d3d which added EditPrefs. Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-04-09ipn/{ipnlocal,localapi}, cmd/tailscale: add logout commandBrad Fitzpatrick1-0/+5
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-04-07ipn/localapi, cmd/tailscale: add API to get prefs, CLI debug command to showBrad Fitzpatrick1-0/+13
Updates #1436 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-04-07client/tailscale: factor out some helpers to reduce boilerplateBrad Fitzpatrick1-89/+35
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-03-31cmd/tailscale, ipn/localapi: add "tailscale bugreport" subcommandMaisem Ali1-0/+23
Adding a subcommand which prints and logs a log marker. This should help diagnose any issues that users face. Fixes #1466 Signed-off-by: Maisem Ali <maisem@tailscale.com>
2021-03-31cmd/tailscale, ipn/localapi: move IP forwarding check to tailscaled, APIBrad Fitzpatrick1-1/+29
Instead of having the CLI check whether IP forwarding is enabled, ask tailscaled. It has a better idea. If it's netstack, for instance, the sysctl values don't matter. And it's possible that only the daemon has permission to know. Fixes #1626 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-03-30ipn/{ipnlocal,localapi}, client/tailscale: add file get/delete APIsBrad Fitzpatrick1-0/+65
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>