split

package
v0.0.0-...-4cf4c4f Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultTimeout time.Duration = 0

DefaultTimeout is the value that will cause DialWithSplitRetry to use the system's default TCP timeout (typically 2-3 minutes).

Variables

This section is empty.

Functions

This section is empty.

Types

type DuplexConn

type DuplexConn interface {
	net.Conn
	io.ReaderFrom
	CloseWrite() error
	CloseRead() error
}

DuplexConn represents a bidirectional stream socket.

func DialWithSplit

func DialWithSplit(d *net.Dialer, addr *net.TCPAddr) (DuplexConn, error)

DialWithSplit returns a TCP connection that always splits the initial upstream segment. Like net.Conn, it is intended for two-threaded use, with one thread calling Read and CloseRead, and another calling Write, ReadFrom, and CloseWrite.

func DialWithSplitRetry

func DialWithSplitRetry(dialer *net.Dialer, addr *net.TCPAddr, stats *RetryStats) (DuplexConn, error)

DialWithSplitRetry returns a TCP connection that transparently retries by splitting the initial upstream segment if the socket closes without receiving a reply. Like net.Conn, it is intended for two-threaded use, with one thread calling Read and CloseRead, and another calling Write, ReadFrom, and CloseWrite. `dialer` will be used to establish the connection. `addr` is the destination. If `stats` is non-nil, it will be populated with retry-related information.

type RetryStats

type RetryStats struct {
	SNI     string // TLS SNI observed, if present.
	Bytes   int32  // Number of bytes uploaded before the retry.
	Chunks  int16  // Number of writes before the retry.
	Split   int16  // Number of bytes in the first retried segment.
	Timeout bool   // True if the retry was caused by a timeout.
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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