本文整理匯總了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;
}
示例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;
}
示例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);
}
}
示例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());
}
示例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;
}
示例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);
}
}
示例7: testLookup
private Lookup testLookup(String thefqdn) throws TextParseException {
Lookup result = new Lookup(thefqdn, Type.SRV);
result.setResolver(xbillResolver);
return result;
}