org.xbill.DNS.Record.getType()方法的使用及代码示例

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

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

Record.getType介绍

暂无

代码示例

代码示例来源:origin: internetarchive/heritrix3

protected ARecord getFirstARecord(Record[] rrecordSet) {
    ARecord arecord = null;
    if (rrecordSet == null || rrecordSet.length == 0) {
      if (logger.isLoggable(Level.FINEST)) {
        logger.finest("rrecordSet is null or zero length: " +
          rrecordSet);
      }
      return arecord;
    }
    for (int i = 0; i < rrecordSet.length; i++) {
      if (rrecordSet[i].getType() != Type.A) {
        if (logger.isLoggable(Level.FINEST)) {
          logger.finest("Record " + Integer.toString(i) +
            " is not A type but " + rrecordSet[i].getType());
        }
        continue;
      }
      arecord = (ARecord) rrecordSet[i];
      break;
    }
    return arecord;
  }
}

代码示例来源:origin: RIPE-NCC/hadoop-pcap

private int convertRecordTypeToInt(Record record) {
  if (record == null)
    return -1;
  return record.getType();
}

代码示例来源:origin: com.ebay.jetstream/jetstreamcore

private List<InetAddress> resolve(String key) throws UnknownHostException {
  List<InetAddress> result = new ArrayList<InetAddress>();
  List<Record> list = m_records.get(key);
  if (list != null)
   for (Record r : list)
    
    if (r.getType() == Type.A)
      result.add(InetAddress.getByName(r.rdataToString()));
    else if ((r.getType() == Type.CNAME)) {
      List<Record> cnamelist = m_records.get(r.rdataToString());
      for (Record r1 : cnamelist) {
        result.add(InetAddress.getByName(r1.rdataToString()));
      }
    }
    
   
  return result;
 }
}

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

/**
 * Determines if an RRset with the given name and type is already
 * present in the given section.
 * @see RRset
 * @see Section
 */
public boolean
findRRset(Name name, int type, int section) {
  if (sections[section] == null)
    return false;
  for (int i = 0; i < sections[section].size(); i++) {
    Record r = (Record) sections[section].get(i);
    if (r.getType() == type && name.equals(r.getName()))
      return true;
  }
  return false;
}

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

/**
 * Determines if an RRset with the given name and type is already
 * present in the given section.
 * @see RRset
 * @see Section
 */
public boolean
findRRset(Name name, int type, int section) {
  if (sections[section] == null)
    return false;
  for (int i = 0; i < sections[section].size(); i++) {
    Record r = (Record) sections[section].get(i);
    if (r.getType() == type && name.equals(r.getName()))
      return true;
  }
  return false;
}

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

/**
 * Determines if an RRset with the given name and type is already
 * present in the given section.
 * @see RRset
 * @see Section
 */
public boolean
findRRset(Name name, int type, int section) {
  if (sections[section] == null)
    return false;
  for (int i = 0; i < sections[section].size(); i++) {
    Record r = (Record) sections[section].get(i);
    if (r.getType() == type && name.equals(r.getName()))
      return true;
  }
  return false;
}

代码示例来源:origin: com.ebay.jetstream/jetstreamcore

public String getTXT(String key) throws ConfigException {
 String qkey = fullyQualify(key);
 List<Record> list = m_records.get(makeHostKey(qkey));
 if (list == null || list.get(0).getType() != Type.TXT) {
  throw new NotFoundException("No such record: " + makeHostKey(qkey));
 }
 TXTRecord trec = (TXTRecord) list.get(0);
 String sdata = trec.rdataToString();
 if (sdata.charAt(0) == '"') {
  sdata = sdata.substring(1, sdata.length() - 1);
 }
 return sdata;
}

代码示例来源:origin: kamax-matrix/mxhsd

