1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-07-01 11:35:23 +00:00
v2fly/transport/pipe/writer.go

26 lines
606 B
Go
Raw Normal View History

2018-04-16 12:57:13 +00:00
package pipe
import (
"github.com/v2fly/v2ray-core/v5/common/buf"
2018-04-16 12:57:13 +00:00
)
2018-04-18 13:40:43 +00:00
// Writer is a buf.Writer that writes data into a pipe.
2018-04-16 12:57:13 +00:00
type Writer struct {
pipe *pipe
}
2018-04-18 13:40:43 +00:00
// WriteMultiBuffer implements buf.Writer.
2018-04-16 12:57:13 +00:00
func (w *Writer) WriteMultiBuffer(mb buf.MultiBuffer) error {
return w.pipe.WriteMultiBuffer(mb)
}
2018-04-18 13:40:43 +00: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 12:57:13 +00:00
func (w *Writer) Close() error {
return w.pipe.Close()
}
2018-12-31 20:25:10 +00:00
// Interrupt implements common.Interruptible.
func (w *Writer) Interrupt() {
w.pipe.Interrupt()
2018-04-16 12:57:13 +00:00
}