mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-12-27 04:27:20 -05:00
simplify code
This commit is contained in:
parent
5c2cabb44e
commit
d6988f1a63
@ -67,8 +67,5 @@ func (w *Writer) Close() {
|
|||||||
frame := buf.New()
|
frame := buf.New()
|
||||||
frame.AppendSupplier(meta.AsSupplier())
|
frame.AppendSupplier(meta.AsSupplier())
|
||||||
|
|
||||||
mb := buf.NewMultiBuffer()
|
w.writer.Write(buf.NewMultiBufferValue(frame))
|
||||||
mb.Append(frame)
|
|
||||||
|
|
||||||
w.writer.Write(mb)
|
|
||||||
}
|
}
|
||||||
|
@ -28,9 +28,7 @@ func (v *NoneResponse) WriteTo(buf.Writer) {}
|
|||||||
func (v *HTTPResponse) WriteTo(writer buf.Writer) {
|
func (v *HTTPResponse) WriteTo(writer buf.Writer) {
|
||||||
b := buf.NewLocal(512)
|
b := buf.NewLocal(512)
|
||||||
b.AppendSupplier(serial.WriteString(http403response))
|
b.AppendSupplier(serial.WriteString(http403response))
|
||||||
mb := buf.NewMultiBuffer()
|
writer.Write(buf.NewMultiBufferValue(b))
|
||||||
mb.Append(b)
|
|
||||||
writer.Write(mb)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetInternalResponse converts response settings from proto to internal data structure.
|
// GetInternalResponse converts response settings from proto to internal data structure.
|
||||||
|
@ -100,10 +100,7 @@ func (v *ChunkReader) Read() (buf.MultiBuffer, error) {
|
|||||||
}
|
}
|
||||||
buffer.SliceFrom(AuthSize)
|
buffer.SliceFrom(AuthSize)
|
||||||
|
|
||||||
mb := buf.NewMultiBuffer()
|
return buf.NewMultiBufferValue(buffer), nil
|
||||||
mb.Append(buffer)
|
|
||||||
|
|
||||||
return mb, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type ChunkWriter struct {
|
type ChunkWriter struct {
|
||||||
|
@ -374,9 +374,7 @@ func (v *UDPReader) Read() (buf.MultiBuffer, error) {
|
|||||||
buffer.Release()
|
buffer.Release()
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
mb := buf.NewMultiBuffer()
|
return buf.NewMultiBufferValue(payload), nil
|
||||||
mb.Append(payload)
|
|
||||||
return mb, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type UDPWriter struct {
|
type UDPWriter struct {
|
||||||
|
@ -358,9 +358,7 @@ func (r *UDPReader) Read() (buf.MultiBuffer, error) {
|
|||||||
}
|
}
|
||||||
b.Clear()
|
b.Clear()
|
||||||
b.Append(data)
|
b.Append(data)
|
||||||
mb := buf.NewMultiBuffer()
|
return buf.NewMultiBufferValue(b), nil
|
||||||
mb.Append(b)
|
|
||||||
return mb, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type UDPWriter struct {
|
type UDPWriter struct {
|
||||||
|
Loading…
Reference in New Issue
Block a user