fix: update ethertype_from_int and protocol_from_number to return string names for better compatibility
All checks were successful
Build and Deploy MITM Webserver / build (push) Successful in 8s

This commit is contained in:
2025-12-01 21:15:13 +01:00
parent 80fa3737a0
commit ac54b8f146
2 changed files with 5 additions and 4 deletions

View File

@@ -131,9 +131,9 @@ ETHERTYPE_MAP: Dict[int, EtherTypeEnum] = {
} }
def ethertype_from_int(value: int) -> EtherTypeEnum: def ethertype_from_int(value: int) -> str:
""" """
Map a numeric EtherType value to the corresponding enum. Map a numeric EtherType value to the corresponding enum.
Returns UNKNOWN if not found. Returns UNKNOWN if not found.
""" """
return ETHERTYPE_MAP.get(value, EtherTypeEnum.UNKNOWN) return ETHERTYPE_MAP.get(value, EtherTypeEnum.UNKNOWN).name

View File

@@ -1,4 +1,5 @@
from enum import Enum from enum import Enum
from typing import Literal
""" """
This module defines an enumeration for IP protocol types and provides a mapping This module defines an enumeration for IP protocol types and provides a mapping
@@ -310,6 +311,6 @@ IP_PROTOCOL_MAP = {
255: IPProtocolEnum.RESERVED, 255: IPProtocolEnum.RESERVED,
} }
def protocol_from_number(n: int) -> IPProtocolEnum: def protocol_from_number(n: int) -> str:
return IP_PROTOCOL_MAP.get(n, IPProtocolEnum.UNKNOWN) return IP_PROTOCOL_MAP.get(n, IPProtocolEnum.UNKNOWN).name