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


Java Type.SRV屬性代碼示例

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


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

示例1: lookupSRVRecords

@Override
public List<SRVRecord> lookupSRVRecords(String name) throws TextParseException {
    List<SRVRecord> res = new ArrayList<SRVRecord>();

    Lookup lookup = new Lookup(name, Type.SRV);
    Record[] recs = lookup.run();
    if (recs == null)
        return res;

    for (Record record : recs) {
        org.xbill.DNS.SRVRecord srvRecord = (org.xbill.DNS.SRVRecord) record;
        if (srvRecord != null && srvRecord.getTarget() != null) {
            String host = srvRecord.getTarget().toString();
            int port = srvRecord.getPort();
            int priority = srvRecord.getPriority();
            int weight = srvRecord.getWeight();

            SRVRecord r = new SRVRecord(host, port, priority, weight);
            res.add(r);
        }
    }

    return res;
}
 
開發者ID:TTalkIM,項目名稱:Smack,代碼行數:24,代碼來源:DNSJavaResolver.java

示例2: getMultiSRV

public List<DNSServiceRecord> getMultiSRV(String key) throws ConfigException {
  String qkey = fullyQualify(key);
  List<DNSServiceRecord> result = new ArrayList<DNSServiceRecord>();

  List<Record> list = m_records.get(makeHostKey(qkey));
  if (list == null) {
    throw new NotFoundException("No such record: " + makeHostKey(qkey));
  }

  for (Record r : list) {
    if (r.getType() != Type.SRV) {
      continue;
    }

    result.add(new DNSServiceRecord(((SRVRecord) r).rdataToString()));
  }

  return result;
}
 
開發者ID:pulsarIO,項目名稱:jetstream,代碼行數:19,代碼來源:DNSFileMap.java

示例3: createLookup

private Lookup createLookup(String name) {
    try {
        return new Lookup(
            String.format("%s.%s.%s", name, configuration.getProto(), configuration.getDomain()),
            Type.SRV);
    } catch (TextParseException e) {
        throw new RuntimeCamelException(e);
    }
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:9,代碼來源:DnsServiceLookupFactory.java

示例4: getSRV

public DNSServiceRecord getSRV(String key) throws ConfigException {
  String qkey = fullyQualify(key);
  List<Record> list = m_records.get(makeHostKey(qkey));
  if (list == null || list.get(0).getType() != Type.SRV) {
    throw new NotFoundException("No such record: " + makeHostKey(qkey));
  }

  SRVRecord srec = (SRVRecord) list.get(0);
  return new DNSServiceRecord(srec.rdataToString());
}
 
開發者ID:pulsarIO,項目名稱:jetstream,代碼行數:10,代碼來源:DNSFileMap.java

示例5: buildLookup

private Lookup buildLookup()
        throws TextParseException, UnknownHostException {

    ExtendedResolver resolver = new ExtendedResolver();
    resolver.setTimeout(serviceDnsTimeout);

    Lookup lookup = new Lookup(serviceDns, Type.SRV);
    lookup.setResolver(resolver);

    // Avoid caching temporary DNS lookup failures indefinitely in global cache
    lookup.setCache(null);

    return lookup;
}
 
開發者ID:hazelcast,項目名稱:hazelcast-kubernetes,代碼行數:14,代碼來源:DnsEndpointResolver.java

示例6: forName

@Override
public Lookup forName(String fqdn) {
  try {
    return new Lookup(fqdn, Type.SRV, DClass.IN);
  } catch (TextParseException e) {
    throw new DnsException("unable to create lookup for name: " + fqdn, e);
  }
}
 
開發者ID:spotify,項目名稱:dns-java,代碼行數:8,代碼來源:SimpleLookupFactory.java

示例7: testLookup

private Lookup testLookup(String thefqdn) throws TextParseException {
  Lookup result = new Lookup(thefqdn, Type.SRV);

  result.setResolver(xbillResolver);

  return result;
}
 
開發者ID:spotify,項目名稱:dns-java,代碼行數:7,代碼來源:XBillDnsSrvResolverTest.java


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