mirror of
https://github.com/nbd-wtf/go-nostr.git
synced 2025-07-07 14:49:56 +02:00
negentropy.
- a way to handle custom messages from Relay (NEG-whatever etc) - negentropy implementation (adapted from that other one) - nip77 nostr negentropy extension - QueryEvents method for RelayStore that returns a channel (makes negentropy syncing work more seamlessly)
This commit is contained in:
12
envelopes.go
12
envelopes.go
@ -58,11 +58,6 @@ type Envelope interface {
|
||||
String() string
|
||||
}
|
||||
|
||||
type EventEnvelope struct {
|
||||
SubscriptionID *string
|
||||
Event
|
||||
}
|
||||
|
||||
var (
|
||||
_ Envelope = (*EventEnvelope)(nil)
|
||||
_ Envelope = (*ReqEnvelope)(nil)
|
||||
@ -74,6 +69,11 @@ var (
|
||||
_ Envelope = (*AuthEnvelope)(nil)
|
||||
)
|
||||
|
||||
type EventEnvelope struct {
|
||||
SubscriptionID *string
|
||||
Event
|
||||
}
|
||||
|
||||
func (_ EventEnvelope) Label() string { return "EVENT" }
|
||||
|
||||
func (v *EventEnvelope) UnmarshalJSON(data []byte) error {
|
||||
@ -96,7 +96,7 @@ func (v EventEnvelope) MarshalJSON() ([]byte, error) {
|
||||
if v.SubscriptionID != nil {
|
||||
w.RawString(`"` + *v.SubscriptionID + `",`)
|
||||
}
|
||||
v.MarshalEasyJSON(&w)
|
||||
v.Event.MarshalEasyJSON(&w)
|
||||
w.RawString(`]`)
|
||||
return w.BuildBytes()
|
||||
}
|
||||
|
Reference in New Issue
Block a user