Converts the entire given buffer into a DNS message.
(cls, buffer: bytes, timestamp: float | None = None)
| 368 | |
| 369 | @classmethod |
| 370 | def unpack(cls, buffer: bytes, timestamp: float | None = None) -> DNSMessage: |
| 371 | """Converts the entire given buffer into a DNS message.""" |
| 372 | length, msg = cls.unpack_from(buffer, 0, timestamp) |
| 373 | if length != len(buffer): |
| 374 | raise struct.error(f"unpack requires a buffer of {length} bytes") |
| 375 | return msg |
| 376 | |
| 377 | @classmethod |
| 378 | def unpack_from( |