client

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2024 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DiscoveryLimit int = 512

	DefaultMaxPeers    int = 16
	DefaultMaxParallel int = 64
	MaxStreamsPerSend  int = 16

	RefreshPeersInterval time.Duration = 30 * time.Second

	SendToPeerTimeout time.Duration = 10 * time.Second
	ConnectTimeout    time.Duration = 500 * time.Millisecond
)

Functions

This section is empty.

Types

type Client

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

func New

func New(node peer.Node, path string, opts ...Option[Client]) (*Client, error)

func (*Client) Close

func (c *Client) Close()

func (*Client) Context

func (c *Client) Context() context.Context

func (*Client) New

func (c *Client) New(cmd string, opts ...Option[Request]) *Request

func (*Client) Send

func (c *Client) Send(cmd string, body command.Body, peers ...peerCore.ID) (cr.Response, error)

type Option

type Option[T Client | Request] func(r *T) error

func Body

func Body(body command.Body) Option[Request]

func Parallel

func Parallel(max int) Option[Client]

func Peers

func Peers(max int) Option[Client]

client option

func Threshold

func Threshold(threshold int) Option[Request]

func Timeout

func Timeout(timeout time.Duration) Option[Request]

request options

func To

func To(peers ...peerCore.ID) Option[Request]

type Request

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

func (*Request) Do

func (r *Request) Do() (<-chan *Response, error)

type Response

type Response struct {
	io.ReadWriter

	cr.Response
	// contains filtered or unexported fields
}

func (*Response) Close

func (r *Response) Close()

func (*Response) CloseRead

func (r *Response) CloseRead()

func (*Response) CloseWrite

func (r *Response) CloseWrite()

func (*Response) Error

func (r *Response) Error() error

func (*Response) PID

func (r *Response) PID() peerCore.ID

Jump to

Keyboard shortcuts

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