1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-22 10:08:15 -05:00
v2fly/transport/pipe/writer.go

26 lines
606 B
Go
Raw Normal View History

2018-04-16 08:57:13 -04:00
package pipe
import (
"github.com/v2fly/v2ray-core/v5/common/buf"
2018-04-16 08:57:13 -04:00
)
2018-04-18 09:40:43 -04:00
// Writer is a buf.Writer that writes data into a pipe.
2018-04-16 08:57:13 -04:00
type Writer struct {
pipe *pipe
}
2018-04-18 09:40:43 -04:00
// WriteMultiBuffer implements buf.Writer.
2018-04-16 08:57:13 -04:00
func (w *Writer) WriteMultiBuffer(mb buf.MultiBuffer) error {
return w.pipe.WriteMultiBuffer(mb)
}
2018-04-18 09:40:43 -04:00
// Close implements io.Closer. After the pipe is closed, writing to the pipe will return io.ErrClosedPipe, while reading will return io.EOF.
2018-04-16 08:57:13 -04:00
func (w *Writer) Close() error {
return w.pipe.Close()
}
2018-12-31 15:25:10 -05:00
// Interrupt implements common.Interruptible.
func (w *Writer) Interrupt() {
w.pipe.Interrupt()
2018-04-16 08:57:13 -04:00
}