filter: add whitelist filter
Fixes: https://github.com/damus-io/noteguard/issues/3 Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
parent
bae87107ae
commit
74c90453b8
5 changed files with 51 additions and 16 deletions
19
README.md
19
README.md
|
|
@ -14,12 +14,15 @@ You can add any new filter you want by implementing the `NoteFilter` trait and r
|
|||
The `pipeline` config specifies the order in which filters are run. When the first `reject` or `shadowReject` action is hit, then the pipeline stops and returns the rejection error.
|
||||
|
||||
```toml
|
||||
|
||||
pipeline = ["ratelimit"]
|
||||
pipeline = ["whitelist", "ratelimit"]
|
||||
|
||||
[filters.ratelimit]
|
||||
notes_per_minute = 8
|
||||
posts_per_minute = 8
|
||||
whitelist = ["127.0.0.1"]
|
||||
|
||||
[filters.whitelist]
|
||||
#pubkeys = ["32e1827635450ebb3c5a7d12c1f8e7b2b514439ac10a67eef3d9fd9c5c68e245"]
|
||||
ips = ["127.0.0.1", "127.0.0.2"]
|
||||
```
|
||||
|
||||
## Filters
|
||||
|
|
@ -38,6 +41,16 @@ Settings:
|
|||
|
||||
- `whitelist`: a list of IP4 or IP6 addresses that are allowed to bypass the ratelimit.
|
||||
|
||||
## Whitelist
|
||||
|
||||
The whitelist filter only allows notes to pass if it matches a particular pubkey or source ip:
|
||||
|
||||
- `pubkeys`: a list of hex public keys to let through
|
||||
|
||||
- `ips`: a list of ip addresses to let through
|
||||
|
||||
Either criteria can match
|
||||
|
||||
## Testing
|
||||
|
||||
You can test your filters like so:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue