Documentation
¶
Index ¶
- Constants
- func GetAuthed(ctx context.Context) string
- func GetListeningFilters() nostr.Filters
- type Listener
- type Relay
- func (rl *Relay) AddEvent(ctx context.Context, evt *nostr.Event) error
- func (rl *Relay) HandleNIP11(w http.ResponseWriter, r *http.Request)
- func (rl *Relay) HandleWebsocket(w http.ResponseWriter, r *http.Request)
- func (rl *Relay) RequestAuth(ctx context.Context)
- func (rl *Relay) Router() *http.ServeMux
- func (rl *Relay) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (rl *Relay) Shutdown(ctx context.Context)
- func (rl *Relay) Start(host string, port int, started ...chan bool) error
- type WebSocket
Constants ¶
View Source
const ( AUTH_CONTEXT_KEY = iota WS_KEY = iota )
Variables ¶
This section is empty.
Functions ¶
func GetListeningFilters ¶
Types ¶
type Relay ¶
type Relay struct {
ServiceURL string // required for nip-42
RejectEvent []func(ctx context.Context, event *nostr.Event) (reject bool, msg string)
RejectFilter []func(ctx context.Context, filter nostr.Filter) (reject bool, msg string)
RejectCountFilter []func(ctx context.Context, filter nostr.Filter) (reject bool, msg string)
OverwriteDeletionOutcome []func(ctx context.Context, target *nostr.Event, deletion *nostr.Event) (acceptDeletion bool, msg string)
OverwriteResponseEvent []func(ctx context.Context, event *nostr.Event)
OverwriteFilter []func(ctx context.Context, filter *nostr.Filter)
OverwriteCountFilter []func(ctx context.Context, filter *nostr.Filter)
StoreEvent []func(ctx context.Context, event *nostr.Event) error
DeleteEvent []func(ctx context.Context, event *nostr.Event) error
QueryEvents []func(ctx context.Context, filter nostr.Filter) (chan *nostr.Event, error)
CountEvents []func(ctx context.Context, filter nostr.Filter) (int64, error)
OnAuth []func(ctx context.Context, pubkey string)
OnConnect []func(ctx context.Context)
OnEventSaved []func(ctx context.Context, event *nostr.Event)
// editing info will affect
Info *nip11.RelayInformationDocument
// Default logger, as set by NewServer, is a stdlib logger prefixed with "[khatru-relay] ",
// outputting to stderr.
Log *log.Logger
// in case you call Server.Start
Addr string
// websocket options
WriteWait time.Duration // Time allowed to write a message to the peer.
PongWait time.Duration // Time allowed to read the next pong message from the peer.
PingPeriod time.Duration // Send pings to peer with this period. Must be less than pongWait.
MaxMessageSize int64 // Maximum message size allowed from peer.
// contains filtered or unexported fields
}
func (*Relay) HandleNIP11 ¶
func (rl *Relay) HandleNIP11(w http.ResponseWriter, r *http.Request)
func (*Relay) HandleWebsocket ¶
func (rl *Relay) HandleWebsocket(w http.ResponseWriter, r *http.Request)
func (*Relay) RequestAuth ¶
func (*Relay) ServeHTTP ¶
func (rl *Relay) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP implements http.Handler interface.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
basic-badger
command
|
|
|
basic-elasticsearch
command
|
|
|
basic-lmdb
command
|
|
|
basic-postgres
command
|
|
|
basic-sqlite3
command
|
|
|
exclusive
command
|
|
|
readme-demo
command
|
|
Click to show internal directories.
Click to hide internal directories.