Skip to content
This repository has been archived by the owner on May 22, 2020. It is now read-only.

Commit

Permalink
Psiphon Android app build & other CI improvements (#78)
Browse files Browse the repository at this point in the history
  • Loading branch information
szechuen authored and sergeyfrolov committed Sep 28, 2018
1 parent 6951fcd commit 2729691
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 39 deletions.
98 changes: 68 additions & 30 deletions .travis.yml
@@ -1,39 +1,77 @@
language: go

go:
- "1.10"

os:
- linux
- osx

os: linux
sudo: required
dist: trusty

services:
- docker

addons:
artifacts: true
apt:
packages:
- libegl1-mesa-dev
- libgles2-mesa-dev
- libx11-dev

install:
- go get -t ./...
- go get github.com/golang/lint/golint
# Install gometalinter
- go get github.com/alecthomas/gometalinter
# Get Psiphon code
- mkdir -p $GOPATH/src/github.com/Psiphon-Labs
- git clone https://github.com/Psiphon-Labs/psiphon-tunnel-core.git $GOPATH/src/github.com/Psiphon-Labs/psiphon-tunnel-core
- go get github.com/kardianos/govendor
- (cd $GOPATH/src/github.com/Psiphon-Labs/psiphon-tunnel-core && govendor remove github.com/sergeyfrolov/gotapdance/...)
- sed -i -e 's/refraction_networking_tapdance.Logger().Out = ioutil.Discard//' $GOPATH/src/github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/common/tapdance/tapdance.go

script:
- go test -race -v ./tapdance/
- go test -race -v ./tdproxy/
- gometalinter --install
- gometalinter --disable-all -E vet -E gofmt -E misspell -E ineffassign -E deadcode --tests ./tapdance/
# Build Psiphon ConsoleClient
- go build -race -tags 'TAPDANCE' github.com/Psiphon-Labs/psiphon-tunnel-core/ConsoleClient

notifications:
slack:
secure: ZzIEqFE4XRdE9U2p3aeE32DMtoC8RgjoEavhEQ1oLrWFgUpLktqmp9UVY/U+W6iElilLpDbFpry51+Sv9MWpxJMxr+Q/JJuq/3Bj5KjF/wEtil7qvBYhQ1sM/qUQFG6wRkrMNjZGMiaTmnkWF0rZB8lf7+nbnGFaPW3AVVbD+8gVDWTHI4Hcvvgs0UbrJzoPfpvH0dprOchswc1BBKTgo5c44rvS2fquEMVcqMMiNJ5JQqphuRWLTfzLgOzImSf0/xJJyVp/YTkSnVSg8BcWmDCJ4iB9fJkVyZM9WxcgY/J4T5VzFxfMah9zv2j8UTfzHSMeCJDRL647hdnkmr/Qum/LN91Ey2DJw5KUH743CsAbyGhQML6wZ3NCeEP06hnMDphalU5+BYhtAPyc5CB84g6eLIUQ2EqptuPZpjFQohFnapCTnfB5XKTcW+PjxJsoJzk8x+85Xid+H1nnNxeyf10tLv6Pwy4ZGmEEbsa4SYWXibpIEu3fPJXEdtrht0vM40pDLeUYL6Axmh7hNjmDQOXJG41saF+Rk4AArRhKhMQTmlYCc0e1H2/hIDXUMPbqjHeCpEkaA5W8BFBKynhlJa0JX+rtHDFaK82Di8rXT0NO2ACyG8ZQqk87qePyBYPyfR8hRwhrkmQHlYYOZzV6LBz+ynJuWl9ktcC2irJlHZs=

jobs:
include:
- stage: test
name: "Test and lint gotapdance"
install:
- go get -t ./...
- go get github.com/golang/lint/golint
- go get github.com/alecthomas/gometalinter
script:
- go test -race -v ./tapdance
- go test -race -v ./tdproxy
- gometalinter --install
- gometalinter --disable-all -E vet -E gofmt -E misspell -E ineffassign -E deadcode --tests ./tapdance

- &build # YAML anchor/alias
stage: build
name: "Build cli and Psiphon ConsoleClient on Linux"
install:
- go get ./...
# Substitute build string
- sed -i.bak "s/\[BUILD\]/$TRAVIS_BRANCH-$TRAVIS_COMMIT/" tapdance/logger.go
- mkdir -p $GOPATH/src/github.com/Psiphon-Labs
- git clone https://github.com/Psiphon-Labs/psiphon-tunnel-core.git $GOPATH/src/github.com/Psiphon-Labs/psiphon-tunnel-core
# Remove gotapdance from vendored packages
- go get github.com/kardianos/govendor
- (cd $GOPATH/src/github.com/Psiphon-Labs/psiphon-tunnel-core && govendor remove github.com/sergeyfrolov/gotapdance/...)
# Enable TapDance logging
- sed -i.bak 's/refraction_networking_tapdance.Logger().Out = ioutil.Discard//' $GOPATH/src/github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/common/tapdance/tapdance.go
script:
- go build -o build/cli-$TRAVIS_OS_NAME ./cli
- go build -o build/ConsoleClient-$TRAVIS_OS_NAME -tags 'TAPDANCE' github.com/Psiphon-Labs/psiphon-tunnel-core/ConsoleClient
after_success:
# Upload built binaries to S3
- sudo pip install awscli
- if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then aws s3 sync build s3://$ARTIFACTS_BUCKET/$TRAVIS_REPO_SLUG/$TRAVIS_BRANCH/; fi

- <<: *build # Same build on OS X
name: "Build cli and Psiphon ConsoleClient on OS X"
os: osx

- <<: *build # Reuse setup steps from build
name: "Build Psiphon Android Library and App"
before_script:
# Get Android build environment
- docker pull refraction/psiandroid
- mkdir -p $GOPATH/src/bitbucket.org/psiphon
- hg clone https://bitbucket.org/psiphon/psiphon-circumvention-system $GOPATH/src/bitbucket.org/psiphon/psiphon-circumvention-system
# Use modified EmbeddedValues.java for TapDance
- openssl aes-256-cbc -d -K $encrypted_8a9748c534c1_key -iv $encrypted_8a9748c534c1_iv -in build/EmbeddedValues.java.enc -out $GOPATH/src/bitbucket.org/psiphon/psiphon-circumvention-system/Android/app/src/main/java/com/psiphon3/psiphonlibrary/EmbeddedValues.java
# Patched tunneling protocol for TapDance
- patch $GOPATH/src/bitbucket.org/psiphon/psiphon-circumvention-system/Android/app/src/main/java/com/psiphon3/psiphonlibrary/TunnelManager.java build/TunnelManager.java.patch
script:
# Build Psiphon Android Library ca.psiphon.aar
- docker run -v $GOPATH/src/github.com/Psiphon-Labs/psiphon-tunnel-core:/go/src/github.com/Psiphon-Labs/psiphon-tunnel-core refraction/psiandroid /bin/bash -c 'cd /go/src/github.com/Psiphon-Labs/psiphon-tunnel-core/MobileLibrary/Android && ./make.bash "TAPDANCE"'
- mv $GOPATH/src/github.com/Psiphon-Labs/psiphon-tunnel-core/MobileLibrary/Android/ca.psiphon.aar build/
# Build Psiphon Android App PsiphonAndroid-debug.apk
- cp build/ca.psiphon.aar $GOPATH/src/bitbucket.org/psiphon/psiphon-circumvention-system/Android/app/libs/
- docker run -v $GOPATH/src/bitbucket.org/psiphon/psiphon-circumvention-system/Android:/go/src/bitbucket.org/psiphon/psiphon-circumvention-system/Android refraction/psiandroid /bin/bash -c 'yes | /android-sdk-linux/tools/bin/sdkmanager --update && cd /go/src/bitbucket.org/psiphon/psiphon-circumvention-system/Android && ./gradlew assembleDebug'
- sudo mv $GOPATH/src/bitbucket.org/psiphon/psiphon-circumvention-system/Android/app/build/outputs/apk/debug/PsiphonAndroid-debug.apk build/
18 changes: 9 additions & 9 deletions README.md
Expand Up @@ -4,14 +4,14 @@

<p align="center">TapDance is a free-to-use anti-censorship technology, protected from enumeration attacks.</p>
<p align="center">
<a href="https://travis-ci.org/sergeyfrolov/gotapdance"><img src="https://travis-ci.org/sergeyfrolov/gotapdance.svg?label=build"></a>
<a href="https://travis-ci.org/sergeyfrolov/gotapdance"><img src="https://travis-ci.org/sergeyfrolov/gotapdance.svg?branch=master"></a>
<a href="https://godoc.org/github.com/sergeyfrolov/gotapdance/tapdance"><img src="https://img.shields.io/badge/godoc-reference-blue.svg"></a>
<a href="https://goreportcard.com/report/github.com/sergeyfrolov/gotapdance"><img src="https://goreportcard.com/badge/github.com/sergeyfrolov/gotapdance"></a>
</p>

# Build
## Download Golang and TapDance and dependencies
1. Install [Golang](https://golang.org/dl/) (currently tested against 1.9 and 1.10 versions), set GOPATH:
1. Install [Golang](https://golang.org/dl/) (currently tested against version 1.10), set GOPATH:

```bash
GOPATH="${HOME}/go/"
Expand All @@ -37,11 +37,11 @@ If you have outdated versions of libraries above you might want to do `go get -u
* Mobile: native applications in Java/Objective C for Android or iOS. Golang bindings are used as a shared library.

* [Android application in Java](android)

* iOS version: coming ~~soon~~ eventually

* [Golang Bindings](gobind)

* Use tapdance directly from other Golang program:

```Golang
Expand Down Expand Up @@ -78,11 +78,11 @@ func main() {


# Links

[Refraction Networking](https://refraction.network) is an umberlla term for the family of similarly working technnologies.
TapDance station code released for FOCI'17 on github: [refraction-networking/tapdance](https://github.com/refraction-networking/tapdance)

TapDance station code released for FOCI'17 on github: [refraction-networking/tapdance](https://github.com/refraction-networking/tapdance)

Original 2014 paper: ["TapDance: End-to-Middle Anticensorship without Flow Blocking"](https://ericw.us/trow/tapdance-sec14.pdf)

Newer(2017) paper that shows TapDance working at high-scale: ["An ISP-Scale Deployment of TapDance"](https://sfrolov.io/papers/foci17-paper-frolov_0.pdf)
Binary file added build/EmbeddedValues.java.enc
Binary file not shown.
10 changes: 10 additions & 0 deletions build/TunnelManager.java.patch
@@ -0,0 +1,10 @@
@@ -732,6 +732,9 @@
json.put("EgressRegion", egressRegion);
}

+ json.put("TunnelProtocol", "TAPDANCE-OSSH");
+ json.put("DisableTactics", true);
+
if (tunnelConfig.disableTimeouts) {
//disable timeouts
MyLog.g("DisableTimeouts", "disableTimeouts", true);
3 changes: 3 additions & 0 deletions tapdance/logger.go
Expand Up @@ -19,11 +19,14 @@ var initLoggerOnce sync.Once

// Logger is an access point for TapDance-wide logger
func Logger() *logrus.Logger {
const build string = "[BUILD]"

initLoggerOnce.Do(func() {
logrusLogger = logrus.New()
logrusLogger.Formatter = new(formatter)
logrusLogger.Level = logrus.InfoLevel
//logrusLogger.Level = logrus.DebugLevel
logrusLogger.Infof("Running gotapdance build %s", build)
})
return logrusLogger
}

0 comments on commit 2729691

Please sign in to comment.