khatru: get rid of subrelays + segregated indexed listeners.

This commit is contained in:
fiatjaf
2026-03-29 11:14:22 -03:00
parent 56610a32e6
commit ac2d4579f1
12 changed files with 425 additions and 641 deletions
+2 -7
View File
@@ -42,7 +42,7 @@ func NewRelay() *Relay {
clients: make(map[*WebSocket][]listenerSpec, 100),
clientsMutex: channelmutex.New(),
listeners: make([]listener, 0, 100),
dispatcher: newDispatcher(),
serveMux: &http.ServeMux{},
@@ -87,11 +87,6 @@ type Relay struct {
// this can be ignored unless you know what you're doing
ChallengePrefix string
// these are used when this relays acts as a router
routes []Route
getSubRelayFromEvent func(*nostr.Event) *Relay // used for handling EVENTs
getSubRelayFromFilter func(nostr.Filter) *Relay // used for handling REQs
// setting up handlers here will enable these methods
ManagementAPI RelayManagementAPI
@@ -108,7 +103,7 @@ type Relay struct {
// keep a connection reference to all connected clients for Server.Shutdown
// also used for keeping track of who is listening to what
clients map[*WebSocket][]listenerSpec
listeners []listener
dispatcher dispatcher
clientsMutex *channelmutex.Mutex
// set this to true to support negentropy