iprotocol.go 272 B

123456789101112
  1. package nnet
  2. type IPacket interface {
  3. // if need to close socket after sending this packet
  4. ShouldClose() (bool, int32)
  5. }
  6. type IProtocol interface {
  7. // parse by raw data to a packet
  8. ReadPacket(conn IConn) (IPacket, error)
  9. Serialize(packet IPacket) ([]byte, error)
  10. }