Versions in this module Expand all Collapse all v0 v0.5.1 Feb 1, 2022 Changes in this version + const KindContactList + const KindDeletion + const KindEncryptedDirectMessage + const KindRecommendServer + const KindSetMetadata + const KindTextNote + const PublishStatusFailed + const PublishStatusSent + const PublishStatusSucceeded + func FilterEqual(a EventFilter, b EventFilter) bool + func GeneratePrivateKey() string + func GetPublicKey(sk string) (string, error) + func NormalizeURL(u string) string + type Connection struct + func NewConnection(socket *websocket.Conn) *Connection + func (c *Connection) Close() error + func (c *Connection) WriteJSON(v interface{}) error + func (c *Connection) WriteMessage(messageType int, data []byte) error + type Event struct + Content string + CreatedAt uint32 + ID string + Kind int + PubKey string + Sig string + Tags Tags + func (evt *Event) Serialize() []byte + func (evt *Event) Sign(privateKey string) error + func (evt Event) CheckSignature() (bool, error) + type EventFilter struct + Authors StringList + IDs StringList + Kinds IntList + Since uint32 + TagE StringList + TagP StringList + Until uint32 + func (ef EventFilter) Matches(event *Event) bool + type EventFilters []EventFilter + func (eff EventFilters) Match(event *Event) bool + type EventMessage struct + Event Event + Relay string + type IntList []int + func (as IntList) Equals(bs IntList) bool + func (haystack IntList) Contains(needle int) bool + type NoticeMessage struct + Message string + Relay string + type PublishStatus struct + Relay string + Status int + type RelayPool struct + Notices chan *NoticeMessage + Relays map[string]RelayPoolPolicy + SecretKey *string + func NewRelayPool() *RelayPool + func (r *RelayPool) Add(url string, policy RelayPoolPolicy) error + func (r *RelayPool) PublishEvent(evt *Event) (*Event, chan PublishStatus, error) + func (r *RelayPool) Remove(url string) + func (r *RelayPool) Sub(filters EventFilters) *Subscription + type RelayPoolPolicy interface + ShouldRead func(EventFilters) bool + ShouldWrite func(*Event) bool + type SimplePolicy struct + Read bool + Write bool + func (s SimplePolicy) ShouldRead(_ EventFilters) bool + func (s SimplePolicy) ShouldWrite(_ *Event) bool + type StringList []string + func (as StringList) Equals(bs StringList) bool + func (haystack StringList) Contains(needle string) bool + type Subscription struct + Events chan EventMessage + UniqueEvents chan Event + func (subscription Subscription) Sub() + func (subscription Subscription) Unsub() + type Tag []interface + type Tags []Tag + func (t *Tags) Scan(src interface{}) error + func (tags Tags) ContainsAny(tagName string, values StringList) bool