Documentation ¶
Index ¶
- Variables
- func ShouldReplaceContactsEvent(old, new Event) (bool, error)
- type ContactsExtractor
- type Event
- func (e Event) Content() string
- func (e Event) CreatedAt() time.Time
- func (e Event) HasInvalidProfileTags() bool
- func (e Event) HasInvalidRTags() bool
- func (e Event) Id() EventId
- func (e Event) IsInvalid() bool
- func (e Event) Kind() EventKind
- func (e Event) Libevent() nostr.Event
- func (e Event) MarshalJSON() ([]byte, error)
- func (e Event) PubKey() PublicKey
- func (e Event) Raw() []byte
- func (e Event) String() string
- func (e Event) Tags() []EventTag
- type EventId
- type EventKind
- type EventTag
- type EventTagName
- type Filter
- type FilterTag
- type MaybeRelayAddress
- type PublicKey
- type PublicKeyToMonitor
- type Registration
- type RelayAddress
- type RelaysExtractor
- type UnverifiedEvent
- func (u UnverifiedEvent) CreatedAt() time.Time
- func (u UnverifiedEvent) HasInvalidProfileTags() bool
- func (u UnverifiedEvent) HasInvalidRTags() bool
- func (u UnverifiedEvent) Id() EventId
- func (u UnverifiedEvent) IsInvalid() bool
- func (u UnverifiedEvent) Kind() EventKind
- func (u UnverifiedEvent) PubKey() PublicKey
- func (u UnverifiedEvent) Raw() []byte
- func (u UnverifiedEvent) String() string
- func (u UnverifiedEvent) Tags() []EventTag
Constants ¶
This section is empty.
Variables ¶
View Source
var ( EventKindMetadata = MustNewEventKind(0) EventKindNote = MustNewEventKind(1) EventKindRecommendedRelay = MustNewEventKind(2) EventKindContacts = MustNewEventKind(3) EventKindEncryptedDirectMessage = MustNewEventKind(4) EventKindReaction = MustNewEventKind(7) EventKindRelayListMetadata = MustNewEventKind(10002) // TODO: This should be changed to 30078 // See https://github.com/nostr-protocol/nips/blob/master/78.md , 6666 is // reserved by nip 90 EventKindRegistration = MustNewEventKind(6666) )
View Source
var ( TagProfile = MustNewEventTagName("p") TagRelay = MustNewEventTagName("r") )
View Source
var ErrNotContactsEvent = errors.New("this is not a contacts event")
Functions ¶
Types ¶
type ContactsExtractor ¶
type ContactsExtractor struct {
// contains filtered or unexported fields
}
ContactsExtractor does its best to get relay addresses out of events. It should only error out on obvious programming errors but not on malformed user input.
func NewContactsExtractor ¶
func NewContactsExtractor(logger logging.Logger) *ContactsExtractor
func (*ContactsExtractor) Extract ¶
func (e *ContactsExtractor) Extract(event Event) ([]PublicKey, error)
Extract returns ErrNotContactsEvent if the event isn't an event that normally contains contacts. This is to distinguish between events that contain zero contacts and events that don't ever contain contacts.
type Event ¶
type Event struct {
// contains filtered or unexported fields
}
func NewEventFromRaw ¶
func NewEventFromUnverifiedEvent ¶
func NewEventFromUnverifiedEvent(event UnverifiedEvent) (Event, error)
func (Event) HasInvalidProfileTags ¶
func (Event) HasInvalidRTags ¶
func (Event) MarshalJSON ¶
type EventId ¶
type EventId struct {
// contains filtered or unexported fields
}
func MustNewEventId ¶
func NewEventIdFromHex ¶
func NewEventIdFromNote ¶
type EventKind ¶
type EventKind struct {
// contains filtered or unexported fields
}
func MustNewEventKind ¶
func NewEventKind ¶
type EventTag ¶
type EventTag struct {
// contains filtered or unexported fields
}
func MustNewEventTag ¶
func NewEventTag ¶
func (EventTag) FirstValue ¶
func (EventTag) FirstValueIsAnEmptyString ¶
func (EventTag) Name ¶
func (e EventTag) Name() EventTagName
func (EventTag) Relay ¶
func (e EventTag) Relay() (MaybeRelayAddress, error)
type EventTagName ¶
type EventTagName struct {
// contains filtered or unexported fields
}
func MustNewEventTagName ¶
func MustNewEventTagName(s string) EventTagName
func NewEventTagName ¶
func NewEventTagName(s string) (EventTagName, error)
func (EventTagName) String ¶
func (e EventTagName) String() string
type Filter ¶
type Filter struct {
// contains filtered or unexported fields
}
func MustNewFilter ¶
func (Filter) MarshalJSON ¶
type FilterTag ¶
type FilterTag struct {
// contains filtered or unexported fields
}
func NewFilterTag ¶
func NewFilterTag(name EventTagName, value string) (FilterTag, error)
func (FilterTag) Name ¶
func (f FilterTag) Name() EventTagName
type MaybeRelayAddress ¶
type MaybeRelayAddress struct {
// contains filtered or unexported fields
}
func NewMaybeRelayAddress ¶
func NewMaybeRelayAddress(s string) MaybeRelayAddress
func (MaybeRelayAddress) String ¶
func (a MaybeRelayAddress) String() string
type PublicKey ¶
type PublicKey struct {
// contains filtered or unexported fields
}
func NewPublicKeyFromHex ¶
func NewPublicKeyFromNpub ¶
type PublicKeyToMonitor ¶
type PublicKeyToMonitor struct {
// contains filtered or unexported fields
}
func NewPublicKeyToMonitor ¶
func (PublicKeyToMonitor) CreatedAt ¶
func (p PublicKeyToMonitor) CreatedAt() time.Time
func (PublicKeyToMonitor) PublicKey ¶
func (p PublicKeyToMonitor) PublicKey() PublicKey
func (PublicKeyToMonitor) UpdatedAt ¶
func (p PublicKeyToMonitor) UpdatedAt() time.Time
type Registration ¶
type Registration struct {
// contains filtered or unexported fields
}
func NewRegistrationFromEvent ¶
func NewRegistrationFromEvent(event Event) (Registration, error)
func (Registration) PublicKey ¶
func (p Registration) PublicKey() PublicKey
func (Registration) Relays ¶
func (p Registration) Relays() []RelayAddress
type RelayAddress ¶
type RelayAddress struct {
// contains filtered or unexported fields
}
func MustNewRelayAddress ¶
func MustNewRelayAddress(s string) RelayAddress
func NewRelayAddress ¶
func NewRelayAddress(s string) (RelayAddress, error)
func NewRelayAddressFromMaybeAddress ¶
func NewRelayAddressFromMaybeAddress(maybe MaybeRelayAddress) (RelayAddress, error)
func (RelayAddress) HostWithoutPort ¶
func (r RelayAddress) HostWithoutPort() string
func (RelayAddress) IsLoopbackOrPrivate ¶
func (r RelayAddress) IsLoopbackOrPrivate() bool
func (RelayAddress) String ¶
func (r RelayAddress) String() string
type RelaysExtractor ¶
type RelaysExtractor struct {
// contains filtered or unexported fields
}
RelaysExtractor does its best to get relay addresses out of events. It should only error out on obvious programming errors but not on malformed user input.
func NewRelaysExtractor ¶
func NewRelaysExtractor(logger logging.Logger) *RelaysExtractor
func (*RelaysExtractor) Extract ¶
func (e *RelaysExtractor) Extract(event Event) ([]MaybeRelayAddress, error)
type UnverifiedEvent ¶
type UnverifiedEvent struct {
// contains filtered or unexported fields
}
func NewUnverifiedEvent ¶
func NewUnverifiedEvent(libevent nostr.Event) (UnverifiedEvent, error)
func NewUnverifiedEventFromRaw ¶
func NewUnverifiedEventFromRaw(raw []byte) (UnverifiedEvent, error)
func (UnverifiedEvent) CreatedAt ¶
func (u UnverifiedEvent) CreatedAt() time.Time
func (UnverifiedEvent) HasInvalidProfileTags ¶
func (u UnverifiedEvent) HasInvalidProfileTags() bool
func (UnverifiedEvent) HasInvalidRTags ¶
func (u UnverifiedEvent) HasInvalidRTags() bool
func (UnverifiedEvent) Id ¶
func (u UnverifiedEvent) Id() EventId
func (UnverifiedEvent) IsInvalid ¶
func (u UnverifiedEvent) IsInvalid() bool
func (UnverifiedEvent) Kind ¶
func (u UnverifiedEvent) Kind() EventKind
func (UnverifiedEvent) PubKey ¶
func (u UnverifiedEvent) PubKey() PublicKey
func (UnverifiedEvent) Raw ¶
func (u UnverifiedEvent) Raw() []byte
func (UnverifiedEvent) String ¶
func (u UnverifiedEvent) String() string
func (UnverifiedEvent) Tags ¶
func (u UnverifiedEvent) Tags() []EventTag
Source Files ¶
Click to show internal directories.
Click to hide internal directories.