Documentation
¶
Index ¶
- Constants
- Variables
- type Connect
- type Frame
- func (f *Frame) BodyLength() uint32
- func (f *Frame) BodyType() byte
- func (f *Frame) FixedHead() []byte
- func (f *Frame) MessageId() uint32
- func (f *Frame) Reserved() []byte
- func (f *Frame) SetBodyLength(bl uint32)
- func (f *Frame) SetBodyOnly(body []byte)
- func (f *Frame) SetBodyWithLength(body []byte)
- func (f *Frame) SetMessageId(messageId uint32)
- func (f *Frame) SetReserved(reserved uint32)
- func (f *Frame) SetVersion(version byte)
- func (f *Frame) String() string
- func (f *Frame) Version() byte
- type Server
Constants ¶
View Source
const ( HeadLength = 16 VersionPing byte = 0x00 Version1 byte = 0x01 )
View Source
const ( BodyTypeJSON byte = 0x01 BodyTypeProtobuf byte = 0x02 BodyTypeXML byte = 0x03 BodyTypePlain byte = 0x04 )
View Source
const ( QueueSize = 4096 Processors = 32 )
View Source
const MaxLength uint32 = 1<<16 - HeadLength
Variables ¶
View Source
var ( ErrFixedHead = errors.New("fixed Head not 0x41 0x63") ErrFrameNil = errors.New("frame is nil") ErrBodyLengthExceed = errors.New("data length exceed") )
View Source
var Fixed = [2]byte{'A', 'c'}
View Source
var Reserved [4]byte = [4]byte{0, 0, 0, 0}
Functions ¶
This section is empty.
Types ¶
type Frame ¶
func NewFrameDefault ¶
func NewFrameDefault() *Frame
func (*Frame) BodyLength ¶
func (*Frame) SetBodyLength ¶
func (*Frame) SetBodyOnly ¶
func (*Frame) SetBodyWithLength ¶
func (*Frame) SetMessageId ¶
func (*Frame) SetReserved ¶
func (*Frame) SetVersion ¶
type Server ¶
type Server struct {
Host string
Port int
Fixed [2]byte // default 'Ac' (0x41 0x63)
MaxLength uint32 // default 65536 (1<<16)
Version byte // default 1 (0x01)
BodyType byte // default 1 (0x01, json)
Handle func([]byte) []byte // one of handlers must not nil
HandleFrame func(*Frame) *Frame
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.