summaryrefslogtreecommitdiff
path: root/go
diff options
context:
space:
mode:
authorcyBerta <cyberta@riseup.net>2019-10-01 00:25:54 +0200
committercyBerta <cyberta@riseup.net>2019-10-01 00:25:54 +0200
commitfca6c9dcff1b5b5400a61b7411a7f72460fbfbfa (patch)
treec8efd8b964d495467619000fa7435c2a5527efa1 /go
parent7820e8c0819a10c5b4729678607681fcfe30cbae (diff)
parent685da193ea29f3e7a8a42d55747dfb2f956f23b6 (diff)
Merge branch 'pluggableTransports2'
Diffstat (limited to 'go')
-rwxr-xr-xgo/android_build_shapeshifter.sh132
-rwxr-xr-xgo/android_build_shapeshifter_lib.sh18
-rwxr-xr-xgo/install_go.sh6
-rw-r--r--go/lib/shapeshifter-sources.jarbin0 -> 6356 bytes
-rw-r--r--go/lib/shapeshifter.aarbin0 -> 8473417 bytes
m---------go/src/github.com/OperatorFoundation/obfs40
m---------go/src/github.com/OperatorFoundation/shapeshifter-dispatcher0
m---------go/src/github.com/OperatorFoundation/shapeshifter-ipc0
m---------go/src/github.com/OperatorFoundation/shapeshifter-transports0
m---------go/src/github.com/aead/chacha200
m---------go/src/github.com/agl/ed255190
m---------go/src/github.com/dchest/siphash0
m---------go/src/github.com/shadowsocks/shadowsocks-go0
m---------go/src/github.com/willscott/goturn0
m---------go/src/golang.org/x/crypto0
m---------go/src/golang.org/x/net0
m---------go/src/golang.org/x/sys0
m---------go/src/golang.org/x/tools0
m---------go/src/se.leap.bitmaskclient/shapeshifter0
19 files changed, 156 insertions, 0 deletions
diff --git a/go/android_build_shapeshifter.sh b/go/android_build_shapeshifter.sh
new file mode 100755
index 00000000..35b85121
--- /dev/null
+++ b/go/android_build_shapeshifter.sh
@@ -0,0 +1,132 @@
+#!/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" == "--library" ]]; 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
+
+ # 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 amd64 armv5 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" = "amd64" ]; 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
+ ./golang/go/bin/go build -buildmode=pie -ldflags '-w -s -extldflags=-pie' -o ./out/${suffix}/piedispatcherlib se.leap.bitmaskclient/shapeshifter || 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_shapeshifter_lib.sh b/go/android_build_shapeshifter_lib.sh
new file mode 100755
index 00000000..e3cd22d2
--- /dev/null
+++ b/go/android_build_shapeshifter_lib.sh
@@ -0,0 +1,18 @@
+#!/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 get golang.org/x/mobile/cmd/gomobile
+
+gomobile init
+gomobile bind -target=android -o ./lib/shapeshifter.aar se.leap.bitmaskclient/shapeshifter/
+cp lib/shapeshifter* ../shapeshifter/. \ No newline at end of file
diff --git a/go/install_go.sh b/go/install_go.sh
new file mode 100755
index 00000000..0181d77c
--- /dev/null
+++ b/go/install_go.sh
@@ -0,0 +1,6 @@
+#!/bin/bash
+
+GO_VERSION=go1.12.7.linux-amd64
+
+curl -o $GO_VERSION.tar.gz https://dl.google.com/go/$GO_VERSION.tar.gz
+tar -C ./golang -xzf $GO_VERSION.tar.gz
diff --git a/go/lib/shapeshifter-sources.jar b/go/lib/shapeshifter-sources.jar
new file mode 100644
index 00000000..ceb59834
--- /dev/null
+++ b/go/lib/shapeshifter-sources.jar
Binary files differ
diff --git a/go/lib/shapeshifter.aar b/go/lib/shapeshifter.aar
new file mode 100644
index 00000000..f80bd5bd
--- /dev/null
+++ b/go/lib/shapeshifter.aar
Binary files differ
diff --git a/go/src/github.com/OperatorFoundation/obfs4 b/go/src/github.com/OperatorFoundation/obfs4
new file mode 160000
+Subproject 17f2cb99c26454c519ca23185ee5dd3176a9363
diff --git a/go/src/github.com/OperatorFoundation/shapeshifter-dispatcher b/go/src/github.com/OperatorFoundation/shapeshifter-dispatcher
new file mode 160000
+Subproject f95b28c267640a039c8968e105bf62b203fa897
diff --git a/go/src/github.com/OperatorFoundation/shapeshifter-ipc b/go/src/github.com/OperatorFoundation/shapeshifter-ipc
new file mode 160000
+Subproject 11746ba927e07aaa79ead1342256419df25ad69
diff --git a/go/src/github.com/OperatorFoundation/shapeshifter-transports b/go/src/github.com/OperatorFoundation/shapeshifter-transports
new file mode 160000
+Subproject df9bac9654e09a0c7b64f1237b538fb3a5e6504
diff --git a/go/src/github.com/aead/chacha20 b/go/src/github.com/aead/chacha20
new file mode 160000
+Subproject 8b13a72661dae6e9e5dea04f344f0dc95ea2954
diff --git a/go/src/github.com/agl/ed25519 b/go/src/github.com/agl/ed25519
new file mode 160000
+Subproject 5312a61534124124185d41f09206b9fef1d8840
diff --git a/go/src/github.com/dchest/siphash b/go/src/github.com/dchest/siphash
new file mode 160000
+Subproject 34f201214d993633bb24f418ba11736ab8b55aa
diff --git a/go/src/github.com/shadowsocks/shadowsocks-go b/go/src/github.com/shadowsocks/shadowsocks-go
new file mode 160000
+Subproject ac922d10041cf4f04da4f76da7cef5ae26f492d
diff --git a/go/src/github.com/willscott/goturn b/go/src/github.com/willscott/goturn
new file mode 160000
+Subproject 19f41278d0c9251d64e0ee29f37d51e87a24a97
diff --git a/go/src/golang.org/x/crypto b/go/src/golang.org/x/crypto
new file mode 160000
+Subproject 88737f569e3a9c7ab309cdc09a07fe7fc87233c
diff --git a/go/src/golang.org/x/net b/go/src/golang.org/x/net
new file mode 160000
+Subproject eb5bcb51f2a31c7d5141d810b70815c05d9c914
diff --git a/go/src/golang.org/x/sys b/go/src/golang.org/x/sys
new file mode 160000
+Subproject 97732733099d6a942a73b889770774366de963e
diff --git a/go/src/golang.org/x/tools b/go/src/golang.org/x/tools
new file mode 160000
+Subproject 2a03e9e3a71aec549198563ca376881717f523d
diff --git a/go/src/se.leap.bitmaskclient/shapeshifter b/go/src/se.leap.bitmaskclient/shapeshifter
new file mode 160000
+Subproject f602ba600f5d3b9444b4072b7cd0b27df14be8b