class NatService {

  public String queryExternalIPAddress(final String fallbackValue) {
    if (isNatEnvironment()) {
      try {
        final NatManager natManager = getNatManager().orElseThrow();
        LOG.debug(
            "Waiting for up to {} seconds to detect external IP address...",
            NatManager.TIMEOUT_SECONDS);
        return Optional.ofNullable(
                natManager
                    .queryExternalIPAddress()
                    .get(NatManager.TIMEOUT_SECONDS, TimeUnit.SECONDS))
            .orElseThrow();

      } catch (Exception e) {
        LOG.debug("Caught exception while trying to query NAT external IP address (ignoring)", e);
        LOG.warn(
            "Unable to query NAT external IP address. Using the fallback value : {} ",
            fallbackValue);
      }
    }
    return fallbackValue;
  }

  public  NatService(final Optional<NatManager> natManager, final boolean fallbackEnabled);
  public  NatService(final Optional<NatManager> natManager);

}