Brad Fitzpatrick
a12aad6b47
all: convert more code to use net/netip directly
...
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-25 21:53:49 -07:00
Brad Fitzpatrick
7eaf5e509f
net/netaddr: start migrating to net/netip via new netaddr adapter package
...
Updates #5162
Change-Id: Id7bdec303b25471f69d542f8ce43805328d56c12
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2022-07-25 16:20:43 -07:00
David Anderson
84c3a09a8d
types/key: export constants for key size, not a method.
...
Signed-off-by: David Anderson <danderson@tailscale.com>
2021-10-29 17:39:04 -07:00
David Anderson
6422789ea0
disco: use key.NodePublic instead of tailcfg.NodeKey.
...
Updates #3206
Signed-off-by: David Anderson <danderson@tailscale.com>
2021-10-29 17:39:04 -07:00
David Anderson
e7eb46bced
wgengine/magicsock: add an explicit else branch to peerMap update.
...
Clarifies that the replace+delete of peerinfo data is only when peerInfo
already exists.
Signed-off-by: David Anderson <danderson@tailscale.com>
2021-10-18 13:05:52 -07:00
David Anderson
1c56643136
disco: amplify comment that disco ping's NodeKey shouldn't be trusted by itself.
...
Signed-off-by: David Anderson <danderson@tailscale.com>
2021-10-18 13:05:52 -07:00
Brad Fitzpatrick
75a7779b42
disco, wgengine/magicsock: send self node key in disco pings
...
This lets clients quickly (sub-millisecond within a local LAN) map
from an ambiguous disco key to a node key without waiting for a
CallMeMaybe (over relatively high latency DERP).
Updates #3088
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-10-17 10:24:07 -07:00
Brad Fitzpatrick
dabeda21e0
net/tstun: block looped disco traffic
...
Updates #1526 (maybe fixes? time will tell)
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-09-13 16:00:28 -07:00
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
edf64e0901
wgengine/magicsock: send, use endpoints in CallMeMaybe messages
...
Fixes #1172
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-01-20 14:59:41 -08:00
Brad Fitzpatrick
b5b4992eff
disco: support parsing/encoding endpoints in call-me-maybe frames
...
Updates #1172
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
2021-01-20 12:16:33 -08:00
Brad Fitzpatrick
a6559a8924
wgengine/magicsock: run test DERP in mode where only disco packets allowed
...
So we don't accidentally pass a NAT traversal test by having DERP pick up our slack
when we really just wanted DERP as an OOB messaging channel.
2020-07-16 12:58:35 -07:00
Brad Fitzpatrick
f5f3885b5b
wgengine/magicsock: bunch of misc discovery path cleanups
...
* fix tailscale status for peers using discovery
* as part of that, pull out disco address selection into reusable
and testable discoEndpoint.addrForSendLocked
* truncate ping/pong logged hex txids in half to eliminate noise
* move a bunch of random time constants into named constants
with docs
* track a history of per-endpoint pong replies for future use &
status display
* add "send" and " got" prefix to discovery message logging
immediately before the frame type so it's easier to read than
searching for the "<-" or "->" arrows earlier in the line; but keep
those as the more reasily machine readable part for later.
Updates #483
2020-07-03 11:26:22 -07:00
Brad Fitzpatrick
847b6f039b
disco: simplify expression, appease staticcheck
...
Was:
disco/disco.go:164:10: unnecessary use of fmt.Sprintf (S1039)
2020-07-02 10:52:23 -07:00
Brad Fitzpatrick
0f0ed3dca0
wgengine/magicsock: clean up discovery logging
...
Updates #483
2020-07-02 10:48:13 -07:00
Brad Fitzpatrick
77d3ef36f4
wgengine/magicsock: hook up discovery messages, upgrade to LAN works
...
Ping messages now go out somewhat regularly, pong replies are sent,
and pong replies are now partially handled enough to upgrade off DERP
to LAN.
CallMeMaybe packets are sent & received over DERP, but aren't yet
handled. That's next (and regular maintenance timers), and then WAN
should work.
Updates #483
2020-07-01 13:00:50 -07:00
Brad Fitzpatrick
eb4eb34f37
disco: new package for parsing & marshaling discovery messages
...
Updates #483
2020-06-29 21:54:34 -07:00