swarmutil

package
v0.0.0-...-d4b7e32 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2023 License: MPL-2.0 Imports: 12 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateSelfSigned

func GenerateSelfSigned(privKey crypto.Signer) tls.Certificate

Types

type AskHub

type AskHub[A p2p.Addr] struct {
	// contains filtered or unexported fields
}

func NewAskHub

func NewAskHub[A p2p.Addr]() AskHub[A]

func (*AskHub[A]) Close

func (q *AskHub[A]) Close() error

func (*AskHub[A]) CloseWithError

func (q *AskHub[A]) CloseWithError(err error)

func (*AskHub[A]) Deliver

func (q *AskHub[A]) Deliver(ctx context.Context, respData []byte, msg p2p.Message[A]) (int, error)

func (*AskHub[A]) ServeAsk

func (q *AskHub[A]) ServeAsk(ctx context.Context, fn func(context.Context, []byte, p2p.Message[A]) int) error

func (*AskHub[A]) String

func (q *AskHub[A]) String() string

type ErrList

type ErrList []error

func (*ErrList) Add

func (ec *ErrList) Add(err error)

func (ErrList) Err

func (ec ErrList) Err() error

type LimitWriter

type LimitWriter struct {
	W io.Writer
	N int
	// contains filtered or unexported fields
}

func (*LimitWriter) Write

func (lw *LimitWriter) Write(p []byte) (n int, err error)

type Queue

type Queue[A p2p.Addr] struct {
	// contains filtered or unexported fields
}

func NewQueue

func NewQueue[A p2p.Addr](maxLen, mtu int) Queue[A]

func (*Queue[A]) Cap

func (q *Queue[A]) Cap() int

func (*Queue[A]) Close

func (q *Queue[A]) Close() error

func (*Queue[A]) Deliver

func (q *Queue[A]) Deliver(m p2p.Message[A]) bool

Deliver does not block. It immediately returns true if the message was accepted. Reasons for refusing the message could be that the queue is full, closed, or the message exceeds the mtu.

func (*Queue[A]) DeliverVec

func (q *Queue[A]) DeliverVec(src, dst A, v p2p.IOVec) bool

func (*Queue[A]) IsClosed

func (q *Queue[A]) IsClosed() bool

func (*Queue[A]) Len

func (q *Queue[A]) Len() int

func (*Queue[A]) Purge

func (q *Queue[A]) Purge() (count int)

Purge empties the queue and returns the number purged.

func (*Queue[A]) Receive

func (q *Queue[A]) Receive(ctx context.Context, fn func(p2p.Message[A])) error

type TellHub

type TellHub[A p2p.Addr] struct {
	// contains filtered or unexported fields
}

func NewTellHub

func NewTellHub[A p2p.Addr]() TellHub[A]

func (*TellHub[A]) CloseWithError

func (q *TellHub[A]) CloseWithError(err error)

func (*TellHub[A]) Deliver

func (q *TellHub[A]) Deliver(ctx context.Context, m p2p.Message[A]) error

Deliver delivers a message to a caller of Recv If Deliver returns an error it will be from the context expiring.

func (*TellHub[A]) Receive

func (q *TellHub[A]) Receive(ctx context.Context, fn func(p2p.Message[A])) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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