websocket

package
v0.0.0-...-9b41daf Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2024 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AddressStatusAvailable = "available"
	AddressStatusAllocated = "allocated"
	AddressStatusUsed      = "used"
)

Variables

This section is empty.

Functions

func AuthenticateConnection

func AuthenticateConnection(ws *websocket.Conn) error

func BuildServer

func BuildServer(store stores.Store) *fiber.App

func CreateNIP88Event

func CreateNIP88Event(relayPrivKey *btcec.PrivateKey, userPubKey string, store stores.Store) error

func GetListenerChallenge

func GetListenerChallenge(ws *websocket.Conn) (*string, error)

func PackRelayForSig

func PackRelayForSig(nr *NIP11RelayInfo) []byte

func SignRelay

func SignRelay(relay *NIP11RelayInfo, privKey *btcec.PrivateKey) error

func StartServer

func StartServer(app *fiber.App) error

Types

type Event

type Event interface {
	HandleEvent(c *websocket.Conn, ctx context.Context, host *host.Host) error // Adapt HostType accordingly
}

type EventMessage

type EventMessage struct {
	Event nostr.Event // Adapted for the specific event structure you're using
}

type HornetExtension

type HornetExtension struct {
	LibP2PID    string    `json:"libp2p_id"`
	LibP2PAddrs []string  `json:"libp2p_addrs"`
	Signature   string    `json:"signature"`
	LastUpdated time.Time `json:"last_updated"`
}

type ListenerData

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

type Message

type Message struct {
	MessageType string          `json:"messageType"`
	Event       json.RawMessage `json:"event"`
}

type NIP11RelayInfo

type NIP11RelayInfo struct {
	Name            string           `json:"name,omitempty"`
	Description     string           `json:"description,omitempty"`
	Pubkey          string           `json:"pubkey,omitempty"`
	Contact         string           `json:"contact,omitempty"`
	SupportedNIPs   []int            `json:"supported_nips,omitempty"`
	Software        string           `json:"software,omitempty"`
	Version         string           `json:"version,omitempty"`
	HornetExtension *HornetExtension `json:"hornet_extension,omitempty"` // custom extension for p2p context
}

TODO: maybe we should move this into a different package since we use it in the sync package as well It certainly shouldn't be here, that's for sure

func GetRelayInfo

func GetRelayInfo() NIP11RelayInfo

type ReqEnvelope

type ReqEnvelope struct {
	SubscriptionID string
	nostr.Filter
}

type Subscription

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

Jump to

Keyboard shortcuts

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