copier

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package copier provides a utility type for simplex proxy connections.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Copier

type Copier struct {
	// Activity will be called if it is non-nil whenever traffic
	// has been copied.
	Activity func(written int64)
	From     DeadlineReader
	To       DeadlineWriter
	// The period of time to wait before interrupting a copy to check
	// for Context cancellation or to report the number of bytes copied.
	WakePeriod time.Duration
}

Copier implements a simplex proxy connection.

func (*Copier) Copy

func (c *Copier) Copy(ctx context.Context) error

Copy executes the given copy operation, but adds an occasional check for context cancellation.

func (*Copier) MarshalYAML added in v0.1.2

func (c *Copier) MarshalYAML() (interface{}, error)

MarshalYAML implements yaml.Marshaler and provides diagnostic information.

func (*Copier) String

func (c *Copier) String() string

type DeadlineReader added in v0.1.2

type DeadlineReader interface {
	io.Reader
	SetReadDeadline(time.Time) error
}

DeadlineReader is under pressure to perform.

type DeadlineWriter added in v0.1.2

type DeadlineWriter interface {
	io.Writer
	SetWriteDeadline(time.Time) error
}

DeadlineWriter is under pressure to perform.

Jump to

Keyboard shortcuts

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