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


Python dns.PORT属性代码示例

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


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

示例1: opt_secondary

# 需要导入模块: from twisted.names import dns [as 别名]
# 或者: from twisted.names.dns import PORT [as 别名]
def opt_secondary(self, ip_domain):
        """Act as secondary for the specified domain, performing
        zone transfers from the specified IP (IP/domain)
        """
        args = ip_domain.split('/', 1)
        if len(args) != 2:
            raise usage.UsageError("Argument must be of the form IP[:port]/domain")
        address = args[0].split(':')
        if len(address) == 1:
            address = (address[0], dns.PORT)
        else:
            try:
                port = int(address[1])
            except ValueError:
                raise usage.UsageError(
                    "Specify an integer port number, not %r" % (address[1],))
            address = (address[0], port)
        self.secondaries.append((address, [args[1]])) 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:20,代码来源:tap.py

示例2: parseConfig

# 需要导入模块: from twisted.names import dns [as 别名]
# 或者: from twisted.names.dns import PORT [as 别名]
def parseConfig(self, resolvConf):
        servers = []
        for L in resolvConf:
            L = L.strip()
            if L.startswith('nameserver'):
                resolver = (L.split()[1], dns.PORT)
                servers.append(resolver)
                log.msg("Resolver added %r to server list" % (resolver,))
            elif L.startswith('domain'):
                try:
                    self.domain = L.split()[1]
                except IndexError:
                    self.domain = ''
                self.search = None
            elif L.startswith('search'):
                try:
                    self.search = L.split()[1:]
                except IndexError:
                    self.search = ''
                self.domain = None
        if not servers:
            servers.append(('127.0.0.1', dns.PORT))
        self.dynServers = servers 
开发者ID:kenorb-contrib,项目名称:BitTorrent,代码行数:25,代码来源:client.py

示例3: __init__

# 需要导入模块: from twisted.names import dns [as 别名]
# 或者: from twisted.names.dns import PORT [as 别名]
def __init__(self):
        # Merge rdns_servers entries from local and bridge configs.
        servers = set()
        try:
            import dtella.local_config as local
            servers.update(local.rdns_servers)
        except (ImportError, AttributeError):
            pass
        try:
            import dtella.bridge_config as cfg
            servers.update(cfg.rdns_servers)
        except (ImportError, AttributeError):
            pass

        # Convert to list, and randomize.
        servers = list(servers)
        random.shuffle(servers)

        self.resolver = client.Resolver(
            servers=[(ip, dns.PORT) for ip in servers],
            timeout=(1,2,3)) 
开发者ID:ffledgling,项目名称:dtella,代码行数:23,代码来源:reverse_dns.py

示例4: _roots

# 需要导入模块: from twisted.names import dns [as 别名]
# 或者: from twisted.names.dns import PORT [as 别名]
def _roots(self):
        """
        Return a list of two-tuples representing the addresses of the root
        servers, as defined by C{self.hints}.
        """
        return [(ip, dns.PORT) for ip in self.hints] 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:8,代码来源:root.py

示例5: extractRecord

# 需要导入模块: from twisted.names import dns [as 别名]
# 或者: from twisted.names.dns import PORT [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

示例6: test_secondary

# 需要导入模块: from twisted.names import dns [as 别名]
# 或者: from twisted.names.dns import PORT [as 别名]
def test_secondary(self):
        """
        An argument of the form C{"ip/domain"} is parsed by L{Options} for the
        I{--secondary} option and added to its list of secondaries, using the
        default DNS port number.
        """
        options = Options()
        options.parseOptions(['--secondary', '1.2.3.4/example.com'])
        self.assertEqual(
            [(('1.2.3.4', PORT), ['example.com'])], options.secondaries) 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:12,代码来源:test_tap.py

示例7: discoveredAuthority

# 需要导入模块: from twisted.names import dns [as 别名]
# 或者: from twisted.names.dns import PORT [as 别名]
def discoveredAuthority(self, auth, name, cls, type, timeout):
        warnings.warn(
            'twisted.names.root.Resolver.discoveredAuthority is deprecated since '
            'Twisted 10.0.  Use twisted.names.client.Resolver directly, instead.',
            category=DeprecationWarning, stacklevel=2)
        from twisted.names import client
        q = dns.Query(name, type, cls)
        r = client.Resolver(servers=[(auth, dns.PORT)])
        d = r.queryUDP([q], timeout)
        d.addCallback(r.filterAnswers)
        return d 
开发者ID:kuri65536,项目名称:python-for-android,代码行数:13,代码来源:root.py

示例8: lookupNameservers

