Converts the resource record into json for mitmweb. Sync with web/src/flow.ts.
(self)
| 169 | return f"0x{self.data.hex()} (invalid {types.to_str(self.type)} data)" |
| 170 | |
| 171 | def to_json(self) -> dict[str, str | int | HTTPSRecordJSON]: |
| 172 | """ |
| 173 | Converts the resource record into json for mitmweb. |
| 174 | Sync with web/src/flow.ts. |
| 175 | """ |
| 176 | return { |
| 177 | "name": self.name, |
| 178 | "type": types.to_str(self.type), |
| 179 | "class": classes.to_str(self.class_), |
| 180 | "ttl": self.ttl, |
| 181 | "data": self._data_json(), |
| 182 | } |
| 183 | |
| 184 | @classmethod |
| 185 | def from_json(cls, data: dict[str, Any]) -> Self: |
nothing calls this directly
no test coverage detected