code: public function execute()
      {
          $resultLayout = null;
  
          try {
              $resultLayout = $this->resultLayoutFactory->create();
              $resultLayout->addDefaultHandle();
  
              // get target store from country code
              $countryCode = $this->getRequest()->getParam(self::REQUEST_PARAM_COUNTRY);
              $storeId = $this->config->getGeoIpMappingForCountry($countryCode);
  
              if ($storeId !== null) {
                  // get redirect URL
                  $redirectUrl = null;
                  $targetStore = $this->storeRepository->getActiveStoreById($storeId);
                  $currentStore = $this->storeManager->getStore();
                  // only generate a redirect URL if current and new store are different
                  if ($currentStore->getId() != $targetStore->getId()) {
                      $this->url->setScope($targetStore->getId());
                      $this->url->addQueryParams([
                          '___store'      => $targetStore->getCode(),
                          '___from_store' => $currentStore->getCode()
                      ]);
                      $redirectUrl = $this->url->getUrl('stores/store/switch');
                  }
  
                  // generate output only if redirect should be performed
                  if ($redirectUrl) {
                      switch ($this->config->getGeoIpAction()) {
                          case Config::GEOIP_ACTION_DIALOG:
                              $resultLayout->getLayout()->getUpdate()->load(['geoip_getaction_dialog']);
                              $resultLayout->getLayout()->getBlock('geoip_getaction')->setMessage(
                                  $this->getMessageInStoreLocale($targetStore)
                              );
                              break;
                          case Config::GEOIP_ACTION_REDIRECT:
                              $resultLayout->getLayout()->getUpdate()->load(['geoip_getaction_redirect']);
                              break;
                      }
  
                      $resultLayout->getLayout()->getBlock('geoip_getaction')->setRedirectUrl($redirectUrl);
                  }
              }
          } catch (\Exception $e) {
              $this->logger->critical($e->getMessage());
              // do not generate output on errors. this is similar to an empty GeoIP mapping for the country.
          }
  
          $resultLayout->setHeader("x-esi", "1");
          return $resultLayout;
      }
docs: Get GeoIP action
  
  @return ResponseInterface|ResultInterface|Layout|null