refactor: sanitize AI code

This commit is contained in:
Stanislav N Mikhailov
2026-08-03 14:52:42 +03:00
parent 0f2cb0384c
commit 7bacf7ac73
3 changed files with 139 additions and 95 deletions
+6
View File
@@ -1,4 +1,7 @@
// Парсим заголовок на базе Nom
pub const HEADER_SIZE: usize = 20;
pub const MAX_BODY_SIZE: u64 = 1024 * 1024;
use nom::{
bytes::complete::tag,
combinator::verify,
@@ -82,6 +85,9 @@ impl Header {
pub fn body_size(&self) -> u64 {
self.body_size
}
///Валидаторы для данных из заголовка:
///
// Валидация Header
pub fn validate(&self) -> Result<(), HeaderValidationError> {
if self.version != 1 {