Moves the relay structure to quartz

This commit is contained in:
Vitor Pamplona 2025-01-14 12:00:37 -05:00
parent e36e49cc88
commit 86a9fb2af5
46 changed files with 96 additions and 89 deletions

View File

@ -20,10 +20,10 @@
*/
package com.vitorpamplona.amethyst.service.okhttp
import com.vitorpamplona.ammolite.relays.relays.sockets.WebSocket
import com.vitorpamplona.ammolite.relays.relays.sockets.WebSocketListener
import com.vitorpamplona.ammolite.relays.relays.sockets.WebsocketBuilder
import com.vitorpamplona.ammolite.relays.relays.sockets.WebsocketBuilderFactory
import com.vitorpamplona.quartz.nip01Core.relays.sockets.WebSocket
import com.vitorpamplona.quartz.nip01Core.relays.sockets.WebSocketListener
import com.vitorpamplona.quartz.nip01Core.relays.sockets.WebsocketBuilder
import com.vitorpamplona.quartz.nip01Core.relays.sockets.WebsocketBuilderFactory
import okhttp3.Request
import okhttp3.Response

View File

@ -53,7 +53,7 @@ import com.vitorpamplona.amethyst.ui.stringRes
import com.vitorpamplona.amethyst.ui.theme.StdHorzSpacer
import com.vitorpamplona.amethyst.ui.theme.StdVertSpacer
import com.vitorpamplona.amethyst.ui.theme.imageModifier
import com.vitorpamplona.ammolite.relays.relays.RelayStat
import com.vitorpamplona.quartz.nip01Core.relays.RelayStat
@OptIn(ExperimentalMaterial3Api::class)
@Composable

View File

@ -53,7 +53,7 @@ import com.vitorpamplona.amethyst.ui.stringRes
import com.vitorpamplona.amethyst.ui.theme.StdHorzSpacer
import com.vitorpamplona.amethyst.ui.theme.StdVertSpacer
import com.vitorpamplona.amethyst.ui.theme.imageModifier
import com.vitorpamplona.ammolite.relays.relays.RelayStat
import com.vitorpamplona.quartz.nip01Core.relays.RelayStat
@OptIn(ExperimentalMaterial3Api::class)
@Composable

View File

