当前位置: 首页>>代码示例>>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;未经允许,请勿转载。