func (m Message) Clone() *Message {
	header := *m.Header
	c := GetPooledMsg()
	header.SetCompressType(None)
	c.Header = &header
	c.ServicePath = m.ServicePath
	c.ServiceMethod = m.ServiceMethod
	c.NodeId = m.NodeId
	c.SessionId = m.SessionId
	c.UserId = m.UserId
	return c
}
Clone clones from an message.
package protocol
import (
	"bytes"
	"encoding/binary"
	"errors"
	"fmt"
	"github.com/kudoochui/kudos/rpcx/util"
	"io"
)
var (
	bufferPool = util.NewLimitedPool(512, 4096)
)
var (
	Compressors = map[CompressType]Compressor{
		None: &RawDataCompressor{},
		Gzip: &GzipCompressor{},
	}
)
var MaxMessageLength = 0
const (
	magicNumber byte = 0x08
)
func MagicNumber() byte {
	return magicNumber
}
var (
	ErrMetaKVMissing = errors.New("wrong metadata lines. some keys or values are missing")
	ErrMessageTooLong = errors.New("message is too long")
	ErrUnsupportedCompressor = errors.New("unsupported compressor")
)
const (
	ServiceError = "__rpcx_error__"
)
type MessageType byte
const (
	Request MessageType = iota
	Response
)
type MessageStatusType byte
const (
	Normal MessageStatusType = iota
	Error
)
type CompressType byte
const (
	None CompressType = iota
	Gzip
)
type SerializeType byte
const (
	SerializeNone SerializeType = iota
	JSON
	ProtoBuffer
	MsgPack
	Thrift
)
type Message struct {
	*Header
	NodeId		string
	SessionId	int64
	UserId 		int64
	ServicePath   string
	ServiceMethod string
	Metadata      map[string]string
	Payload       []byte
	data          []byte
}
func NewMessage() *Message {
	header := Header([12]byte{})
	header[0] = magicNumber
	return &Message{
		Header: &header,
	}
}
type Header [12]byte
func (h Header) CheckMagicNumber() bool {
	return h[0] == magicNumber
}
func (h Header) Version() byte {
	return h[1]
}
func (h *Header) SetVersion(v byte) {
	h[1] = v
}
func (h Header) MessageType() MessageType {
	return MessageType(h[2]&0x80) >> 7
}
func (h *Header) SetMessageType(mt MessageType) {
	h[2] = h[2] | (byte(mt) << 7)
}
func (h Header) IsHeartbeat() bool {
	return h[2]&0x40 == 0x40
}
func (h *Header) SetHeartbeat(hb bool) {
	if hb {
		h[2] = h[2] | 0x40
	} else {
		h[2] = h[2] &^ 0x40
	}
}
func (h Header) IsOneway() bool {
	return h[2]&0x20 == 0x20
}
func (h *Header) SetOneway(oneway bool) {
	if oneway {
		h[2] = h[2] | 0x20
	} else {
		h[2] = h[2] &^ 0x20
	}
}
func (h Header) CompressType() CompressType {
	return CompressType((h[2] & 0x1C) >> 2)
}
func (h *Header) SetCompressType(ct CompressType) {
	h[2] = (h[2] &^ 0x1C) | ((byte(ct) << 2) & 0x1C)
}
func (h Header) MessageStatusType() MessageStatusType {
	return MessageStatusType(h[2] & 0x03)
}
func (h *Header) SetMessageStatusType(mt MessageStatusType) {
	h[2] = (h[2] &^ 0x03) | (byte(mt) & 0x03)
}
func (h Header) SerializeType() SerializeType {
	return SerializeType((h[3] & 0xF0) >> 4)
}
func (h *Header) SetSerializeType(st SerializeType) {
	h[3] = (h[3] &^ 0xF0) | (byte(st) << 4)
}
func (h Header) Seq() uint64 {
	return binary.BigEndian.Uint64(h[4:])
}
func (h *Header) SetSeq(seq uint64) {
	binary.BigEndian.PutUint64(h[4:], seq)
}