code: protected Pair<NodeRole, String> getRole(@NonNull VoidConfiguration voidConfiguration,
                      @NonNull Collection<String> localIPs) {
          NodeRole result = NodeRole.CLIENT;
  
          for (String ip : voidConfiguration.getShardAddresses()) {
              String cleansed = ip.replaceAll(":.*", "");
              if (localIPs.contains(cleansed))
                  return Pair.create(NodeRole.SHARD, ip);
          }
  
          if (voidConfiguration.getBackupAddresses() != null)
              for (String ip : voidConfiguration.getBackupAddresses()) {
                  String cleansed = ip.replaceAll(":.*", "");
                  if (localIPs.contains(cleansed))
                      return Pair.create(NodeRole.BACKUP, ip);
              }
  
  
          String sparkIp = null;
  
  
          if (sparkIp == null && voidConfiguration.getNetworkMask() != null) {
              NetworkOrganizer organizer = new NetworkOrganizer(voidConfiguration.getNetworkMask());
              sparkIp = organizer.getMatchingAddress();
          }
  
          // last resort here...
          if (sparkIp == null)
              sparkIp = System.getenv(ND4JEnvironmentVars.DL4J_VOID_IP);
  
  
          log.info("Got [{}] as sparkIp", sparkIp);
          if (sparkIp == null)
              throw new ND4JIllegalStateException("Can't get IP address for UDP communcation");
  
          // local IP from pair is used for shard only, so we don't care
          return Pair.create(result, sparkIp + ":" + voidConfiguration.getUnicastControllerPort());
      }
docs: This method checks for designated role, according to local IP addresses and configuration passed into method
  
  @param voidConfiguration
  @param localIPs
  @return