relayer

package module
v1.5.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 26, 2022 License: Unlicense Imports: 15 Imported by: 9

README

Nostr Relay Framework -- use it to implement your own custom relay.

There is an example/reference implementation at basic. Binaries for that are also available under Releases.

GoDoc

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Log = log
View Source
var Router = mux.NewRouter()

Functions

func AddEvent added in v1.5.2

func AddEvent(relay Relay, evt nostr.Event) (accepted bool, message string)

func GetListeningFilters

func GetListeningFilters() nostr.Filters

func Start

func Start(relay Relay)

Types

type AdvancedDeleter added in v1.5.0

type AdvancedDeleter interface {
	BeforeDelete(id string, pubkey string)
	AfterDelete(id string, pubkey string)
}

type AdvancedQuerier added in v1.5.0

type AdvancedQuerier interface {
	BeforeQuery(*nostr.Filter)
	AfterQuery([]nostr.Event, *nostr.Filter)
}

type AdvancedSaver added in v1.5.0

type AdvancedSaver interface {
	BeforeSave(*nostr.Event)
	AfterSave(*nostr.Event)
}

type CustomWebSocketHandler added in v1.5.2

type CustomWebSocketHandler interface {
	HandleUnknownType(ws *WebSocket, typ string, request []json.RawMessage)
}

type Informationer added in v1.5.0

type Informationer interface {
	GetNIP11InformationDocument() nip11.RelayInformationDocument
}

type Injector

type Injector interface {
	InjectEvents() chan nostr.Event
}

type Listener

type Listener struct {
	// contains filtered or unexported fields
}

type Notice

type Notice struct {
	Kind    string `json:"kind"`
	Message string `json:"message"`
}

type Relay

type Relay interface {
	Name() string
	Init() error
	OnInitialized()
	AcceptEvent(*nostr.Event) bool
	Storage() Storage
}

relay

type Settings

type Settings struct {
	Host string `envconfig:"HOST" default:"0.0.0.0"`
	Port string `envconfig:"PORT" default:"7447"`
}

type Storage added in v1.5.0

type Storage interface {
	Init() error

	QueryEvents(filter *nostr.Filter) (events []nostr.Event, err error)
	DeleteEvent(id string, pubkey string) error
	SaveEvent(event *nostr.Event) error
}

storage

type WebSocket added in v1.2.0

type WebSocket struct {
	// contains filtered or unexported fields
}

func (*WebSocket) WriteJSON added in v1.2.0

func (ws *WebSocket) WriteJSON(any interface{}) error

func (*WebSocket) WriteMessage added in v1.2.0

func (ws *WebSocket) WriteMessage(t int, b []byte) error

Directories

Path Synopsis
storage

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL