Documentation
¶
Index ¶
- Constants
- func GetAuthed(c context.T) string
- func GetIP(c context.T) string
- func GetListeningFilters() filters2.T
- func GetOpenSubscriptions(c context.T) (res []*filter.T)
- func GetSubscriptionID(c context.T) string
- func RequestAuth(c context.T)
- type Listener
- type Relay
- func (rl *Relay) AddEvent(c context.T, evt *event.T) (e error)
- func (rl *Relay) HandleNIP11(w http.ResponseWriter, r *http.Request)
- func (rl *Relay) HandleWebsocket(w http.ResponseWriter, r *http.Request)
- func (rl *Relay) Router() *http.ServeMux
- func (rl *Relay) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (rl *Relay) Shutdown(c context.T)
- func (rl *Relay) Start(host string, port int, started ...chan bool) (e error)
- type WebSocket
Constants ¶
View Source
const ( WebsocketContextKey = iota SubscriptionIDContextKey )
Variables ¶
This section is empty.
Functions ¶
func GetListeningFilters ¶
func GetSubscriptionID ¶
func RequestAuth ¶
Types ¶
type Relay ¶
type Relay struct {
ServiceURL string
RejectEvent []func(c context.T, ev *event.T) (reject bool, msg string)
RejectFilter []func(c context.T, f *filter.T) (reject bool, msg string)
RejectCountFilter []func(c context.T, f *filter.T) (reject bool, msg string)
OverwriteDeletionOutcome []func(c context.T, target *event.T, deletion *event.T) (acceptDeletion bool, msg string)
OverwriteResponseEvent []func(c context.T, ev *event.T)
OverwriteFilter []func(c context.T, f *filter.T)
OverwriteCountFilter []func(c context.T, f *filter.T)
OverwriteRelayInformation []func(c context.T, r *http.Request, info *relayinfo.T) *relayinfo.T
StoreEvent []func(c context.T, ev *event.T) error
DeleteEvent []func(c context.T, ev *event.T) error
QueryEvents []func(c context.T, f *filter.T) (chan *event.T, error)
CountEvents []func(c context.T, f *filter.T) (int64, error)
OnAuth []func(c context.T, pubkey string)
OnConnect []func(c context.T)
OnDisconnect []func(c context.T)
OnEventSaved []func(c context.T, ev *event.T)
// editing info will affect
Info *relayinfo.T
// Default logger, as set by NewServer, is a stdlib logger prefixed with "[khatru-relay] ",
// outputting to stderr.
*log2.Log
// 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) ServeHTTP ¶
func (rl *Relay) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP implements http.Handler interface.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.