p2p

package
v0.8.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidResponse = errors.New("server returned an invalid response or caused an internal error")

ErrInvalidResponse is returned when a peer returns an invalid response or caused an internal error. It is used to signal that the peer couldn't serve the data successfully, and should not be retried.

View Source
var ErrUnavailable = errors.New("server cannot serve the requested data at this time")

ErrUnavailable is returned when a peer doesn't have the requested data or doesn't have the capacity to serve it at the moment. It is used to signal that the peer couldn't serve the data successfully, but should be retried later.

Functions

func ProtocolID added in v0.7.0

func ProtocolID(networkID, protocolString string) protocol.ID

ProtocolID creates a protocol ID string according to common format

func RateLimitMiddleware added in v0.7.0

func RateLimitMiddleware(inner network.StreamHandler, concurrencyLimit int) network.StreamHandler

Types

type Parameters added in v0.7.0

type Parameters struct {
	// ServerReadTimeout sets the timeout for reading messages from the stream.
	ServerReadTimeout time.Duration

	// ServerWriteTimeout sets the timeout for writing messages to the stream.
	ServerWriteTimeout time.Duration

	// HandleRequestTimeout defines the deadline for handling request.
	HandleRequestTimeout time.Duration

	// ConcurrencyLimit is the maximum number of concurrently handled streams
	ConcurrencyLimit int
	// contains filtered or unexported fields
}

Parameters is the set of parameters that must be configured for the shrex/eds protocol.

func DefaultParameters added in v0.7.0

func DefaultParameters() *Parameters

func (*Parameters) NetworkID added in v0.7.0

func (p *Parameters) NetworkID() string

NetworkID returns the value of networkID stored in params

func (*Parameters) Validate added in v0.7.0

func (p *Parameters) Validate() error

func (*Parameters) WithNetworkID added in v0.7.0

func (p *Parameters) WithNetworkID(networkID string)

WithNetworkID sets the value of networkID in params

Directories

Path Synopsis
pb
pb
pb

Jump to

Keyboard shortcuts

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