本文整理汇总了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;
}