当前位置: 首页>>代码示例>>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;未经允许,请勿转载。