tailscale/wgengine/magicsock
Joe Tsai 81fd259133
wgengine/magicsock: gather physical-layer statistics (#5925)
There is utility in logging traffic statistics that occurs at the physical layer.
That is, in order to send packets virtually to a particular tailscale IP address,
what physical endpoints did we need to communicate with?

This functionality logs IP addresses identical to
what had always been logged in magicsock prior to #5823,
so there is no increase in PII being logged.

ExtractStatistics returns a mapping of connections to counts.
The source is always a Tailscale IP address (without port),
while the destination is some endpoint reachable on WAN or LAN.
As a special case, traffic routed through DERP will use 127.3.3.40
as the destination address with the port being the DERP region.

This entire feature is only enabled if data-plane audit logging
is enabled on the tailnet (by default it is disabled).

Example of type of information logged:

	------------------------------------  Tx[P/s]    Tx[B/s]  Rx[P/s]   Rx[B/s]
	PhysicalTraffic:                       25.80      3.39Ki   38.80     5.57Ki
	    100.1.2.3 -> 143.11.22.33:41641    15.40      2.00Ki   23.20     3.37Ki
	    100.4.5.6 -> 192.168.0.100:41641   10.20      1.38Ki   15.60     2.20Ki
	    100.7.8.9 -> 127.3.3.40:2           0.20      6.40      0.00     0.00

Signed-off-by: Joe Tsai <joetsai@digital-static.net>
2022-10-27 16:26:52 -07:00
..
debughttp.go wgengine/magicsock: fix panic in http debug server 2022-09-06 15:02:07 -07:00
debugknobs_stubs.go wgengine/magicsock: add client flag and envknob to disable heartbeat (#5638) 2022-09-16 23:48:46 -04:00
debugknobs.go wgengine/magicsock: add client flag and envknob to disable heartbeat (#5638) 2022-09-16 23:48:46 -04:00
discopingpurpose_string.go wgengine/magicsock: make discoPingPurpose a stringer 2020-09-14 14:29:28 -07:00
magicsock_default.go wgengine/magicsock: set UDP socket buffer sizes to 7MB 2022-10-13 14:46:25 -07:00
magicsock_linux.go wgengine/magicsock: set UDP socket buffer sizes to 7MB 2022-10-13 14:46:25 -07:00
magicsock_test.go wgengine/magicsock: gather physical-layer statistics (#5925) 2022-10-27 16:26:52 -07:00
magicsock_unix_test.go wgengine/magicsock: set UDP socket buffer sizes to 7MB 2022-10-13 14:46:25 -07:00
magicsock.go wgengine/magicsock: gather physical-layer statistics (#5925) 2022-10-27 16:26:52 -07:00
pathfinder.go wgengine/magicsock: set up pathfinder (#5994) 2022-10-20 14:34:49 -04:00