1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-22 01:57:12 -05:00

restrict multi-writer to syscall.conn only

This commit is contained in:
Darien Raymond 2018-08-08 10:22:59 +02:00
parent 63c7f5e686
commit f27a381fe8
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169

View File

@ -79,6 +79,13 @@ func NewWriter(writer io.Writer) Writer {
return mw
}
if _, ok := writer.(syscall.Conn); !ok {
// If the writer doesn't implement syscall.Conn, it is probably not a TCP connection.
return &SequentialWriter{
Writer: writer,
}
}
return &BufferToBytesWriter{
Writer: writer,
}