@@ -59,6 +59,14 @@ class OptionType(dns.enum.IntEnum):
5959 EDE = 15
6060 #: REPORTCHANNEL
6161 REPORTCHANNEL = 18
62+ #: EDE-EXTRA-TEXT-LANGUAGE (Extended DNS Error EXTRA-TEXT language)
63+ EDE_EXTRA_TEXT_LANGUAGE = 22
64+ #: FILTERING-CONTACT
65+ FILTERING_CONTACT = 23
66+ #: FILTERING-ORGANIZATION
67+ FILTERING_ORGANIZATION = 24
68+ #: FILTERING-DB
69+ FILTERING_DB = 25
6270
6371 @classmethod
6472 def _maximum (cls ):
@@ -513,12 +521,140 @@ def from_wire_parser(
513521 return cls (parser .get_name ())
514522
515523
524+ class EDEExtraTextLanguageOption (Option ):
525+ """Extended DNS Error EXTRA-TEXT language (EDE-EXTRA-TEXT-LANGUAGE)"""
526+
527+ def __init__ (self , language : str ):
528+ """Initialize an EDEExtraTextLanguageOption.
529+
530+ :param language: The language of EXTRA-TEXT in the EDE option.
531+ :type language: str
532+ """
533+
534+ super ().__init__ (OptionType .EDE_EXTRA_TEXT_LANGUAGE )
535+ self .language = language
536+
537+ def to_wire (self , file : Any = None ) -> bytes | None :
538+ if file :
539+ file .write (self .language .encode ("utf8" ))
540+ return None
541+ else :
542+ return self .language
543+
544+ def to_text (self ) -> str :
545+ return f"EDE-EXTRA-TEXT-LANGUAGE { self .language } "
546+
547+ @classmethod
548+ def from_wire_parser (
549+ cls , otype : OptionType | str , parser : dns .wire .Parser
550+ ) -> Option :
551+ return cls (parser .get_remaining ().decode ("utf8" ))
552+
553+
554+ class FilteringContactOption (Option ):
555+ """Filtering contact (FILTERING-CONTACT)"""
556+
557+ def __init__ (self , contact : str ):
558+ """Initialize a FilteringContactOption.
559+
560+ :param contact: A filtering contact URI as a string.
561+ :type contact: str
562+ """
563+
564+ super ().__init__ (OptionType .FILTERING_CONTACT )
565+ self .contact = contact
566+
567+ def to_wire (self , file : Any = None ) -> bytes | None :
568+ if file :
569+ file .write (self .contact .encode ("utf8" ))
570+ return None
571+ else :
572+ return self .contact
573+
574+ def to_text (self ) -> str :
575+ return f"FILTERING-CONTACT { self .contact } "
576+
577+ @classmethod
578+ def from_wire_parser (
579+ cls , otype : OptionType | str , parser : dns .wire .Parser
580+ ) -> Option :
581+ return cls (parser .get_remaining ().decode ("utf8" ))
582+
583+
584+ class FilteringOrganizationOption (Option ):
585+ """Filtering organization (FILTERING-ORGANIZATION)"""
586+
587+ def __init__ (self , organization : str ):
588+ """Initialize a FilteringOrganizationOption.
589+
590+ :param organization: The filtering organization.
591+ :type organization: str
592+ """
593+
594+ super ().__init__ (OptionType .FILTERING_ORGANIZATION )
595+ self .organization = organization
596+
597+ def to_wire (self , file : Any = None ) -> bytes | None :
598+ if file :
599+ file .write (self .organization .encode ("utf8" ))
600+ return None
601+ else :
602+ return self .organization
603+
604+ def to_text (self ) -> str :
605+ return f"FILTERING-ORGANIZATION { self .organization } "
606+
607+ @classmethod
608+ def from_wire_parser (
609+ cls , otype : OptionType | str , parser : dns .wire .Parser
610+ ) -> Option :
611+ return cls (parser .get_remaining ().decode ("utf8" ))
612+
613+
614+ class FilteringDBOption (Option ):
615+ """Filtering DB (FILTERING-DB)"""
616+
617+ def __init__ (self , db : str ):
618+ """Initialize a FilteringDBOption.
619+
620+ :param db: The filtering database containing the identifier,
621+ name, or description of the filtering database
622+ against which a matched query caused the filtering to
623+ occur.
624+ :type db: str
625+
626+ """
627+
628+ super ().__init__ (OptionType .FILTERING_DB )
629+ self .db = db
630+
631+ def to_wire (self , file : Any = None ) -> bytes | None :
632+ if file :
633+ file .write (self .db .encode ("utf8" ))
634+ return None
635+ else :
636+ return self .db
637+
638+ def to_text (self ) -> str :
639+ return f"FILTERING-DB { self .db } "
640+
641+ @classmethod
642+ def from_wire_parser (
643+ cls , otype : OptionType | str , parser : dns .wire .Parser
644+ ) -> Option :
645+ return cls (parser .get_remaining ().decode ("utf8" ))
646+
647+
516648_type_to_class : dict [OptionType , Any ] = {
517649 OptionType .ECS : ECSOption ,
518650 OptionType .EDE : EDEOption ,
519651 OptionType .NSID : NSIDOption ,
520652 OptionType .COOKIE : CookieOption ,
521653 OptionType .REPORTCHANNEL : ReportChannelOption ,
654+ OptionType .EDE_EXTRA_TEXT_LANGUAGE : EDEExtraTextLanguageOption ,
655+ OptionType .FILTERING_CONTACT : FilteringContactOption ,
656+ OptionType .FILTERING_ORGANIZATION : FilteringOrganizationOption ,
657+ OptionType .FILTERING_DB : FilteringDBOption ,
522658}
523659
524660
@@ -596,5 +732,9 @@ def register_type(implementation: Any, otype: OptionType) -> None:
596732CHAIN = OptionType .CHAIN
597733EDE = OptionType .EDE
598734REPORTCHANNEL = OptionType .REPORTCHANNEL
735+ EDE_EXTRA_TEXT_LANGUAGE = OptionType .EDE_EXTRA_TEXT_LANGUAGE
736+ FILTERING_CONTACT = OptionType .FILTERING_CONTACT
737+ FILTERING_ORGANIZATION = OptionType .FILTERING_ORGANIZATION
738+ FILTERING_DB = OptionType .FILTERING_DB
599739
600740### END generated OptionType constants
0 commit comments