From 1c54a877e241a6a07b8efd23f6e48329ada54f8d Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 3 Jun 2026 21:44:12 +0000 Subject: [PATCH] refactor(quartz): split relay server package into engine / backend / policies MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The relay server package had 14 top-level files. Group by concern: - relay/server/ engine + entry points: NostrServer, EventSourceServer, RelayServerBase, RelaySession, ConnectionRegistry, RelayServerListener, NegSessionRegistry - relay/server/backend/ data plane: SessionBackend, EventSource, EventSourceBackend, LiveEventStore, IngestQueue - relay/server/policies/ policy model + impls: IRelayPolicy(+PolicyResult) and RelayLimits move in alongside the existing policies - relay/server/inprocess/ unchanged Layering is acyclic: engine -> {backend, policies} -> nip01Core. This moves three already-published classes (IRelayPolicy, LiveEventStore, IngestQueue), so external quartz consumers re-import — a source-only change, no behavior change. In-repo callers (geode) updated. Full quartz + geode suites green; RELAY.md source map updated. https://claude.ai/code/session_016YBS2pWCBSDgAMthHzfCTr --- .../vitorpamplona/geode/InProcessRelays.kt | 2 +- .../kotlin/com/vitorpamplona/geode/Main.kt | 2 +- .../com/vitorpamplona/geode/RelayEngine.kt | 6 ++-- .../geode/policies/PoliciesIntegrationTest.kt | 2 +- .../geode/policies/PoliciesTest.kt | 4 +-- .../testing/RelayEngineTestExtensions.kt | 2 +- quartz/RELAY.md | 34 +++++++++++-------- .../relay/server/EventSourceServer.kt | 5 +++ .../relay/server/NegSessionRegistry.kt | 3 ++ .../nip01Core/relay/server/NostrServer.kt | 5 +++ .../nip01Core/relay/server/RelayServerBase.kt | 3 ++ .../nip01Core/relay/server/RelaySession.kt | 3 ++ .../relay/server/{ => backend}/EventSource.kt | 2 +- .../{ => backend}/EventSourceBackend.kt | 2 +- .../relay/server/{ => backend}/IngestQueue.kt | 2 +- .../server/{ => backend}/LiveEventStore.kt | 2 +- .../server/{ => backend}/SessionBackend.kt | 2 +- .../relay/server/policies/FullAuthPolicy.kt | 2 -- .../server/{ => policies}/IRelayPolicy.kt | 3 +- .../server/policies/KindAllowDenyPolicy.kt | 1 - .../relay/server/policies/LimitsPolicy.kt | 2 -- .../server/policies/PassThroughPolicy.kt | 2 -- .../relay/server/policies/PolicyStack.kt | 2 -- .../server/policies/PubkeyAllowDenyPolicy.kt | 1 - .../policies/RejectFutureEventsPolicy.kt | 1 - .../server/{ => policies}/RelayLimits.kt | 2 +- .../relay/server/policies/VerifyPolicy.kt | 4 +-- .../server/BanListPolicy.kt | 2 +- .../relay/server/EventSourceServerTest.kt | 1 + .../relay/server/NostrServerAuthTest.kt | 2 ++ .../nip01Core/relay/server/NostrServerTest.kt | 1 + .../relay/server/RelayLimitsServerTest.kt | 2 ++ .../nip01Core/relay/server/RelayLimitsTest.kt | 2 ++ .../relay/server/RelayServerListenerTest.kt | 1 + .../quartz/nip11RelayInfo/Nip11ServingTest.kt | 2 +- 35 files changed, 67 insertions(+), 47 deletions(-) rename quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/{ => backend}/EventSource.kt (98%) rename quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/{ => backend}/EventSourceBackend.kt (97%) rename quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/{ => backend}/IngestQueue.kt (99%) rename quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/{ => backend}/LiveEventStore.kt (99%) rename quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/{ => backend}/SessionBackend.kt (98%) rename quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/{ => policies}/IRelayPolicy.kt (97%) rename quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/{ => policies}/RelayLimits.kt (98%) diff --git a/geode/src/main/kotlin/com/vitorpamplona/geode/InProcessRelays.kt b/geode/src/main/kotlin/com/vitorpamplona/geode/InProcessRelays.kt index 860238688d..17f9f01b20 100644 --- a/geode/src/main/kotlin/com/vitorpamplona/geode/InProcessRelays.kt +++ b/geode/src/main/kotlin/com/vitorpamplona/geode/InProcessRelays.kt @@ -22,9 +22,9 @@ package com.vitorpamplona.geode import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl import com.vitorpamplona.quartz.nip01Core.relay.normalizer.RelayUrlNormalizer -import com.vitorpamplona.quartz.nip01Core.relay.server.IRelayPolicy import com.vitorpamplona.quartz.nip01Core.relay.server.inprocess.InProcessWebSocket import com.vitorpamplona.quartz.nip01Core.relay.server.policies.EmptyPolicy +import com.vitorpamplona.quartz.nip01Core.relay.server.policies.IRelayPolicy import com.vitorpamplona.quartz.nip01Core.relay.sockets.WebSocket import com.vitorpamplona.quartz.nip01Core.relay.sockets.WebSocketListener import com.vitorpamplona.quartz.nip01Core.relay.sockets.WebsocketBuilder diff --git a/geode/src/main/kotlin/com/vitorpamplona/geode/Main.kt b/geode/src/main/kotlin/com/vitorpamplona/geode/Main.kt index 600aa45fe7..e2becaf114 100644 --- a/geode/src/main/kotlin/com/vitorpamplona/geode/Main.kt +++ b/geode/src/main/kotlin/com/vitorpamplona/geode/Main.kt @@ -25,9 +25,9 @@ import com.vitorpamplona.geode.config.RuntimeConfig import com.vitorpamplona.geode.config.RuntimeConfigData import com.vitorpamplona.geode.config.StaticConfig import com.vitorpamplona.quartz.nip01Core.relay.normalizer.normalizeRelayUrl -import com.vitorpamplona.quartz.nip01Core.relay.server.IRelayPolicy import com.vitorpamplona.quartz.nip01Core.relay.server.policies.EmptyPolicy import com.vitorpamplona.quartz.nip01Core.relay.server.policies.FullAuthPolicy +import com.vitorpamplona.quartz.nip01Core.relay.server.policies.IRelayPolicy import com.vitorpamplona.quartz.nip01Core.relay.server.policies.RejectFutureEventsPolicy import com.vitorpamplona.quartz.nip01Core.relay.server.policies.VerifyAuthOnlyPolicy import com.vitorpamplona.quartz.nip01Core.relay.server.policies.VerifyPolicy diff --git a/geode/src/main/kotlin/com/vitorpamplona/geode/RelayEngine.kt b/geode/src/main/kotlin/com/vitorpamplona/geode/RelayEngine.kt index cbe9a60e9c..84d15a56aa 100644 --- a/geode/src/main/kotlin/com/vitorpamplona/geode/RelayEngine.kt +++ b/geode/src/main/kotlin/com/vitorpamplona/geode/RelayEngine.kt @@ -26,9 +26,9 @@ import com.vitorpamplona.geode.config.seedInto import com.vitorpamplona.geode.config.snapshotOf import com.vitorpamplona.quartz.nip01Core.core.HexKey import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl -import com.vitorpamplona.quartz.nip01Core.relay.server.IRelayPolicy import com.vitorpamplona.quartz.nip01Core.relay.server.NostrServer import com.vitorpamplona.quartz.nip01Core.relay.server.policies.EmptyPolicy +import com.vitorpamplona.quartz.nip01Core.relay.server.policies.IRelayPolicy import com.vitorpamplona.quartz.nip01Core.store.IEventStore import com.vitorpamplona.quartz.nip01Core.store.sqlite.EventStore import com.vitorpamplona.quartz.nip11RelayInfo.Nip11RelayInformation @@ -45,7 +45,7 @@ import kotlin.coroutines.CoroutineContext * * Speaks NIP-01 (REQ/EVENT/EOSE/CLOSE), NIP-11 (relay info via [info]), * NIP-42 (AUTH — supply [policyBuilder] = `{ FullAuthPolicy(url) }` or - * stack one with [com.vitorpamplona.quartz.nip01Core.relay.server.IRelayPolicy.plus]), + * stack one with [com.vitorpamplona.quartz.nip01Core.relay.server.policies.IRelayPolicy.plus]), * NIP-45 (COUNT) and NIP-50 (search via the SQLite FTS index). * * Two transports: @@ -81,7 +81,7 @@ class RelayEngine( parentContext: CoroutineContext = SupervisorJob(), /** * Run Schnorr signature verification in parallel inside the - * [com.vitorpamplona.quartz.nip01Core.relay.server.IngestQueue] + * [com.vitorpamplona.quartz.nip01Core.relay.server.backend.IngestQueue] * instead of serially in the policy chain. Enables the Tier-3 * win in `geode/plans/2026-05-07-event-ingestion-batching.md`. * diff --git a/geode/src/test/kotlin/com/vitorpamplona/geode/policies/PoliciesIntegrationTest.kt b/geode/src/test/kotlin/com/vitorpamplona/geode/policies/PoliciesIntegrationTest.kt index 9bdb8e0bc3..5034158ac5 100644 --- a/geode/src/test/kotlin/com/vitorpamplona/geode/policies/PoliciesIntegrationTest.kt +++ b/geode/src/test/kotlin/com/vitorpamplona/geode/policies/PoliciesIntegrationTest.kt @@ -27,7 +27,7 @@ import com.vitorpamplona.quartz.nip01Core.relay.client.NostrClient import com.vitorpamplona.quartz.nip01Core.relay.client.accessories.publishAndConfirm import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl import com.vitorpamplona.quartz.nip01Core.relay.normalizer.RelayUrlNormalizer -import com.vitorpamplona.quartz.nip01Core.relay.server.IRelayPolicy +import com.vitorpamplona.quartz.nip01Core.relay.server.policies.IRelayPolicy import com.vitorpamplona.quartz.nip01Core.relay.server.policies.KindAllowDenyPolicy import com.vitorpamplona.quartz.nip01Core.relay.server.policies.PubkeyAllowDenyPolicy import com.vitorpamplona.quartz.nip01Core.relay.server.policies.RejectFutureEventsPolicy diff --git a/geode/src/test/kotlin/com/vitorpamplona/geode/policies/PoliciesTest.kt b/geode/src/test/kotlin/com/vitorpamplona/geode/policies/PoliciesTest.kt index dd7cca7c2d..a97e207919 100644 --- a/geode/src/test/kotlin/com/vitorpamplona/geode/policies/PoliciesTest.kt +++ b/geode/src/test/kotlin/com/vitorpamplona/geode/policies/PoliciesTest.kt @@ -22,8 +22,8 @@ package com.vitorpamplona.geode.policies import com.vitorpamplona.geode.fixtures.SyntheticEvents import com.vitorpamplona.quartz.nip01Core.relay.commands.toRelay.EventCmd -import com.vitorpamplona.quartz.nip01Core.relay.server.PolicyResult import com.vitorpamplona.quartz.nip01Core.relay.server.policies.KindAllowDenyPolicy +import com.vitorpamplona.quartz.nip01Core.relay.server.policies.PolicyResult import com.vitorpamplona.quartz.nip01Core.relay.server.policies.PubkeyAllowDenyPolicy import com.vitorpamplona.quartz.nip01Core.relay.server.policies.RejectFutureEventsPolicy import kotlin.test.Test @@ -156,7 +156,7 @@ class PoliciesTest { fun stackedPoliciesAllMustAccept() { val now = 1_000L val stack = - (KindAllowDenyPolicy(allow = setOf(1)) as com.vitorpamplona.quartz.nip01Core.relay.server.IRelayPolicy) + + (KindAllowDenyPolicy(allow = setOf(1)) as com.vitorpamplona.quartz.nip01Core.relay.server.policies.IRelayPolicy) + RejectFutureEventsPolicy(maxFutureSeconds = 10, now = { now }) // Allowed kind, in window — accepted. diff --git a/geode/src/testFixtures/kotlin/com/vitorpamplona/geode/testing/RelayEngineTestExtensions.kt b/geode/src/testFixtures/kotlin/com/vitorpamplona/geode/testing/RelayEngineTestExtensions.kt index 0e100496a6..50db47107c 100644 --- a/geode/src/testFixtures/kotlin/com/vitorpamplona/geode/testing/RelayEngineTestExtensions.kt +++ b/geode/src/testFixtures/kotlin/com/vitorpamplona/geode/testing/RelayEngineTestExtensions.kt @@ -46,7 +46,7 @@ suspend fun RelayEngine.preload(vararg events: Event) = preload(events.toList()) * (mirrors what a real client would do via an `EVENT` command). * * Suspends until the relay's `OK` (or `NOTICE`) reply lands, i.e. until - * the [com.vitorpamplona.quartz.nip01Core.relay.server.IngestQueue] drain + * the [com.vitorpamplona.quartz.nip01Core.relay.server.backend.IngestQueue] drain * loop has processed the event and fanned it out to active subscribers. * Tests that publish-then-subscribe rely on this ordering: otherwise the * fire-and-forget submit lets a subscription register *after* publish diff --git a/quartz/RELAY.md b/quartz/RELAY.md index 5dae552aa9..b182d1ecc4 100644 --- a/quartz/RELAY.md +++ b/quartz/RELAY.md @@ -408,23 +408,29 @@ coroutine — keep them cheap and non-blocking. ``` quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/ -├── relay/server/ +├── relay/server/ # engine + entry points │ ├── RelayServerBase.kt # Shared engine (connect/serve/policy/registry) │ ├── NostrServer.kt # Storage-backed engine (IEventStore) -│ ├── EventSourceServer.kt # Non-storage engine (search/redirector/computed) -│ ├── EventSource.kt # Flow SPI for non-storage relays -│ ├── SessionBackend.kt # Data-plane seam (LiveEventStore / EventSourceBackend) -│ ├── RelayServerListener.kt # Connection open/close observability hook +│ ├── EventSourceServer.kt # Non-storage engine (search/redirector/computed) │ ├── RelaySession.kt # Per-connection handler (stable .id) -│ ├── LiveEventStore.kt # Reactive event streaming (storage SessionBackend) -│ ├── IRelayPolicy.kt # Policy interface + PolicyResult + onAuthenticated -│ ├── RelayLimits.kt # Limits: enforced + NIP-11 limitation source of truth -│ └── policies/ -│ ├── EmptyPolicy.kt # Accept everything -│ ├── VerifyPolicy.kt # Signature verification (default) -│ ├── FullAuthPolicy.kt # NIP-42 auth required (override authorize to bridge) -│ ├── LimitsPolicy.kt # Per-command enforcement of RelayLimits -│ └── PolicyStack.kt # Chain multiple policies +│ ├── ConnectionRegistry.kt # Live-connection bookkeeping + gauge +│ ├── RelayServerListener.kt # Connection open/close observability hook +│ ├── NegSessionRegistry.kt # NIP-77 negentropy per-connection state +│ ├── backend/ # data plane (how REQ/COUNT/EVENT are answered) +│ │ ├── SessionBackend.kt # Data-plane seam (LiveEventStore / EventSourceBackend) +│ │ ├── EventSource.kt # Flow SPI for non-storage relays +│ │ ├── EventSourceBackend.kt # Adapts an EventSource to SessionBackend +│ │ ├── LiveEventStore.kt # Reactive event streaming (storage SessionBackend) +│ │ └── IngestQueue.kt # Group-commit EVENT writer +│ ├── policies/ # policy model + implementations +│ │ ├── IRelayPolicy.kt # Policy interface + PolicyResult + onAuthenticated +│ │ ├── RelayLimits.kt # Limits: enforced + NIP-11 limitation source of truth +│ │ ├── EmptyPolicy.kt # Accept everything +│ │ ├── VerifyPolicy.kt # Signature verification (default) +│ │ ├── FullAuthPolicy.kt # NIP-42 auth required (override authorize to bridge) +│ │ ├── LimitsPolicy.kt # Enforcement of RelayLimits (per-command + hooks) +│ │ └── PolicyStack.kt # Chain multiple policies +│ └── inprocess/ # in-memory transport for tests ├── relay/commands/ │ ├── toRelay/Command.kt # Command.fromJson / toJson │ └── toClient/ diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/EventSourceServer.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/EventSourceServer.kt index d02c323dd2..f28fd7285c 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/EventSourceServer.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/EventSourceServer.kt @@ -20,7 +20,12 @@ */ package com.vitorpamplona.quartz.nip01Core.relay.server +import com.vitorpamplona.quartz.nip01Core.relay.server.backend.EventSource +import com.vitorpamplona.quartz.nip01Core.relay.server.backend.EventSourceBackend +import com.vitorpamplona.quartz.nip01Core.relay.server.backend.SessionBackend import com.vitorpamplona.quartz.nip01Core.relay.server.policies.EmptyPolicy +import com.vitorpamplona.quartz.nip01Core.relay.server.policies.IRelayPolicy +import com.vitorpamplona.quartz.nip01Core.relay.server.policies.RelayLimits import com.vitorpamplona.quartz.nip77Negentropy.NegentropySettings import kotlinx.coroutines.SupervisorJob import kotlin.coroutines.CoroutineContext diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/NegSessionRegistry.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/NegSessionRegistry.kt index 3cb6ebac79..e0d01b6687 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/NegSessionRegistry.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/NegSessionRegistry.kt @@ -23,6 +23,9 @@ package com.vitorpamplona.quartz.nip01Core.relay.server import com.vitorpamplona.quartz.nip01Core.relay.commands.toClient.Message import com.vitorpamplona.quartz.nip01Core.relay.commands.toClient.NoticeMessage import com.vitorpamplona.quartz.nip01Core.relay.commands.toRelay.ReqCmd +import com.vitorpamplona.quartz.nip01Core.relay.server.backend.SessionBackend +import com.vitorpamplona.quartz.nip01Core.relay.server.policies.IRelayPolicy +import com.vitorpamplona.quartz.nip01Core.relay.server.policies.PolicyResult import com.vitorpamplona.quartz.nip77Negentropy.NegCloseCmd import com.vitorpamplona.quartz.nip77Negentropy.NegErrMessage import com.vitorpamplona.quartz.nip77Negentropy.NegMsgCmd diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/NostrServer.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/NostrServer.kt index f7e75ef1a1..2250c4dd02 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/NostrServer.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/NostrServer.kt @@ -21,6 +21,11 @@ package com.vitorpamplona.quartz.nip01Core.relay.server import com.vitorpamplona.quartz.nip01Core.crypto.verify +import com.vitorpamplona.quartz.nip01Core.relay.server.backend.IngestQueue +import com.vitorpamplona.quartz.nip01Core.relay.server.backend.LiveEventStore +import com.vitorpamplona.quartz.nip01Core.relay.server.backend.SessionBackend +import com.vitorpamplona.quartz.nip01Core.relay.server.policies.IRelayPolicy +import com.vitorpamplona.quartz.nip01Core.relay.server.policies.RelayLimits import com.vitorpamplona.quartz.nip01Core.relay.server.policies.VerifyPolicy import com.vitorpamplona.quartz.nip01Core.store.IEventStore import com.vitorpamplona.quartz.nip77Negentropy.NegentropySettings diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/RelayServerBase.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/RelayServerBase.kt index 6303f0fe3f..7423b0804b 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/RelayServerBase.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/RelayServerBase.kt @@ -20,7 +20,10 @@ */ package com.vitorpamplona.quartz.nip01Core.relay.server +import com.vitorpamplona.quartz.nip01Core.relay.server.backend.SessionBackend +import com.vitorpamplona.quartz.nip01Core.relay.server.policies.IRelayPolicy import com.vitorpamplona.quartz.nip01Core.relay.server.policies.LimitsPolicy +import com.vitorpamplona.quartz.nip01Core.relay.server.policies.RelayLimits import com.vitorpamplona.quartz.nip77Negentropy.NegentropySettings import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.SupervisorJob diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/RelaySession.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/RelaySession.kt index b8530f0824..4b6c2d9903 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/RelaySession.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/RelaySession.kt @@ -34,6 +34,9 @@ import com.vitorpamplona.quartz.nip01Core.relay.commands.toRelay.CloseCmd import com.vitorpamplona.quartz.nip01Core.relay.commands.toRelay.CountCmd import com.vitorpamplona.quartz.nip01Core.relay.commands.toRelay.EventCmd import com.vitorpamplona.quartz.nip01Core.relay.commands.toRelay.ReqCmd +import com.vitorpamplona.quartz.nip01Core.relay.server.backend.SessionBackend +import com.vitorpamplona.quartz.nip01Core.relay.server.policies.IRelayPolicy +import com.vitorpamplona.quartz.nip01Core.relay.server.policies.PolicyResult import com.vitorpamplona.quartz.nip01Core.store.IEventStore import com.vitorpamplona.quartz.nip77Negentropy.NegCloseCmd import com.vitorpamplona.quartz.nip77Negentropy.NegMsgCmd diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/EventSource.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/backend/EventSource.kt similarity index 98% rename from quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/EventSource.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/backend/EventSource.kt index 64ae8a2358..96c460cc28 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/EventSource.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/backend/EventSource.kt @@ -18,7 +18,7 @@ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -package com.vitorpamplona.quartz.nip01Core.relay.server +package com.vitorpamplona.quartz.nip01Core.relay.server.backend import com.vitorpamplona.quartz.nip01Core.core.Event import com.vitorpamplona.quartz.nip01Core.relay.commands.toClient.CountResult diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/EventSourceBackend.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/backend/EventSourceBackend.kt similarity index 97% rename from quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/EventSourceBackend.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/backend/EventSourceBackend.kt index bfeb56b98f..abc20cdf90 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/EventSourceBackend.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/backend/EventSourceBackend.kt @@ -18,7 +18,7 @@ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -package com.vitorpamplona.quartz.nip01Core.relay.server +package com.vitorpamplona.quartz.nip01Core.relay.server.backend import com.vitorpamplona.quartz.nip01Core.core.Event import com.vitorpamplona.quartz.nip01Core.relay.commands.toClient.CountResult diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/IngestQueue.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/backend/IngestQueue.kt similarity index 99% rename from quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/IngestQueue.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/backend/IngestQueue.kt index 8c9cb467d7..4886124421 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/IngestQueue.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/backend/IngestQueue.kt @@ -18,7 +18,7 @@ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -package com.vitorpamplona.quartz.nip01Core.relay.server +package com.vitorpamplona.quartz.nip01Core.relay.server.backend import com.vitorpamplona.quartz.nip01Core.core.Event import com.vitorpamplona.quartz.nip01Core.store.IEventStore diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/LiveEventStore.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/backend/LiveEventStore.kt similarity index 99% rename from quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/LiveEventStore.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/backend/LiveEventStore.kt index 23ab3f67fe..9bb4b66b15 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/LiveEventStore.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/backend/LiveEventStore.kt @@ -18,7 +18,7 @@ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -package com.vitorpamplona.quartz.nip01Core.relay.server +package com.vitorpamplona.quartz.nip01Core.relay.server.backend import com.vitorpamplona.quartz.nip01Core.core.Event import com.vitorpamplona.quartz.nip01Core.relay.filters.Filter diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/SessionBackend.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/backend/SessionBackend.kt similarity index 98% rename from quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/SessionBackend.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/backend/SessionBackend.kt index 7982874b2b..ceef1c8003 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/SessionBackend.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/backend/SessionBackend.kt @@ -18,7 +18,7 @@ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -package com.vitorpamplona.quartz.nip01Core.relay.server +package com.vitorpamplona.quartz.nip01Core.relay.server.backend import com.vitorpamplona.quartz.nip01Core.core.Event import com.vitorpamplona.quartz.nip01Core.relay.commands.toClient.CountResult diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/policies/FullAuthPolicy.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/policies/FullAuthPolicy.kt index 7c7b1a19da..5c247f122c 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/policies/FullAuthPolicy.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/policies/FullAuthPolicy.kt @@ -29,8 +29,6 @@ import com.vitorpamplona.quartz.nip01Core.relay.commands.toRelay.CountCmd import com.vitorpamplona.quartz.nip01Core.relay.commands.toRelay.EventCmd import com.vitorpamplona.quartz.nip01Core.relay.commands.toRelay.ReqCmd import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl -import com.vitorpamplona.quartz.nip01Core.relay.server.IRelayPolicy -import com.vitorpamplona.quartz.nip01Core.relay.server.PolicyResult import com.vitorpamplona.quartz.nip40Expiration.isExpired import com.vitorpamplona.quartz.nip42RelayAuth.RelayAuthEvent import com.vitorpamplona.quartz.utils.RandomInstance diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/IRelayPolicy.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/policies/IRelayPolicy.kt similarity index 97% rename from quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/IRelayPolicy.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/policies/IRelayPolicy.kt index 92b709e451..fa3bbb8d31 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/IRelayPolicy.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/policies/IRelayPolicy.kt @@ -18,7 +18,7 @@ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -package com.vitorpamplona.quartz.nip01Core.relay.server +package com.vitorpamplona.quartz.nip01Core.relay.server.policies import com.vitorpamplona.quartz.nip01Core.core.Event import com.vitorpamplona.quartz.nip01Core.core.HexKey @@ -28,7 +28,6 @@ import com.vitorpamplona.quartz.nip01Core.relay.commands.toRelay.Command import com.vitorpamplona.quartz.nip01Core.relay.commands.toRelay.CountCmd import com.vitorpamplona.quartz.nip01Core.relay.commands.toRelay.EventCmd import com.vitorpamplona.quartz.nip01Core.relay.commands.toRelay.ReqCmd -import com.vitorpamplona.quartz.nip01Core.relay.server.policies.PolicyStack import com.vitorpamplona.quartz.nip42RelayAuth.RelayAuthEvent /** diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/policies/KindAllowDenyPolicy.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/policies/KindAllowDenyPolicy.kt index 77331db711..bf2b62db16 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/policies/KindAllowDenyPolicy.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/policies/KindAllowDenyPolicy.kt @@ -21,7 +21,6 @@ package com.vitorpamplona.quartz.nip01Core.relay.server.policies import com.vitorpamplona.quartz.nip01Core.relay.commands.toRelay.EventCmd -import com.vitorpamplona.quartz.nip01Core.relay.server.PolicyResult /** * Operator-controlled kind allow/deny list. Mirrors nostr-rs-relay's diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/policies/LimitsPolicy.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/policies/LimitsPolicy.kt index 724a6e6c4a..e711734d5b 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/policies/LimitsPolicy.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/policies/LimitsPolicy.kt @@ -26,8 +26,6 @@ import com.vitorpamplona.quartz.nip01Core.relay.commands.toRelay.CountCmd import com.vitorpamplona.quartz.nip01Core.relay.commands.toRelay.EventCmd import com.vitorpamplona.quartz.nip01Core.relay.commands.toRelay.ReqCmd import com.vitorpamplona.quartz.nip01Core.relay.filters.Filter -import com.vitorpamplona.quartz.nip01Core.relay.server.PolicyResult -import com.vitorpamplona.quartz.nip01Core.relay.server.RelayLimits /** * Enforces the per-command fields of a [RelayLimits]: rejects EVENTs whose diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/policies/PassThroughPolicy.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/policies/PassThroughPolicy.kt index 09e8d4760f..79d9a306ca 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/policies/PassThroughPolicy.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/policies/PassThroughPolicy.kt @@ -26,8 +26,6 @@ import com.vitorpamplona.quartz.nip01Core.relay.commands.toRelay.AuthCmd import com.vitorpamplona.quartz.nip01Core.relay.commands.toRelay.CountCmd import com.vitorpamplona.quartz.nip01Core.relay.commands.toRelay.EventCmd import com.vitorpamplona.quartz.nip01Core.relay.commands.toRelay.ReqCmd -import com.vitorpamplona.quartz.nip01Core.relay.server.IRelayPolicy -import com.vitorpamplona.quartz.nip01Core.relay.server.PolicyResult /** * Convenience base that accepts everything by default. Subclasses diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/policies/PolicyStack.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/policies/PolicyStack.kt index 1a5687c996..6393830c97 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/policies/PolicyStack.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/policies/PolicyStack.kt @@ -28,8 +28,6 @@ import com.vitorpamplona.quartz.nip01Core.relay.commands.toRelay.Command import com.vitorpamplona.quartz.nip01Core.relay.commands.toRelay.CountCmd import com.vitorpamplona.quartz.nip01Core.relay.commands.toRelay.EventCmd import com.vitorpamplona.quartz.nip01Core.relay.commands.toRelay.ReqCmd -import com.vitorpamplona.quartz.nip01Core.relay.server.IRelayPolicy -import com.vitorpamplona.quartz.nip01Core.relay.server.PolicyResult import com.vitorpamplona.quartz.nip42RelayAuth.RelayAuthEvent class PolicyStack( diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/policies/PubkeyAllowDenyPolicy.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/policies/PubkeyAllowDenyPolicy.kt index 199c86a97c..393aeb2f63 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/policies/PubkeyAllowDenyPolicy.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/policies/PubkeyAllowDenyPolicy.kt @@ -22,7 +22,6 @@ package com.vitorpamplona.quartz.nip01Core.relay.server.policies import com.vitorpamplona.quartz.nip01Core.core.HexKey import com.vitorpamplona.quartz.nip01Core.relay.commands.toRelay.EventCmd -import com.vitorpamplona.quartz.nip01Core.relay.server.PolicyResult /** * Operator-controlled author allow/deny list. Mirrors nostr-rs-relay's diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/policies/RejectFutureEventsPolicy.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/policies/RejectFutureEventsPolicy.kt index 34f0082085..ec3fa7e074 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/policies/RejectFutureEventsPolicy.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/policies/RejectFutureEventsPolicy.kt @@ -21,7 +21,6 @@ package com.vitorpamplona.quartz.nip01Core.relay.server.policies import com.vitorpamplona.quartz.nip01Core.relay.commands.toRelay.EventCmd -import com.vitorpamplona.quartz.nip01Core.relay.server.PolicyResult import com.vitorpamplona.quartz.utils.TimeUtils /** diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/RelayLimits.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/policies/RelayLimits.kt similarity index 98% rename from quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/RelayLimits.kt rename to quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/policies/RelayLimits.kt index 04a41a2b79..3f9ef87bcc 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/RelayLimits.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/policies/RelayLimits.kt @@ -18,7 +18,7 @@ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -package com.vitorpamplona.quartz.nip01Core.relay.server +package com.vitorpamplona.quartz.nip01Core.relay.server.policies import com.vitorpamplona.quartz.nip11RelayInfo.Nip11RelayInformation.RelayInformationLimitation diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/policies/VerifyPolicy.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/policies/VerifyPolicy.kt index e59bd53088..8961ff9041 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/policies/VerifyPolicy.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/policies/VerifyPolicy.kt @@ -27,8 +27,6 @@ import com.vitorpamplona.quartz.nip01Core.relay.commands.toRelay.AuthCmd import com.vitorpamplona.quartz.nip01Core.relay.commands.toRelay.CountCmd import com.vitorpamplona.quartz.nip01Core.relay.commands.toRelay.EventCmd import com.vitorpamplona.quartz.nip01Core.relay.commands.toRelay.ReqCmd -import com.vitorpamplona.quartz.nip01Core.relay.server.IRelayPolicy -import com.vitorpamplona.quartz.nip01Core.relay.server.PolicyResult /** * Verifies the Schnorr signature + id hash of every incoming @@ -36,7 +34,7 @@ import com.vitorpamplona.quartz.nip01Core.relay.server.PolicyResult * * The default `VerifyPolicy` singleton verifies both. The * [VerifyAuthOnlyPolicy] singleton skips the EVENT path — use it - * when the [com.vitorpamplona.quartz.nip01Core.relay.server.IngestQueue] + * when the [com.vitorpamplona.quartz.nip01Core.relay.server.backend.IngestQueue] * is doing parallel verify (Tier 3 of the event-ingestion plan) * so EVENTs aren't verified twice. AUTH is still verified inline * because the AUTH path bypasses the queue entirely; without it, diff --git a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip86RelayManagement/server/BanListPolicy.kt b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip86RelayManagement/server/BanListPolicy.kt index 20405c0661..dd693e80e1 100644 --- a/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip86RelayManagement/server/BanListPolicy.kt +++ b/quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/nip86RelayManagement/server/BanListPolicy.kt @@ -21,8 +21,8 @@ package com.vitorpamplona.quartz.nip86RelayManagement.server import com.vitorpamplona.quartz.nip01Core.relay.commands.toRelay.EventCmd -import com.vitorpamplona.quartz.nip01Core.relay.server.PolicyResult import com.vitorpamplona.quartz.nip01Core.relay.server.policies.PassThroughPolicy +import com.vitorpamplona.quartz.nip01Core.relay.server.policies.PolicyResult /** * Reads the live [BanStore] on every EVENT and rejects events that diff --git a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/EventSourceServerTest.kt b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/EventSourceServerTest.kt index 04e34ecada..a3206fd8f9 100644 --- a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/EventSourceServerTest.kt +++ b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/EventSourceServerTest.kt @@ -28,6 +28,7 @@ import com.vitorpamplona.quartz.nip01Core.relay.commands.toClient.EoseMessage import com.vitorpamplona.quartz.nip01Core.relay.commands.toClient.EventMessage import com.vitorpamplona.quartz.nip01Core.relay.filters.Filter import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl +import com.vitorpamplona.quartz.nip01Core.relay.server.backend.EventSource import com.vitorpamplona.quartz.nip01Core.relay.server.policies.FullAuthPolicy import com.vitorpamplona.quartz.nip45Count.HllBuilder import kotlinx.coroutines.ExperimentalCoroutinesApi diff --git a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/NostrServerAuthTest.kt b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/NostrServerAuthTest.kt index e9cf093320..d08f7476ee 100644 --- a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/NostrServerAuthTest.kt +++ b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/NostrServerAuthTest.kt @@ -31,7 +31,9 @@ import com.vitorpamplona.quartz.nip01Core.relay.commands.toRelay.ReqCmd import com.vitorpamplona.quartz.nip01Core.relay.normalizer.NormalizedRelayUrl import com.vitorpamplona.quartz.nip01Core.relay.server.policies.EmptyPolicy import com.vitorpamplona.quartz.nip01Core.relay.server.policies.FullAuthPolicy +import com.vitorpamplona.quartz.nip01Core.relay.server.policies.IRelayPolicy import com.vitorpamplona.quartz.nip01Core.relay.server.policies.PassThroughPolicy +import com.vitorpamplona.quartz.nip01Core.relay.server.policies.PolicyResult import com.vitorpamplona.quartz.nip01Core.store.IEventStore import com.vitorpamplona.quartz.nip01Core.store.sqlite.EventStore import com.vitorpamplona.quartz.nip42RelayAuth.RelayAuthEvent diff --git a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/NostrServerTest.kt b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/NostrServerTest.kt index 3217b994a5..d0b1e9df46 100644 --- a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/NostrServerTest.kt +++ b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/NostrServerTest.kt @@ -27,6 +27,7 @@ import com.vitorpamplona.quartz.nip01Core.relay.commands.toClient.EventMessage import com.vitorpamplona.quartz.nip01Core.relay.commands.toRelay.EventCmd import com.vitorpamplona.quartz.nip01Core.relay.filters.Filter import com.vitorpamplona.quartz.nip01Core.relay.server.policies.EmptyPolicy +import com.vitorpamplona.quartz.nip01Core.relay.server.policies.IRelayPolicy import com.vitorpamplona.quartz.nip01Core.store.IEventStore import com.vitorpamplona.quartz.nip01Core.store.sqlite.EventStore import kotlinx.coroutines.ExperimentalCoroutinesApi diff --git a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/RelayLimitsServerTest.kt b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/RelayLimitsServerTest.kt index 911091a392..961f288ad2 100644 --- a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/RelayLimitsServerTest.kt +++ b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/RelayLimitsServerTest.kt @@ -22,7 +22,9 @@ package com.vitorpamplona.quartz.nip01Core.relay.server import com.vitorpamplona.quartz.nip01Core.core.Event import com.vitorpamplona.quartz.nip01Core.relay.filters.Filter +import com.vitorpamplona.quartz.nip01Core.relay.server.backend.EventSource import com.vitorpamplona.quartz.nip01Core.relay.server.policies.EmptyPolicy +import com.vitorpamplona.quartz.nip01Core.relay.server.policies.RelayLimits import com.vitorpamplona.quartz.nip01Core.store.sqlite.EventStore import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.Flow diff --git a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/RelayLimitsTest.kt b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/RelayLimitsTest.kt index 535091631a..4fa12f80d7 100644 --- a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/RelayLimitsTest.kt +++ b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/RelayLimitsTest.kt @@ -26,6 +26,8 @@ import com.vitorpamplona.quartz.nip01Core.relay.commands.toRelay.EventCmd import com.vitorpamplona.quartz.nip01Core.relay.commands.toRelay.ReqCmd import com.vitorpamplona.quartz.nip01Core.relay.filters.Filter import com.vitorpamplona.quartz.nip01Core.relay.server.policies.LimitsPolicy +import com.vitorpamplona.quartz.nip01Core.relay.server.policies.PolicyResult +import com.vitorpamplona.quartz.nip01Core.relay.server.policies.RelayLimits import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertTrue diff --git a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/RelayServerListenerTest.kt b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/RelayServerListenerTest.kt index 232c562ac0..b11c415752 100644 --- a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/RelayServerListenerTest.kt +++ b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip01Core/relay/server/RelayServerListenerTest.kt @@ -22,6 +22,7 @@ package com.vitorpamplona.quartz.nip01Core.relay.server import com.vitorpamplona.quartz.nip01Core.core.Event import com.vitorpamplona.quartz.nip01Core.relay.filters.Filter +import com.vitorpamplona.quartz.nip01Core.relay.server.backend.EventSource import com.vitorpamplona.quartz.nip01Core.relay.server.policies.EmptyPolicy import com.vitorpamplona.quartz.nip01Core.store.sqlite.EventStore import kotlinx.coroutines.ExperimentalCoroutinesApi diff --git a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip11RelayInfo/Nip11ServingTest.kt b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip11RelayInfo/Nip11ServingTest.kt index 8038abe1f9..3ee77165c1 100644 --- a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip11RelayInfo/Nip11ServingTest.kt +++ b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip11RelayInfo/Nip11ServingTest.kt @@ -20,7 +20,7 @@ */ package com.vitorpamplona.quartz.nip11RelayInfo -import com.vitorpamplona.quartz.nip01Core.relay.server.RelayLimits +import com.vitorpamplona.quartz.nip01Core.relay.server.policies.RelayLimits import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertTrue