@@ -9,6 +9,7 @@ use std::sync::Arc;
99use nostr:: signer:: { IntoNostrSigner , NostrSigner } ;
1010use nostr_database:: memory:: MemoryDatabase ;
1111use nostr_database:: { IntoNostrDatabase , NostrDatabase } ;
12+ use nostr_gossip:: NostrGossip ;
1213use nostr_relay_pool:: monitor:: Monitor ;
1314use nostr_relay_pool:: policy:: AdmitPolicy ;
1415use nostr_relay_pool:: transport:: websocket:: {
@@ -29,6 +30,8 @@ pub struct ClientBuilder {
2930 pub admit_policy : Option < Arc < dyn AdmitPolicy > > ,
3031 /// Database
3132 pub database : Arc < dyn NostrDatabase > ,
33+ /// Gossip
34+ pub gossip : Option < Arc < dyn NostrGossip > > ,
3235 /// Relay monitor
3336 pub monitor : Option < Monitor > ,
3437 /// Client options
@@ -42,6 +45,7 @@ impl Default for ClientBuilder {
4245 websocket_transport : Arc :: new ( DefaultWebsocketTransport ) ,
4346 admit_policy : None ,
4447 database : Arc :: new ( MemoryDatabase :: default ( ) ) ,
48+ gossip : None ,
4549 monitor : None ,
4650 opts : ClientOptions :: default ( ) ,
4751 }
@@ -106,6 +110,16 @@ impl ClientBuilder {
106110 self
107111 }
108112
113+ /// Set a gossip database
114+ #[ inline]
115+ pub fn gossip < T > ( mut self , gossip : T ) -> Self
116+ where
117+ T : NostrGossip + ' static ,
118+ {
119+ self . gossip = Some ( Arc :: new ( gossip) ) ;
120+ self
121+ }
122+
109123 /// Set monitor
110124 #[ inline]
111125 pub fn monitor ( mut self , monitor : Monitor ) -> Self {
0 commit comments