//序列化 func MarshalProtoMsg(args proto.Message) []byte { msgID := protos.GetMsgID(args) msgBody, _ := proto.Marshal(args) result := make([]byte, 2+len(msgBody)) binary.PutUint16LE(result[:2], msgID) copy(result[2:], msgBody) return result }
//序列化 func MarshalProtoMsg(identification uint64, args proto.Message) []byte { msgID := protos.GetMsgID(args) msgBody, _ := proto.Marshal(args) result := make([]byte, 2+8+len(msgBody)) binary.PutUint16LE(result[:2], msgID) binary.PutUint64LE(result[2:10], identification) copy(result[10:], msgBody) return result }