diff --git a/src/db.rs b/src/db.rs index f5e7895..516bff3 100644 --- a/src/db.rs +++ b/src/db.rs @@ -26,6 +26,7 @@ pub type PooledConnection = r2d2::PooledConnection, + pub source_ip: String, } /// Database file @@ -227,11 +228,12 @@ pub async fn db_writer( notice_tx.try_send(Notice::duplicate(event.id)).ok(); } else { info!( - "persisted event: {:?} (kind: {}) from: {:?} in: {:?}", + "persisted event: {:?} (kind: {}) from: {:?} in: {:?} (IP: {:?})", event.get_event_id_prefix(), event.kind, event.get_author_prefix(), - start.elapsed() + start.elapsed(), + subm_event.source_ip, ); event_write = true; // send this out to all clients diff --git a/src/server.rs b/src/server.rs index a9173d9..be3eab7 100644 --- a/src/server.rs +++ b/src/server.rs @@ -736,7 +736,7 @@ async fn nostr_server( // check if the event is too far in the future. if e.is_valid_timestamp(settings.options.reject_future_seconds) { // Write this to the database. - let submit_event = SubmittedEvent { event: e.clone(), notice_tx: notice_tx.clone() }; + let submit_event = SubmittedEvent { event: e.clone(), notice_tx: notice_tx.clone(), source_ip: conn.ip().to_string()}; event_tx.send(submit_event).await.ok(); client_published_event_count += 1; } else {