コード例 #1
0
    def test_generate_doh_stamp(self):
        address = "[fe80::6d6d:f72c:3ad:60b8]"
        hashes = ["3e1a1a0f6c53f3e97a492d57084b5b9807059ee057ab1505876fd83fda3db838"]
        hostname = "doh.example.com"
        path = "/dns-query"

        self.assertEqual(
            "sdns://AgAAAAAAAAAAGltmZTgwOjo2ZDZkOmY3MmM6M2FkOjYwYjhdID4aGg9sU_PpekktVwhLW5gHBZ7gV6sVBYdv2D_aPbg4D2RvaC5leGFtcGxlLmNvbQovZG5zLXF1ZXJ5",
            dnsstamps.create_doh(address, hashes, hostname, path),
            "Invalid stamp")
コード例 #2
0
    def test_generate_doh_stamp_without_hashes(self):
        address = ""
        hashes = []
        hostname = "doh.example.com"
        path = "/dns-query"
        options = [Option.DNSSEC, Option.NO_FILTERS]

        self.assertEqual(
            "sdns://AgUAAAAAAAAAAAAPZG9oLmV4YW1wbGUuY29tCi9kbnMtcXVlcnk",
            dnsstamps.create_doh(address, hashes, hostname, path, options),
            "Invalid stamp")
コード例 #3
0
    def test_generate_doh_stamp_with_bootstrap_ips(self):
        address = "127.0.0.1"
        hashes = ["3e1a1a0f6c53f3e97a492d57084b5b9807059ee057ab1505876fd83fda3db838"]
        hostname = "doh.example.com"
        path = "/dns-query"
        bootstrap_ips = ["1.1.1.1"]

        self.assertEqual(
            "sdns://AgAAAAAAAAAACTEyNy4wLjAuMSA-GhoPbFPz6XpJLVcIS1uYBwWe4FerFQWHb9g_2j24OA9kb2guZXhhbXBsZS5jb20KL2Rucy1xdWVyeQcxLjEuMS4x",
            dnsstamps.create_doh(address, hashes, hostname, path, bootstrap_ips=bootstrap_ips),
            "Invalid stamp")
コード例 #4
0
    def test_generate_doh_stamp_with_multiple_hashes(self):
        address = "127.0.0.1"
        hashes = ["3e1a1a0f6c53f3e97a492d57084b5b9807059ee057ab1505876fd83fda3db838",
                  "d0b243776a6c10e4485b34ea3e3b3a063f3089770e04a78c8087b7c49d4f98d6"]
        hostname = "doh.example.com"
        path = "/dns-query"

        self.assertEqual(
            "sdns://AgAAAAAAAAAACTEyNy4wLjAuMaA-GhoPbFPz6XpJLVcIS1uYBwWe4FerFQWHb9g_2j24OCDQskN3amwQ5EhbNOo-OzoGPzCJdw4Ep4yAh7fEnU-Y1g9kb2guZXhhbXBsZS5jb20KL2Rucy1xdWVyeQ",
            dnsstamps.create_doh(address, hashes, hostname, path),
            "Invalid stamp")
コード例 #5
0
    def test_generate_doh_stamp_with_options(self):
        address = "127.0.0.1"
        hashes = ["3e1a1a0f6c53f3e97a492d57084b5b9807059ee057ab1505876fd83fda3db838"]
        hostname = "doh.example.com"
        path = "/dns-query"
        options = [Option.NO_LOGS, Option.NO_FILTERS]

        self.assertEqual(
            "sdns://AgYAAAAAAAAACTEyNy4wLjAuMSA-GhoPbFPz6XpJLVcIS1uYBwWe4FerFQWHb9g_2j24OA9kb2guZXhhbXBsZS5jb20KL2Rucy1xdWVyeQ",
            dnsstamps.create_doh(address, hashes, hostname, path, options),
            "Invalid stamp")