private Optional<RemoteAddress> lookupSrv(String domain) {
  try {
    Record[] records = new Lookup(prefix + domain, Type.SRV).run();
    if (records == null) {
      return Optional.empty();
    }
    return Stream.of(records)
        .filter(record -> record.getType() == Type.SRV && record instanceof SRVRecord)
        .map(record -> (SRVRecord) record)
        .min(Comparator.comparingInt(SRVRecord::getPriority))
        .map(record -> new RemoteAddress(record.getTarget().toString(true), record.getPort()));
  } catch (TextParseException e) {
    return Optional.empty();
  }
}

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

private static boolean resolve(final Name name,
                  final Resolver resolver,
                  final int type) {
    final Lookup lookup = new Lookup(name, type);
    // NMS-9238: Do not use a cache when looking up the record,
    // that kind of defeats the purpose of this monitor :)
    lookup.setCache(null);
    lookup.setResolver(resolver);

    final Record[] records = lookup.run();

    if (records == null) {
      return false;
    }

    return Arrays.stream(records)
           .filter(r -> r.getType() == type)
           .count() > 0;
  }
}

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

private final void
maybeAddRecord(Record record) throws IOException {
  int rtype = record.getType();
  Name name = record.getName();

  if (rtype == Type.SOA && !name.equals(origin)) {
    throw new IOException("SOA owner " + name +
           " does not match zone origin " +
           origin);
  }
  if (name.subdomain(origin))
    addRecord(record);
}

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

private final void
maybeAddRecord(Record record) throws IOException {
  int rtype = record.getType();
  Name name = record.getName();

  if (rtype == Type.SOA && !name.equals(origin)) {
    throw new IOException("SOA owner " + name +
           " does not match zone origin " +
           origin);
  }
  if (name.subdomain(origin))
    addRecord(record);
}

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

/**
 * Indicates that the record should be inserted into the zone replacing any
 * other records with the same name and type.
 */
public void
replace(Record record) {
  delete(record.getName(), record.getType());
  add(record);
}

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

private final void
maybeAddRecord(Record record) throws IOException {
  int rtype = record.getType();
  Name name = record.getName();

  if (rtype == Type.SOA && !name.equals(origin)) {
    throw new IOException("SOA owner " + name +
           " does not match zone origin " +
           origin);
  }
  if (name.subdomain(origin))
    addRecord(record);
}

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

/**
 * Indicates that the record should be inserted into the zone replacing any
 * other records with the same name and type.
 */
public void
replace(Record record) {
  delete(record.getName(), record.getType());
  add(record);
}

代码示例来源:origin: com.ebay.jetstream/jetstreamcore

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());
}

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

private final void
maybeAddRecord(Record record) throws IOException {
  int rtype = record.getType();
  Name name = record.getName();

  if (rtype == Type.SOA && !name.equals(origin)) {
    throw new IOException("SOA owner " + name +
           " does not match zone origin " +
           origin);
  }
  if (name.subdomain(origin))
    addRecord(record);
}

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

/**
 * Indicates that the record should be inserted into the zone replacing any
 * other records with the same name and type.
 */
public void
replace(Record record) {
  delete(record.getName(), record.getType());
  add(record);
}

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

/**
 * Indicates that the record should be inserted into the zone replacing any
 * other records with the same name and type.
 */
public void
replace(Record record) {
  delete(record.getName(), record.getType());
  add(record);
}

代码示例来源:origin: com.ebay.jetstream/jetstreamcore

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;
}

代码示例来源:origin: org.jboss.resteasy/resteasy-eagledns-fork

public DBRecord(Record record, Name origin, long zoneTTL) {
  this.name = record.getName().relativize(origin).toString();
  this.type = Type.string(record.getType());
  this.dclass = DClass.string(record.getDClass());
  this.content = record.rdataToString();
  
  if(record.getTTL() == zoneTTL){
    
    this.ttl = null;
    
  }else{
  
    this.ttl = record.getTTL();
  }
}

相关文章