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
All checks were successful
Build and Deploy MITM Webserver / build (push) Successful in 8s
This commit is contained in:
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user