tcp

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEchoData  = errors.New("incorrect echo data")
	ErrEmptyConn = errors.New("empty conn")
)

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(dialer *net.Dialer, host string) *Client

func (*Client) Connect

func (client *Client) Connect() (err error)

func (*Client) Disconnect

func (client *Client) Disconnect() (err error)

func (*Client) Download

func (client *Client) Download()

func (*Client) PingContext

func (client *Client) PingContext(ctx context.Context) (int64, error)

PingContext Measure latency(RTT) between client and server. We use the 2RTT method to obtain three RTT result in order to get more data in less time (t2-t0, t4-t2, t3-t1). And give lower weight to the delay measured by the server. local factor = 0.4 * 2 and remote factor = 0.2 latency = 0.4 * (t2 - t0) + 0.4 * (t4 - t2) + 0.2 * (t3 - t1) @return cumulative delay in nanoseconds

func (*Client) Read

func (client *Client) Read() ([]byte, error)

func (*Client) Upload

func (client *Client) Upload()

func (*Client) Version

func (client *Client) Version() string

func (*Client) Write

func (client *Client) Write(data []byte) (err error)

Jump to

Keyboard shortcuts

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