@ -61,7 +61,7 @@ import com.vitorpamplona.amethyst.ui.theme.RowColSpacing
import com.vitorpamplona.amethyst.ui.theme.StdHorzSpacer
import com.vitorpamplona.amethyst.ui.theme.grayText
import com.vitorpamplona.ammolite.relays.Constants
import com.vitorpamplona.ammolite.relays.relays.RelayStat
import com.vitorpamplona.quartz.nip01Core.relays.RelayStat
@Composable
fun AllRelayListView(

View File

@ -23,8 +23,8 @@ package com.vitorpamplona.amethyst.ui.actions.relays
import androidx.compose.runtime.Immutable
import com.vitorpamplona.ammolite.relays.FeedType
import com.vitorpamplona.ammolite.relays.RelayBriefInfoCache
import com.vitorpamplona.ammolite.relays.relays.RelayStat
import com.vitorpamplona.quartz.nip01Core.HexKey
import com.vitorpamplona.quartz.nip01Core.relays.RelayStat
@Immutable
data class BasicRelaySetupInfo(

View File

@ -94,7 +94,7 @@ import com.vitorpamplona.ammolite.relays.Constants
import com.vitorpamplona.ammolite.relays.Constants.activeTypesGlobalChats
import com.vitorpamplona.ammolite.relays.FeedType
import com.vitorpamplona.ammolite.relays.RelayBriefInfoCache
import com.vitorpamplona.ammolite.relays.relays.RelayStat
import com.vitorpamplona.quartz.nip01Core.relays.RelayStat
import com.vitorpamplona.quartz.nip65RelayList.RelayUrlFormatter
import kotlinx.coroutines.launch

View File

@ -63,7 +63,7 @@ import com.vitorpamplona.amethyst.ui.theme.ThemeComparisonColumn
import com.vitorpamplona.amethyst.ui.theme.allGoodColor
import com.vitorpamplona.amethyst.ui.theme.largeRelayIconModifier
import com.vitorpamplona.ammolite.relays.COMMON_FEED_TYPES
import com.vitorpamplona.ammolite.relays.relays.RelayStat
import com.vitorpamplona.quartz.nip01Core.relays.RelayStat
@OptIn(ExperimentalLayoutApi::class)
@Composable

View File

@ -40,7 +40,7 @@ import com.vitorpamplona.amethyst.ui.stringRes
import com.vitorpamplona.amethyst.ui.theme.ButtonBorder
import com.vitorpamplona.amethyst.ui.theme.Size10dp
import com.vitorpamplona.amethyst.ui.theme.placeholderText
import com.vitorpamplona.ammolite.relays.relays.RelayStat
import com.vitorpamplona.quartz.nip01Core.relays.RelayStat
import com.vitorpamplona.quartz.nip65RelayList.RelayUrlFormatter
@Composable

View File

@ -21,10 +21,10 @@
package com.vitorpamplona.ammolite.relays
import android.util.Log
import com.vitorpamplona.ammolite.relays.relays.RelayState
import com.vitorpamplona.ammolite.relays.relays.sockets.WebsocketBuilderFactory
import com.vitorpamplona.ammolite.service.checkNotInMainThread
import com.vitorpamplona.quartz.nip01Core.core.Event
import com.vitorpamplona.quartz.nip01Core.relays.RelayState
import com.vitorpamplona.quartz.nip01Core.relays.sockets.WebsocketBuilderFactory
import kotlinx.coroutines.DelicateCoroutinesApi
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope

View File

@ -21,9 +21,9 @@
package com.vitorpamplona.ammolite.relays
import android.util.Log
import com.vitorpamplona.ammolite.relays.relays.RelayState
import com.vitorpamplona.ammolite.service.checkNotInMainThread
import com.vitorpamplona.quartz.nip01Core.core.Event
import com.vitorpamplona.quartz.nip01Core.relays.RelayState
import com.vitorpamplona.quartz.utils.TimeUtils
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.DelicateCoroutinesApi

View File

@ -20,13 +20,12 @@
*/
package com.vitorpamplona.ammolite.relays
import com.vitorpamplona.ammolite.relays.relays.RelayState
import com.vitorpamplona.ammolite.relays.relays.SimpleClientRelay
import com.vitorpamplona.ammolite.relays.relays.Subscription
import com.vitorpamplona.ammolite.relays.relays.SubscriptionCollection
import com.vitorpamplona.ammolite.relays.relays.sockets.WebsocketBuilderFactory
import com.vitorpamplona.quartz.nip01Core.core.Event
import com.vitorpamplona.quartz.nip01Core.relays.Filter
import com.vitorpamplona.quartz.nip01Core.relays.RelayState
import com.vitorpamplona.quartz.nip01Core.relays.SimpleClientRelay
import com.vitorpamplona.quartz.nip01Core.relays.SubscriptionCollection
import com.vitorpamplona.quartz.nip01Core.relays.filters.Filter
import com.vitorpamplona.quartz.nip01Core.relays.sockets.WebsocketBuilderFactory
import com.vitorpamplona.quartz.nip42RelayAuth.RelayAuthEvent
enum class FeedType {
@ -63,11 +62,12 @@ class RelaySubFilter(
override fun getFilters(subscriptionId: String) = filter(subs.getSubscriptionFilters(subscriptionId))
override fun allSubscriptions(): List<Subscription> =
override fun allSubscriptions(): List<com.vitorpamplona.quartz.nip01Core.relays.Subscription> =
subs.allSubscriptions().mapNotNull { filter ->
val filters = filter(filter.value)
if (filters.isNotEmpty()) {
Subscription(filter.key, filters)
com.vitorpamplona.quartz.nip01Core.relays
.Subscription(filter.key, filters)
} else {
null
}

View File

@ -21,9 +21,9 @@
package com.vitorpamplona.ammolite.relays
import androidx.compose.runtime.Immutable
import com.vitorpamplona.ammolite.relays.relays.RelayState
import com.vitorpamplona.ammolite.service.checkNotInMainThread
import com.vitorpamplona.quartz.nip01Core.core.Event
import com.vitorpamplona.quartz.nip01Core.relays.RelayState
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.channels.BufferOverflow

View File

@ -20,7 +20,7 @@
*/
package com.vitorpamplona.ammolite.relays
import com.vitorpamplona.ammolite.relays.relays.RelayStat
import com.vitorpamplona.quartz.nip01Core.relays.RelayStat
object RelayStats {
private val innerCache = mutableMapOf<String, RelayStat>()

View File

@ -21,7 +21,7 @@
package com.vitorpamplona.ammolite.relays.filters
import com.vitorpamplona.quartz.nip01Core.core.Event
import com.vitorpamplona.quartz.nip01Core.relays.Filter
import com.vitorpamplona.quartz.nip01Core.relays.filters.Filter
interface IPerRelayFilter {
fun toRelay(forRelay: String): Filter

View File

@ -24,9 +24,9 @@ import com.fasterxml.jackson.databind.node.JsonNodeFactory
import com.vitorpamplona.quartz.nip01Core.HexKey
import com.vitorpamplona.quartz.nip01Core.core.Event
import com.vitorpamplona.quartz.nip01Core.jackson.EventMapper
import com.vitorpamplona.quartz.nip01Core.relays.Filter
import com.vitorpamplona.quartz.nip01Core.relays.FilterMatcher
import com.vitorpamplona.quartz.nip01Core.relays.FilterSerializer
import com.vitorpamplona.quartz.nip01Core.relays.filters.Filter
import com.vitorpamplona.quartz.nip01Core.relays.filters.FilterMatcher
import com.vitorpamplona.quartz.nip01Core.relays.filters.FilterSerializer
/**
* This is a nostr filter with per-relay authors list and since parameters

View File

@ -23,9 +23,9 @@ package com.vitorpamplona.ammolite.relays.filters
import com.fasterxml.jackson.databind.node.JsonNodeFactory
import com.vitorpamplona.quartz.nip01Core.core.Event
import com.vitorpamplona.quartz.nip01Core.jackson.EventMapper
import com.vitorpamplona.quartz.nip01Core.relays.Filter
import com.vitorpamplona.quartz.nip01Core.relays.FilterMatcher
import com.vitorpamplona.quartz.nip01Core.relays.FilterSerializer
import com.vitorpamplona.quartz.nip01Core.relays.filters.Filter
import com.vitorpamplona.quartz.nip01Core.relays.filters.FilterMatcher
import com.vitorpamplona.quartz.nip01Core.relays.filters.FilterSerializer
/**
* This is a nostr filter with per-relay authors list and since parameters

View File

@ -21,7 +21,7 @@
package com.vitorpamplona.quartz.experimental.limits
import com.vitorpamplona.quartz.nip01Core.core.Event
import com.vitorpamplona.quartz.nip01Core.relays.Filter
import com.vitorpamplona.quartz.nip01Core.relays.filters.Filter
import com.vitorpamplona.quartz.nip13Pow.getPoWRank
import com.vitorpamplona.quartz.utils.TimeUtils

View File

@ -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.ammolite.relays.relays
package com.vitorpamplona.quartz.nip01Core.relays
import androidx.collection.LruCache
import com.vitorpamplona.quartz.utils.TimeUtils

View File

@ -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.ammolite.relays.relays
package com.vitorpamplona.quartz.nip01Core.relays
enum class RelayState {
// Websocket connected

View File

@ -18,28 +18,27 @@
* 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.ammolite.relays.relays
package com.vitorpamplona.quartz.nip01Core.relays
import android.util.Log
import com.vitorpamplona.ammolite.relays.relays.commands.toClient.AuthMessage
import com.vitorpamplona.ammolite.relays.relays.commands.toClient.ClosedMessage
import com.vitorpamplona.ammolite.relays.relays.commands.toClient.EoseMessage
import com.vitorpamplona.ammolite.relays.relays.commands.toClient.EventMessage
import com.vitorpamplona.ammolite.relays.relays.commands.toClient.NoticeMessage
import com.vitorpamplona.ammolite.relays.relays.commands.toClient.NotifyMessage
import com.vitorpamplona.ammolite.relays.relays.commands.toClient.OkMessage
import com.vitorpamplona.ammolite.relays.relays.commands.toClient.ToClientParser
import com.vitorpamplona.ammolite.relays.relays.commands.toRelay.AuthCmd
import com.vitorpamplona.ammolite.relays.relays.commands.toRelay.CloseCmd
import com.vitorpamplona.ammolite.relays.relays.commands.toRelay.CountCmd
import com.vitorpamplona.ammolite.relays.relays.commands.toRelay.EventCmd
import com.vitorpamplona.ammolite.relays.relays.commands.toRelay.ReqCmd
import com.vitorpamplona.ammolite.relays.relays.sockets.WebSocket
import com.vitorpamplona.ammolite.relays.relays.sockets.WebSocketListener
import com.vitorpamplona.ammolite.relays.relays.sockets.WebsocketBuilder
import com.vitorpamplona.quartz.nip01Core.HexKey
import com.vitorpamplona.quartz.nip01Core.core.Event
import com.vitorpamplona.quartz.nip01Core.relays.Filter
import com.vitorpamplona.quartz.nip01Core.relays.commands.toClient.AuthMessage
import com.vitorpamplona.quartz.nip01Core.relays.commands.toClient.ClosedMessage
import com.vitorpamplona.quartz.nip01Core.relays.commands.toClient.EoseMessage
import com.vitorpamplona.quartz.nip01Core.relays.commands.toClient.EventMessage
import com.vitorpamplona.quartz.nip01Core.relays.commands.toClient.NoticeMessage
import com.vitorpamplona.quartz.nip01Core.relays.commands.toClient.NotifyMessage
import com.vitorpamplona.quartz.nip01Core.relays.commands.toClient.OkMessage
import com.vitorpamplona.quartz.nip01Core.relays.commands.toClient.ToClientParser
import com.vitorpamplona.quartz.nip01Core.relays.commands.toRelay.AuthCmd
import com.vitorpamplona.quartz.nip01Core.relays.commands.toRelay.CloseCmd
import com.vitorpamplona.quartz.nip01Core.relays.commands.toRelay.CountCmd
import com.vitorpamplona.quartz.nip01Core.relays.commands.toRelay.EventCmd
import com.vitorpamplona.quartz.nip01Core.relays.filters.Filter
import com.vitorpamplona.quartz.nip01Core.relays.sockets.WebSocket
import com.vitorpamplona.quartz.nip01Core.relays.sockets.WebSocketListener
import com.vitorpamplona.quartz.nip01Core.relays.sockets.WebsocketBuilder
import com.vitorpamplona.quartz.nip42RelayAuth.RelayAuthEvent
import com.vitorpamplona.quartz.utils.TimeUtils
import com.vitorpamplona.quartz.utils.bytesUsedInMemory
@ -313,7 +312,10 @@ class SimpleClientRelay(
if (isConnectionStarted()) {
if (isReady) {
if (filters.isNotEmpty()) {
writeToSocket(ReqCmd.toJson(requestId, filters))
writeToSocket(
com.vitorpamplona.quartz.nip01Core.relays.commands.toRelay.ReqCmd
.toJson(requestId, filters),
)
afterEOSEPerSubscription[requestId] = false
}
}

View File

@ -18,9 +18,9 @@
* 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.ammolite.relays.relays
package com.vitorpamplona.quartz.nip01Core.relays
import com.vitorpamplona.quartz.nip01Core.relays.Filter
import com.vitorpamplona.quartz.nip01Core.relays.filters.Filter
import java.util.UUID
class Subscription(

View File

@ -18,10 +18,10 @@
* 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.ammolite.relays.relays
package com.vitorpamplona.quartz.nip01Core.relays
import com.vitorpamplona.quartz.nip01Core.core.Event
import com.vitorpamplona.quartz.nip01Core.relays.Filter
import com.vitorpamplona.quartz.nip01Core.relays.filters.Filter
interface SubscriptionCollection {
fun isActive(subscriptionId: String): Boolean

View File

@ -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.ammolite.relays.relays.commands.toClient
package com.vitorpamplona.quartz.nip01Core.relays.commands.toClient
import com.fasterxml.jackson.databind.JsonNode

View File

@ -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.ammolite.relays.relays.commands.toClient
package com.vitorpamplona.quartz.nip01Core.relays.commands.toClient
import com.fasterxml.jackson.databind.JsonNode

View File

@ -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.ammolite.relays.relays.commands.toClient
package com.vitorpamplona.quartz.nip01Core.relays.commands.toClient
import com.fasterxml.jackson.databind.JsonNode

View File

@ -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.ammolite.relays.relays.commands.toClient
package com.vitorpamplona.quartz.nip01Core.relays.commands.toClient
import com.fasterxml.jackson.databind.JsonNode
import com.vitorpamplona.quartz.nip01Core.core.Event

View File

@ -18,6 +18,6 @@
* 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.ammolite.relays.relays.commands.toClient
package com.vitorpamplona.quartz.nip01Core.relays.commands.toClient
interface Message

View File

@ -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.ammolite.relays.relays.commands.toClient
package com.vitorpamplona.quartz.nip01Core.relays.commands.toClient
import com.fasterxml.jackson.databind.JsonNode

View File

@ -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.ammolite.relays.relays.commands.toClient
package com.vitorpamplona.quartz.nip01Core.relays.commands.toClient
import com.fasterxml.jackson.databind.JsonNode

View File

@ -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.ammolite.relays.relays.commands.toClient
package com.vitorpamplona.quartz.nip01Core.relays.commands.toClient
import com.fasterxml.jackson.databind.JsonNode
import com.vitorpamplona.quartz.nip01Core.HexKey

View File

@ -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.ammolite.relays.relays.commands.toClient
package com.vitorpamplona.quartz.nip01Core.relays.commands.toClient
import com.vitorpamplona.quartz.nip01Core.jackson.EventMapper

View File

@ -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.ammolite.relays.relays.commands.toRelay
package com.vitorpamplona.quartz.nip01Core.relays.commands.toRelay
import com.fasterxml.jackson.databind.JsonNode
import com.vitorpamplona.quartz.nip01Core.jackson.EventMapper

View File

@ -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.ammolite.relays.relays.commands.toRelay
package com.vitorpamplona.quartz.nip01Core.relays.commands.toRelay
import com.fasterxml.jackson.databind.JsonNode

View File

@ -18,6 +18,6 @@
* 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.ammolite.relays.relays.commands.toRelay
package com.vitorpamplona.quartz.nip01Core.relays.commands.toRelay
interface Command

View File

@ -18,13 +18,13 @@
* 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.ammolite.relays.relays.commands.toRelay
package com.vitorpamplona.quartz.nip01Core.relays.commands.toRelay
import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.databind.node.ObjectNode
import com.vitorpamplona.quartz.nip01Core.jackson.EventMapper
import com.vitorpamplona.quartz.nip01Core.relays.Filter
import com.vitorpamplona.quartz.nip01Core.relays.FilterDeserializer
import com.vitorpamplona.quartz.nip01Core.relays.filters.Filter
import com.vitorpamplona.quartz.nip01Core.relays.filters.FilterDeserializer
import com.vitorpamplona.quartz.utils.joinToStringLimited
class CountCmd(

View File

@ -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.ammolite.relays.relays.commands.toRelay
package com.vitorpamplona.quartz.nip01Core.relays.commands.toRelay
import com.fasterxml.jackson.databind.JsonNode
import com.vitorpamplona.quartz.nip01Core.core.Event

View File

@ -18,19 +18,19 @@
* 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.ammolite.relays.relays.commands.toRelay
package com.vitorpamplona.quartz.nip01Core.relays.commands.toRelay
import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.databind.node.ObjectNode
import com.vitorpamplona.quartz.nip01Core.jackson.EventMapper
import com.vitorpamplona.quartz.nip01Core.relays.Filter
import com.vitorpamplona.quartz.nip01Core.relays.FilterDeserializer
import com.vitorpamplona.quartz.nip01Core.relays.filters.Filter
import com.vitorpamplona.quartz.nip01Core.relays.filters.FilterDeserializer
import com.vitorpamplona.quartz.utils.joinToStringLimited
class ReqCmd(
val subscriptionId: String,
val filters: List<Filter>,
) : Command {
) : com.vitorpamplona.quartz.nip01Core.relays.commands.toRelay.Command {
companion object {
const val LABEL = "REQ"
@ -50,7 +50,7 @@ class ReqCmd(
}
@JvmStatic
fun parse(msgArray: JsonNode): ReqCmd {
fun parse(msgArray: JsonNode): com.vitorpamplona.quartz.nip01Core.relays.commands.toRelay.ReqCmd {
val filters = mutableListOf<Filter>()
for (i in 2 until msgArray.size()) {
@ -60,7 +60,10 @@ class ReqCmd(
}
}
return ReqCmd(msgArray.get(1).asText(), filters)
return com.vitorpamplona.quartz.nip01Core.relays.commands.toRelay.ReqCmd(
msgArray.get(1).asText(),
filters,
)
}
}
}

View File

@ -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.ammolite.relays.relays.commands.toRelay
package com.vitorpamplona.quartz.nip01Core.relays.commands.toRelay
import com.vitorpamplona.quartz.nip01Core.jackson.EventMapper
@ -31,7 +31,9 @@ class ToRelayParser {
CloseCmd.LABEL -> CloseCmd.parse(msgArray)
CountCmd.LABEL -> CountCmd.parse(msgArray)
EventCmd.LABEL -> EventCmd.parse(msgArray)
ReqCmd.LABEL -> ReqCmd.parse(msgArray)
com.vitorpamplona.quartz.nip01Core.relays.commands.toRelay.ReqCmd.LABEL ->
com.vitorpamplona.quartz.nip01Core.relays.commands.toRelay.ReqCmd
.parse(msgArray)
else -> null
}
}

View File

@ -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.relays
package com.vitorpamplona.quartz.nip01Core.relays.filters
import com.vitorpamplona.quartz.nip01Core.core.Event

View File

@ -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.relays
package com.vitorpamplona.quartz.nip01Core.relays.filters
import com.fasterxml.jackson.databind.node.ObjectNode

View File

@ -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.relays
package com.vitorpamplona.quartz.nip01Core.relays.filters
import com.vitorpamplona.quartz.nip01Core.core.Event

View File

@ -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.relays
package com.vitorpamplona.quartz.nip01Core.relays.filters
import com.fasterxml.jackson.databind.node.JsonNodeFactory
import com.fasterxml.jackson.databind.node.ObjectNode

View File

@ -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.ammolite.relays.relays.sockets
package com.vitorpamplona.quartz.nip01Core.relays.sockets
interface WebSocket {
fun connect()

View File

@ -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.ammolite.relays.relays.sockets
package com.vitorpamplona.quartz.nip01Core.relays.sockets
interface WebSocketListener {
fun onOpen(

View File

@ -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.ammolite.relays.relays.sockets
package com.vitorpamplona.quartz.nip01Core.relays.sockets
interface WebsocketBuilder {
fun build(

View File

@ -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.ammolite.relays.relays.sockets
package com.vitorpamplona.quartz.nip01Core.relays.sockets
interface WebsocketBuilderFactory {
fun build(forceProxy: Boolean): WebsocketBuilder