mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-01-05 00:47:51 -05:00
comments
This commit is contained in:
parent
9cc9a76b71
commit
2a96aaaf7b
@ -14,6 +14,7 @@ type Reader interface {
|
|||||||
// ErrReadTimeout is an error that happens with IO timeout.
|
// ErrReadTimeout is an error that happens with IO timeout.
|
||||||
var ErrReadTimeout = newError("IO timeout")
|
var ErrReadTimeout = newError("IO timeout")
|
||||||
|
|
||||||
|
// TimeoutReader is a reader that returns error if Read() operation takes longer than the given timeout.
|
||||||
type TimeoutReader interface {
|
type TimeoutReader interface {
|
||||||
ReadTimeout(time.Duration) (MultiBuffer, error)
|
ReadTimeout(time.Duration) (MultiBuffer, error)
|
||||||
}
|
}
|
||||||
|
@ -161,6 +161,7 @@ func (mb MultiBuffer) ToNetBuffers() net.Buffers {
|
|||||||
return bs
|
return bs
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SliceBySize splits the begining of this MultiBuffer into another one, for at most size bytes.
|
||||||
func (mb *MultiBuffer) SliceBySize(size int) MultiBuffer {
|
func (mb *MultiBuffer) SliceBySize(size int) MultiBuffer {
|
||||||
slice := NewMultiBuffer()
|
slice := NewMultiBuffer()
|
||||||
sliceSize := 0
|
sliceSize := 0
|
||||||
@ -178,6 +179,7 @@ func (mb *MultiBuffer) SliceBySize(size int) MultiBuffer {
|
|||||||
return slice
|
return slice
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SplitFirst splits out the first Buffer in this MultiBuffer.
|
||||||
func (mb *MultiBuffer) SplitFirst() *Buffer {
|
func (mb *MultiBuffer) SplitFirst() *Buffer {
|
||||||
if len(*mb) == 0 {
|
if len(*mb) == 0 {
|
||||||
return nil
|
return nil
|
||||||
|
@ -137,6 +137,9 @@ func (noOpBytesWriter) ReadFrom(reader io.Reader) (int64, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
Discard Writer = noOpWriter{}
|
// Discard is a Writer that swallows all contents written in.
|
||||||
|
Discard Writer = noOpWriter{}
|
||||||
|
|
||||||
|
// DiscardBytes is an io.Writer that swallows all contents written in.
|
||||||
DiscardBytes io.Writer = noOpBytesWriter{}
|
DiscardBytes io.Writer = noOpBytesWriter{}
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user