summaryrefslogtreecommitdiffstats
path: root/node-admin
diff options
context:
space:
mode:
Diffstat (limited to 'node-admin')
-rw-r--r--node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/network/IPAddresses.java9
1 files changed, 9 insertions, 0 deletions
diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/network/IPAddresses.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/network/IPAddresses.java
index fc181eb3107..07e172c5117 100644
--- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/network/IPAddresses.java
+++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/network/IPAddresses.java
@@ -73,6 +73,15 @@ public interface IPAddresses {
addresses));
}
+ /** Returns the hostname of given inetAddress */
+ default String getHostname(InetAddress inetAddress) {
+ String hostname = inetAddress.getHostName();
+ if (hostname.equals(inetAddress.getHostAddress())) {
+ throw new IllegalArgumentException("Could not find hostname for address " + inetAddress.getHostAddress());
+ }
+ return hostname;
+ }
+
/**
* Get the IPv4 address for the host if any.
*