org.xbill.DNS.Resolver类的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(5.5k)|赞(0)|评价(0)|浏览(134)

本文整理了Java中org.xbill.DNS.Resolver类的一些代码示例,展示了Resolver类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Resolver类的具体详情如下:
包路径:org.xbill.DNS.Resolver
类名称:Resolver

Resolver介绍

暂无

代码示例

代码示例来源:origin: yuliskov/SmartYouTubeTV

public GoogleResolver() {
  String dns = findProperServer();
  resolver = createResolver(dns);
  resolver.setTimeout(RESOLVE_TIMEOUT_S);
}

代码示例来源:origin: dnsjava/dnsjava

public void
setPort(int port) {
  for (int i = 0; i < resolvers.size(); i++)
    ((Resolver)resolvers.get(i)).setPort(port);
}

代码示例来源:origin: posicks/mdnsjava

/**
 * {@inheritDoc}
 */
public void setTCP(final boolean flag)
{
  for (Resolver resolver : unicastResolvers)
  {
    resolver.setTCP(flag);
  }
}

代码示例来源:origin: org.apache.whirr/whirr-core

try {
 Resolver resolver = new ExtendedResolver();
 resolver.setTimeout(timeoutInSeconds);
 resolver.setTCP(true);
 Message response = resolver.send(newQuery(record));

代码示例来源:origin: DSpace/DSpace

int timeout = ConfigurationManager.getIntProperty("usage-statistics",
                         "resolver.timeout", 200);
res.setTimeout(0, timeout);
Message response = res.send(query);

代码示例来源:origin: dnsjava/dnsjava

if (token.isString()) {
  String portstr = token.value;
  res.setPort(Short.parseShort(portstr));
if (res == null)
  res = new SimpleResolver(server);
res.setTSIGKey(new TSIG(keyname, keydata));
if (res == null)
  res = new SimpleResolver(server);
res.setEDNS(st.getUInt16());
if (res == null)
  res = new SimpleResolver(server);
res.setPort(st.getUInt16());
if (res == null)
  res = new SimpleResolver(server);
res.setTCP(true);

代码示例来源:origin: dnsjava/dnsjava

/**
 * Performs the query, and executes the callback.
 */
public void
run() {
  try {
    Message response = res.send(query);
    listener.receiveMessage(id, response);
  }
  catch (Exception e) {
    listener.handleException(id, e);
  }
}

代码示例来源:origin: OpenNMS/opennms

/**
 * <p>afterPropertiesSet</p>
 *
 * @throws java.lang.Exception if any.
 */
@Override
public void afterPropertiesSet() throws Exception {        
  String dnsServer = System.getProperty("importer.adapter.dns.server");
  if (!StringUtils.isBlank(dnsServer)) {
    LOG.info("DNS property found: {}", dnsServer);
    if (dnsServer.contains(":")) {
      final String[] serverAddress = dnsServer.split(":");
      m_resolver = new SimpleResolver(serverAddress[0]);
      m_resolver.setPort(Integer.valueOf(serverAddress[1]));
    } else {
      m_resolver = new SimpleResolver(dnsServer);
    }

    // Doesn't work for some reason, haven't figured out why yet
    String key = System.getProperty("importer.adapter.dns.privatekey");
    if (key != null && key.length() > 0) {
      m_signature = key;
      m_resolver.setTSIGKey(TSIG.fromString(m_signature));
    }
  } else {
    LOG.warn("no DNS server configured, ReverseDnsProvisioningAdapter will not do anything!");
  }
}

代码示例来源:origin: github/elasticsearch-srv-discovery

Resolver resolver = new SimpleResolver(host);
  if (port > 0) {
    resolver.setPort(port);
    parent_resolver.setTCP(true);
parent_resolver.setTCP(true);

代码示例来源:origin: net.sf.dnsjava-osgi/dnsjava-osgi

public void
setEDNS(int level, int payloadSize, int flags, List options) {
  for (int i = 0; i < resolvers.size(); i++)
    ((Resolver)resolvers.get(i)).setEDNS(level, payloadSize,
               flags, options);
}

代码示例来源:origin: net.sf.dnsjava-osgi/dnsjava-osgi

public void
setTSIGKey(TSIG key) {
  for (int i = 0; i < resolvers.size(); i++)
    ((Resolver)resolvers.get(i)).setTSIGKey(key);
}

代码示例来源:origin: net.sf.dnsjava-osgi/dnsjava-osgi

public void
send(int n) {
  sent[n]++;
  outstanding++;
  try {
    inprogress[n] = resolvers[n].sendAsync(query, this);
  }
  catch (Throwable t) {
    thrown = t;
    done = true;
    if (listener == null) {
      notifyAll();
      return;
    }
  }
}

代码示例来源:origin: dnsjava/dnsjava

public void
setIgnoreTruncation(boolean flag) {
  for (int i = 0; i < resolvers.size(); i++)
    ((Resolver)resolvers.get(i)).setIgnoreTruncation(flag);
}

代码示例来源:origin: apache/attic-whirr

try {
 Resolver resolver = new ExtendedResolver();
 resolver.setTimeout(timeoutInSeconds);
 resolver.setTCP(true);
 Message response = resolver.send(newQuery(record));

代码示例来源:origin: org.dspace/dspace-stats

public static String reverseDns(String hostIp) throws IOException {
     Resolver res = new ExtendedResolver();
          // set the timeout, defaults to 200 milliseconds
     int timeout = ConfigurationManager.getIntProperty("solr-statistics", "resolver.timeout", 200);
     res.setTimeout(0, timeout);

     Name name = ReverseMap.fromAddress(hostIp);
     int type = Type.PTR;
     int dclass = DClass.IN;
     Record rec = Record.newRecord(name, type, dclass);
     Message query = Message.newQuery(rec);
     Message response = res.send(query);

     Record[] answers = response.getSectionArray(Section.ANSWER);
     if (answers.length == 0)
     {
       return hostIp;
     }
     else
     {
       return answers[0].rdataToString();
     }
  }
}

代码示例来源:origin: org.littleshoot/dnsjava

/**
 * Performs the query, and executes the callback.
 */
public void
run() {
  try {
    Message response = res.send(query);
    listener.receiveMessage(id, response);
  }
  catch (Exception e) {
    listener.handleException(id, e);
  }
}

代码示例来源:origin: OpenNMS/opennms

final String[] serverAddress = dnsServer.split(":");
  m_resolver = new SimpleResolver(serverAddress[0]);
  m_resolver.setPort(Integer.valueOf(serverAddress[1]));
} else {
  m_resolver = new SimpleResolver(dnsServer);
if (key != null && key.length() > 0) {
  m_signature = key;
  m_resolver.setTSIGKey(TSIG.fromString(m_signature));

代码示例来源:origin: dnsjava/dnsjava

public void
setEDNS(int level, int payloadSize, int flags, List options) {
  for (int i = 0; i < resolvers.size(); i++)
    ((Resolver)resolvers.get(i)).setEDNS(level, payloadSize,
               flags, options);
}

代码示例来源:origin: tiandawu/IotXmpp

public void
setTSIGKey(TSIG key) {
  for (int i = 0; i < resolvers.size(); i++)
    ((Resolver)resolvers.get(i)).setTSIGKey(key);
}

代码示例来源:origin: org.littleshoot/dnsjava

public void
send(int n) {
  sent[n]++;
  outstanding++;
  try {
    inprogress[n] = resolvers[n].sendAsync(query, this);
  }
  catch (Throwable t) {
    synchronized (this) {
      thrown = t;
      done = true;
      if (listener == null) {
        notifyAll();
        return;
      }
    }
  }
}

相关文章