Convert possibly compressed wire format into a Name. *message* is a ``bytes`` containing an entire DNS message in DNS wire form. *current*, an ``int``, is the offset of the beginning of the name from the start of the message Raises ``dns.name.BadPointer`` if a compression poin
(message: bytes, current: int)
| 1106 | |
| 1107 | |
| 1108 | def from_wire(message: bytes, current: int) -> Tuple[Name, int]: |
| 1109 | """Convert possibly compressed wire format into a Name. |
| 1110 | |
| 1111 | *message* is a ``bytes`` containing an entire DNS message in DNS |
| 1112 | wire form. |
| 1113 | |
| 1114 | *current*, an ``int``, is the offset of the beginning of the name |
| 1115 | from the start of the message |
| 1116 | |
| 1117 | Raises ``dns.name.BadPointer`` if a compression pointer did not |
| 1118 | point backwards in the message. |
| 1119 | |
| 1120 | Raises ``dns.name.BadLabelType`` if an invalid label type was encountered. |
| 1121 | |
| 1122 | Returns a ``(dns.name.Name, int)`` tuple consisting of the name |
| 1123 | that was read and the number of bytes of the wire format message |
| 1124 | which were consumed reading it. |
| 1125 | """ |
| 1126 | |
| 1127 | if not isinstance(message, bytes): |
| 1128 | raise ValueError("input to from_wire() must be a byte string") |
| 1129 | parser = dns.wire.Parser(message, current) |
| 1130 | name = from_wire_parser(parser) |
| 1131 | return (name, parser.current - current) |
| 1132 | |
| 1133 | |
| 1134 | # RFC 4471 Support |
nothing calls this directly
no test coverage detected
searching dependent graphs…