当前位置: 首页>>代码示例>>Python>>正文


Python dns.SOA属性代码示例

本文整理汇总了Python中twisted.names.dns.SOA属性的典型用法代码示例。如果您正苦于以下问题:Python dns.SOA属性的具体用法?Python dns.SOA怎么用?Python dns.SOA使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在twisted.names.dns的用法示例。


在下文中一共展示了dns.SOA属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_authority

# 需要导入模块: from twisted.names import dns [as 别名]
# 或者: from twisted.names.dns import SOA [as 别名]
def test_authority(self):
        """
        Two L{dns.Message} instances compare equal if they have the same
        authority records.
        """
        self.assertNormalEqualityImplementation(
            self.messageFactory(authority=[dns.RRHeader(
                        b'example.com',
                        type=dns.SOA, payload=dns.Record_SOA())]),
            self.messageFactory(authority=[dns.RRHeader(
                        b'example.com',
                        type=dns.SOA, payload=dns.Record_SOA())]),
            self.messageFactory(authority=[dns.RRHeader(
                        b'example.org',
                        type=dns.SOA, payload=dns.Record_SOA())]),
            ) 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:18,代码来源:test_dns.py

示例2: lookupZone

# 需要导入模块: from twisted.names import dns [as 别名]
# 或者: from twisted.names.dns import SOA [as 别名]
def lookupZone(self, name, timeout = 10):
        if self.soa[0].lower() == name.lower():
            # Wee hee hee hooo yea
            default_ttl = max(self.soa[1].minimum, self.soa[1].expire)
            if self.soa[1].ttl is not None:
                soa_ttl = self.soa[1].ttl
            else:
                soa_ttl = default_ttl
            results = [dns.RRHeader(self.soa[0], dns.SOA, dns.IN, soa_ttl, self.soa[1], auth=True)]
            for (k, r) in self.records.items():
                for rec in r:
                    if rec.ttl is not None:
                        ttl = rec.ttl
                    else:
                        ttl = default_ttl
                    if rec.TYPE != dns.SOA:
                        results.append(dns.RRHeader(k, rec.TYPE, dns.IN, ttl, rec, auth=True))
            results.append(results[0])
            return defer.succeed((results, (), ()))
        return defer.fail(failure.Failure(dns.DomainError(name))) 
开发者ID:kuri65536,项目名称:python-for-android,代码行数:22,代码来源:authority.py

示例3: class_IN

# 需要导入模块: from twisted.names import dns [as 别名]
# 或者: from twisted.names.dns import SOA [as 别名]
def class_IN(self, ttl, type, domain, rdata):
        record = getattr(dns, 'Record_%s' % type, None)
        if record:
            r = record(*rdata)
            r.ttl = ttl
            self.records.setdefault(domain.lower(), []).append(r)

            print 'Adding IN Record', domain, ttl, r
            if type == 'SOA':
                self.soa = (domain, r)
        else:
            raise NotImplementedError, "Record type %r not supported" % type


    #
    # This file ends here.  Read no further.
    # 
开发者ID:kuri65536,项目名称:python-for-android,代码行数:19,代码来源:authority.py

示例4: messageReceived

# 需要导入模块: from twisted.names import dns [as 别名]
# 或者: from twisted.names.dns import SOA [as 别名]
def messageReceived(self, message, protocol):
        # Caveat: We have to handle two cases: All records are in 1
        # message, or all records are in N messages.

        # According to http://cr.yp.to/djbdns/axfr-notes.html,
        # 'authority' and 'additional' are always empty, and only
        # 'answers' is present.
        self.records.extend(message.answers)
        if not self.records:
            return
        if not self.soa:
            if self.records[0].type == dns.SOA:
                #print "first SOA!"
                self.soa = self.records[0]
        if len(self.records) > 1 and self.records[-1].type == dns.SOA:
            #print "It's the second SOA! We're done."
            if self.timeoutCall is not None:
                self.timeoutCall.cancel()
                self.timeoutCall = None
            if self.deferred is not None:
                self.deferred.callback(self.records)
                self.deferred = None 
开发者ID:kuri65536,项目名称:python-for-android,代码行数:24,代码来源:client.py

示例5: lookupZone

# 需要导入模块: from twisted.names import dns [as 别名]
# 或者: from twisted.names.dns import SOA [as 别名]
def lookupZone(self, name, timeout=10):
        if self.soa[0].lower() == name.lower():
            # Wee hee hee hooo yea
            default_ttl = max(self.soa[1].minimum, self.soa[1].expire)
            if self.soa[1].ttl is not None:
                soa_ttl = self.soa[1].ttl
            else:
                soa_ttl = default_ttl
            results = [
                dns.RRHeader(
                    self.soa[0], dns.SOA, dns.IN, soa_ttl, self.soa[1],
                    auth=True
                )
            ]
            for (k, r) in self.records.items():
                for rec in r:
                    if rec.ttl is not None:
                        ttl = rec.ttl
                    else:
                        ttl = default_ttl
                    if rec.TYPE != dns.SOA:
                        results.append(
                            dns.RRHeader(
                                k, rec.TYPE, dns.IN, ttl, rec, auth=True
                            )
                        )
            results.append(results[0])
            return defer.succeed((results, (), ()))
        return defer.fail(failure.Failure(dns.DomainError(name))) 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:31,代码来源:authority.py

示例6: class_IN