# 需要导入模块: from twisted.names import dns [as 别名]
# 或者: from twisted.names.dns import PORT [as 别名]
def lookupNameservers(host, atServer, p=None):
    warnings.warn(
        'twisted.names.root.lookupNameservers is deprecated since Twisted '
        '10.0.  Use twisted.names.root.Resolver.lookupNameservers instead.',
        category=DeprecationWarning, stacklevel=2)
    # print 'Nameserver lookup for', host, 'at', atServer, 'with', p
    if p is None:
        p = dns.DNSDatagramProtocol(_DummyController())
        p.noisy = False
    return retry(
        (1, 3, 11, 45),                     # Timeouts
        p,                                  # Protocol instance
        (atServer, dns.PORT),               # Server to query
        [dns.Query(host, dns.NS, dns.IN)]   # Question to ask
    ) 
开发者ID:kuri65536,项目名称:python-for-android,代码行数:17,代码来源:root.py

示例9: lookupAddress

# 需要导入模块: from twisted.names import dns [as 别名]
# 或者: from twisted.names.dns import PORT [as 别名]
def lookupAddress(host, atServer, p=None):
    warnings.warn(
        'twisted.names.root.lookupAddress is deprecated since Twisted '
        '10.0.  Use twisted.names.root.Resolver.lookupAddress instead.',
        category=DeprecationWarning, stacklevel=2)
    # print 'Address lookup for', host, 'at', atServer, 'with', p
    if p is None:
        p = dns.DNSDatagramProtocol(_DummyController())
        p.noisy = False
    return retry(
        (1, 3, 11, 45),                     # Timeouts
        p,                                  # Protocol instance
        (atServer, dns.PORT),               # Server to query
        [dns.Query(host, dns.A, dns.IN)]    # Question to ask
    ) 
开发者ID:kuri65536,项目名称:python-for-android,代码行数:17,代码来源:root.py

示例10: transfer

# 需要导入模块: from twisted.names import dns [as 别名]
# 或者: from twisted.names.dns import PORT [as 别名]
def transfer(self):
        if self.transferring:
            return
        self.transfering = True
        return client.Resolver(servers=[(self.primary, dns.PORT)]
            ).lookupZone(self.domain
            ).addCallback(self._cbZone
            ).addErrback(self._ebZone
            ) 
开发者ID:kuri65536,项目名称:python-for-android,代码行数:11,代码来源:secondary.py

示例11: extractRecord

# 需要导入模块: from twisted.names import dns [as 别名]
# 或者: from twisted.names.dns import PORT [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

示例12: discoveredAuthority

# 需要导入模块: from twisted.names import dns [as 别名]
# 或者: from twisted.names.dns import PORT [as 别名]
def discoveredAuthority(self, auth, name, cls, type, timeout):
        from twisted.names import client
        q = dns.Query(name, type, cls)
        r = client.Resolver(servers=[(auth, dns.PORT)])
        d = r.queryUDP([q], timeout)
        d.addCallback(r.filterAnswers)
        return d 
开发者ID:kenorb-contrib,项目名称:BitTorrent,代码行数:9,代码来源:root.py

示例13: lookupNameservers

# 需要导入模块: from twisted.names import dns [as 别名]
# 或者: from twisted.names.dns import PORT [as 别名]
def lookupNameservers(host, atServer, p=None):
    # print 'Nameserver lookup for', host, 'at', atServer, 'with', p
    if p is None:
        p = dns.DNSDatagramProtocol(_DummyController())
        p.noisy = False
    return retry(
        (1, 3, 11, 45),                     # Timeouts
        p,                                  # Protocol instance
        (atServer, dns.PORT),               # Server to query
        [dns.Query(host, dns.NS, dns.IN)]   # Question to ask
    ) 
开发者ID:kenorb-contrib,项目名称:BitTorrent,代码行数:13,代码来源:root.py

示例14: lookupAddress

# 需要导入模块: from twisted.names import dns [as 别名]
# 或者: from twisted.names.dns import PORT [as 别名]
def lookupAddress(host, atServer, p=None):
    # print 'Address lookup for', host, 'at', atServer, 'with', p
    if p is None:
        p = dns.DNSDatagramProtocol(_DummyController())
        p.noisy = False
    return retry(
        (1, 3, 11, 45),                     # Timeouts
        p,                                  # Protocol instance
        (atServer, dns.PORT),               # Server to query
        [dns.Query(host, dns.A, dns.IN)]    # Question to ask
    ) 
开发者ID:kenorb-contrib,项目名称:BitTorrent,代码行数:13,代码来源:root.py

示例15: __init__

# 需要导入模块: from twisted.names import dns [as 别名]
# 或者: from twisted.names.dns import PORT [as 别名]
def __init__(self, servers, hostname):
        self.servers = list(servers)
        self.hostname = hostname

        random.shuffle(servers)

        self.resolver = client.Resolver(
            servers=[(ip, dns.PORT) for ip in servers],
            timeout=(1,2,3)) 
开发者ID:ffledgling,项目名称:dtella,代码行数:11,代码来源:pull_dns.py


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