Josh Bleecher Snyder
25df067dd0
all: adapt to opaque netaddr types
...
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-16 14:52:00 -07:00
Brad Fitzpatrick
4066c606df
ipn/ipnlocal: update peerapi logging of received PUTs
...
Clarify direction and add duration.
(per chat with Avery)
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-05-04 11:09:02 -07:00
Brad Fitzpatrick
f5bccc0746
ipn/ipnlocal: redact more errors
...
Updates tailscale/corp#1636
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-05-04 09:58:09 -07:00
Brad Fitzpatrick
138921ae40
ipn/ipnlocal: always write files to partial files, even in buffered mode
...
The intention was always that files only get written to *.partial
files and renamed at the end once fully received, but somewhere in the
process that got lost in buffered mode and *.partial files were only
being used in direct receive mode. This fix prevents WaitingFiles
from returning files that are still being transferred.
Updates tailscale/corp#1626
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-04-26 11:34:05 -07:00
Brad Fitzpatrick
5e268e6153
ipn/ipnlocal: use delete marker files to work around Windows delete problems
...
If DeleteFile fails on Windows due to another process (anti-virus,
probably) having our file open, instead leave a marker file that the
file is logically deleted, and remove it from API calls and clean it
up lazily later.
Updates tailscale/corp#1626
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-04-26 10:59:25 -07:00
Brad Fitzpatrick
86e85d8934
ipn/ipnlocal: add peerapi goroutine fetch
...
Between owners.
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-04-22 13:11:51 -07:00
Brad Fitzpatrick
2d786821f6
ipn/ipnlocal: put a retry loop around Windows file deletes
...
oh, Windows.
Updates tailscale/corp#1626
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-04-22 10:04:50 -07:00
Brad Fitzpatrick
529ef98b2a
ipn/ipnlocal: fix approxSize operator precedence
...
Whoops.
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-04-22 08:44:50 -07:00
Brad Fitzpatrick
b03c23d2ed
ipn/ipnlocal: log on DeleteFile error
...
Updates tailscale/corp#1626
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-04-22 07:48:18 -07:00
Brad Fitzpatrick
3d0599fca0
ipn{,/ipnlocal}: in direct file receive mode, don't rename partial file
...
Let caller (macOS) do it so Finder progress bar can be dismissed
without races.
Updates tailscale/corp#1575
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-04-20 12:40:42 -07:00
Brad Fitzpatrick
8570f82c8b
ipn/ipnlocal: finish/fix up filename validation & encoding on disk
...
It used to just store received files URL-escaped on disk, but that was
a half done lazy implementation, and pushed the burden to callers to
validate and write things to disk in an unescaped way.
Instead, do all the validation in the receive handler and only
accept filenames that are UTF-8 and in the intersection of valid
names that all platforms support.
Fixes tailscale/corp#1594
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-04-19 22:39:53 -07:00
Brad Fitzpatrick
cad8df500c
ipn/ipnlocal: add some more peerapi handlePeerPut tests
...
Updates tailscale/corp#1594
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-04-19 21:01:04 -07:00
Brad Fitzpatrick
0d1550898e
ipn/ipnlocal: add some peerapi tests
...
Updates tailscale/corp#1594
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-04-19 20:28:53 -07:00
Brad Fitzpatrick
b993d9802a
ipn/ipnlocal, etc: require file sharing capability to send/recv files
...
tailscale/corp#1582
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-04-16 10:58:19 -07:00
Brad Fitzpatrick
b91f3c4191
ipn/ipnlocal: fix peerapi printf arg mismatch
...
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-04-13 08:56:26 -07:00
Brad Fitzpatrick
db5e269463
client/tailscale/apitype: move local API types to new apitype package
...
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-13 08:13:46 -07:00
Brad Fitzpatrick
8e75c8504c
ipn/ipnlocal: in direct file mode, don't readdir
...
And don't even allow attempts at Open/Delete.
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-04-12 15:12:47 -07:00
Brad Fitzpatrick
f5742b0647
ipn/ipnlocal: add LocalBackend.SetDirectFileRoot
...
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-04-12 14:29:45 -07:00
Brad Fitzpatrick
6d01d3bece
ipn/ipnlocal: provide IPN bus updates as files arrive
...
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-04-08 20:09:52 -07:00
Brad Fitzpatrick
6266cf8e36
ipn/ipnlocal: fix peerapi6 port being report as 0 in netstack mode
...
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-04-01 22:04:46 -07:00
Brad Fitzpatrick
6d1a9017c9
ipn/{ipnlocal,localapi}, client/tailscale: add file get/delete APIs
...
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-03-30 12:56:51 -07:00
Brad Fitzpatrick
672b9fd4bd
ipn{,/ipnlocal}: set new Notify.FilesWaiting when server has file(s)
...
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-03-30 11:36:12 -07:00
Brad Fitzpatrick
f01091babe
ipn/ipnlocal: make peerapi work in netstack mode
...
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-03-30 09:55:01 -07:00
Brad Fitzpatrick
9659ab81e0
ipn/ipnlocal: send peerapi port(s) in Hostinfo.Services
...
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-03-29 12:51:19 -07:00
Brad Fitzpatrick
35596ae5ce
ipn/ipnlocal: push down a user-specific root dir to peerapi handler
...
And add a put handler.
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-03-29 11:33:35 -07:00
Brad Fitzpatrick
f26dfd054a
ipn/ipnlocal: rename/document peerapi stuff a bit, pass self identity
...
So handlers can vary based on whether owner of peer matches owner of
local node.
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-03-26 21:36:39 -07:00
Brad Fitzpatrick
1642dfdb07
ipn/ipnlocal: get peerapi ~working in macOS/iOS NetworkExtension sandbox
...
IPv4 and IPv6 both work remotely, but IPv6 doesn't yet work from the
machine itself due to routing mysteries.
Untested yet on iOS, but previous prototype worked on iOS, so should
work the same.
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-03-26 13:46:01 -07:00
Brad Fitzpatrick
5a62aa8047
ipn/ipnlocal: pass down interface state to peerapi ListenConfig hook
...
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-03-26 09:11:48 -07:00
Brad Fitzpatrick
81143b6d9a
ipn/ipnlocal: start of peerapi between nodes
...
Also some necessary refactoring of the ipn/ipnstate too.
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-03-25 16:00:35 -07:00