diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 47071502..eb55b7db 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -116,11 +116,6 @@ variables: - ./tools/vcpkg/install_ci/vcpkg_install.sh "${VCPKG_ROOT}" --configure-git interruptible: true -.download_dependency_ctrld: - script: - - curl --silent --show-error --fail -u "${NEXUS_USERNAME}:${NEXUS_PASSWORD}" --cacert tools/cacert.pem - --create-dirs -o ${BUILD_LIBS_FOLDER}/ctrld.zip "${NEXUS_PATH_DEPS}/${OS_IDENTIFIER}/ctrld.zip" - .download_dependency_openvpn_dco: script: - curl --silent --show-error --fail -u "${NEXUS_USERNAME}:${NEXUS_PASSWORD}" --cacert tools/cacert.pem @@ -148,7 +143,6 @@ variables: .download_dependencies_win: script: - - !reference [.download_dependency_ctrld, script] - !reference [.download_dependency_openvpn_dco, script] - !reference [.download_dependency_qt, script] - !reference [.download_dependency_wintun, script] @@ -157,7 +151,6 @@ variables: .download_dependencies_posix: script: - - !reference [.download_dependency_ctrld, script] - !reference [.download_dependency_qt, script] - !reference [.download_dependency_wireguard, script] - !reference [.download_dependency_wstunnel, script] diff --git a/README.md b/README.md index 0c2352ad..26849927 100644 --- a/README.md +++ b/README.md @@ -59,8 +59,6 @@ install_wireguard install_wstunnel ``` -As of version 2.7, you will need a copy of the [ctrld utility](https://github.com/Control-D-Inc/ctrld). Follow the instructions in that repo to build it, and place the binary at `build-libs[-arm64]/ctrld/ctrld.exe`. - ### Build the Windscribe 2.0 app Go to subfolder `tools` and run `build_all`. Assuming all goes well with the build, the installer will be placed in `build-exe`. You can run `build_all --sign --use-local-secrets` for a code-signed build, using the certificate from the [Install signing certificate](#install-signing-certificate-optional) section above, which will perform run-time signature verification checks on the executables. Note that an unsigned build must be installed on your PC if you intend to debug the project. Append `--arm64` to the command to build for Windows arm64. @@ -139,8 +137,6 @@ install_wireguard install_wstunnel ``` -As of version 2.7, you will need a copy of the [ctrld utility](https://github.com/Control-D-Inc/ctrld). Follow the instructions in that repo to build it, and place the binary at `build-libs/ctrld/ctrld`. - ### Build the Windscribe 2.0 app Go to subfolder `tools` and run `build_all`. Assuming all goes well with the build, the installer will be placed in `build-exe`. @@ -214,8 +210,6 @@ install_wireguard install_wstunnel ``` -As of version 2.7, you will need a copy of the [ctrld utility](https://github.com/Control-D-Inc/ctrld). Follow the instructions in that repo to build it, and place the binary at `build-libs/ctrld/ctrld`. - ### Build the Windscribe 2.0 app Go to subfolder `tools` and run `build_all`. Assuming all goes well with the build, the installer will be placed in `build-exe`. diff --git a/backend/linux/helper/ovpn.cpp b/backend/linux/helper/ovpn.cpp index 0e470088..2acc76e2 100644 --- a/backend/linux/helper/ovpn.cpp +++ b/backend/linux/helper/ovpn.cpp @@ -73,7 +73,8 @@ bool writeOVPNFile(const std::string &dnsScript, int port, const std::string &co std::string opts = \ "management 127.0.0.1 " + std::to_string(port) + "\n" \ "management-query-passwords\n" \ - "management-hold\n"; + "management-hold\n" \ + "verb 3\n"; if (httpProxy.length() > 0) { opts += "http-proxy " + httpProxy + " " + std::to_string(httpPort) + " auto\n"; diff --git a/backend/mac/helper/ovpn.cpp b/backend/mac/helper/ovpn.cpp index cfaa14b6..4ef10ce3 100644 --- a/backend/mac/helper/ovpn.cpp +++ b/backend/mac/helper/ovpn.cpp @@ -63,7 +63,8 @@ bool writeOVPNFile(const std::string &dnsScript, int port, const std::string &co std::string opts = \ "management 127.0.0.1 " + std::to_string(port) + "\n" \ "management-query-passwords\n" \ - "management-hold\n"; + "management-hold\n" \ + "verb 3\n"; if (httpProxy.length() > 0) { opts += "http-proxy " + httpProxy + " " + std::to_string(httpPort) + " auto\n"; diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index 79cf1ea1..d909b1e1 100644 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -86,6 +86,9 @@ if (WIN32) #postbuild copy commands for Windows add_custom_command(TARGET Windscribe POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different ${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/tools/openvpn/openvpn.exe $/windscribeopenvpn.exe) + + add_custom_command(TARGET Windscribe POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different + ${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/tools/ctrld/ctrld.exe $/windscribectrld.exe) elseif (APPLE) #postbuild copy commands for Mac set(WINDSCRIBE_BUILD_LIBS_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../build-libs) @@ -109,8 +112,9 @@ elseif (APPLE) add_custom_command(TARGET Windscribe POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different ${WINDSCRIBE_BUILD_LIBS_PATH}/wireguard/windscribewireguard $/../Helpers/windscribewireguard) + add_custom_command(TARGET Windscribe POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different - ${WINDSCRIBE_BUILD_LIBS_PATH}/ctrld/ctrld $/../Helpers/windscribectrld) + ${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/tools/ctrld/ctrld $/../Helpers/windscribectrld) add_custom_command(TARGET Windscribe POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different ${WINDSCRIBE_BUILD_LIBS_PATH}/wstunnel/windscribewstunnel $/../Helpers/windscribewstunnel) @@ -170,6 +174,7 @@ install(TARGETS Windscribe wsnet if (WIN32) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/windscribeopenvpn.exe DESTINATION .) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/windscribectrld.exe DESTINATION .) endif() if(UNIX AND (NOT APPLE)) @@ -185,4 +190,10 @@ if(UNIX AND (NOT APPLE)) DESTINATION . PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE ) + # copy ctrld + install(FILES ${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/tools/ctrld/ctrld + RENAME windscribectrld + DESTINATION . + PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE + ) endif() diff --git a/client/common/changelog.txt b/client/common/changelog.txt index e72f9fdc..9adda34e 100644 --- a/client/common/changelog.txt +++ b/client/common/changelog.txt @@ -1,7 +1,21 @@ +2.10.11 (03/06/2024) +All: + * Fixed wsnet bug sometimes causing the library to freeze. #1012 + * Updated ctrld dependency to 1.3.7. #1022 +MacOS: + * Fixed MacOS 11 bug, unable to open app after installing. #1011 + * Fixed Wireguard takes too long to connect and tunnel tests are randomly slow. #1013 + * Fixed missing "verb 3" argument for OpenVPN after refactor. #997 +Linux: + * Fixed tray icon sometimes can't be clicked. #792 + * Fixed missing "verb 3" argument for OpenVPN after refactor. #997 + * Fixed resolvconf/NetworkManager DNS managers sometimes not taking effect. #1015 + + 2.10.10 (15/05/2024) All: - * Fixed wsnet bugs, in particular the icmp ping bug. Also other library refactoring related improvements taken from 2.11. #999 * Improved internal error handling. #987 + * Fixed wsnet bugs, in particular the icmp ping bug. Also other library refactoring related improvements taken from 2.11. #999 Windows: * Added security warning in the installer when installing to a custom folder. #988 * Added debugging information for wsnet. #1001 diff --git a/client/common/version/windscribe_version.h b/client/common/version/windscribe_version.h index a3b716b2..109372f0 100644 --- a/client/common/version/windscribe_version.h +++ b/client/common/version/windscribe_version.h @@ -2,7 +2,7 @@ #define WINDSCRIBE_MAJOR_VERSION 2 #define WINDSCRIBE_MINOR_VERSION 10 -#define WINDSCRIBE_BUILD_VERSION 10 +#define WINDSCRIBE_BUILD_VERSION 11 // only one of these should be enabled; neither -> stable //#define WINDSCRIBE_IS_BETA diff --git a/client/gui/mainwindow.cpp b/client/gui/mainwindow.cpp index 13a9e3f0..2da6217b 100644 --- a/client/gui/mainwindow.cpp +++ b/client/gui/mainwindow.cpp @@ -3424,6 +3424,11 @@ void MainWindow::setupTrayIcon() { updateTrayTooltip(tr("Disconnected") + "\n" + PersistentState::instance().lastExternalIp()); + // Create tray menu items here, because it seems like Qt on Linux does not even trigger aboutToShow() + // if the menu is empty, and since aboutToShow() is never called, we never populate the menu, ad nauseum. + // Calling createTrayMenuItems() once here makes everything work. + createTrayMenuItems(); + trayIcon_.setContextMenu(&trayMenu_); connect(&trayMenu_, &QMenu::aboutToShow, this, &MainWindow::onTrayMenuAboutToShow); connect(&trayMenu_, &QMenu::aboutToHide, this, &MainWindow::onTrayMenuAboutToHide); diff --git a/installer/common/translations/windscribe_installer_ru.ts b/installer/common/translations/windscribe_installer_ru.ts index 669d8da3..bbefaae2 100644 --- a/installer/common/translations/windscribe_installer_ru.ts +++ b/installer/common/translations/windscribe_installer_ru.ts @@ -5,21 +5,21 @@ AlertWindow ESC - Регулятор + ЗАКР InitialWindow Read EULA - Ознакомиться с конечным пользователем + Ознакомиться с лицензионным соглашением InstallButton Install - Устанавливать + Установить %1% @@ -46,11 +46,11 @@ The specified installation path is not on the system drive. To ensure the security of the application, and your system, it must be installed on the same drive as Windows. The installation folder has been reset to the default. - Указанный путь установки отсутствует на системном диске. Чтобы обеспечить безопасность приложения и вашей системы, оно должно быть установлено на том же диске, что и Windows. Папка установки была сброшена до значений по умолчанию. + Указанный путь установки отсутствует на системном диске. Чтобы обеспечить безопасность приложения и вашей системы, оно должно быть установлено на том же диске, что и Windows. Папка установки была сброшена до стандартной. OK - ХОРОШО + ОК The installation was cancelled. Administrator privileges are required to install the application. @@ -66,7 +66,7 @@ The installer could not connect to the privileged helper tool. Please try again. - Установщику не удалось подключиться к привилегированному вспомогательному средству. Повторите попытку. + Установщику не удалось подключиться к привилегированной вспомогательной службе. Повторите попытку. An existing installation of Windscribe could not be removed. Please uninstall the application manually and try again. @@ -74,7 +74,7 @@ Quit - Покидать + Выйти Cancel @@ -98,7 +98,7 @@ Installation to a custom folder may allow an attacker to tamper with the Windscribe application. To ensure the security of the application, and your system, we strongly recommend you install to the default location in the 'Program Files' folder. Click OK to continue with the custom folder or Cancel to use the default location. - Установка в пользовательскую папку может позволить злоумышленнику взломать приложение Windscribe. Чтобы обеспечить безопасность приложения и вашей системы, мы настоятельно рекомендуем вам установить его в папку «Program Files» по умолчанию. Нажмите кнопку ОК, чтобы продолжить работу с пользовательской папкой, или кнопку Отмена, чтобы использовать расположение по умолчанию. + Установка в пользовательскую папку может позволить злоумышленнику модифицировать приложение Windscribe. Чтобы обеспечить безопасность приложения и вашей системы, мы настоятельно рекомендуем вам установить его в папку «Program Files» по умолчанию. Нажмите кнопку ОК, чтобы продолжить работу с пользовательской папкой, или кнопку Отмена, чтобы использовать расположение по умолчанию. @@ -117,15 +117,15 @@ The Windscribe installer accepts the following optional commmand-line parameters: - Инсталлятор Windscribe принимает следующие необязательные параметры commmand-line: + Инсталлятор Windscribe принимает следующие необязательные параметры командной строки: Show this information. - Покажите эту информацию. + Показать эту информацию. Do not launch the application after installation. - Не запускайте приложение после установки. + Не запускать приложение после установки. Instructs the installer to skip installing drivers. @@ -133,7 +133,7 @@ Delete existing preferences, logs, and other data, if they exist. - Удалите существующие настройки, журналы и другие данные, если они существуют. + Удалить существующие настройки, журналы и другие данные, если они существуют. Overrides the default installation directory. Installation directory must be on the system drive. @@ -204,15 +204,15 @@ SettingsWindow Install Settings - Настройки установки + Настройки установщика OK - ХОРОШО + ОК Factory Reset - Сброс к заводским настройкам + Сброс к стандартным настройкам Create shortcut diff --git a/installer/linux/common/etc/windscribe/dns-leak-protect b/installer/linux/common/etc/windscribe/dns-leak-protect index dd8771fb..20fee004 100755 --- a/installer/linux/common/etc/windscribe/dns-leak-protect +++ b/installer/linux/common/etc/windscribe/dns-leak-protect @@ -43,8 +43,12 @@ dnsleak_protection_up() printf -v rules '%s-I OUTPUT -j windscribe_dnsleaks %s\n' "$rules" "$marker" # disallow all OS-default DNS servers - for dnsIp in "${dns_array[@]}" - do + for dnsIp in "${dns_array[@]}"; do + for allowed in "$@"; do + if [[ $dnsIp == "$allowed" ]]; then + continue 2 + fi + done printf -v rules '%s-A windscribe_dnsleaks -d %s -p udp --dport 53 -j DROP %s\n' "$rules" "$dnsIp" "$marker" printf -v rules '%s-A windscribe_dnsleaks -d %s -p tcp --dport 53 -j DROP %s\n' "$rules" "$dnsIp" "$marker" done @@ -87,11 +91,11 @@ main() local action="$1" if [[ $action == "up" ]]; then - dnsleak_protection_up + dnsleak_protection_up $@ elif [[ $action == "down" ]]; then dnsleak_protection_down else - echo "Usage: dns-leak-protect up|down" + echo "Usage: dns-leak-protect up|down [servers_to_allow]" return 1 fi } diff --git a/installer/linux/common/etc/windscribe/update-network-manager b/installer/linux/common/etc/windscribe/update-network-manager index 79f886da..72d95e33 100755 --- a/installer/linux/common/etc/windscribe/update-network-manager +++ b/installer/linux/common/etc/windscribe/update-network-manager @@ -46,7 +46,7 @@ case "$script_type" in fi done - "$DNS_LEAK_SCRIPT" "up" ${dev} ${servers[@]} + "$DNS_LEAK_SCRIPT" "up" ${servers[@]} ;; down) diff --git a/installer/linux/common/etc/windscribe/update-resolv-conf b/installer/linux/common/etc/windscribe/update-resolv-conf index da1469bf..19b327cd 100755 --- a/installer/linux/common/etc/windscribe/update-resolv-conf +++ b/installer/linux/common/etc/windscribe/update-resolv-conf @@ -72,7 +72,7 @@ case "$script_type" in echo -n "$R" | resolvconf -a "$(resolvconf_iface_prefix)${dev}" -m 0 -x fi - "$DNS_LEAK_SCRIPT" "up" ${dev} ${servers[@]} + "$DNS_LEAK_SCRIPT" "up" ${servers[@]} ;; down) diff --git a/installer/linux/common/etc/windscribe/update-systemd-resolved b/installer/linux/common/etc/windscribe/update-systemd-resolved index 15383ddc..51b8525f 100755 --- a/installer/linux/common/etc/windscribe/update-systemd-resolved +++ b/installer/linux/common/etc/windscribe/update-systemd-resolved @@ -120,7 +120,7 @@ up() { # Set dns leak protection SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) DNS_LEAK_SCRIPT=$SCRIPT_DIR/dns-leak-protect - "$DNS_LEAK_SCRIPT" "up" ${dev} ${dns_ips[@]} + "$DNS_LEAK_SCRIPT" "up" ${dns_ips[@]} # For the loopback DNS-address set the global DNS config for dnsIp in "${dns_ips[@]}" diff --git a/installer/mac/installer/installer/installer.mm b/installer/mac/installer/installer/installer.mm index 079a7413..3bbcb03a 100644 --- a/installer/mac/installer/installer/installer.mm +++ b/installer/mac/installer/installer/installer.mm @@ -80,9 +80,7 @@ - (void)appDidLaunch:(NSNotification*)note -(void)runLauncher { [[[NSWorkspace sharedWorkspace] notificationCenter] addObserver:self selector:@selector(appDidLaunch:) name:NSWorkspaceDidLaunchApplicationNotification object:nil]; - NSWorkspaceOpenConfiguration *config = [NSWorkspaceOpenConfiguration configuration]; - [config setCreatesNewApplicationInstance: YES]; - [[NSWorkspace sharedWorkspace] openApplicationAtURL: [NSURL fileURLWithPath: [self getInstallPath]] configuration: config completionHandler: nil]; + [[NSWorkspace sharedWorkspace] openURL: [NSURL fileURLWithPath: [self getInstallPath]]]; } -(NSString *)runProcess:(NSString*)exePath args:(NSArray *)args diff --git a/libs/wsnet/src/httpnetworkmanager/curlnetworkmanager.cpp b/libs/wsnet/src/httpnetworkmanager/curlnetworkmanager.cpp index 17b62fb1..eb01bb0d 100644 --- a/libs/wsnet/src/httpnetworkmanager/curlnetworkmanager.cpp +++ b/libs/wsnet/src/httpnetworkmanager/curlnetworkmanager.cpp @@ -88,7 +88,7 @@ void CurlNetworkManager::setProxySettings(const std::string &address, const std: void CurlNetworkManager::setWhitelistSocketsCallback(std::shared_ptr > callback) { - std::lock_guard locker(mutex_); + std::lock_guard locker(mutexForWhiteListSockets_); whitelistSocketsCallback_ = callback; } @@ -205,7 +205,7 @@ int CurlNetworkManager::curlSocketCallback(void *clientp, curl_socket_t curlfd, { CurlNetworkManager *this_ = (CurlNetworkManager *)clientp; - std::lock_guard locker(this_->mutex_); + std::lock_guard locker(this_->mutexForWhiteListSockets_); // whitelist the new socket descriptor if (this_->whitelistSockets_.find(curlfd) == this_->whitelistSockets_.end()) { this_->whitelistSockets_.insert(curlfd); @@ -224,7 +224,7 @@ int CurlNetworkManager::curlCloseSocketCallback(void *clientp, curl_socket_t cur #else close(curlfd); #endif - std::lock_guard locker(this_->mutex_); + std::lock_guard locker(this_->mutexForWhiteListSockets_); // whitelist the deleted socket descriptor if (this_->whitelistSockets_.find(curlfd) != this_->whitelistSockets_.end()) { this_->whitelistSockets_.erase(curlfd); @@ -250,8 +250,7 @@ bool CurlNetworkManager::setupOptions(RequestInfo *requestInfo, const std::share spdlog::debug("New curl request : {}", request->url().c_str()); - // It is necessary? - //if (curl_easy_setopt(requestInfo->curlEasyHandle, CURLOPT_FRESH_CONNECT, 1) != CURLE_OK) return false; + if (curl_easy_setopt(requestInfo->curlEasyHandle, CURLOPT_FRESH_CONNECT, 1) != CURLE_OK) return false; if (curl_easy_setopt(requestInfo->curlEasyHandle, CURLOPT_CONNECTTIMEOUT_MS , request->timeoutMs()) != CURLE_OK) return false; if (curl_easy_setopt(requestInfo->curlEasyHandle, CURLOPT_XFERINFOFUNCTION, progressCallback) != CURLE_OK) return false; diff --git a/libs/wsnet/src/httpnetworkmanager/curlnetworkmanager.h b/libs/wsnet/src/httpnetworkmanager/curlnetworkmanager.h index 93aa0347..b5d483cb 100644 --- a/libs/wsnet/src/httpnetworkmanager/curlnetworkmanager.h +++ b/libs/wsnet/src/httpnetworkmanager/curlnetworkmanager.h @@ -82,6 +82,7 @@ class CurlNetworkManager CURLM *multiHandle_; std::map activeRequests_; + std::mutex mutexForWhiteListSockets_; // this socket protects whitelistSocketsCallback_ variable std::shared_ptr > whitelistSocketsCallback_; std::set whitelistSockets_; diff --git a/tools/build_all.yml b/tools/build_all.yml index 3bfe7c0e..19500e11 100644 --- a/tools/build_all.yml +++ b/tools/build_all.yml @@ -157,8 +157,6 @@ deploy_files: wireguard: - tunnel.dll -> tunnel.dll - wireguard.dll -> wireguard.dll - ctrld: - - ctrld.exe -> windscribectrld.exe wstunnel: - windscribewstunnel.exe -> windscribewstunnel.exe wintun: @@ -251,8 +249,6 @@ deploy_files: - plugins/wayland-shell-integration/libxdg-shell.so -> plugins/wayland-shell-integration/libxdg-shell.so - plugins/xcbglintegrations/libqxcb-egl-integration.so -> plugins/xcbglintegrations/libqxcb-egl-integration.so - plugins/xcbglintegrations/libqxcb-glx-integration.so -> plugins/xcbglintegrations/libqxcb-glx-integration.so - ctrld: - - ctrld -> windscribectrld wireguard: - windscribewireguard -> windscribewireguard wstunnel: diff --git a/tools/vars/ctrld.yml b/tools/vars/ctrld.yml index 93d7dc7c..e69de29b 100644 --- a/tools/vars/ctrld.yml +++ b/tools/vars/ctrld.yml @@ -1,8 +0,0 @@ -# ------------------------------------------------------------------------------ -# Windscribe Build System -# Copyright (c) 2020-2024, Windscribe Limited. All rights reserved. -# ------------------------------------------------------------------------------ -variables: - VERSION_CTRLD: '1.3.2' - BUILDROOT_CTRLD: 'build-libs/ctrld' - ARTIFACT_CTRLD: 'ctrld.zip' diff --git a/tools/vcpkg/ports/ctrld/portfile.cmake b/tools/vcpkg/ports/ctrld/portfile.cmake new file mode 100644 index 00000000..21c9bf29 --- /dev/null +++ b/tools/vcpkg/ports/ctrld/portfile.cmake @@ -0,0 +1,79 @@ +set(VCPKG_POLICY_EMPTY_INCLUDE_FOLDER enabled) + +# Making a universal binary for Mac with lipo util +if(VCPKG_TARGET_IS_OSX) + set(CTRLD_FILE_NAME_ARM64 "ctrld_${VERSION}_darwin_arm64") + set(CTRLD_FILE_NAME_AMD64 "ctrld_${VERSION}_darwin_amd64") + + vcpkg_download_distfile(ARCHIVE_ARM64 + URLS "https://github.com/Control-D-Inc/ctrld/releases/download/v${VERSION}/${CTRLD_FILE_NAME_ARM64}.tar.gz" + FILENAME "${CTRLD_FILE_NAME_ARM64}.tar.gz" + SKIP_SHA512 + ) + vcpkg_download_distfile(ARCHIVE_AMD64 + URLS "https://github.com/Control-D-Inc/ctrld/releases/download/v${VERSION}/${CTRLD_FILE_NAME_AMD64}.tar.gz" + FILENAME "${CTRLD_FILE_NAME_AMD64}.tar.gz" + SKIP_SHA512 + ) + + vcpkg_extract_source_archive(SOURCE_PATH_ARM64 + ARCHIVE "${ARCHIVE_ARM64}" + ) + vcpkg_extract_source_archive(SOURCE_PATH_AMD64 + ARCHIVE "${ARCHIVE_AMD64}" + ) + + vcpkg_execute_build_process( + COMMAND "lipo" "${SOURCE_PATH_AMD64}/${CTRLD_FILE_NAME_AMD64}/ctrld" "${SOURCE_PATH_ARM64}/${CTRLD_FILE_NAME_ARM64}/ctrld" -create -output ctrld + WORKING_DIRECTORY "${SOURCE_PATH_AMD64}" + LOGNAME "ctrld_${TARGET_TRIPLET}.log" + ) + vcpkg_copy_tools(TOOL_NAMES ctrld${EXECUTABLE_EXTENSION} + SEARCH_DIR ${SOURCE_PATH_AMD64} + AUTO_CLEAN) + +else() + if(VCPKG_TARGET_IS_WINDOWS) + set(ARCHIVE_EXTENSION "zip") + if(VCPKG_TARGET_ARCHITECTURE MATCHES "x64") + set(CTRLD_FILE_NAME "ctrld_${VERSION}_windows_amd64") + elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "arm64") + set(CTRLD_FILE_NAME "ctrld_${VERSION}_windows_arm64") + else() + message(FATAL_ERROR "Unsupported Windows architecture.") + endif() + elseif(VCPKG_TARGET_IS_LINUX) + set(ARCHIVE_EXTENSION "tar.gz") + if(VCPKG_TARGET_ARCHITECTURE MATCHES "x64") + set(CTRLD_FILE_NAME "ctrld_${VERSION}_linux_amd64") + elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "arm64") + set(CTRLD_FILE_NAME "ctrld_${VERSION}_linux_arm64") + else() + message(FATAL_ERROR "Unsupported Linux architecture.") + endif() + else() + message(FATAL_ERROR "Unsupported platform.") + endif() + + vcpkg_download_distfile(ARCHIVE + URLS "https://github.com/Control-D-Inc/ctrld/releases/download/v${VERSION}/${CTRLD_FILE_NAME}.${ARCHIVE_EXTENSION}" + FILENAME "${CTRLD_FILE_NAME}.${ARCHIVE_EXTENSION}" + SKIP_SHA512 + ) + vcpkg_extract_source_archive(SOURCE_PATH + ARCHIVE "${ARCHIVE}" + ) + + vcpkg_copy_tools(TOOL_NAMES ctrld + SEARCH_DIR ${SOURCE_PATH}/${CTRLD_FILE_NAME} + AUTO_CLEAN) +endif() + + +vcpkg_download_distfile(LICENSE_PATH + URLS "https://raw.githubusercontent.com/Control-D-Inc/ctrld/main/LICENSE" + FILENAME "CTRLD_LICENSE" + SKIP_SHA512 +) + +file(INSTALL "${LICENSE_PATH}" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) \ No newline at end of file diff --git a/tools/vcpkg/ports/ctrld/vcpkg.json b/tools/vcpkg/ports/ctrld/vcpkg.json new file mode 100644 index 00000000..d1a1d6b9 --- /dev/null +++ b/tools/vcpkg/ports/ctrld/vcpkg.json @@ -0,0 +1,7 @@ +{ + "name": "ctrld", + "version": "1.3.7", + "port-version": 0, + "description": "A highly configurable, multi-protocol DNS forwarding proxy", + "homepage": "https://github.com/Control-D-Inc/ctrld" +} diff --git a/tools/vcpkg/vcpkg.json b/tools/vcpkg/vcpkg.json index 07918e55..aaac33b2 100644 --- a/tools/vcpkg/vcpkg.json +++ b/tools/vcpkg/vcpkg.json @@ -23,6 +23,7 @@ "c-ares", "advobfuscator", "7zip", + "ctrld", { "name": "winreg", "platform": "windows"