Add rate limit by size

This commit is contained in:
Andrea Maria Piana 2020-06-08 11:01:47 +02:00
parent afa2afdbcf
commit 33b8d7304c
No known key found for this signature in database
GPG Key ID: AA6CCA6DE0E06424

View File

@ -104,27 +104,35 @@ Using [Augmented Backus-Naur form (ABNF)](https://tools.ietf.org/html/rfc5234) w
; Packet codes 0 - 127 are reserved for Waku protocol ; Packet codes 0 - 127 are reserved for Waku protocol
packet-code = 1*3DIGIT packet-code = 1*3DIGIT
; rate limits ; rate limits per packet
limit-ip = 1*DIGIT packet-limit-ip = 1*DIGIT
limit-peerid = 1*DIGIT packet-limit-peerid = 1*DIGIT
limit-topic = 1*DIGIT packet-limit-topic = 1*DIGIT
rate-limits = "[" limit-ip limit-peerid limit-topic "]" ; rate limits by size in bytes
bytes-limit-ip = 1*DIGIT
bytes-limit-peerid = 1*DIGIT
bytes-limit-topic = 1*DIGIT
packet-rate-limits = "[" packet-limit-ip packet-limit-peerid packet-limit-topic "]"
bytes-rate-limits = "[" bytes-limit-ip bytes-limit-peerid bytes-limit-topic "]"
pow-requirement-key = 0 pow-requirement-key = 0
bloom-filter-key = 1 bloom-filter-key = 1
light-node-key = 2 light-node-key = 2
confirmations-enabled-key = 3 confirmations-enabled-key = 3
rate-limits-key = 4 packet-rate-limits-key = 4
topic-interest-key = 5 topic-interest-key = 5
bytes-rate-limits-key = 6
status-options = "[" status-options = "["
[ pow-requirement-key pow-requirement ] [ pow-requirement-key pow-requirement ]
[ bloom-filter-key bloom-filter ] [ bloom-filter-key bloom-filter ]
[ light-node-key light-node ] [ light-node-key light-node ]
[ confirmations-enabled-key confirmations-enabled ] [ confirmations-enabled-key confirmations-enabled ]
[ rate-limits-key rate-limits ] [ packet-rate-limits-key packet-rate-limits ]
[ topic-interest-key topic-interest ] [ topic-interest-key topic-interest ]
[ bytes-limits-key bytes-rate-limits ]
"]" "]"
status = status-options status = status-options
@ -309,10 +317,19 @@ Each node MAY decide to whitelist, i.e. do not rate limit, selected IPs or peer
If a peer exceeds node's rate limits, the connection between them MAY be dropped. If a peer exceeds node's rate limits, the connection between them MAY be dropped.
Each node SHOULD broadcast its rate limits to its peers using the rate limits packet. The rate limits MAY also be sent as an optional parameter in the handshake. Each node SHOULD broadcast its rate limits to its peers using the `status-update` packet. The rate limits MAY also be sent as an optional parameter in the handshake.
Each node SHOULD respect rate limits advertised by its peers. The number of packets SHOULD be throttled in order not to exceed peer's rate limits. If the limit gets exceeded, the connection MAY be dropped by the peer. Each node SHOULD respect rate limits advertised by its peers. The number of packets SHOULD be throttled in order not to exceed peer's rate limits. If the limit gets exceeded, the connection MAY be dropped by the peer.
Two rate limits strategies are applied:
1) Number of packets per second
2) Size of packets (in bytes) per second
Both strategies SHOULD be applied per IP address, peer id and topic.
The size limit SHOULD be greater or equal than the maximum packet size.
##### Light Node Field ##### Light Node Field
When the node's `light-node` field is set to true, the node SHOULD NOT forward Envelopes from its peers. When the node's `light-node` field is set to true, the node SHOULD NOT forward Envelopes from its peers.
@ -557,6 +574,12 @@ Known static nodes MAY also be used.
- Consistent use of the words packet, message and envelope. - Consistent use of the words packet, message and envelope.
- Added section on max packet size - Added section on max packet size
### Version 1.1
Released []()
- Add rate limit per bytes
### Version 1.0 ### Version 1.0
Released [April 21,2020](https://github.com/vacp2p/specs/commit/9e650995f24179844857520c68fa3e8f6018b125) Released [April 21,2020](https://github.com/vacp2p/specs/commit/9e650995f24179844857520c68fa3e8f6018b125)