github.com/xraypb/xray-core@v1.6.6/transport/pipe/reader.go (about) 1 package pipe 2 3 import ( 4 "time" 5 6 "github.com/xraypb/xray-core/common/buf" 7 ) 8 9 // Reader is a buf.Reader that reads content from a pipe. 10 type Reader struct { 11 pipe *pipe 12 } 13 14 // ReadMultiBuffer implements buf.Reader. 15 func (r *Reader) ReadMultiBuffer() (buf.MultiBuffer, error) { 16 return r.pipe.ReadMultiBuffer() 17 } 18 19 // ReadMultiBufferTimeout reads content from a pipe within the given duration, or returns buf.ErrTimeout otherwise. 20 func (r *Reader) ReadMultiBufferTimeout(d time.Duration) (buf.MultiBuffer, error) { 21 return r.pipe.ReadMultiBufferTimeout(d) 22 } 23 24 // Interrupt implements common.Interruptible. 25 func (r *Reader) Interrupt() { 26 r.pipe.Interrupt() 27 }