From e2acec745c2260a99358ef9471d2cf5cef660875 Mon Sep 17 00:00:00 2001 From: v2ray Date: Tue, 15 Dec 2015 00:53:27 +0100 Subject: [PATCH] Add a bytes method to alloc.buffer --- common/alloc/buffer.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/common/alloc/buffer.go b/common/alloc/buffer.go index 4cd57afe..ba7a6660 100644 --- a/common/alloc/buffer.go +++ b/common/alloc/buffer.go @@ -40,6 +40,10 @@ func (b *Buffer) Append(data []byte) *Buffer { return b } +func (b *Buffer) Bytes() []byte { + return b.Value +} + // Slice cuts the buffer at the given position. func (b *Buffer) Slice(from, to int) *Buffer { b.Value = b.Value[from:to]