Versions in this module Expand all Collapse all v1 v1.8.5 Sep 3, 2023 Changes in this version + const Size + var ErrNotTimeoutReader = newError("not a TimeoutReader") + var ErrReadTimeout = newError("IO timeout") + func Copy(reader Reader, writer Writer, options ...CopyOption) error + func CopyOnceTimeout(reader Reader, writer Writer, timeout time.Duration) error + func IsReadError(err error) bool + func IsWriteError(err error) bool + func MergeMulti(dest MultiBuffer, src MultiBuffer) (MultiBuffer, MultiBuffer) + func ReadAllToBytes(reader io.Reader) ([]byte, error) + func SplitFirst(mb MultiBuffer) (MultiBuffer, *Buffer) + func SplitMulti(mb MultiBuffer, i int) (MultiBuffer, MultiBuffer) + func SplitSize(mb MultiBuffer, size int32) (MultiBuffer, MultiBuffer) + func WriteAllBytes(writer io.Writer, payload []byte, c stats.Counter) error + type Buffer struct + UDP *net.Destination + func FromBytes(b []byte) *Buffer + func New() *Buffer + func NewExisted(b []byte) *Buffer + func ReadBuffer(r io.Reader) (*Buffer, error) + func StackNew() Buffer + func (b *Buffer) Advance(from int32) + func (b *Buffer) Byte(index int32) byte + func (b *Buffer) Bytes() []byte + func (b *Buffer) BytesFrom(from int32) []byte + func (b *Buffer) BytesRange(from, to int32) []byte + func (b *Buffer) BytesTo(to int32) []byte + func (b *Buffer) Check() + func (b *Buffer) Clear() + func (b *Buffer) Extend(n int32) []byte + func (b *Buffer) IsEmpty() bool + func (b *Buffer) IsFull() bool + func (b *Buffer) Len() int32 + func (b *Buffer) Read(data []byte) (int, error) + func (b *Buffer) ReadByte() (byte, error) + func (b *Buffer) ReadBytes(length int32) ([]byte, error) + func (b *Buffer) ReadFrom(reader io.Reader) (int64, error) + func (b *Buffer) ReadFullFrom(reader io.Reader, size int32) (int64, error) + func (b *Buffer) Release() + func (b *Buffer) Resize(from, to int32) + func (b *Buffer) SetByte(index int32, value byte) + func (b *Buffer) String() string + func (b *Buffer) Write(data []byte) (int, error) + func (b *Buffer) WriteByte(v byte) error + func (b *Buffer) WriteString(s string) (int, error) + type BufferToBytesWriter struct + func (w *BufferToBytesWriter) ReadFrom(reader io.Reader) (int64, error) + func (w *BufferToBytesWriter) WriteMultiBuffer(mb MultiBuffer) error + type BufferedReader struct + Buffer MultiBuffer + Reader Reader + Spliter func(MultiBuffer, []byte) (MultiBuffer, int) + func (r *BufferedReader) BufferedBytes() int32 + func (r *BufferedReader) Close() error + func (r *BufferedReader) Interrupt() + func (r *BufferedReader) Read(b []byte) (int, error) + func (r *BufferedReader) ReadAtMost(size int32) (MultiBuffer, error) + func (r *BufferedReader) ReadByte() (byte, error) + func (r *BufferedReader) ReadMultiBuffer() (MultiBuffer, error) + func (r *BufferedReader) WriteTo(writer io.Writer) (int64, error) + type BufferedWriter struct + func NewBufferedWriter(writer Writer) *BufferedWriter + func (w *BufferedWriter) Close() error + func (w *BufferedWriter) Flush() error + func (w *BufferedWriter) ReadFrom(reader io.Reader) (int64, error) + func (w *BufferedWriter) SetBuffered(f bool) error + func (w *BufferedWriter) Write(b []byte) (int, error) + func (w *BufferedWriter) WriteByte(c byte) error + func (w *BufferedWriter) WriteMultiBuffer(b MultiBuffer) error + type CopyOption func(*copyHandler) + func CountSize(sc *SizeCounter) CopyOption + func UpdateActivity(timer signal.ActivityUpdater) CopyOption + type EndpointOverrideReader struct + Dest net.Address + OriginalDest net.Address + func (r *EndpointOverrideReader) ReadMultiBuffer() (MultiBuffer, error) + type EndpointOverrideWriter struct + Dest net.Address + OriginalDest net.Address + func (w *EndpointOverrideWriter) WriteMultiBuffer(mb MultiBuffer) error + type MultiBuffer []*Buffer + func Compact(mb MultiBuffer) MultiBuffer + func MergeBytes(dest MultiBuffer, src []byte) MultiBuffer + func ReadFrom(reader io.Reader) (MultiBuffer, error) + func ReleaseMulti(mb MultiBuffer) MultiBuffer + func SplitBytes(mb MultiBuffer, b []byte) (MultiBuffer, int) + func SplitFirstBytes(mb MultiBuffer, p []byte) (MultiBuffer, int) + func WriteMultiBuffer(writer io.Writer, mb MultiBuffer) (MultiBuffer, error) + func (mb MultiBuffer) Copy(b []byte) int + func (mb MultiBuffer) IsEmpty() bool + func (mb MultiBuffer) Len() int32 + func (mb MultiBuffer) String() string + type MultiBufferContainer struct + func (c *MultiBufferContainer) Close() error + func (c *MultiBufferContainer) Read(b []byte) (int, error) + func (c *MultiBufferContainer) ReadMultiBuffer() (MultiBuffer, error) + func (c *MultiBufferContainer) Write(b []byte) (int, error) + func (c *MultiBufferContainer) WriteMultiBuffer(b MultiBuffer) error + type PacketReader struct + func (r *PacketReader) ReadMultiBuffer() (MultiBuffer, error) + type ReadVReader struct — darwin/amd64, linux/amd64, windows/amd64 + func NewReadVReader(reader io.Reader, rawConn syscall.RawConn, counter stats.Counter) *ReadVReader + func (r *ReadVReader) ReadMultiBuffer() (MultiBuffer, error) + type Reader interface + ReadMultiBuffer func() (MultiBuffer, error) + func NewPacketReader(reader io.Reader) Reader + func NewReadVReader(reader io.Reader, rawConn syscall.RawConn) Reader + func NewReader(reader io.Reader) Reader + type SequentialWriter struct + func (w *SequentialWriter) WriteMultiBuffer(mb MultiBuffer) error + type SingleReader struct + func (r *SingleReader) ReadMultiBuffer() (MultiBuffer, error) + type SizeCounter struct + Size int64 + type TimeoutReader interface + ReadMultiBufferTimeout func(time.Duration) (MultiBuffer, error) + type Writer interface + WriteMultiBuffer func(MultiBuffer) error + var Discard Writer = noOpWriter(0) + var DiscardBytes io.Writer = noOpWriter(0) + func NewWriter(writer io.Writer) Writer