common

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 31, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CustomPacker

type CustomPacker struct{}

CustomPacker treats packet as:

totalSize(4)|idSize(2)|id(n)|data(n)

| segment | type | size | remark | | ----------- | ------ | ------- | --------------------- | | `totalSize` | uint32 | 4 | the whole packet size | | `idSize` | uint16 | 2 | length of id | | `id` | string | dynamic | | | `data` | []byte | dynamic | |

func (*CustomPacker) Pack

func (p *CustomPacker) Pack(msg *easytcp.Message) ([]byte, error)

func (*CustomPacker) Unpack

func (p *CustomPacker) Unpack(reader io.Reader) (*easytcp.Message, error)

type Json01Req

type Json01Req struct {
	Key1 string `json:"key_1"`
	Key2 int    `json:"key_2"`
	Key3 bool   `json:"key_3"`
}

type Json01Resp

type Json01Resp struct {
	Success bool        `json:"success"`
	Data    interface{} `json:"data"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL