derp, cmd/derper: add rate limiting support, add default 5Mbps limit

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick
2020-02-20 15:14:24 -08:00
committed by Dave Anderson
parent 1166c34f6c
commit 88f1cc0c98
6 changed files with 38 additions and 12 deletions

View File

@@ -131,7 +131,7 @@ func (c *Client) send(dstKey key.Public, pkt []byte) (ret error) {
}
}()
if len(pkt) > 64<<10 {
if len(pkt) > maxPacketData {
return fmt.Errorf("packet too big: %d", len(pkt))
}