當前位置: 首頁>>代碼示例>>Python>>正文


Python dns.AAAA屬性代碼示例

本文整理匯總了Python中twisted.names.dns.AAAA屬性的典型用法代碼示例。如果您正苦於以下問題:Python dns.AAAA屬性的具體用法?Python dns.AAAA怎麽用?Python dns.AAAA使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在twisted.names.dns的用法示例。


在下文中一共展示了dns.AAAA屬性的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_messageReceivedLogging2

# 需要導入模塊: from twisted.names import dns [as 別名]
# 或者: from twisted.names.dns import AAAA [as 別名]
def test_messageReceivedLogging2(self):
        """
        L{server.DNSServerFactory.messageReceived} logs the repr of all queries
        in the message if C{verbose} is set to C{2}.
        """
        m = dns.Message()
        m.addQuery(name='example.com', type=dns.MX)
        m.addQuery(name='example.com', type=dns.AAAA)
        f = NoResponseDNSServerFactory(verbose=2)

        assertLogMessage(
            self,
            ["<Query example.com MX IN> "
             "<Query example.com AAAA IN> query from ('192.0.2.100', 53)"],
            f.messageReceived,
            message=m, proto=None, address=('192.0.2.100', 53)) 
開發者ID:proxysh,項目名稱:Safejumper-for-Desktop,代碼行數:18,代碼來源:test_server.py

示例2: lookupIPV6Address

# 需要導入模塊: from twisted.names import dns [as 別名]
# 或者: from twisted.names.dns import AAAA [as 別名]
def lookupIPV6Address(self, name, timeout=None):
        return self._lookup(name, dns.IN, dns.AAAA, timeout) 
開發者ID:proxysh,項目名稱:Safejumper-for-Desktop,代碼行數:4,代碼來源:common.py

示例3: extractRecord

# 需要導入模塊: from twisted.names import dns [as 別名]
# 或者: from twisted.names.dns import AAAA [as 別名]
def extractRecord(resolver, name, answers, level=10):
    if not level:
        return None
    if hasattr(socket, 'inet_ntop'):
        for r in answers:
            if r.name == name and r.type == dns.A6:
                return socket.inet_ntop(socket.AF_INET6, r.payload.address)
        for r in answers:
            if r.name == name and r.type == dns.AAAA:
                return socket.inet_ntop(socket.AF_INET6, r.payload.address)
    for r in answers:
        if r.name == name and r.type == dns.A:
            return socket.inet_ntop(socket.AF_INET, r.payload.address)
    for r in answers:
        if r.name == name and r.type == dns.CNAME:
            result = extractRecord(
                resolver, r.payload.name, answers, level - 1)
            if not result:
                return resolver.getHostByName(
                    str(r.payload.name), effort=level - 1)
            return result
    # No answers, but maybe there's a hint at who we should be asking about
    # this
    for r in answers:
        if r.type == dns.NS:
            from twisted.names import client
            r = client.Resolver(servers=[(str(r.payload.name), dns.PORT)])
            return r.lookupAddress(str(name)
                ).addCallback(
                    lambda records: extractRecord(
                        r, name,
                        records[_ANS] + records[_AUTH] + records[_ADD],
                        level - 1)) 
開發者ID:proxysh,項目名稱:Safejumper-for-Desktop,代碼行數:35,代碼來源:common.py

示例4: test_messageReceivedLogging1

# 需要導入模塊: from twisted.names import dns [as 別名]
# 或者: from twisted.names.dns import AAAA [as 別名]
def test_messageReceivedLogging1(self):
        """
        L{server.DNSServerFactory.messageReceived} logs the query types of all
        queries in the message if C{verbose} is set to C{1}.
        """
        m = dns.Message()
        m.addQuery(name='example.com', type=dns.MX)
        m.addQuery(name='example.com', type=dns.AAAA)
        f = NoResponseDNSServerFactory(verbose=1)

        assertLogMessage(
            self,
            ["MX AAAA query from ('192.0.2.100', 53)"],
            f.messageReceived,
            message=m, proto=None, address=('192.0.2.100', 53)) 
開發者ID:proxysh,項目名稱:Safejumper-for-Desktop,代碼行數:17,代碼來源:test_server.py

示例5: test_lookupIPV6Address

# 需要導入模塊: from twisted.names import dns [as 別名]
# 或者: from twisted.names.dns import AAAA [as 別名]
def test_lookupIPV6Address(self):
        """
        See L{test_lookupAddress}
        """
        d = client.lookupIPV6Address(self.hostname)
        d.addCallback(self.checkResult, dns.AAAA)
        return d 
開發者ID:proxysh,項目名稱:Safejumper-for-Desktop,代碼行數:9,代碼來源:test_client.py

示例6: lookupIPV6Address

