package nnet type IPacket interface { // free the memory if needs Destroy([]byte) // if need to close socket after sending this packet ShouldClose() (bool, int32) } type IProtocol interface { // parse by raw data to a packet ReadPacket(conn IConn) (IPacket, error) Serialize(packet IPacket) ([]byte, error) }