stream

package
v0.0.0-...-f274180 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NopCloseWriterAdapter

func NopCloseWriterAdapter(stream io.ReadWriter) *nopCloseWriterAdapter

func Pipe

func Pipe(tunnelConn, originConn io.ReadWriter, log *zerolog.Logger)

Pipe copies copy data to & from provided io.ReadWriters.

func PipeBidirectional

func PipeBidirectional(downstream, upstream Stream, maxWaitForSecondStream time.Duration, log *zerolog.Logger) error

PipeBidirectional copies data two BidirectionStreams. It is a special case of Pipe where it receives a concept that allows for Read and Write side to be closed independently. The main difference is that when piping data from a reader to a writer, if EOF is read, then this implementation propagates the EOF signal to the destination/writer by closing the write side of the Bidirectional Stream. Finally, depending on once EOF is ready from one of the provided streams, the other direction of streaming data will have a configured time period to also finish, otherwise, the method will return immediately with a timeout error. It is however, the responsability of the caller to close the associated streams in both ends in order to free all the resources/go-routines.

Types

type DebugStream

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

DebugStream will tee each read and write to the output logger as a debug message

func NewDebugStream

func NewDebugStream(stream io.ReadWriter, logger *zerolog.Logger, max uint64) *DebugStream

func (*DebugStream) Read

func (d *DebugStream) Read(p []byte) (n int, err error)

func (*DebugStream) Write

func (d *DebugStream) Write(p []byte) (n int, err error)

type Reader

type Reader interface {
	io.Reader
}

type Stream

type Stream interface {
	Reader
	WriterCloser
}

type WriteCloser

type WriteCloser interface {
	CloseWrite() error
}

type WriterCloser

type WriterCloser interface {
	io.Writer
	WriteCloser
}

Jump to

Keyboard shortcuts

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