# 需要导入模块: from twisted.names import dns [as 别名]
# 或者: from twisted.names.dns import SOA [as 别名]
def class_IN(self, ttl, type, domain, rdata):
        """
        Simulate a class IN and recurse into the actual class.

        @param ttl: time to live for the record
        @type ttl: L{int}

        @param type: record type
        @type type: str

        @param domain: the domain
        @type domain: bytes

        @param rdata:
        @type rdate: bytes
        """
        record = getattr(dns, 'Record_%s' % (nativeString(type),), None)
        if record:
            r = record(*rdata)
            r.ttl = ttl
            self.records.setdefault(domain.lower(), []).append(r)

            if type == 'SOA':
                self.soa = (domain, r)
        else:
            raise NotImplementedError(
                "Record type %r not supported" % (nativeString(type),)
            ) 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:30,代码来源:authority.py

示例7: _cbZone

# 需要导入模块: from twisted.names import dns [as 别名]
# 或者: from twisted.names.dns import SOA [as 别名]
def _cbZone(self, zone):
        ans, _, _ = zone
        self.records = r = {}
        for rec in ans:
            if not self.soa and rec.type == dns.SOA:
                self.soa = (str(rec.name).lower(), rec.payload)
            else:
                r.setdefault(str(rec.name).lower(), []).append(rec.payload) 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:10,代码来源:secondary.py

示例8: lookupAuthority

# 需要导入模块: from twisted.names import dns [as 别名]
# 或者: from twisted.names.dns import SOA [as 别名]
def lookupAuthority(self, name, timeout=None):
        return self._lookup(name, dns.IN, dns.SOA, timeout) 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:4,代码来源:common.py

示例9: test_authority

# 需要导入模块: from twisted.names import dns [as 别名]
# 或者: from twisted.names.dns import SOA [as 别名]
def test_authority(self):
        """Test DNS 'SOA' record queries"""
        return self.namesTest(
            self.resolver.lookupAuthority('test-domain.com'),
            [soa_record]
        ) 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:8,代码来源:test_names.py

示例10: test_soa

# 需要导入模块: from twisted.names import dns [as 别名]
# 或者: from twisted.names.dns import SOA [as 别名]
def test_soa(self):
        """
        The repr of a L{dns.Record_SOA} instance includes all of the
        authority fields.
        """
        self.assertEqual(
            repr(dns.Record_SOA(mname=b'mName', rname=b'rName', serial=123,
                                refresh=456, retry=789, expire=10,
                                minimum=11, ttl=12)),
            "<SOA mname=mName rname=rName serial=123 refresh=456 "
            "retry=789 expire=10 minimum=11 ttl=12>") 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:13,代码来源:test_dns.py

示例11: test_authorityOverride

# 需要导入模块: from twisted.names import dns [as 别名]
# 或者: from twisted.names.dns import SOA [as 别名]
def test_authorityOverride(self):
        """
        L{dns._EDNSMessage.authority} can be overridden in the constructor.
        """
        msg = self.messageFactory(
            authority=[
                dns.RRHeader(
                    b'example.com',
                    type=dns.SOA,
                    payload=dns.Record_SOA())])

        self.assertEqual(
            msg.authority,
            [dns.RRHeader(b'example.com', type=dns.SOA,
                          payload=dns.Record_SOA())]) 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:17,代码来源:test_dns.py

示例12: test_lookupAuthority

# 需要导入模块: from twisted.names import dns [as 别名]
# 或者: from twisted.names.dns import SOA [as 别名]
def test_lookupAuthority(self):
        """
        See L{test_lookupAddress}
        """
        d = client.lookupAuthority(self.hostname)
        d.addCallback(self.checkResult, dns.SOA)
        return d 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:9,代码来源:test_client.py

示例13: lookupAuthority

# 需要导入模块: from twisted.names import dns [as 别名]
# 或者: from twisted.names.dns import SOA [as 别名]
def lookupAuthority(self, name, timeout = None):
        """
        @see: twisted.names.client.lookupAuthority
        """
        return self._lookup(name, dns.IN, dns.SOA, timeout) 
开发者ID:kuri65536,项目名称:python-for-android,代码行数:7,代码来源:common.py

示例14: testAuthority

# 需要导入模块: from twisted.names import dns [as 别名]
# 或者: from twisted.names.dns import SOA [as 别名]
def testAuthority(self):
        """Test DNS 'SOA' record queries"""
        return self.namesTest(
            self.resolver.lookupAuthority('test-domain.com'),
            [soa_record]
        ) 
开发者ID:kuri65536,项目名称:python-for-android,代码行数:8,代码来源:test_names.py

示例15: setUp

# 需要导入模块: from twisted.names import dns [as 别名]
# 或者: from twisted.names.dns import SOA [as 别名]
def setUp(self):
        self.results = None
        self.d = defer.Deferred()
        self.d.addCallback(self._gotResults)
        self.controller = client.AXFRController('fooby.com', self.d)

        self.soa = dns.RRHeader(name='fooby.com', type=dns.SOA, cls=dns.IN, ttl=86400, auth=False,
                                payload=dns.Record_SOA(mname='fooby.com',
                                                       rname='hooj.fooby.com',
                                                       serial=100,
                                                       refresh=200,
                                                       retry=300,
                                                       expire=400,
                                                       minimum=500,
                                                       ttl=600))

        self.records = [
            self.soa,
            dns.RRHeader(name='fooby.com', type=dns.NS, cls=dns.IN, ttl=700, auth=False,
                         payload=dns.Record_NS(name='ns.twistedmatrix.com', ttl=700)),

            dns.RRHeader(name='fooby.com', type=dns.MX, cls=dns.IN, ttl=700, auth=False,
                         payload=dns.Record_MX(preference=10, exchange='mail.mv3d.com', ttl=700)),

            dns.RRHeader(name='fooby.com', type=dns.A, cls=dns.IN, ttl=700, auth=False,
                         payload=dns.Record_A(address='64.123.27.105', ttl=700)),
            self.soa
            ] 
开发者ID:kuri65536,项目名称:python-for-android,代码行数:30,代码来源:test_names.py


注:本文中的twisted.names.dns.SOA属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。