help

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CancelSub

func CancelSub(ctx context.Context, t *testing.T, subID messages.SubscriptionID, conn *websocket.Conn)

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, conn *websocket.Conn, id event.ID, timeout time.Duration) (event.Event, bool)

func ListenForEventsOnSub

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

func NewConnection

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

func Publish

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

func RequestSub

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

func SetDefaultURI added in v0.1.7

func SetDefaultURI(uri string)

Types

type Closer

type Closer func()

func NewSocket

func NewSocket(ctx context.Context, t require.TestingT, opts ...SocketOpts) (*websocket.Conn, 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 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