| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -26,6 +26,7 @@ | |||
| 26 | 26 | import socket | |
| 27 | 27 | from typing import TYPE_CHECKING, Any, cast | |
| 28 | 28 | ||
| 29 | + from ._exceptions import AbstractMethodException | ||
| 29 | 30 | from ._utils.net import _is_v6_address | |
| 30 | 31 | from ._utils.time import current_time_millis | |
| 31 | 32 | from .const import _CLASS_MASK, _CLASS_UNIQUE, _CLASSES, _TYPE_ANY, _TYPES | |
@@ -156,7 +157,7 @@ def __repr__(self) -> str: | |||
| 156 | 157 | ) | |
| 157 | 158 | ||
| 158 | 159 | ||
| 159 | - class DNSRecord(DNSEntry): | ||
| 160 | + class DNSRecord(DNSEntry): # noqa: PLW1641 | ||
| 160 | 161 | """A DNS record - like a DNS entry, but has a TTL""" | |
| 161 | 162 | ||
| 162 | 163 | __slots__ = ("created", "ttl") | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -311,6 +311,7 @@ def _read_string(self, length: _int) -> bytes: | |||
| 311 | 311 | return info | |
| 312 | 312 | ||
| 313 | 313 | def _read_others(self) -> None: | |
| 314 | + """Read the answer, authority and additional sections.""" | ||
| 314 | 315 | self._did_read_others = True | |
| 315 | 316 | buf = self._buf | |
| 316 | 317 | answers = self._answers | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -65,11 +65,10 @@ cdef class DNSOutgoing: | |||
| 65 | 65 | cdef cython.bint _write_question(self, DNSQuestion question) | |
| 66 | 66 | ||
| 67 | 67 | @cython.locals( | |
| 68 | - chunk=cython.bytes, | ||
| 69 | 68 | data_length_before=cython.uint, | |
| 70 | 69 | size_before=cython.uint, | |
| 71 | 70 | length_index=cython.uint, | |
| 72 | - rdata_length=cython.uint, | ||
| 71 | + rdata_size_start=cython.uint, | ||
| 73 | 72 | ) | |
| 74 | 73 | cdef cython.bint _write_record(self, DNSRecord record, double now) | |
| 75 | 74 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -335,11 +335,9 @@ def _write_record(self, record: DNSRecord_, now: float_) -> bool: | |||
| 335 | 335 | self._write_ttl(record, now) | |
| 336 | 336 | length_index = len(self.data) | |
| 337 | 337 | self.write_short(0) # placeholder for the rdata length | |
| 338 | + rdata_size_start = self.size | ||
| 338 | 339 | record.write(self) | |
| 339 | - rdata_length = 0 | ||
| 340 | - for chunk in self.data[length_index + 1 :]: | ||
| 341 | - rdata_length += len(chunk) | ||
| 342 | - self._replace_short(length_index, rdata_length) | ||
| 340 | + self._replace_short(length_index, self.size - rdata_size_start) | ||
| 343 | 341 | return self._check_data_limit_or_rollback(data_length_before, size_before) | |
| 344 | 342 | ||
| 345 | 343 | def _check_data_limit_or_rollback(self, start_data_length: int_, start_size: int_) -> bool: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -457,6 +457,7 @@ def test_questions_do_not_end_up_every_packet(self): | |||
| 457 | 457 | ||
| 458 | 458 | class PacketForm(unittest.TestCase): | |
| 459 | 459 | def test_transaction_id(self): | |
| 460 | + """Multicast DNS messages carry transaction id 0 (RFC 6762 section 18.1).""" | ||
| 460 | 461 | generated = r.DNSOutgoing(const._FLAGS_QR_QUERY) | |
| 461 | 462 | bytes = generated.packets()[0] | |
| 462 | 463 | id = bytes[0] << 8 | bytes[1] | |
| Back | FazBrowse Home | New Git URL |
0 commit comments