From 87b8cb9c87632d7ce323c8ffd987098e8cddb02e Mon Sep 17 00:00:00 2001 From: Micah Lee Date: Sun, 29 May 2022 14:17:16 -0700 Subject: [PATCH] Add compiling obfs4proxy, snowflake, and meek --- .circleci/config.yml | 124 +++++++++++++++++++++++-------------------- 1 file changed, 67 insertions(+), 57 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index f97648be..8ecd2843 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -200,6 +200,72 @@ jobs: paths: - C:\Users\circleci\build\tor + - run: + name: Copy tor binaries into project + shell: C:\\cygwin64\\bin\\bash.exe --login -eo pipefail + # TODO: update this to actually copy the files + command: find /cygdrive/c/Users/circleci/build/tor + + - restore_cache: + # NOTE: make sure to change when uprading obfs4proxy + key: build-win64-obfs4proxy-v0.0.13-{{ .Environment.CACHE_VERSION }}" + - run: + name: Build obfs4proxy + command: | + if (Test-Path -Path C:\Users\circleci\project\desktop\onionshare\resources\tor\Tor\obfs4proxy.exe -PathType -leaf -eq $true) { + Write-Output "obfs4proxy already built" + } else { + # curl https://keys.openpgp.org/vks/v1/by-fingerprint/9EB1A490C73CC5D44DFB3E47BFBD1C7B8A6EC81A | gpg --import + mkdir C:\Users\circleci\src\obfs4proxy + cd C:\Users\circleci\src\obfs4proxy + git clone https://gitlab.com/yawning/obfs4 + cd obfs4 + git checkout obfs4proxy-0.0.13 + go build .\obfs4proxy + Move-Item -Path .\obfs4proxy.exe -Destination C:\Users\circleci\project\desktop\onionshare\resources\tor\Tor\obfs4proxy.exe + } + - save_cache: + # NOTE: make sure to change when uprading obfs4proxy + key: build-win64-obfs4proxy-v0.0.13-{{ .Environment.CACHE_VERSION }}" + paths: + - C:\Users\circleci\project\desktop\onionshare\resources\tor\Tor\obfs4proxy.exe + + - restore_cache: + # NOTE: make sure to change when uprading snowflake + key: build-win64-snowflake-v2.1.0-{{ .Environment.CACHE_VERSION }}" + - run: + name: Build snowflake-client + command: | + if (Test-Path -Path C:\Users\circleci\project\desktop\onionshare\resources\tor\Tor\snowflake-client.exe -PathType -leaf -eq $true) { + Write-Output "snowflake already built" + } else { + go install git.torproject.org/pluggable-transports/snowflake.git/client@v2.1.0 + Move-Item -Path C:\Users\circleci\go\bin\client.exe -Destination C:\Users\circleci\project\desktop\onionshare\resources\tor\Tor\snowflake-client.exe + } + - save_cache: + # NOTE: make sure to change when uprading snowflake + key: build-win64-snowflake-v2.1.0-{{ .Environment.CACHE_VERSION }}" + paths: + - C:\Users\circleci\project\desktop\onionshare\resources\tor\Tor\snowflake-client.exe + + - restore_cache: + # NOTE: make sure to change when uprading meek + key: build-win64-meek-v0.37.0-{{ .Environment.CACHE_VERSION }}" + - run: + name: Build meek-client + command: | + if (Test-Path -Path C:\Users\circleci\project\desktop\onionshare\resources\tor\Tor\meek-client.exe -PathType -leaf -eq $true) { + Write-Output "snowflake already built" + } else { + go install git.torproject.org/pluggable-transports/meek.git/meek-client@v0.37.0 + Move-Item -Path C:\Users\circleci\go\bin\meek-client.exe -Destination ~\project\desktop\onionshare\resources\tor\Tor\meek-client.exe + } + - save_cache: + # NOTE: make sure to change when uprading meek + key: build-win64-meek-v0.37.0-{{ .Environment.CACHE_VERSION }}" + paths: + - C:\Users\circleci\project\desktop\onionshare\resources\tor\Tor\meek-client.exe + # # Install python # - run: # name: Install Python 3.9.12 @@ -224,66 +290,10 @@ jobs: # paths: # - C:\Users\circleci\AppData\Local\pypoetry\Cache\virtualenvs - # - restore_cache: - # key: download-tor-win32-0.4.7.7 - # - run: - # name: Download tor (Windows Expert Bundle) - # command: | - # mkdir ~\Downloads\tor - # cd ~\Downloads\tor - # $URL = "https://www.torproject.org/dist/torbrowser/11.0.13/tor-win32-0.4.7.7.zip" - # $Filename = "tor-win32-0.4.7.7.zip" - # $ExpectedHash = "6af0088460d61a5e60971aea94562a3bed2fb597da6b8ac77948a5f6424dfa29" - # Invoke-WebRequest -Uri $URL -OutFile $Filename - # $FileHash = Get-FileHash $Filename - # if($FileHash.Hash -ne $ExpectedHash) { throw "Invalid hash" } - # mkdir ~\Downloads\tor\tor-win32 - # Expand-Archive -LiteralPath tor-win32-0.4.7.7.zip -DestinationPath ~\Downloads\tor\tor-win32 - # - save_cache: - # key: download-tor-win32-0.4.7.7 - # paths: - # - ~\Downloads\tor\tor-win32 # - run: # name: Copy tor binary into app # command: cp ~\Downloads\tor\tor-win32\* ~\project\desktop\onionshare\resources\tor - # - restore_cache: - # key: build-win64-obfs4proxy-v0.0.13 - # - run: - # name: Build obfs4proxy - # command: | - # mkdir ~\Downloads\obfs4proxy - # cd Downloads\obfs4proxy - # git clone https://gitlab.com/yawning/obfs4 - # cd obfs4 - # git checkout obfs4proxy-0.0.13 - # go build .\obfs4proxy - # Move-Item -Path .\obfs4proxy.exe -Destination ~\project\desktop\onionshare\resources\tor\Tor\obfs4proxy.exe - # - save_cache: - # key: build-win64-obfs4proxy-v0.0.13 - # paths: - # - ~\project\desktop\onionshare\resources\tor\Tor\obfs4proxy.exe - # - restore_cache: - # key: build-win64-snowflake-v2.1.0 - # - run: - # name: Build snowflake-client - # command: | - # go install git.torproject.org/pluggable-transports/snowflake.git/client@v2.1.0 - # Move-Item -Path ~\go\bin\client.exe -Destination ~\project\desktop\onionshare\resources\tor\Tor\snowflake-client.exe - # - save_cache: - # key: build-win64-snowflake-v2.1.0 - # paths: - # - ~\project\desktop\onionshare\resources\tor\Tor\snowflake-client.exe - # - restore_cache: - # key: build-win64-meek-v0.37.0 - # - run: - # name: Build meek-client - # command: | - # go install git.torproject.org/pluggable-transports/meek.git/meek-client@v0.37.0 - # Move-Item -Path ~\go\bin\meek-client.exe -Destination ~\project\desktop\onionshare\resources\tor\Tor\meek-client.exe - # - save_cache: - # key: build-win64-meek-v0.37.0 - # paths: - # - ~\project\desktop\onionshare\resources\tor\Tor\meek-client.exe + # - run: # name: Build OnionShare # command: |