mirror of
https://github.com/tailscale/tailscale.git
synced 2025-10-09 08:01:31 +00:00
net/connstats: enforce maximum number of connections (#6760)
The Tailscale logging service has a hard limit on the maximum log message size that can be accepted. We want to ensure that netlog messages never exceed this limit otherwise a client cannot transmit logs. Move the goroutine for periodically dumping netlog messages from wgengine/netlog to net/connstats. This allows net/connstats to manage when it dumps messages, either based on time or by size. Updates tailscale/corp#8427 Signed-off-by: Joe Tsai <joetsai@digital-static.net>
This commit is contained in:
@@ -30,6 +30,15 @@ type Message struct {
|
||||
}
|
||||
|
||||
const (
|
||||
messageJSON = `{"nodeId":"n0123456789abcdefCNTRL",` + maxJSONTimeRange + `,` + minJSONTraffic + `}`
|
||||
maxJSONTimeRange = `"start":` + maxJSONRFC3339 + `,"end":` + maxJSONRFC3339
|
||||
maxJSONRFC3339 = `"0001-01-01T00:00:00.000000000Z"`
|
||||
minJSONTraffic = `"virtualTraffic":{},"subnetTraffic":{},"exitTraffic":{},"physicalTraffic":{}`
|
||||
|
||||
// MaxMessageJSONSize is the overhead size of Message when it is
|
||||
// serialized as JSON assuming that each traffic map is populated.
|
||||
MaxMessageJSONSize = len(messageJSON)
|
||||
|
||||
maxJSONConnCounts = `{` + maxJSONConn + `,` + maxJSONCounts + `}`
|
||||
maxJSONConn = `"proto":` + maxJSONProto + `,"src":` + maxJSONAddrPort + `,"dst":` + maxJSONAddrPort
|
||||
maxJSONProto = `255`
|
||||
|
Reference in New Issue
Block a user