| 123456789101112131415 |
- package nnet
- type IPacket interface {
- // if need to close socket after sending this packet
- ShouldClose() (bool, int32)
- }
- // Simple definition of Encoder/Decoder
- // NO middleware-like mechanism here, just do it directly within those 2 functions.
- type IProtocol interface {
- // parse by raw data to a packet
- ReadPacket(conn IConn) (IPacket, error)
- // encode user-impl packet to []byte
- Serialize(packet IPacket) ([]byte, error)
- }
|