MCPcopy Index your code
hub / github.com/mitmproxy/mitmproxy / Question

Class Question

mitmproxy/dns.py:33–60  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31
32@dataclass
33class Question(serializable.SerializableDataclass):
34 HEADER: ClassVar[struct.Struct] = struct.Struct("!HH")
35
36 name: str
37 type: int
38 class_: int
39
40 def __str__(self) -> str:
41 return self.name
42
43 def to_json(self) -> dict:
44 """
45 Converts the question into json for mitmweb.
46 Sync with web/src/flow.ts.
47 """
48 return {
49 "name": self.name,
50 "type": types.to_str(self.type),
51 "class": classes.to_str(self.class_),
52 }
53
54 @classmethod
55 def from_json(cls, data: dict[str, str]) -> Self:
56 return cls(
57 name=data["name"],
58 type=types.from_str(data["type"]),
59 class_=classes.from_str(data["class"]),
60 )
61
62
63@dataclass

Callers 1

unpack_fromMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…