1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-11-16 09:26:21 -05:00
v2fly/common/io/transport.go
2016-04-18 18:44:10 +02:00

17 lines
229 B
Go

package io
func Pipe(reader Reader, writer Writer) error {
for {
buffer, err := reader.Read()
if buffer.Len() > 0 {
err = writer.Write(buffer)
} else {
buffer.Release()
}
if err != nil {
return nil
}
}
}