From b167f1b2ae7edbcab95554b5203d22d9e372c8b5 Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Thu, 4 Dec 2025 17:03:40 +0000 Subject: feat(sync): Phase 1 MVP - single relay proactive sync - Add src/sync/ module with SyncManager - Add NGIT_SYNC_RELAY_URL config option - Subscribe to kind 30617 on configured relay - Validate synced events through Nip34WritePolicy - Integration test with two TestRelay instances --- src/sync/mod.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 src/sync/mod.rs (limited to 'src/sync/mod.rs') diff --git a/src/sync/mod.rs b/src/sync/mod.rs new file mode 100644 index 0000000..279471b --- /dev/null +++ b/src/sync/mod.rs @@ -0,0 +1,22 @@ +//! Proactive Sync Module for GRASP-02 +//! +//! This module implements proactive synchronization of kind 30617 (repository state) +//! events from configured relay(s). Events are validated through the same write policy +//! as directly-submitted events. + +mod connection; +mod manager; + +pub use manager::SyncManager; + +use std::net::SocketAddr; + +/// Synthetic source address used for synced events +/// +/// This distinguishes synced events from directly-submitted events in logs and metrics. +/// Uses 127.0.0.2:0 as a recognizable "synced event" marker. +pub const SYNC_SOURCE_ADDR: SocketAddr = + SocketAddr::new(std::net::IpAddr::V4(std::net::Ipv4Addr::new(127, 0, 0, 2)), 0); + +/// Kind for repository state events (NIP-34) +pub const KIND_REPOSITORY_STATE: u16 = 30617; \ No newline at end of file -- cgit v1.2.3