nostr

package
v0.0.0-...-92aaef2 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var KindHandlers map[string]KindHandler

Functions

func AuthTimeCheck

func AuthTimeCheck(eventCreatedAt int64) (bool, string)

func BuildCborResponse

func BuildCborResponse(messageType string, params ...interface{}) []byte

func BuildResponse

func BuildResponse(messageType string, params ...interface{}) []byte

func CloseStream

func CloseStream(stream network.Stream)

func GetHandler

func GetHandler(kind string) func(read KindReader, write KindWriter)

func GetHandlers

func GetHandlers() map[string]KindHandler

func IsKindBlocked

func IsKindBlocked(kind int, settings *types.RelaySettings) bool

func IsTheKindAllowed

func IsTheKindAllowed(kind int, settings *types.RelaySettings) bool

func LoadRelaySettings

func LoadRelaySettings() (*types.RelaySettings, error)

func RegisterHandler

func RegisterHandler(kind string, handler func(read KindReader, write KindWriter)) error

func Responder

func Responder(stream network.Stream, messageType string, params ...interface{})

responder sends a response string through the given network stream

func TimeCheck

func TimeCheck(eventCreatedAt int64) bool

Check if the event is pretending it can time travel

func ValidateEvent

func ValidateEvent(write KindWriter, env nostr.EventEnvelope, expectedKind int) bool

Gerneric event validation that almost all kinds will use

Types

type KindHandler

type KindHandler func(read KindReader, write KindWriter)

type KindReader

type KindReader func() ([]byte, error)

type KindWriter

type KindWriter func(messageType string, params ...interface{})

Jump to

Keyboard shortcuts

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