Documentation
¶
Overview ¶
Package wire defines the Nostr relay wire-protocol packet types (EVENT, REQ, EOSE, OK, NOTICE, CLOSE, AUTH, and NIP-77 negentropy packets) and their JSON encoding. Most consumers should reach for relay/client instead of this package directly — it hides these packet types behind a higher-level Connection API.
Index ¶
- func IsPacketError(err error) bool
- type AuthChallengeResponse
- type AuthPacket
- type ClientPayload
- type ClosePacket
- type ClosedSubscriptionResponse
- type CountPacket
- type CountSubscriptionResponse
- type EOSESubscriptionResponse
- type EventPacket
- type EventSubscriptionResponse
- type NegClosePacket
- type NegErrPacket
- type NegErrResponse
- type NegMsgPacket
- type NegMsgResponse
- type NegOpenPacket
- type NoticeSubscriptionResponse
- type OkSubscriptionResponse
- type Packet
- type PacketError
- type RelayPayload
- type RequestPacket
- type SubscriptionResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsPacketError ¶
Types ¶
type AuthChallengeResponse ¶
type AuthChallengeResponse struct {
Challenge string
}
func (*AuthChallengeResponse) MarshalJSON ¶
func (acr *AuthChallengeResponse) MarshalJSON() ([]byte, error)
func (*AuthChallengeResponse) UnmarshalJSON ¶ added in v0.2.2
func (acr *AuthChallengeResponse) UnmarshalJSON(data []byte) error
type AuthPacket ¶
func (*AuthPacket) MarshalJSON ¶
func (ap *AuthPacket) MarshalJSON() ([]byte, error)
type ClientPayload ¶
type ClientPayload struct {
SubscriptionResponse
}
func (*ClientPayload) UnmarshalJSON ¶
func (sr *ClientPayload) UnmarshalJSON(data []byte) error
type ClosePacket ¶
type ClosePacket struct {
SubscriptionID string
}
func NewClosePacket ¶
func NewClosePacket(subID string) *ClosePacket
func (*ClosePacket) MarshalJSON ¶
func (rp *ClosePacket) MarshalJSON() ([]byte, error)
func (*ClosePacket) String ¶
func (cp *ClosePacket) String() string
type ClosedSubscriptionResponse ¶
func (*ClosedSubscriptionResponse) MarshalJSON ¶
func (csr *ClosedSubscriptionResponse) MarshalJSON() ([]byte, error)
func (*ClosedSubscriptionResponse) UnmarshalJSON ¶
func (csr *ClosedSubscriptionResponse) UnmarshalJSON(data []byte) error
type CountPacket ¶
type CountPacket struct {
SubscriptionID string
Filters *nip01.SubscriptionFilterGroup
}
func (*CountPacket) MarshalJSON ¶
func (cp *CountPacket) MarshalJSON() ([]byte, error)
type CountSubscriptionResponse ¶
func (*CountSubscriptionResponse) MarshalJSON ¶
func (csr *CountSubscriptionResponse) MarshalJSON() ([]byte, error)
func (*CountSubscriptionResponse) UnmarshalJSON ¶ added in v0.2.2
func (csr *CountSubscriptionResponse) UnmarshalJSON(data []byte) error
type EOSESubscriptionResponse ¶
type EOSESubscriptionResponse struct {
SubscriptionID string
}
func (*EOSESubscriptionResponse) MarshalJSON ¶
func (esr *EOSESubscriptionResponse) MarshalJSON() ([]byte, error)
func (*EOSESubscriptionResponse) UnmarshalJSON ¶
func (esr *EOSESubscriptionResponse) UnmarshalJSON(data []byte) error
type EventPacket ¶
func NewEventPacket ¶
func NewEventPacket(ev *nip01.Event) *EventPacket
func (*EventPacket) MarshalJSON ¶
func (ep *EventPacket) MarshalJSON() ([]byte, error)
func (*EventPacket) String ¶
func (ep *EventPacket) String() string
type EventSubscriptionResponse ¶
type EventSubscriptionResponse struct {
SubscriptionID string
Event *nip01.Event
// For sending raw bytes if available (optimization)
EventBytes []byte
}
func (*EventSubscriptionResponse) MarshalJSON ¶
func (esr *EventSubscriptionResponse) MarshalJSON() ([]byte, error)
func (*EventSubscriptionResponse) UnmarshalJSON ¶
func (esr *EventSubscriptionResponse) UnmarshalJSON(data []byte) error
type NegClosePacket ¶
type NegClosePacket struct {
SubscriptionID string
}
func (*NegClosePacket) MarshalJSON ¶
func (p *NegClosePacket) MarshalJSON() ([]byte, error)
type NegErrPacket ¶
func (*NegErrPacket) MarshalJSON ¶
func (p *NegErrPacket) MarshalJSON() ([]byte, error)
type NegErrResponse ¶
func (*NegErrResponse) MarshalJSON ¶
func (r *NegErrResponse) MarshalJSON() ([]byte, error)
func (*NegErrResponse) UnmarshalJSON ¶
func (r *NegErrResponse) UnmarshalJSON(data []byte) error
type NegMsgPacket ¶
func (*NegMsgPacket) MarshalJSON ¶
func (p *NegMsgPacket) MarshalJSON() ([]byte, error)
type NegMsgResponse ¶
func (*NegMsgResponse) MarshalJSON ¶
func (r *NegMsgResponse) MarshalJSON() ([]byte, error)
func (*NegMsgResponse) UnmarshalJSON ¶
func (r *NegMsgResponse) UnmarshalJSON(data []byte) error
type NegOpenPacket ¶
type NegOpenPacket struct {
SubscriptionID string
Filter *nip01.SubscriptionFilter
Message string
}
func (*NegOpenPacket) MarshalJSON ¶
func (p *NegOpenPacket) MarshalJSON() ([]byte, error)
type NoticeSubscriptionResponse ¶
type NoticeSubscriptionResponse struct {
Message string
}
func (*NoticeSubscriptionResponse) MarshalJSON ¶
func (nsr *NoticeSubscriptionResponse) MarshalJSON() ([]byte, error)
func (*NoticeSubscriptionResponse) UnmarshalJSON ¶
func (nsr *NoticeSubscriptionResponse) UnmarshalJSON(data []byte) error
type OkSubscriptionResponse ¶
func (*OkSubscriptionResponse) MarshalJSON ¶
func (osr *OkSubscriptionResponse) MarshalJSON() ([]byte, error)
func (*OkSubscriptionResponse) UnmarshalJSON ¶
func (osr *OkSubscriptionResponse) UnmarshalJSON(data []byte) error
type PacketError ¶
func NewPacketError ¶
func NewPacketError(message string, err error, args ...interface{}) *PacketError
func (*PacketError) Error ¶
func (pe *PacketError) Error() string
type RelayPayload ¶
type RelayPayload struct {
Packet Packet
}
func (*RelayPayload) UnmarshalJSON ¶
func (p *RelayPayload) UnmarshalJSON(data []byte) error
type RequestPacket ¶
type RequestPacket struct {
SubscriptionID string
Filters *nip01.SubscriptionFilterGroup
}
func NewRequestPacket ¶
func NewRequestPacket(subID string, filters *nip01.SubscriptionFilterGroup) *RequestPacket
func (*RequestPacket) MarshalJSON ¶
func (rp *RequestPacket) MarshalJSON() ([]byte, error)
func (*RequestPacket) String ¶
func (rp *RequestPacket) String() string
type SubscriptionResponse ¶
type SubscriptionResponse interface{}
Click to show internal directories.
Click to hide internal directories.