spec/waku-rate-limiting (#66)

* adds ratelimting

* Update waku.md

* @oskarth replaced
This commit is contained in:
Dean Eigenmann 2019-12-05 15:30:30 +01:00 committed by Oskar Thorén
parent c85a2d8aa7
commit 3367e27320

33
waku.md
View File

@ -133,8 +133,8 @@ messages = 1*waku-envelope
p2p-request = waku-envelope
p2p-message = 1*waku-envelope
; packet-format needs to be paired with its corresponding
; packet-format
; packet-format needs to be paired with its
corresponding packet-format
packet-format = "[" packet-code packet-format "]"
required-packet = 0 status /
@ -142,7 +142,7 @@ required-packet = 0 status /
2 pow-requirement /
3 bloom-filter
optional-packet = 126 p2p-request / 127 p2p-message
optional-packet = 126 p2p-request / 127 p2p-message / 20 rate-limits
packet = "[" required-packet [ optional-packet ] "]"
```
@ -157,12 +157,13 @@ Messages with unknown codes MUST be ignored without generating any error, for fo
The Waku sub-protocol MUST support the following packet codes:
| Name | Int Value |
|----------------------------|-----------|
| Status | 0 |
| Messages | 1 |
| PoW Requirement | 2 |
| Bloom Filter | 3 |
| Name | Int Value |
| -------------------------- | ------------- |
| Status | 0 |
| Messages | 1 |
| PoW Requirement | 2 |
| Bloom Filter | 3 |
| Rate limits | 20 |
The following message codes are optional, but they are reserved for specific purpose.
@ -242,6 +243,20 @@ This packet is used for sending Dapp-level peer-to-peer requests, e.g. Waku Mail
This packet is used for sending the peer-to-peer messages, which are not supposed to be forwarded any further. E.g. it might be used by the Waku Mail Server for delivery of old (expired) messages, which is otherwise not allowed.
**Rate Limits**
This packet is used for informing other nodes of their self defined rate limits.
In order to provide basic Denial-of-Service attack protection, each node SHOULD define its own rate limits. The rate limits SHOULD be applied on IPs, peer IDs, and envelope topics.
Each node MAY decide to whitelist, i.e. do not rate limit, selected IPs or peer IDs.
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 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.
### Whisper Envelope data field (Optional)
This section outlines the description of the Data Field.