mustash.utils
– Miscellaneous utilities¶
- pydantic model mustash.utils.Runk¶
Bases:
BaseModel
Ronald’s universal number kounter.
This counts lines, columns and offsets.
- Fields:
- mustash.utils.NO_VALUE = NO_VALUE¶
Constant representing the absence of a value.
The type of this value is a singleton.
- mustash.utils.get_generic_args(generic: Any, value: Any, /) tuple[Any, ...] ¶
Get the generic arguments.
- mustash.utils.get_generic_arg(generic: Any, value: Any, /, *, default: type | NoValueType = NO_VALUE) Any ¶
Get the generic argument.
- Parameters:
generic (Any) – The generic class to detect and extract parameters from.
value (Any) – The value from which to get the generic class parameters.
default (type | NoValueType) – Default value to return.
- Returns:
The generic class parameters.
- Raises:
TypeError – The value is not an instance of the generic class.
- Return type:
- pydantic model mustash.utils.CommunityIDTransport¶
Bases:
BaseModel
Details regarding the community ID transport.
- classmethod from_iana_number(number: int, /) CommunityIDTransport ¶
Get transport details from the IANA protocol number.
- Parameters:
number (int) – IANA number of the protocol.
- Returns:
Transport details.
- Return type:
- classmethod from_name(name: str, /) CommunityIDTransport ¶
Get transport details from the protocol name.
- Parameters:
name (str) – Name of the protocol.
- Returns:
Transport details.
- Return type:
- pydantic model mustash.utils.CommunityID¶
Bases:
BaseModel
Details regarding a community ID to compute.
See Community ID Flow Hashing Specification for more information.
- Fields:
- field destination_ip: IPv4Address | IPv6Address [Required]¶
Destination IP address.
- field destination_port: Annotated[int, Ge(0), Lt(65536)] [Required]¶
Destination port.
- Constraints:
ge = 0
lt = 65536
- field seed: Annotated[int, Ge(0), Lt(65536)] = 0¶
Seed for the community ID hash.
This seed can prevent hash collisions between network domains, such as staging and production network that use the same addressing scheme.
- Constraints:
ge = 0
lt = 65536
- field source_ip: IPv4Address | IPv6Address [Required]¶
Source IP address.
- field source_port: Annotated[int, Ge(0), Lt(65536)] [Required]¶
Source port.
- Constraints:
ge = 0
lt = 65536
- field transport: CommunityIDTransport [Required]¶
Transport protocol.