help

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloseSubscription added in v0.1.8

func CloseSubscription(ctx context.Context, t *testing.T, subID messages.SubscriptionID, conn MsgWriter)

func Event added in v0.1.7

func Event(t require.TestingT, opts ...EventOptions) event.Event

func EventWithContent added in v0.1.7

func EventWithContent(t require.TestingT, content string) event.Event

func EventWithCreatedAt added in v0.1.7

func EventWithCreatedAt(t require.TestingT, createdAt time.Time) event.Event

func EventWithKind added in v0.1.7

func EventWithKind(t require.TestingT, kind int) event.Event

func EventWithPTagReferenceTo added in v0.1.7

func EventWithPTagReferenceTo(t require.TestingT, pubKey event.PubKey) event.Event

func EventWithPrivKey added in v0.1.7

func EventWithPrivKey(t require.TestingT, pk PrivKey) event.Event

func EventWithTags added in v0.1.7

func EventWithTags(t require.TestingT, tags nostr.Tags) event.Event

func GetEvent added in v0.1.7

func GetEvent(ctx context.Context, t *testing.T, id event.ID) (event.Event, bool)

func ListenForEventsOnSub

func ListenForEventsOnSub(
	ctx context.Context,
	t *testing.T,
	read <-chan MsgRead,
	sub messages.SubscriptionID) chan event.Event

func NewConnection

func NewConnection(t *testing.T) *nostr.Relay

func NewSocket

func NewSocket(ctx context.Context, t require.TestingT, opts ...SocketOpts) (MsgWriter, <-chan MsgRead, Closer)

func Publish

func Publish(ctx context.Context, t require.TestingT, e event.Event, conn MsgWriter)

func ReadEvent

func ReadEvent(ctx context.Context, t *testing.T, read <-chan MsgRead, sub messages.SubscriptionID) (event.Event, bool)

func SetDefaultURI added in v0.1.7

func SetDefaultURI(uri string)

func StoredEvents added in v0.1.8

func StoredEvents(
	t *testing.T,
	read <-chan MsgRead,
	sub messages.SubscriptionID,
	timeout time.Duration) ([]event.Event, error)

Types

type Closer

type Closer func()

func RequestSub

func RequestSub(ctx context.Context, t *testing.T, conn MsgWriter, filters ...messages.Filter) (messages.SubscriptionID, Closer)

type EventOptions

type EventOptions struct {
	PrivKey   PrivKey
	CreatedAt time.Time
	Kind      int
	Tags      nostr.Tags
	Content   string
}

func WithContent added in v0.1.7

func WithContent(content string) EventOptions

func WithCreatedAt added in v0.1.7

func WithCreatedAt(createdAt time.Time) EventOptions

func WithKind added in v0.1.7

func WithKind(kind int) EventOptions

func WithPrivKey added in v0.1.7

func WithPrivKey(pk PrivKey) EventOptions

func WithTags added in v0.1.7

func WithTags(tags nostr.Tags) EventOptions

type MsgRead added in v0.1.8

type MsgRead []byte

type MsgWriter added in v0.1.8

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

func (*MsgWriter) Write added in v0.1.8

func (w *MsgWriter) Write(ctx context.Context, typ websocket.MessageType, p []byte) error

type PrivKey

type PrivKey string

func NewKeyPair

func NewKeyPair(t *testing.T) (PrivKey, event.PubKey)

func (PrivKey) String

func (priv PrivKey) String() string

type PubKey

type PubKey string

func (PubKey) String

func (priv PubKey) String() string

type SocketOpts added in v0.1.7

type SocketOpts struct {
	URI string
}

func WithURI added in v0.1.7

func WithURI(uri string) SocketOpts

Jump to

Keyboard shortcuts

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