Exemple #1
0
 def testA6(self):
     """Test DNS 'A6' record queries (IPv6)"""
     return self.namesTest(
         self.resolver.lookupAddress6('test-domain.com'),
         [dns.Record_A6(0, 'ABCD::4321', '', ttl=19283784),
          dns.Record_A6(12, '0:0069::0', 'some.network.tld', ttl=19283784),
          dns.Record_A6(8, '0:5634:1294:AFCB:56AC:48EF:34C3:01FF', 'tra.la.la.net', ttl=19283784)]
      )
 def test_A6(self):
     """Test DNS 'A6' record queries (IPv6)"""
     return self.namesTest(
         self.resolver.lookupAddress6("test-domain.com"),
         [
             dns.Record_A6(0, "ABCD::4321", "", ttl=19283784),
             dns.Record_A6(
                 12, "0:0069::0", "some.network.tld", ttl=19283784),
             dns.Record_A6(
                 8,
                 "0:5634:1294:AFCB:56AC:48EF:34C3:01FF",
                 "tra.la.la.net",
                 ttl=19283784,
             ),
         ],
     )
Exemple #3
0
 def record_A6FromRawData(ttl, prefixLen, suffix, prefix):
     record_A6 = dns.Record_A6(ttl=ttl, prefixLen=prefixLen)
     record_A6.bytes = int((128 - prefixLen) / 8.0)
     if record_A6.bytes:
         record_A6.suffix = suffix
     if record_A6.prefixLen:
         record_A6.prefix = prefix
     return record_A6
Exemple #4
0
 def test_a6(self):
     """
     The repr of a L{dns.Record_A6} instance includes the colon-separated
     hex string representation of the address it is for and the TTL of the
     record.
     """
     self.assertEqual(
         repr(dns.Record_A6(0, '1234::5678', 'foo.bar', ttl=10)),
         "<A6 suffix=1234::5678 prefix=foo.bar ttl=10>")
 soa=('test-domain.com', soa_record),
 records={
     'test-domain.com': [
         soa_record,
         dns.Record_A('127.0.0.1'),
         dns.Record_NS('39.28.189.39'),
         dns.Record_SPF('v=spf1 mx/30 mx:example.org/30 -all'),
         dns.Record_SPF('v=spf1 +mx a:\0colo',
                        '.example.com/28 -all not valid'),
         dns.Record_MX(10, 'host.test-domain.com'),
         dns.Record_HINFO(os='Linux', cpu='A Fast One, Dontcha know'),
         dns.Record_CNAME('canonical.name.com'),
         dns.Record_MB('mailbox.test-domain.com'),
         dns.Record_MG('mail.group.someplace'),
         dns.Record_TXT('A First piece of Text', 'a SecoNd piece'),
         dns.Record_A6(0, 'ABCD::4321', ''),
         dns.Record_A6(12, '0:0069::0', 'some.network.tld'),
         dns.Record_A6(8, '0:5634:1294:AFCB:56AC:48EF:34C3:01FF',
                       'tra.la.la.net'),
         dns.Record_TXT('Some more text, haha!  Yes.  \0  Still here?'),
         dns.Record_MR('mail.redirect.or.whatever'),
         dns.Record_MINFO(rmailbx='r mail box', emailbx='e mail box'),
         dns.Record_AFSDB(subtype=1, hostname='afsdb.test-domain.com'),
         dns.Record_RP(mbox='whatever.i.dunno', txt='some.more.text'),
         dns.Record_WKS('12.54.78.12', socket.IPPROTO_TCP,
                        '\x12\x01\x16\xfe\xc1\x00\x01'),
         dns.Record_NAPTR(100, 10, "u", "sip+E2U",
                          "!^.*$!sip:[email protected]!"),
         dns.Record_AAAA('AF43:5634:1294:AFCB:56AC:48EF:34C3:01FF')
     ],
     'http.tcp.test-domain.com':
 soa=(b"test-domain.com", soa_record),
 records={
     b"test-domain.com": [
         soa_record,
         dns.Record_A(b"127.0.0.1"),
         dns.Record_NS(b"39.28.189.39"),
         dns.Record_SPF(b"v=spf1 mx/30 mx:example.org/30 -all"),
         dns.Record_SPF(b"v=spf1 +mx a:\0colo",
                        b".example.com/28 -all not valid"),
         dns.Record_MX(10, "host.test-domain.com"),
         dns.Record_HINFO(os=b"Linux", cpu=b"A Fast One, Dontcha know"),
         dns.Record_CNAME(b"canonical.name.com"),
         dns.Record_MB(b"mailbox.test-domain.com"),
         dns.Record_MG(b"mail.group.someplace"),
         dns.Record_TXT(b"A First piece of Text", b"a SecoNd piece"),
         dns.Record_A6(0, b"ABCD::4321", b""),
         dns.Record_A6(12, b"0:0069::0", b"some.network.tld"),
         dns.Record_A6(8, b"0:5634:1294:AFCB:56AC:48EF:34C3:01FF",
                       b"tra.la.la.net"),
         dns.Record_TXT(b"Some more text, haha!  Yes.  \0  Still here?"),
         dns.Record_MR(b"mail.redirect.or.whatever"),
         dns.Record_MINFO(rmailbx=b"r mail box", emailbx=b"e mail box"),
         dns.Record_AFSDB(subtype=1, hostname=b"afsdb.test-domain.com"),
         dns.Record_RP(mbox=b"whatever.i.dunno", txt=b"some.more.text"),
         dns.Record_WKS(b"12.54.78.12", socket.IPPROTO_TCP,
                        b"\x12\x01\x16\xfe\xc1\x00\x01"),
         dns.Record_NAPTR(100, 10, b"u", b"sip+E2U",
                          b"!^.*$!sip:[email protected]!"),
         dns.Record_AAAA(b"AF43:5634:1294:AFCB:56AC:48EF:34C3:01FF"),
     ],
     b"http.tcp.test-domain.com":
Exemple #7
0
    def test_a6(self):
        """
        Two L{dns.Record_A6} instances compare equal if and only if they have
        the same prefix, prefix length, suffix, and ttl.
        """
        # Note, A6 is crazy, I'm not sure these values are actually legal.
        # Hopefully that doesn't matter for this test. -exarkun

        # Vary the prefix length
        self._equalityTest(dns.Record_A6(16, '::abcd', 'example.com', 10),
                           dns.Record_A6(16, '::abcd', 'example.com', 10),
                           dns.Record_A6(32, '::abcd', 'example.com', 10))
        # Vary the suffix
        self._equalityTest(dns.Record_A6(16, '::abcd', 'example.com', 10),
                           dns.Record_A6(16, '::abcd', 'example.com', 10),
                           dns.Record_A6(16, '::abcd:0', 'example.com', 10))
        # Vary the prefix
        self._equalityTest(dns.Record_A6(16, '::abcd', 'example.com', 10),
                           dns.Record_A6(16, '::abcd', 'example.com', 10),
                           dns.Record_A6(16, '::abcd', 'example.org', 10))
        # Vary the ttl
        self._equalityTest(dns.Record_A6(16, '::abcd', 'example.com', 10),
                           dns.Record_A6(16, '::abcd', 'example.com', 10),
                           dns.Record_A6(16, '::abcd', 'example.com', 100))