1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-11-17 18:06:15 -05:00
v2fly/transport/pipe/reader.go

28 lines
657 B
Go
Raw Normal View History

2018-04-16 08:57:13 -04:00
package pipe
import (
"time"
2021-02-16 15:31:50 -05:00
"github.com/v2fly/v2ray-core/v4/common/buf"
2018-04-16 08:57:13 -04:00
)
2018-04-18 09:40:43 -04:00
// Reader is a buf.Reader that reads content from a pipe.
2018-04-16 08:57:13 -04:00
type Reader struct {
pipe *pipe
}
2018-04-18 09:40:43 -04:00
// ReadMultiBuffer implements buf.Reader.
2018-04-16 08:57:13 -04:00
func (r *Reader) ReadMultiBuffer() (buf.MultiBuffer, error) {
return r.pipe.ReadMultiBuffer()
}
// ReadMultiBufferTimeout reads content from a pipe within the given duration, or returns buf.ErrTimeout otherwise.
func (r *Reader) ReadMultiBufferTimeout(d time.Duration) (buf.MultiBuffer, error) {
return r.pipe.ReadMultiBufferTimeout(d)
2018-04-16 08:57:13 -04:00
}
2018-12-31 15:25:10 -05:00
// Interrupt implements common.Interruptible.
func (r *Reader) Interrupt() {
r.pipe.Interrupt()
2018-04-16 08:57:13 -04:00
}