|
@@ -1,13 +1,10 @@
|
|
|
use futures::Future;
|
|
|
use nostr_rs_client::Pool;
|
|
|
+use nostr_rs_relayer::Relayer;
|
|
|
use nostr_rs_rocksdb::RocksDb;
|
|
|
-use nostr_rs_types::{relayer, types::Filter, Request, Response};
|
|
|
-use std::{collections::HashMap, env, fs, pin::Pin, sync::Arc};
|
|
|
-use tokio::{
|
|
|
- net::TcpListener,
|
|
|
- sync::mpsc,
|
|
|
- time::{sleep, Duration},
|
|
|
-};
|
|
|
+use nostr_rs_types::{types::Filter, Request, Response};
|
|
|
+use std::{env, fs, pin::Pin, sync::Arc};
|
|
|
+use tokio::{net::TcpListener, sync::mpsc};
|
|
|
use url::Url;
|
|
|
|
|
|
mod config;
|
|
@@ -86,6 +83,15 @@ async fn main() {
|
|
|
];
|
|
|
|
|
|
let _ = client_pool.subscribe(initial_subscription.into()).await;
|
|
|
+
|
|
|
+ let relayer = Relayer::new(Some(db), Some(client_pool)).expect("relayer");
|
|
|
+
|
|
|
+ let addr = "127.0.0.1:3000";
|
|
|
+ let listener: TcpListener = TcpListener::bind(&addr).await.unwrap();
|
|
|
+
|
|
|
+ let _ = relayer.main(listener).expect("valid main").await;
|
|
|
+
|
|
|
+ /*
|
|
|
loop {
|
|
|
tokio::select! {
|
|
|
Some((event, url)) = client_pool.recv() => {
|
|
@@ -94,7 +100,6 @@ async fn main() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- /*
|
|
|
let db = RocksDb::new("./relayer-db").expect("db");
|
|
|
let (relayer, mut server_receiver) = nostr_rs_relayer::Relayer::new(Some(db));
|
|
|
let mut clients = nostr_rs_client::Pool::new()
|