From 8acb6f12e1e870c171d5b520cc9f58695b2eed8b Mon Sep 17 00:00:00 2001 From: cyBerta Date: Thu, 1 Jul 2021 17:03:49 +0200 Subject: remove snowflake submodule --- go/android_build_golib.sh | 157 ++++++++++++++++++++++++++++++++++++ go/src/github.com/cyBerta/snowflake | 1 + 2 files changed, 158 insertions(+) create mode 100755 go/android_build_golib.sh create mode 160000 go/src/github.com/cyBerta/snowflake (limited to 'go') diff --git a/go/android_build_golib.sh b/go/android_build_golib.sh new file mode 100755 index 00000000..a54a42af --- /dev/null +++ b/go/android_build_golib.sh @@ -0,0 +1,157 @@ +#!/bin/bash + +# Copyright (C) 2016 Andrew Jiang (TunnelBear Inc.) +# Convenience script for generating shapeshifter-dispatcher binaries for Android devices +# adapted for Bitmask by cyberta + +BUILD_LIBRARY="false" +BUILD_SHAPESHIFTER_DISPATCHER="false" +BUILD_SNOWFLAKE="false" + +function quit { + echo "$1." + exit 1 +} + +if [[ "$1" == "removeAll" ]]; then + echo "removing golang, sources and generated files" + for folder in /tmp/android-toolchain-*; do + if [[ -d $folder ]]; then + rm -rf $folder + fi + done + if [[ -d "./out" ]]; then + rm -rf ./out + fi + + if [[ -d "./bin" ]]; then + rm -rf ./bin + fi + + if [[ -d "./golang" ]]; then + rm -rf ./golang + fi + + if [[ -d "./src" ]]; then + rm -rf ./src + fi + echo "Done!" + exit 0 + +elif [[ "$1" == "clean" ]]; then + echo "Cleaning up..." + for folder in /tmp/android-toolchain-*; do + if [[ -d $folder ]]; then + rm -rf $folder + fi + done + if [[ -d "./out" ]]; then + rm -rf ./out + fi + + if [[ -d "./bin" ]]; then + rm -rf ./bin + fi + echo "Done!" + exit 0 + +elif [[ "$1" == "shapeshifterlib" ]]; then + BUILD_LIBRARY="true" +elif [[ "$1" == "shapeshifter-dispatcher" ]]; then + BUILD_SHAPESHIFTER_DISPATCHER="true" +elif [[ "$1" == "snowflake-client" ]]; then + BUILD_SNOWFLAKE="true" + echo "BUILD_SNOWFLAKE!" +fi + + +if [ -z $ANDROID_NDK_HOME ]; then + echo "Android NDK path not specified!" + echo "Please set \$ANDROID_NDK_HOME before starting this script!" + exit 1; +fi + +if [[ ! -f ./bin/gomobile && $BUILD_LIBRARY == true ]]; then + echo "gomobile not installed" + echo please run "install_go.sh first" + exit 1 +fi + +# Our targets are x86, x86_64, armeabi, armeabi-v7a, armv8; +# To remove targets, simply delete them from the bracket. +# NOTE: We are only currently shipping the armeabi-v7a binary +# on Android, for space reasons. +targets=(386 x86_64 armv7 arm64) +export GOOS=android + +for arch in ${targets[@]}; do + # Initialize variables + go_arch=$arch + ndk_arch=$arch + ndk_platform="android-16" + suffix=$arch + + if [ "$arch" = "386" ]; then + export CGO_ENABLED=1 + ndk_arch="x86" + suffix="x86" + binary="i686-linux-android-gcc" + elif [ "$arch" = "x86_64" ]; then + ndk_platform="android-21" + ndk_arch="x86_64" + suffix="x86_64" + binary="x86_64-linux-android-gcc" + elif [ "$arch" = "armv5" ]; then + export GOARM=5 + export CGO_ENABLED=1 + go_arch="arm" + ndk_arch="arm" + suffix="armeabi" + binary="arm-linux-androideabi-gcc" + elif [ "$arch" = "armv7" ]; then + export GOARM=7 + export CGO_ENABLED=1 + go_arch="arm" + ndk_arch="arm" + suffix="armeabi-v7a" + binary="arm-linux-androideabi-gcc" + elif [ "$arch" = "arm64" ]; then + suffix="arm64-v8a" + ndk_platform="android-21" + binary="aarch64-linux-android-gcc" + elif [ "$arch" = "mips" ]; then + binary="mipsel-linux-android-gcc" + fi + export GOARCH=${go_arch} + export GOPATH=`pwd` + export NDK_TOOLCHAIN=/tmp/android-toolchain-${ndk_arch} + + # Only generate toolchain if it does not already exist + if [ ! -d $NDK_TOOLCHAIN ]; then + echo "Generating ${suffix} toolchain..." + $ANDROID_NDK_HOME/build/tools/make-standalone-toolchain.sh \ + --arch=${ndk_arch} --platform=${ndk_platform} --install-dir=$NDK_TOOLCHAIN || quit "Failed to generate toolchain" + echo "Toolchain generated!" + fi + + export CC=$NDK_TOOLCHAIN/bin/clang + echo "Starting compilation for $suffix..." + + + # if [[ BUILD_SNOWFLAKE == "true" ]]; then + echo "cross compiling snowflake-client executable..." + pwd + ./golang/go/bin/go get github.com/cyBerta/snowflake/client + ./golang/go/bin/go build -buildmode=pie -ldflags '-w -s -extldflags=-pie' -o ./out/${suffix}/piesnowflakeclient github.com/cyBerta/snowflake/client || quit "Failed to cross-compile shapeshifter-dispatcher" + # elif [[ BUILD_LIBRARY == "true" ]]; then + # echo "cross compiling shapeshifter lib..." + # ./bin/gomobile bind -target=android -o ./lib/shapeshifter.aar se.leap.bitmaskclient/shapeshifter/ + # cp lib/shapeshifter* ../shapeshifter/. + # #./android_build_shapeshifter_lib.sh || quit "Failed to cross-compile shapeshifter-dispatcher-library" + # elif [[ BUILD_SHAPESHIFTER_DISPATCHER == "true" ]]; then + # echo "cross compiling shapeshifter-dispatcher executable..." + # ./golang/go/bin/go build -buildmode=pie -ldflags '-w -s -extldflags=-pie' -o ./out/${suffix}/piedispatcher github.com/OperatorFoundation/shapeshifter-dispatcher/shapeshifter-dispatcher || quit "Failed to cross-compile shapeshifter-dispatcher" + # fi + echo "Build succeeded!" + +done \ No newline at end of file diff --git a/go/src/github.com/cyBerta/snowflake b/go/src/github.com/cyBerta/snowflake new file mode 160000 index 00000000..af6e2c30 --- /dev/null +++ b/go/src/github.com/cyBerta/snowflake @@ -0,0 +1 @@ +Subproject commit af6e2c30e1a6aacc6e7adf9a31df0a387891cc37 -- cgit v1.2.3 From 4b74dcacf76c22f747a03f2e4d9ff3068522a9fd Mon Sep 17 00:00:00 2001 From: cyBerta Date: Thu, 1 Jul 2021 17:05:01 +0200 Subject: remove files in go/src/github.com/cyBerta/snowflake --- go/src/github.com/cyBerta/snowflake | 1 - 1 file changed, 1 deletion(-) delete mode 160000 go/src/github.com/cyBerta/snowflake (limited to 'go') diff --git a/go/src/github.com/cyBerta/snowflake b/go/src/github.com/cyBerta/snowflake deleted file mode 160000 index af6e2c30..00000000 --- a/go/src/github.com/cyBerta/snowflake +++ /dev/null @@ -1 +0,0 @@ -Subproject commit af6e2c30e1a6aacc6e7adf9a31df0a387891cc37 -- cgit v1.2.3 From 466408cc641d0635e61e0ec26a4178c1ebdcedc5 Mon Sep 17 00:00:00 2001 From: cyBerta Date: Thu, 1 Jul 2021 17:07:23 +0200 Subject: re-add snowflake submodule under different path --- go/src/git.torproject.org/pluggable-transports/snowflake | 1 + 1 file changed, 1 insertion(+) create mode 160000 go/src/git.torproject.org/pluggable-transports/snowflake (limited to 'go') diff --git a/go/src/git.torproject.org/pluggable-transports/snowflake b/go/src/git.torproject.org/pluggable-transports/snowflake new file mode 160000 index 00000000..af6e2c30 --- /dev/null +++ b/go/src/git.torproject.org/pluggable-transports/snowflake @@ -0,0 +1 @@ +Subproject commit af6e2c30e1a6aacc6e7adf9a31df0a387891cc37 -- cgit v1.2.3 From 7dfe33e09a97b7cde1c8637efd215dc2749f58c1 Mon Sep 17 00:00:00 2001 From: cyBerta Date: Wed, 7 Jul 2021 16:59:15 +0200 Subject: remove snowflake again --- go/src/git.torproject.org/pluggable-transports/snowflake | 1 - 1 file changed, 1 deletion(-) delete mode 160000 go/src/git.torproject.org/pluggable-transports/snowflake (limited to 'go') diff --git a/go/src/git.torproject.org/pluggable-transports/snowflake b/go/src/git.torproject.org/pluggable-transports/snowflake deleted file mode 160000 index af6e2c30..00000000 --- a/go/src/git.torproject.org/pluggable-transports/snowflake +++ /dev/null @@ -1 +0,0 @@ -Subproject commit af6e2c30e1a6aacc6e7adf9a31df0a387891cc37 -- cgit v1.2.3 From 7919dfabc1a42c2dfdcf0ded326afad352096a06 Mon Sep 17 00:00:00 2001 From: cyBerta Date: Fri, 9 Jul 2021 02:19:29 +0200 Subject: remove golang submodules --- go/src/github.com/OperatorFoundation/obfs4 | 1 - go/src/github.com/OperatorFoundation/shapeshifter-dispatcher | 1 - go/src/github.com/OperatorFoundation/shapeshifter-ipc | 1 - go/src/github.com/OperatorFoundation/shapeshifter-transports | 1 - go/src/github.com/aead/chacha20 | 1 - go/src/github.com/agl/ed25519 | 1 - go/src/github.com/dchest/siphash | 1 - go/src/github.com/shadowsocks/shadowsocks-go | 1 - go/src/golang.org/x/crypto | 1 - go/src/golang.org/x/net | 1 - go/src/golang.org/x/sys | 1 - go/src/golang.org/x/tools | 1 - go/src/se.leap.bitmaskclient/shapeshifter | 1 - 13 files changed, 13 deletions(-) delete mode 160000 go/src/github.com/OperatorFoundation/obfs4 delete mode 160000 go/src/github.com/OperatorFoundation/shapeshifter-dispatcher delete mode 160000 go/src/github.com/OperatorFoundation/shapeshifter-ipc delete mode 160000 go/src/github.com/OperatorFoundation/shapeshifter-transports delete mode 160000 go/src/github.com/aead/chacha20 delete mode 160000 go/src/github.com/agl/ed25519 delete mode 160000 go/src/github.com/dchest/siphash delete mode 160000 go/src/github.com/shadowsocks/shadowsocks-go delete mode 160000 go/src/golang.org/x/crypto delete mode 160000 go/src/golang.org/x/net delete mode 160000 go/src/golang.org/x/sys delete mode 160000 go/src/golang.org/x/tools delete mode 160000 go/src/se.leap.bitmaskclient/shapeshifter (limited to 'go') diff --git a/go/src/github.com/OperatorFoundation/obfs4 b/go/src/github.com/OperatorFoundation/obfs4 deleted file mode 160000 index 17f2cb99..00000000 --- a/go/src/github.com/OperatorFoundation/obfs4 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 17f2cb99c26454c519ca23185ee5dd3176a9363d diff --git a/go/src/github.com/OperatorFoundation/shapeshifter-dispatcher b/go/src/github.com/OperatorFoundation/shapeshifter-dispatcher deleted file mode 160000 index 7f7dd9fa..00000000 --- a/go/src/github.com/OperatorFoundation/shapeshifter-dispatcher +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 7f7dd9fa3e11173dc5f54b9fca7e693cfe93cc87 diff --git a/go/src/github.com/OperatorFoundation/shapeshifter-ipc b/go/src/github.com/OperatorFoundation/shapeshifter-ipc deleted file mode 160000 index 11746ba9..00000000 --- a/go/src/github.com/OperatorFoundation/shapeshifter-ipc +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 11746ba927e07aaa79ead1342256419df25ad699 diff --git a/go/src/github.com/OperatorFoundation/shapeshifter-transports b/go/src/github.com/OperatorFoundation/shapeshifter-transports deleted file mode 160000 index b69856f6..00000000 --- a/go/src/github.com/OperatorFoundation/shapeshifter-transports +++ /dev/null @@ -1 +0,0 @@ -Subproject commit b69856f6c6f6864167030359cb556143ecafb0a0 diff --git a/go/src/github.com/aead/chacha20 b/go/src/github.com/aead/chacha20 deleted file mode 160000 index 8b13a726..00000000 --- a/go/src/github.com/aead/chacha20 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 8b13a72661dae6e9e5dea04f344f0dc95ea29547 diff --git a/go/src/github.com/agl/ed25519 b/go/src/github.com/agl/ed25519 deleted file mode 160000 index 5312a615..00000000 --- a/go/src/github.com/agl/ed25519 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 5312a61534124124185d41f09206b9fef1d88403 diff --git a/go/src/github.com/dchest/siphash b/go/src/github.com/dchest/siphash deleted file mode 160000 index 34f20121..00000000 --- a/go/src/github.com/dchest/siphash +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 34f201214d993633bb24f418ba11736ab8b55aa7 diff --git a/go/src/github.com/shadowsocks/shadowsocks-go b/go/src/github.com/shadowsocks/shadowsocks-go deleted file mode 160000 index 6a03846c..00000000 --- a/go/src/github.com/shadowsocks/shadowsocks-go +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 6a03846ca9c02d8e94142b3c72b3182207a414b4 diff --git a/go/src/golang.org/x/crypto b/go/src/golang.org/x/crypto deleted file mode 160000 index 87dc89f0..00000000 --- a/go/src/golang.org/x/crypto +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 87dc89f01550277dc22b74ffcf4cd89fa2f40f4c diff --git a/go/src/golang.org/x/net b/go/src/golang.org/x/net deleted file mode 160000 index ec77196f..00000000 --- a/go/src/golang.org/x/net +++ /dev/null @@ -1 +0,0 @@ -Subproject commit ec77196f6094c3492a8b61f2c11cf937f78992ae diff --git a/go/src/golang.org/x/sys b/go/src/golang.org/x/sys deleted file mode 160000 index f89234f9..00000000 --- a/go/src/golang.org/x/sys +++ /dev/null @@ -1 +0,0 @@ -Subproject commit f89234f9a2c237c4d4cf7b32e3d9fe2f7c4eacd7 diff --git a/go/src/golang.org/x/tools b/go/src/golang.org/x/tools deleted file mode 160000 index 2b779830..00000000 --- a/go/src/golang.org/x/tools +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 2b779830f9d33eccacea7d9e741475351b225b1a diff --git a/go/src/se.leap.bitmaskclient/shapeshifter b/go/src/se.leap.bitmaskclient/shapeshifter deleted file mode 160000 index f50f9089..00000000 --- a/go/src/se.leap.bitmaskclient/shapeshifter +++ /dev/null @@ -1 +0,0 @@ -Subproject commit f50f90891c1b0dfab1c717c19c183387d08b8780 -- cgit v1.2.3 From 768fc328d2af734681894e760aad3ab69ceaf5f6 Mon Sep 17 00:00:00 2001 From: cyBerta Date: Fri, 9 Jul 2021 02:21:50 +0200 Subject: remove go directory --- go/android_build_core.sh | 22 --- go/android_build_golib.sh | 157 --------------------- go/android_build_shapeshifter.sh | 142 ------------------- go/android_build_web_core.sh | 22 --- go/install_go.sh | 43 ------ go/src/github.com/willscott/goturn | 1 - .../se.leap.bitmaskclient/pgpverify/pgpverify.go | 45 ------ 7 files changed, 432 deletions(-) delete mode 100755 go/android_build_core.sh delete mode 100755 go/android_build_golib.sh delete mode 100755 go/android_build_shapeshifter.sh delete mode 100755 go/android_build_web_core.sh delete mode 100755 go/install_go.sh delete mode 160000 go/src/github.com/willscott/goturn delete mode 100644 go/src/se.leap.bitmaskclient/pgpverify/pgpverify.go (limited to 'go') diff --git a/go/android_build_core.sh b/go/android_build_core.sh deleted file mode 100755 index 1a6af5b7..00000000 --- a/go/android_build_core.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash - -export GOPATH=`pwd` -export GO_LANG=`pwd`/golang/go/bin -export GO_COMPILED=`pwd`/bin -PATH="${GO_LANG}:${GO_COMPILED}:${PATH}" - -if [ -z $ANDROID_NDK_HOME ]; then - echo "Android NDK path not specified!" - echo "Please set \$ANDROID_NDK_HOME before starting this script!" - exit 1; -fi - -./golang/go/bin/go env -echo "getting gomobile..." -./golang/go/bin/go get golang.org/x/mobile/cmd/gomobile -echo "initiating gomobile..." -./bin/gomobile init -if [ ! -d ./lib ]; then mkdir ./lib; fi -echo "cross compiling bitmask core lib (shapeshifter)..." -./bin/gomobile bind -target=android -o ./lib/bitmask-core.aar se.leap.bitmaskclient/shapeshifter/ -cp lib/bitmask-core* ../bitmask-core/. \ No newline at end of file diff --git a/go/android_build_golib.sh b/go/android_build_golib.sh deleted file mode 100755 index a54a42af..00000000 --- a/go/android_build_golib.sh +++ /dev/null @@ -1,157 +0,0 @@ -#!/bin/bash - -# Copyright (C) 2016 Andrew Jiang (TunnelBear Inc.) -# Convenience script for generating shapeshifter-dispatcher binaries for Android devices -# adapted for Bitmask by cyberta - -BUILD_LIBRARY="false" -BUILD_SHAPESHIFTER_DISPATCHER="false" -BUILD_SNOWFLAKE="false" - -function quit { - echo "$1." - exit 1 -} - -if [[ "$1" == "removeAll" ]]; then - echo "removing golang, sources and generated files" - for folder in /tmp/android-toolchain-*; do - if [[ -d $folder ]]; then - rm -rf $folder - fi - done - if [[ -d "./out" ]]; then - rm -rf ./out - fi - - if [[ -d "./bin" ]]; then - rm -rf ./bin - fi - - if [[ -d "./golang" ]]; then - rm -rf ./golang - fi - - if [[ -d "./src" ]]; then - rm -rf ./src - fi - echo "Done!" - exit 0 - -elif [[ "$1" == "clean" ]]; then - echo "Cleaning up..." - for folder in /tmp/android-toolchain-*; do - if [[ -d $folder ]]; then - rm -rf $folder - fi - done - if [[ -d "./out" ]]; then - rm -rf ./out - fi - - if [[ -d "./bin" ]]; then - rm -rf ./bin - fi - echo "Done!" - exit 0 - -elif [[ "$1" == "shapeshifterlib" ]]; then - BUILD_LIBRARY="true" -elif [[ "$1" == "shapeshifter-dispatcher" ]]; then - BUILD_SHAPESHIFTER_DISPATCHER="true" -elif [[ "$1" == "snowflake-client" ]]; then - BUILD_SNOWFLAKE="true" - echo "BUILD_SNOWFLAKE!" -fi - - -if [ -z $ANDROID_NDK_HOME ]; then - echo "Android NDK path not specified!" - echo "Please set \$ANDROID_NDK_HOME before starting this script!" - exit 1; -fi - -if [[ ! -f ./bin/gomobile && $BUILD_LIBRARY == true ]]; then - echo "gomobile not installed" - echo please run "install_go.sh first" - exit 1 -fi - -# Our targets are x86, x86_64, armeabi, armeabi-v7a, armv8; -# To remove targets, simply delete them from the bracket. -# NOTE: We are only currently shipping the armeabi-v7a binary -# on Android, for space reasons. -targets=(386 x86_64 armv7 arm64) -export GOOS=android - -for arch in ${targets[@]}; do - # Initialize variables - go_arch=$arch - ndk_arch=$arch - ndk_platform="android-16" - suffix=$arch - - if [ "$arch" = "386" ]; then - export CGO_ENABLED=1 - ndk_arch="x86" - suffix="x86" - binary="i686-linux-android-gcc" - elif [ "$arch" = "x86_64" ]; then - ndk_platform="android-21" - ndk_arch="x86_64" - suffix="x86_64" - binary="x86_64-linux-android-gcc" - elif [ "$arch" = "armv5" ]; then - export GOARM=5 - export CGO_ENABLED=1 - go_arch="arm" - ndk_arch="arm" - suffix="armeabi" - binary="arm-linux-androideabi-gcc" - elif [ "$arch" = "armv7" ]; then - export GOARM=7 - export CGO_ENABLED=1 - go_arch="arm" - ndk_arch="arm" - suffix="armeabi-v7a" - binary="arm-linux-androideabi-gcc" - elif [ "$arch" = "arm64" ]; then - suffix="arm64-v8a" - ndk_platform="android-21" - binary="aarch64-linux-android-gcc" - elif [ "$arch" = "mips" ]; then - binary="mipsel-linux-android-gcc" - fi - export GOARCH=${go_arch} - export GOPATH=`pwd` - export NDK_TOOLCHAIN=/tmp/android-toolchain-${ndk_arch} - - # Only generate toolchain if it does not already exist - if [ ! -d $NDK_TOOLCHAIN ]; then - echo "Generating ${suffix} toolchain..." - $ANDROID_NDK_HOME/build/tools/make-standalone-toolchain.sh \ - --arch=${ndk_arch} --platform=${ndk_platform} --install-dir=$NDK_TOOLCHAIN || quit "Failed to generate toolchain" - echo "Toolchain generated!" - fi - - export CC=$NDK_TOOLCHAIN/bin/clang - echo "Starting compilation for $suffix..." - - - # if [[ BUILD_SNOWFLAKE == "true" ]]; then - echo "cross compiling snowflake-client executable..." - pwd - ./golang/go/bin/go get github.com/cyBerta/snowflake/client - ./golang/go/bin/go build -buildmode=pie -ldflags '-w -s -extldflags=-pie' -o ./out/${suffix}/piesnowflakeclient github.com/cyBerta/snowflake/client || quit "Failed to cross-compile shapeshifter-dispatcher" - # elif [[ BUILD_LIBRARY == "true" ]]; then - # echo "cross compiling shapeshifter lib..." - # ./bin/gomobile bind -target=android -o ./lib/shapeshifter.aar se.leap.bitmaskclient/shapeshifter/ - # cp lib/shapeshifter* ../shapeshifter/. - # #./android_build_shapeshifter_lib.sh || quit "Failed to cross-compile shapeshifter-dispatcher-library" - # elif [[ BUILD_SHAPESHIFTER_DISPATCHER == "true" ]]; then - # echo "cross compiling shapeshifter-dispatcher executable..." - # ./golang/go/bin/go build -buildmode=pie -ldflags '-w -s -extldflags=-pie' -o ./out/${suffix}/piedispatcher github.com/OperatorFoundation/shapeshifter-dispatcher/shapeshifter-dispatcher || quit "Failed to cross-compile shapeshifter-dispatcher" - # fi - echo "Build succeeded!" - -done \ No newline at end of file diff --git a/go/android_build_shapeshifter.sh b/go/android_build_shapeshifter.sh deleted file mode 100755 index e39f9eb1..00000000 --- a/go/android_build_shapeshifter.sh +++ /dev/null @@ -1,142 +0,0 @@ -#!/bin/bash - -# Copyright (C) 2016 Andrew Jiang (TunnelBear Inc.) -# Convenience script for generating shapeshifter-dispatcher binaries for Android devices -# adapted for Bitmask by cyberta - -BUILD_LIBRARY=false; - -function quit { - echo "$1." - exit 1 -} - -if [ "$1" == "removeAll" ]; then - echo "removing golang, sources and generated files" - for folder in /tmp/android-toolchain-*; do - if [[ -d $folder ]]; then - rm -rf $folder - fi - done - if [[ -d "./out" ]]; then - rm -rf ./out - fi - - if [[ -d "./bin" ]]; then - rm -rf ./bin - fi - - if [[ -d "./golang" ]]; then - rm -rf ./golang - fi - - if [[ -d "./src" ]]; then - rm -rf ./src - fi - echo "Done!" - -elif [ "$1" == "clean" ]; then - echo "Cleaning up..." - for folder in /tmp/android-toolchain-*; do - if [[ -d $folder ]]; then - rm -rf $folder - fi - done - if [[ -d "./out" ]]; then - rm -rf ./out - fi - - if [[ -d "./bin" ]]; then - rm -rf ./bin - fi - echo "Done!" -else - if [[ "$1" == "createLibrary" ]]; then - BUILD_LIBRARY=true - fi - - if [ -z $ANDROID_NDK_HOME ]; then - echo "Android NDK path not specified!" - echo "Please set \$ANDROID_NDK_HOME before starting this script!" - exit 1; - fi - - if [[ ! -f ./bin/gomobile && $BUILD_LIBRARY == true ]]; then - echo "gomobile not installed" - echo please run "install_go.sh first" - exit 1 - fi - - # Our targets are x86, x86_64, armeabi, armeabi-v7a, armv8; - # To remove targets, simply delete them from the bracket. - # NOTE: We are only currently shipping the armeabi-v7a binary - # on Android, for space reasons. - targets=(386 x86_64 armv7 arm64) - export GOOS=android - - for arch in ${targets[@]}; do - # Initialize variables - go_arch=$arch - ndk_arch=$arch - ndk_platform="android-16" - suffix=$arch - - if [ "$arch" = "386" ]; then - export CGO_ENABLED=1 - ndk_arch="x86" - suffix="x86" - binary="i686-linux-android-gcc" - elif [ "$arch" = "x86_64" ]; then - ndk_platform="android-21" - ndk_arch="x86_64" - suffix="x86_64" - binary="x86_64-linux-android-gcc" - elif [ "$arch" = "armv5" ]; then - export GOARM=5 - export CGO_ENABLED=1 - go_arch="arm" - ndk_arch="arm" - suffix="armeabi" - binary="arm-linux-androideabi-gcc" - elif [ "$arch" = "armv7" ]; then - export GOARM=7 - export CGO_ENABLED=1 - go_arch="arm" - ndk_arch="arm" - suffix="armeabi-v7a" - binary="arm-linux-androideabi-gcc" - elif [ "$arch" = "arm64" ]; then - suffix="arm64-v8a" - ndk_platform="android-21" - binary="aarch64-linux-android-gcc" - elif [ "$arch" = "mips" ]; then - binary="mipsel-linux-android-gcc" - fi - export GOARCH=${go_arch} - export GOPATH=`pwd` - export NDK_TOOLCHAIN=/tmp/android-toolchain-${ndk_arch} - - # Only generate toolchain if it does not already exist - if [ ! -d $NDK_TOOLCHAIN ]; then - echo "Generating ${suffix} toolchain..." - $ANDROID_NDK_HOME/build/tools/make-standalone-toolchain.sh \ - --arch=${ndk_arch} --platform=${ndk_platform} --install-dir=$NDK_TOOLCHAIN || quit "Failed to generate toolchain" - echo "Toolchain generated!" - fi - - export CC=$NDK_TOOLCHAIN/bin/clang - echo "Starting compilation for $suffix..." - - if [[ BUILD_LIBRARY ]]; then - echo "cross compiling shapeshifter lib..." - ./bin/gomobile bind -target=android -o ./lib/shapeshifter.aar se.leap.bitmaskclient/shapeshifter/ - cp lib/shapeshifter* ../shapeshifter/. - #./android_build_shapeshifter_lib.sh || quit "Failed to cross-compile shapeshifter-dispatcher-library" - - else - ./golang/go/bin/go build -buildmode=pie -ldflags '-w -s -extldflags=-pie' -o ./out/${suffix}/piedispatcher github.com/OperatorFoundation/shapeshifter-dispatcher/shapeshifter-dispatcher || quit "Failed to cross-compile shapeshifter-dispatcher" - fi - echo "Build succeeded!" - - done -fi \ No newline at end of file diff --git a/go/android_build_web_core.sh b/go/android_build_web_core.sh deleted file mode 100755 index 762d4dad..00000000 --- a/go/android_build_web_core.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash - -export GOPATH=`pwd` -export GO_LANG=`pwd`/golang/go/bin -export GO_COMPILED=`pwd`/bin -PATH="${GO_LANG}:${GO_COMPILED}:${PATH}" - -if [ -z $ANDROID_NDK_HOME ]; then - echo "Android NDK path not specified!" - echo "Please set \$ANDROID_NDK_HOME before starting this script!" - exit 1; -fi - -./golang/go/bin/go env -echo "getting gomobile..." -./golang/go/bin/go get golang.org/x/mobile/cmd/gomobile -echo "initiating gomobile..." -./bin/gomobile init -if [ ! -d ./lib ]; then mkdir ./lib; fi -echo "cross compiling bitmask web apk core lib (shapeshifter, pgpverify)..." -./bin/gomobile bind -target=android -o ./lib/bitmask-web-core.aar se.leap.bitmaskclient/shapeshifter/ se.leap.bitmaskclient/pgpverify -cp lib/bitmask-web-core* ../bitmask-web-core/. \ No newline at end of file diff --git a/go/install_go.sh b/go/install_go.sh deleted file mode 100755 index 59aab4f0..00000000 --- a/go/install_go.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/bash - -GO_VERSION=go1.14.2.linux-amd64 -EXPECTED_FP=6272d6e940ecb71ea5636ddb5fab3933e087c1356173c61f4a803895e947ebb3 - -if [[ $(ls -A ${GO_VERSION}.tar.gz) ]] -then - echo "reusing downloaded golang bundle" -else - echo "installing go lang bundle ${GO_VERSION}.tar.gz" - curl -o $GO_VERSION.tar.gz https://dl.google.com/go/$GO_VERSION.tar.gz - ACTUAL_FP=`sha256sum $GO_VERSION.tar.gz | cut -d " " -f1` - if [[ ! $ACTUAL_FP == $EXPECTED_FP ]] - then - echo "Download seems to be corrupted. Cancelling build." - return 1 - fi -fi - -if [[ -d ./golang ]] -then - if [[ $(ls -A ./golang/*) ]] - then - rm -r ./golang/* - fi -else - mkdir ./golang -fi -tar -C ./golang -xzf $GO_VERSION.tar.gz - - -export GOPATH=`pwd` -export GO_LANG=`pwd`/golang/go/bin -export GO_COMPILED=`pwd`/bin -export PATH="${GO_LANG}:${GO_COMPILED}:${PATH}" - -./golang/go/bin/go get golang.org/x/mobile/cmd/gomobile -./golang/go/bin/go env -echo "getting gomobile..." -./golang/go/bin/go get golang.org/x/mobile/cmd/gomobile -echo "initiating gomobile..." -./bin/gomobile init - diff --git a/go/src/github.com/willscott/goturn b/go/src/github.com/willscott/goturn deleted file mode 160000 index 19f41278..00000000 --- a/go/src/github.com/willscott/goturn +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 19f41278d0c9251d64e0ee29f37d51e87a24a97b diff --git a/go/src/se.leap.bitmaskclient/pgpverify/pgpverify.go b/go/src/se.leap.bitmaskclient/pgpverify/pgpverify.go deleted file mode 100644 index 1388a33c..00000000 --- a/go/src/se.leap.bitmaskclient/pgpverify/pgpverify.go +++ /dev/null @@ -1,45 +0,0 @@ -package pgpverify - -import ( - "os" - "strings" - - "golang.org/x/crypto/openpgp" -) - -// PgpVerifier - exported struct used for file verification -type PgpVerifier struct { - Logger Logger -} - -// Logger - logging interface -type Logger interface { - Log(msg string) -} - -// Verify checks if a file was signed with the correct pgp key -// using a PEM formatted signature and a corresponding public key -func (pgpv *PgpVerifier) Verify(signature string, publicKey string, targetPath string) bool { - keyRingReader := strings.NewReader(publicKey) - signatureReader := strings.NewReader(signature) - - verificationTarget, err := os.Open(targetPath) - if err != nil { - pgpv.Logger.Log("Open verification target: " + err.Error()) - return false - } - - keyring, err := openpgp.ReadArmoredKeyRing(keyRingReader) - if err != nil { - pgpv.Logger.Log("Read Armored Key Ring: " + err.Error()) - return false - } - _, err = openpgp.CheckArmoredDetachedSignature(keyring, verificationTarget, signatureReader) - if err != nil { - pgpv.Logger.Log("Verification failed: " + err.Error()) - return false - } - pgpv.Logger.Log("Successfully verified: entity.Identities") - return true -} - -- cgit v1.2.3