CHAIN = 13
#: EDE (extended-dns-error)
EDE = 15
+ #: REPORTCHANNEL
+ REPORTCHANNEL = 18
@classmethod
def _maximum(cls):
return cls(parser.get_bytes(8), parser.get_remaining())
+class ReportChannelOption(Option):
+ # RFC 9567
+ def __init__(self, agent_domain: dns.name.Name):
+ super().__init__(OptionType.REPORTCHANNEL)
+ self.agent_domain = agent_domain
+
+ def to_wire(self, file: Any = None) -> Optional[bytes]:
+ return self.agent_domain.to_wire(file)
+
+ def to_text(self) -> str:
+ return "REPORTCHANNEL " + self.agent_domain.to_text()
+
+ @classmethod
+ def from_wire_parser(
+ cls, otype: Union[OptionType, str], parser: dns.wire.Parser
+ ) -> Option:
+ return cls(parser.get_name())
+
+
_type_to_class: Dict[OptionType, Any] = {
OptionType.ECS: ECSOption,
OptionType.EDE: EDEOption,
OptionType.NSID: NSIDOption,
OptionType.COOKIE: CookieOption,
+ OptionType.REPORTCHANNEL: ReportChannelOption,
}
PADDING = OptionType.PADDING
CHAIN = OptionType.CHAIN
EDE = OptionType.EDE
+REPORTCHANNEL = OptionType.REPORTCHANNEL
### END generated OptionType constants
.. autoclass:: dns.edns.ECSOption
:members:
-
+
+.. autoclass:: dns.edns.EDEOption
+ :members:
+
+.. autoclass:: dns.edns.NSIDOption
+ :members:
+
+.. autoclass:: dns.edns.CookieOption
+ :members:
+
+.. autoclass:: dns.edns.ReportChannelOption
+ :members:
+
.. autofunction:: dns.edns.get_option_class
.. autofunction:: dns.edns.option_from_wire_parser
.. autofunction:: dns.edns.option_from_wire
b"12345678", b"abcdefghabcdefghabcdefghabcdefghi"
)
+ def testReportChannelOption(self):
+ agent_domain = dns.name.from_text("agent.example.")
+ expected_wire = b"\x05agent\x07example\x00"
+ opt = dns.edns.ReportChannelOption(agent_domain)
+ io = BytesIO()
+ opt.to_wire(io)
+ data = io.getvalue()
+ self.assertEqual(data, expected_wire)
+ self.assertEqual(str(opt), "REPORTCHANNEL agent.example.")
+ opt2 = dns.edns.option_from_wire(
+ dns.edns.OptionType.REPORTCHANNEL, expected_wire, 0, len(expected_wire)
+ )
+ self.assertEqual(opt2.agent_domain, agent_domain)
+
def test_option_registration(self):
U32OptionType = 9999