Documentation ¶
Index ¶
- Constants
- func Bytes2Uint16(bytes []byte, off int) (uint16, error)
- func Bytes2Uint16NoCheck(bytes []byte) uint16
- func Bytes2Uint32(bytes []byte) (uint32, error)
- func Bytes2Uint32NoCheck(bytes []byte) uint32
- func Bytes2Uint8(bytes []byte, off int) (uint8, error)
- func IsTTHeader(flagBuf []byte) bool
- func NewDataIfNeeded(method string, message remote.Message) error
- func NewDefaultCodec() remote.Codec
- func PeekUint32(in remote.ByteBuffer) (uint32, error)
- func ReadString(in remote.ByteBuffer) (string, int, error)
- func ReadString2BLen(bytes []byte, off int) (string, int, error)
- func ReadUint16(in remote.ByteBuffer) (uint16, error)
- func ReadUint32(in remote.ByteBuffer) (uint32, error)
- func SetOrCheckMethodName(methodName string, message remote.Message) error
- func SetOrCheckSeqID(seqID int32, message remote.Message) error
- func UpdateMsgType(msgType uint32, message remote.Message) error
- func WriteByte(val byte, out remote.ByteBuffer) error
- func WriteString(val string, out remote.ByteBuffer) (int, error)
- func WriteString2BLen(val string, out remote.ByteBuffer) (int, error)
- func WriteUint16(val uint16, out remote.ByteBuffer) error
- func WriteUint32(val uint32, out remote.ByteBuffer) error
- type HeaderFlags
- type InfoIDType
- type ProtocolID
Constants ¶
View Source
const ( Size32 = 4 Size16 = 2 )
The byte count of 32 and 16 integer values.
View Source
const ( // ThriftV1Magic is the magic code for thrift.VERSION_1 ThriftV1Magic = 0x80010000 // ProtobufV1Magic is the magic code for kitex protobuf ProtobufV1Magic = 0x90010000 // MagicMask is bit mask for checking version. MagicMask = 0xffff0000 )
View Source
const ( // Header Magics // 0 and 16th bits must be 0 to differentiate from framed & unframed TTHeaderMagic uint32 = 0x10000000 MeshHeaderMagic uint32 = 0xFFAF0000 MeshHeaderLenMask uint32 = 0x0000FFFF // HeaderMask uint32 = 0xFFFF0000 FlagsMask uint32 = 0x0000FFFF MethodMask uint32 = 0x41000000 // method first byte [A-Za-z_] MaxFrameSize uint32 = 0x3FFFFFFF MaxHeaderSize uint32 = 65536 )
Header keys
View Source
const ( HeaderFlagsKey string = "HeaderFlags" HeaderFlagSupportOutOfOrder HeaderFlags = 0x01 HeaderFlagDuplexReverse HeaderFlags = 0x08 HeaderFlagSASL HeaderFlags = 0x10 )
View Source
const (
// FrontMask is used in protocol sniffing.
FrontMask = 0x0000ffff
)
View Source
const (
TTHeaderMetaSize = 14
)
Variables ¶
This section is empty.
Functions ¶
func IsTTHeader ¶
*
- +------------------------------------------------------------+
- | 4Byte | 2Byte |
- +------------------------------------------------------------+
- | Length | HEADER MAGIC |
- +------------------------------------------------------------+
func NewDataIfNeeded ¶
NewDataIfNeeded is used to create the data if not exist.
func NewDefaultCodec ¶
NewDefaultCodec creates the default protocol sniffing codec supporting thrift and protobuf.
func ReadString2BLen ¶
ReadString2BLen ...
func SetOrCheckMethodName ¶
SetOrCheckMethodName is used to set method name to invocation.
func SetOrCheckSeqID ¶
SetOrCheckSeqID is used to check the sequence ID.
func UpdateMsgType ¶
UpdateMsgType updates msg type.
func WriteString2BLen ¶
func WriteString2BLen(val string, out remote.ByteBuffer) (int, error)
WriteString2BLen ...
Types ¶
type HeaderFlags ¶
type HeaderFlags uint16
type InfoIDType ¶
type InfoIDType uint8 // uint8
const ( InfoIDPadding InfoIDType = 0 InfoIDKeyValue InfoIDType = 0x01 InfoIDIntKeyValue InfoIDType = 0x10 InfoIDACLToken InfoIDType = 0x11 )
type ProtocolID ¶
type ProtocolID uint8
ProtocolID is the wrapped protocol id used in THeader.
const ( ProtocolIDThriftBinary ProtocolID = 0x00 ProtocolIDThriftCompact ProtocolID = 0x02 ProtocolIDProtobufKitex ProtocolID = 0x03 ProtocolIDDefault = ProtocolIDThriftBinary )
Supported ProtocolID values.
Click to show internal directories.
Click to hide internal directories.