func (h *Header) SetVersion(v byte) {
	h[1] = v
}
SetVersion sets version for this header.
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]
}