mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-04-18 13:35:56 +00:00
30 lines
656 B
Go
30 lines
656 B
Go
|
|
package pipe
|
||
|
|
|
||
|
|
import (
|
||
|
|
"github.com/xtls/xray-core/common/buf"
|
||
|
|
)
|
||
|
|
|
||
|
|
// Writer is a buf.Writer that writes data into a pipe.
|
||
|
|
type Writer struct {
|
||
|
|
pipe *pipe
|
||
|
|
}
|
||
|
|
|
||
|
|
// WriteMultiBuffer implements buf.Writer.
|
||
|
|
func (w *Writer) WriteMultiBuffer(mb buf.MultiBuffer) error {
|
||
|
|
return w.pipe.WriteMultiBuffer(mb)
|
||
|
|
}
|
||
|
|
|
||
|
|
// Close implements io.Closer. After the pipe is closed, writing to the pipe will return io.ErrClosedPipe, while reading will return io.EOF.
|
||
|
|
func (w *Writer) Close() error {
|
||
|
|
return w.pipe.Close()
|
||
|
|
}
|
||
|
|
|
||
|
|
func (w *Writer) Len() int32 {
|
||
|
|
return w.pipe.Len()
|
||
|
|
}
|
||
|
|
|
||
|
|
// Interrupt implements common.Interruptible.
|
||
|
|
func (w *Writer) Interrupt() {
|
||
|
|
w.pipe.Interrupt()
|
||
|
|
}
|