(
cls, otype: OptionType | str, parser: "dns.wire.Parser"
)
| 310 | |
| 311 | @classmethod |
| 312 | def from_wire_parser( |
| 313 | cls, otype: OptionType | str, parser: "dns.wire.Parser" |
| 314 | ) -> Option: |
| 315 | family, src, scope = parser.get_struct("!HBB") |
| 316 | addrlen = int(math.ceil(src / 8.0)) |
| 317 | prefix = parser.get_bytes(addrlen) |
| 318 | if family == 1: |
| 319 | pad = 4 - addrlen |
| 320 | addr = dns.ipv4.inet_ntoa(prefix + b"\x00" * pad) |
| 321 | elif family == 2: |
| 322 | pad = 16 - addrlen |
| 323 | addr = dns.ipv6.inet_ntoa(prefix + b"\x00" * pad) |
| 324 | else: |
| 325 | raise ValueError("unsupported family") |
| 326 | |
| 327 | return cls(addr, src, scope) |
| 328 | |
| 329 | |
| 330 | class EDECode(dns.enum.IntEnum): |
nothing calls this directly
no test coverage detected