type(1byte) + length(3byte) + body(length bytes) package分为header和body两部分。header描述package包的类型和包的长度,body则是需要传输的数据内容。 type - package类型,1个byte 0x01: 客户端到服务器的握手请求以及服务器到客户端的握手响应 0x02: 客户端到服务器的握手ack 0x03: 心跳包 0x04: 数据包 0x05: 服务器主动断开连接通知 length - body内容长度,3个byte的大端整数,因此最大的包长度为2^24个byte。 body - 二进制的传输内容
(typ packet.Type, data []byte)
source not stored for this graph (policy: none)