wgengine/magicsock, derp, derp/derphttp: respond to DERP server->client pings

No server support yet, but we want Tailscale 1.6 clients to be able to respond
to them when the server can do it.

Updates #1310

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick
2021-03-09 12:53:02 -08:00
committed by Brad Fitzpatrick
parent 66480755c2
commit 79d8288f0a
5 changed files with 124 additions and 3 deletions

View File

@@ -59,7 +59,8 @@ Login:
* server sends frameServerInfo
Steady state:
* server occasionally sends frameKeepAlive
* server occasionally sends frameKeepAlive (or framePing)
* client responds to any framePing with a framePong
* client sends frameSendPacket
* server then sends frameRecvPacket to recipient
*/
@@ -97,6 +98,9 @@ const (
// connection. (To be used for cluster load balancing
// purposes, when clients end up on a non-ideal node)
frameClosePeer = frameType(0x11) // 32B pub key of peer to close.
framePing = frameType(0x12) // 8 byte ping payload, to be echoed back in framePong
framePong = frameType(0x13) // 8 byte payload, the contents of the ping being replied to
)
var bin = binary.BigEndian