# 需要導入模塊: from twisted.names import dns [as 別名]
# 或者: from twisted.names.dns import AAAA [as 別名]
def lookupIPV6Address(self, name, timeout = None):
        """
        @see: twisted.names.client.lookupIPV6Address
        """
        return self._lookup(name, dns.IN, dns.AAAA, timeout) 
開發者ID:kuri65536,項目名稱:python-for-android,代碼行數:7,代碼來源:common.py

示例7: extractRecord

# 需要導入模塊: from twisted.names import dns [as 別名]
# 或者: from twisted.names.dns import AAAA [as 別名]
def extractRecord(resolver, name, answers, level=10):
    if not level:
        return None
    if hasattr(socket, 'inet_ntop'):
        for r in answers:
            if r.name == name and r.type == dns.A6:
                return socket.inet_ntop(socket.AF_INET6, r.payload.address)
        for r in answers:
            if r.name == name and r.type == dns.AAAA:
                return socket.inet_ntop(socket.AF_INET6, r.payload.address)
    for r in answers:
        if r.name == name and r.type == dns.A:
            return socket.inet_ntop(socket.AF_INET, r.payload.address)
    for r in answers:
        if r.name == name and r.type == dns.CNAME:
            result = extractRecord(
                resolver, r.payload.name, answers, level - 1)
            if not result:
                return resolver.getHostByName(
                    str(r.payload.name), effort=level - 1)
            return result
    # No answers, but maybe there's a hint at who we should be asking about
    # this
    for r in answers:
        if r.type == dns.NS:
            from twisted.names import client
            r = client.Resolver(servers=[(str(r.payload.name), dns.PORT)])
            return r.lookupAddress(str(name)
                ).addCallback(
                    lambda (ans, auth, add):
                        extractRecord(r, name, ans + auth + add, level - 1)) 
開發者ID:kuri65536,項目名稱:python-for-android,代碼行數:33,代碼來源:common.py

示例8: lookupIPV6Address

# 需要導入模塊: from twisted.names import dns [as 別名]
# 或者: from twisted.names.dns import AAAA [as 別名]
def lookupIPV6Address(self, name, timeout = None):
        return self._lookup(name, dns.IN, dns.AAAA, timeout) 
開發者ID:kenorb-contrib,項目名稱:BitTorrent,代碼行數:4,代碼來源:common.py

示例9: extractRecord

# 需要導入模塊: from twisted.names import dns [as 別名]
# 或者: from twisted.names.dns import AAAA [as 別名]
def extractRecord(resolver, name, answers, level = 10):
    if not level:
        return None
    if hasattr(socket, 'inet_ntop'):
        for r in answers:
            if r.name == name and r.type == dns.A6:
                return socket.inet_ntop(socket.AF_INET6, r.payload.address)
        for r in answers:
            if r.name == name and r.type == dns.AAAA:
                return socket.inet_ntop(socket.AF_INET6, r.payload.address)
    for r in answers:
        if r.name == name and r.type == dns.A:
            return socket.inet_ntop(socket.AF_INET, r.payload.address)
    for r in answers:
        if r.name == name and r.type == dns.CNAME:
            result = extractRecord(resolver, r.payload.name, answers, level - 1)
            if not result:
                return resolver.getHostByName(str(r.payload.name), effort=level-1)
            return result
    # No answers, but maybe there's a hint at who we should be asking about this
    for r in answers:
        if r.type == dns.NS:
            from twisted.names import client
            r = client.Resolver(servers=[(str(r.payload.name), dns.PORT)])
            return r.lookupAddress(str(name)
                ).addCallback(lambda (ans, auth, add): extractRecord(r, name, ans + auth + add, level - 1)
                ).addBoth(lambda passthrough: (r.protocol.transport.stopListening(), passthrough)[1]) 
開發者ID:kenorb-contrib,項目名稱:BitTorrent,代碼行數:29,代碼來源:common.py

示例10: _aaaaRecords

# 需要導入模塊: from twisted.names import dns [as 別名]
# 或者: from twisted.names.dns import AAAA [as 別名]
def _aaaaRecords(self, name, address):
        return tuple([dns.RRHeader(name, dns.AAAA, dns.IN, self.minTTL,
                                   dns.Record_AAAA(address, self.minTTL))]) 
開發者ID:skyline75489,項目名稱:SimpleDNS,代碼行數:5,代碼來源:dnsproxy.py

示例11: lookupIPV6Address

# 需要導入模塊: from twisted.names import dns [as 別名]
# 或者: from twisted.names.dns import AAAA [as 別名]
def lookupIPV6Address(self, name, timeout=None):
        r = self._matchAddress(name, self._aaaaRecords)
        if r:
            return self._respond(name, r)
        else:
            return self._lookup(name, dns.IN, dns.AAAA, timeout) 
開發者ID:skyline75489,項目名稱:SimpleDNS,代碼行數:8,代碼來源:dnsproxy.py


注:本文中的twisted.names.dns.AAAA屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。