From 4ae96ab4dc17c991df005269130a0fef0266e8fa Mon Sep 17 00:00:00 2001 From: Mark Puha Date: Tue, 19 Sep 2023 12:32:21 +0200 Subject: [PATCH] minor modifications --- .gitignore | 4 ++++ CMakeLists.txt | 30 ------------------------------ build.cmd | 4 ++-- 3 files changed, 6 insertions(+), 32 deletions(-) create mode 100644 .gitignore delete mode 100644 CMakeLists.txt diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..91e3029 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +.deps +tunnel.dll +tunnel.h +x64/ \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt deleted file mode 100644 index a271712..0000000 --- a/CMakeLists.txt +++ /dev/null @@ -1,30 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -## Download and extract wintun.dll and friends. -file(DOWNLOAD https://www.wintun.net/builds/wintun-0.12.zip - ${CMAKE_CURRENT_BINARY_DIR}/.deps/wintun.zip - EXPECTED_HASH SHA256=eba90e26686ed86595ae0a6d4d3f4f022924b1758f5148a32a91c60cc6e604df) - -file(ARCHIVE_EXTRACT INPUT ${CMAKE_CURRENT_BINARY_DIR}/.deps/wintun.zip DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/.deps) - -## Build the tunnel DLL -add_custom_target(tunneldll ALL - BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/tunnel.dll ${CMAKE_CURRENT_BINARY_DIR}/tunnel.h - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - COMMAND ${CMAKE_COMMAND} -E env - GOCACHE=${CMAKE_BINARY_DIR}/go-cache - GOOS=windows CGO_ENABLED=1 - CC=gcc - CGO_CFLAGS="-O3 -Wall -Wno-unused-function -Wno-switch -std=gnu11 -DWINVER=0x0601" - CGO_LDFLAGS="-Wl,--dynamicbase -Wl,--nxcompat -Wl,--export-all-symbols -Wl,--high-entropy-va" - go build -buildmode c-shared -ldflags="-w -s" -trimpath -v -o "${CMAKE_CURRENT_BINARY_DIR}/tunnel.dll" -) -set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES ${CMAKE_BINARY_DIR}/go-cache) - -install(FILES - ${CMAKE_CURRENT_BINARY_DIR}/tunnel.dll - ${CMAKE_CURRENT_BINARY_DIR}/.deps/wintun/bin/${CMAKE_SYSTEM_PROCESSOR}/wintun.dll - DESTINATION . -) diff --git a/build.cmd b/build.cmd index e1071b6..58595de 100644 --- a/build.cmd +++ b/build.cmd @@ -37,11 +37,11 @@ if exist .deps\prepared goto :build :download echo [+] Downloading %1 - powershell -command "Invoke-WebRequest" -Uri %2 -OutFile %1 || exit /b 1 + curl -#fLo %1 %2 || exit /b 1 echo [+] Verifying %1 for /f %%a in ('CertUtil -hashfile %1 SHA256 ^| findstr /r "^[0-9a-f]*$"') do if not "%%a"=="%~3" exit /b 1 echo [+] Extracting %1 - powershell -command "Expand-Archive" -Path %1 -DestinationPath %cd% || exit /b 1 + tar -xf %1 %~4 || exit /b 1 echo [+] Cleaning up %1 del %1 || exit /b 1 goto :eof