Exemple #1
0
    def combine(
        self, existing_options: Iterable[DomainSearchListOption]
    ) -> DomainSearchListOption:
        """
        Combine multiple options into one.

        :param existing_options: The existing options to include domain names from
        :return: The combined option
        """
        domains = []

        # Add from existing options first
        for option in existing_options:
            for domain in option.search_list:
                if domain not in domains:
                    domains.append(domain)

        # Then add our own
        for domain in self.option.dns_servers:
            if domain not in domains:
                domains.append(domain)

        # And return a new option with the combined addresses
        return DomainSearchListOption(search_list=domains)
Exemple #2
0
 def setUp(self):
     self.option_bytes = bytes.fromhex(
         '0018000d') + b'\x08steffann\x02nl\x00'
     self.option_object = DomainSearchListOption(
         search_list=['steffann.nl'])
     self.parse_option()
Exemple #3
0
    def __init__(self, search_list: Iterable[str], always_send: bool = False):
        option = DomainSearchListOption(search_list=search_list)
        option.validate()

        super().__init__(option, always_send=always_send)