MCPcopy
hub / github.com/mitmproxy/mitmproxy / _data_json

Method _data_json

mitmproxy/dns.py:153–169  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

151 self.data = https_records.pack(record)
152
153 def _data_json(self) -> str | HTTPSRecordJSON:
154 try:
155 match self.type:
156 case types.A:
157 return str(self.ipv4_address)
158 case types.AAAA:
159 return str(self.ipv6_address)
160 case types.NS | types.CNAME | types.PTR:
161 return self.domain_name
162 case types.TXT:
163 return self.text
164 case types.HTTPS:
165 return https_records.unpack(self.data).to_json()
166 case _:
167 return f"0x{self.data.hex()}"
168 except Exception:
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 """

Callers 2

__str__Method · 0.95
to_jsonMethod · 0.95

Calls 2

unpackMethod · 0.80
to_jsonMethod · 0.45

Tested by

no test coverage detected