/** * Look into A-record at a specific DNS address. * * @return resolved IP addresses or null if no A-record was present */ @Nullable public static List<String> resolveARecord(String rootDomainName) { if (isLocalOrIp(rootDomainName)) { return null; } try { Attributes attrs = getDirContext().getAttributes(rootDomainName, new String[]{A_RECORD_TYPE, CNAME_RECORD_TYPE}); Attribute aRecord = attrs.get(A_RECORD_TYPE); Attribute cRecord = attrs.get(CNAME_RECORD_TYPE); if (aRecord != null && cRecord == null) { List<String> result = new ArrayList<>(); NamingEnumeration<String> entries = (NamingEnumeration<String>) aRecord.getAll(); while (entries.hasMore()) { result.add(entries.next()); } return result; } } catch (Exception e) { logger.warn("Cannot load A-record for eureka server address {}", rootDomainName, e); return null; } return null; }
if (isLocalOrIp(currentHost)) { return originalHost;
/** * Look into A-record at a specific DNS address. * * @return resolved IP addresses or null if no A-record was present */ @Nullable public static List<String> resolveARecord(String rootDomainName) { if (isLocalOrIp(rootDomainName)) { return null; } try { Attributes attrs = getDirContext().getAttributes(rootDomainName, new String[]{A_RECORD_TYPE, CNAME_RECORD_TYPE}); Attribute aRecord = attrs.get(A_RECORD_TYPE); Attribute cRecord = attrs.get(CNAME_RECORD_TYPE); if (aRecord != null && cRecord == null) { List<String> result = new ArrayList<>(); NamingEnumeration<String> entries = (NamingEnumeration<String>) aRecord.getAll(); while (entries.hasMore()) { result.add(entries.next()); } return result; } } catch (Exception e) { logger.warn("Cannot load A-record for eureka server address {}", rootDomainName, e); return null; } return null; }
if (isLocalOrIp(currentHost)) { return originalHost;