diff options
Diffstat (limited to 'pkg/payload/payload.go')
-rwxr-xr-x | pkg/payload/payload.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/pkg/payload/payload.go b/pkg/payload/payload.go index fac36852..bf3972aa 100755 --- a/pkg/payload/payload.go +++ b/pkg/payload/payload.go @@ -1,5 +1,7 @@ package payload +import "unsafe" + // Payload carries binary header and body to stack and // back to the server. type Payload struct { @@ -12,5 +14,10 @@ type Payload struct { // String returns payload body as string func (p *Payload) String() string { - return string(p.Body) + return toString(p.Body) +} + +// unsafe, but lightning fast []byte to string conversion +func toString(data []byte) string { + return *(*string)(unsafe.Pointer(&data)) } |