File tree Expand file tree Collapse file tree 3 files changed +17
-0
lines changed Expand file tree Collapse file tree 3 files changed +17
-0
lines changed Original file line number Diff line number Diff line change 36
36
### Added
37
37
38
38
- Add ` ClientOptions::sleep_when_idle ` (https://github.com/rust-nostr/nostr/pull/959 )
39
+ - add ` verify_subscriptions ` and ` ban_relay_on_mismatch ` to ` ClientOptions ` (https://github.com/rust-nostr/nostr/pull/998 )
39
40
40
41
### Deprecated
41
42
Original file line number Diff line number Diff line change @@ -256,6 +256,8 @@ impl Client {
256
256
// Set limits
257
257
opts. limits ( self . opts . relay_limits . clone ( ) )
258
258
. max_avg_latency ( self . opts . max_avg_latency )
259
+ . verify_subscriptions ( self . opts . verify_subscriptions )
260
+ . ban_relay_on_mismatch ( self . opts . ban_relay_on_mismatch )
259
261
}
260
262
261
263
/// If return `false` means that already existed
Original file line number Diff line number Diff line change @@ -26,6 +26,8 @@ pub struct ClientOptions {
26
26
pub ( super ) relay_limits : RelayLimits ,
27
27
pub ( super ) max_avg_latency : Option < Duration > ,
28
28
pub ( super ) sleep_when_idle : SleepWhenIdle ,
29
+ pub ( super ) verify_subscriptions : bool ,
30
+ pub ( super ) ban_relay_on_mismatch : bool ,
29
31
pub ( super ) pool : RelayPoolOptions ,
30
32
}
31
33
@@ -114,6 +116,18 @@ impl ClientOptions {
114
116
self
115
117
}
116
118
119
+ /// Verify that received events belong to a subscription and match the filter.
120
+ pub fn verify_subscriptions ( mut self , enable : bool ) -> Self {
121
+ self . verify_subscriptions = enable;
122
+ self
123
+ }
124
+
125
+ /// If true, ban a relay when it sends an event that doesn't match the subscription filter.
126
+ pub fn ban_relay_on_mismatch ( mut self , ban_relay : bool ) -> Self {
127
+ self . ban_relay_on_mismatch = ban_relay;
128
+ self
129
+ }
130
+
117
131
/// Set relay pool options
118
132
#[ inline]
119
133
pub fn pool ( mut self , opts : RelayPoolOptions ) -> Self {
You can’t perform that action at this time.
0 commit comments