public static Map<String, String> readKV(final String record) {
    return Arrays.stream(record.split("\\s+"))
        .map(
            it -> {
              // First split on ':' since Base64 uses '=' as padding
              if (it.contains(":")) {
                return it.split(":", 2);
              } else if (it.contains("=")) {
                return it.split("=", 2);
              } else {
                // this should not happen, as the record should be well-formed
                return new String[] {it};
              }
            })
        .filter(kv -> kv.length == 2)
        .collect(Collectors.toMap(kv -> kv[0], kv -> kv[1]));
  }
Read a key value pair from a DNS record

@param record the record to read
@return the key value pair
ethereum/p2p/src/main/java/org/hyperledger/besu/ethereum/p2p/discovery/dns/KVReader.java