diff --git a/app/proxyman/mux/writer.go b/app/proxyman/mux/writer.go index 30b76e28e..a2f802628 100644 --- a/app/proxyman/mux/writer.go +++ b/app/proxyman/mux/writer.go @@ -67,8 +67,5 @@ func (w *Writer) Close() { frame := buf.New() frame.AppendSupplier(meta.AsSupplier()) - mb := buf.NewMultiBuffer() - mb.Append(frame) - - w.writer.Write(mb) + w.writer.Write(buf.NewMultiBufferValue(frame)) } diff --git a/proxy/blackhole/config.go b/proxy/blackhole/config.go index 7633fc85d..837b997cd 100644 --- a/proxy/blackhole/config.go +++ b/proxy/blackhole/config.go @@ -28,9 +28,7 @@ func (v *NoneResponse) WriteTo(buf.Writer) {} func (v *HTTPResponse) WriteTo(writer buf.Writer) { b := buf.NewLocal(512) b.AppendSupplier(serial.WriteString(http403response)) - mb := buf.NewMultiBuffer() - mb.Append(b) - writer.Write(mb) + writer.Write(buf.NewMultiBufferValue(b)) } // GetInternalResponse converts response settings from proto to internal data structure. diff --git a/proxy/shadowsocks/ota.go b/proxy/shadowsocks/ota.go index 0c8fbd26f..56d8a87b7 100644 --- a/proxy/shadowsocks/ota.go +++ b/proxy/shadowsocks/ota.go @@ -100,10 +100,7 @@ func (v *ChunkReader) Read() (buf.MultiBuffer, error) { } buffer.SliceFrom(AuthSize) - mb := buf.NewMultiBuffer() - mb.Append(buffer) - - return mb, nil + return buf.NewMultiBufferValue(buffer), nil } type ChunkWriter struct { diff --git a/proxy/shadowsocks/protocol.go b/proxy/shadowsocks/protocol.go index daec7b61e..d4f567bf1 100644 --- a/proxy/shadowsocks/protocol.go +++ b/proxy/shadowsocks/protocol.go @@ -374,9 +374,7 @@ func (v *UDPReader) Read() (buf.MultiBuffer, error) { buffer.Release() return nil, err } - mb := buf.NewMultiBuffer() - mb.Append(payload) - return mb, nil + return buf.NewMultiBufferValue(payload), nil } type UDPWriter struct { diff --git a/proxy/socks/protocol.go b/proxy/socks/protocol.go index 0175f8a27..c6dd66482 100644 --- a/proxy/socks/protocol.go +++ b/proxy/socks/protocol.go @@ -358,9 +358,7 @@ func (r *UDPReader) Read() (buf.MultiBuffer, error) { } b.Clear() b.Append(data) - mb := buf.NewMultiBuffer() - mb.Append(b) - return mb, nil + return buf.NewMultiBufferValue(b), nil } type UDPWriter struct {