file structure and comments unified
Some checks failed
Build and Deploy MITM Webserver / build (push) Failing after 3s
Some checks failed
Build and Deploy MITM Webserver / build (push) Failing after 3s
This commit is contained in:
@@ -1,12 +1,16 @@
|
||||
# src/models/packet.py
|
||||
from datetime import datetime
|
||||
"""Pydantic model for packet rows returned by the backend."""
|
||||
|
||||
from pydantic import BaseModel, Field, IPvAnyAddress
|
||||
from datetime import datetime
|
||||
from typing import Optional, Union
|
||||
|
||||
from pydantic import BaseModel, Field, IPvAnyAddress
|
||||
|
||||
|
||||
class PacketDBModel(BaseModel):
|
||||
"""Normalized packet representation used across DB and API layers."""
|
||||
|
||||
id: Union[int, str]
|
||||
timestamp: datetime = Field(..., description="ISO timestamp")
|
||||
timestamp: datetime = Field(..., description="Packet timestamp in ISO format.")
|
||||
iface: str
|
||||
src_mac: Optional[str] = None
|
||||
dst_mac: Optional[str] = None
|
||||
@@ -18,7 +22,7 @@ class PacketDBModel(BaseModel):
|
||||
dst_port: Optional[int] = None
|
||||
vlan_id: Optional[int] = None
|
||||
length: Optional[int] = None
|
||||
raw_b64: Optional[str] = Field(None, description="Base64-encoded raw bytes")
|
||||
raw_b64: Optional[str] = Field(None, description="Base64-encoded packet bytes.")
|
||||
direction: Optional[str] = None
|
||||
packets: Optional[int] = None
|
||||
|
||||
@@ -40,4 +44,4 @@ class PacketDBModel(BaseModel):
|
||||
"length": 128,
|
||||
"raw_b64": "BASE64...",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user