Documentation ¶
Index ¶
- func NopCloseWriterAdapter(stream io.ReadWriter) *nopCloseWriterAdapter
- func Pipe(tunnelConn, originConn io.ReadWriter, log *zerolog.Logger)
- func PipeBidirectional(downstream, upstream Stream, maxWaitForSecondStream time.Duration, ...) error
- type DebugStream
- type Reader
- type Stream
- type WriteCloser
- type WriterCloser
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
type Stream ¶
type Stream interface { Reader WriterCloser }
type WriteCloser ¶
type WriteCloser interface {
CloseWrite() error
}
type WriterCloser ¶
type WriterCloser interface { io.Writer WriteCloser }