private boolean internalVisit(
      final String entryName, final String domainName, final DNSVisitor visitor) {
    final Optional<DNSEntry> optionalDNSEntry = resolveRecord(entryName + "." + domainName);
    if (optionalDNSEntry.isEmpty()) {
      return true;
    }

    final DNSEntry entry = optionalDNSEntry.get();
    switch (entry) {
      case ENRNode node -> {
        return visitor.visit(node.nodeRecord());
      }
      case DNSEntry.ENRTree tree -> {
        for (String e : tree.entries()) {
          boolean keepGoing = internalVisit(e, domainName, visitor);
          if (!keepGoing) {
            return false;
          }
        }
      }
      case ENRTreeLink link -> visitTree(link, visitor);
      default -> LOG.debug("Unsupported type of node {}", entry);
    }
    return true;
  }
Reads a complete tree of record, starting with the top-level record.

@param link the ENR link to start with
@param visitor the visitor that will look at each record
ethereum/p2p/src/main/java/org/hyperledger/besu/ethereum/p2p/discovery/dns/DNSResolver.java