anderoo commented on code in PR #227:
URL: https://github.com/apache/cassandra-sidecar/pull/227#discussion_r2157382492


##########
server-common/src/main/java/org/apache/cassandra/sidecar/common/server/dns/DnsResolver.java:
##########
@@ -26,20 +28,38 @@
  */
 public interface DnsResolver
 {
-    DnsResolver DEFAULT = new DnsResolver()
-    {
-        @Override
-        public String resolve(String hostname) throws UnknownHostException
+    enum DnsResolverEnum implements DnsResolver {
+        @JsonProperty("default")
+        DEFAULT("default")
         {
-            return InetAddress.getByName(hostname).getHostAddress();
+            @Override
+            public String reverseResolve(String address) throws 
UnknownHostException
+            {
+                return InetAddress.getByName(address).getHostName();
+            }
+        },
+        @JsonProperty("resolveToIp")
+        RESOLVE_TO_IP("resolveToIp")
+        {
+            @Override
+            public String reverseResolve(String address) throws 
UnknownHostException
+            {
+                return InetAddress.getByName(address).getHostAddress();
+            }
+        };
+
+        final String name;
+
+        DnsResolverEnum(String name)
+        {
+            this.name = name;
         }
 
-        @Override
-        public String reverseResolve(String address) throws 
UnknownHostException
+        public String toString()

Review Comment:
   Updated



##########
server/src/main/java/org/apache/cassandra/sidecar/config/ServiceConfiguration.java:
##########
@@ -179,4 +180,11 @@ default WorkerPoolConfiguration 
serverInternalWorkerPoolConfiguration()
      * @return the configuration relevant to the coordination functionality of 
Sidecar
      */
     CoordinationConfiguration coordinationConfiguration();
+
+    /**
+     * @return Sidecar's DNS Resolver to use. Default will be to provide 
forward and reverse DNS resolution which
+     * provides both the hostname & address. The alternative, resolveToIp, 
only provides forward resolution meaning
+     * the IP address will be returned for both hostname & address.
+     */
+    DnsResolver.DnsResolverEnum dnsResolver();

Review Comment:
   Updated



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org
For additional commands, e-mail: pr-h...@cassandra.apache.org

Reply via email to