Documentation
¶
Index ¶
- Constants
- Variables
- func DecodeSegment(seg string) ([]byte, error)
- func EncodeSegment(seg []byte) string
- func GenerateRandomKey(length int) []byte
- func GenerateRandomString(length int) string
- func New[T IPayload](pl T, opts ...Opt) (string, error)
- func Parse[T IPayload](str string, pl T, opts ...Opt) error
- type BasicPayload
- type IPayload
- type Opt
- type StickPackage
Constants ¶
View Source
const LengthLength = 2
View Source
const LengthStartIndex = 2 // 数据部分长度起始字节位置
View Source
const LengthStopIndex = 4 // 数据部分长度结束字节位置
View Source
const TcpHeaderLength = VersionLength + LengthLength
View Source
const VersionLength = 2
Variables ¶
View Source
var VersionContent = [2]byte{'v', '1'}
Functions ¶
func DecodeSegment ¶
DecodeSegment Decode JWT specific base64url encoding with padding stripped
func EncodeSegment ¶
EncodeSegment Encode JWT specific base64url encoding with padding stripped
func GenerateRandomKey ¶
GenerateRandomKey generates a random bytes of the specified length
func GenerateRandomString ¶
GenerateRandomString generates a random string of the specified length
Types ¶
type BasicPayload ¶
func (*BasicPayload) Decode ¶
func (p *BasicPayload) Decode(b []byte) error
func (*BasicPayload) Encode ¶
func (p *BasicPayload) Encode() ([]byte, error)
func (*BasicPayload) Ver ¶
func (p *BasicPayload) Ver() uint8
Ver return the unique id of payload.Must be unique!!!
type StickPackage ¶
func (*StickPackage) GetPackageLength ¶
func (p *StickPackage) GetPackageLength() int16
func (*StickPackage) String ¶
func (p *StickPackage) String() string
Click to show internal directories.
Click to hide internal directories.