Skip to content
No description, website, or topics provided.
Go Shell Makefile
Branch: master
Clone or download
Latest commit 984a4ab Aug 17, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
android Enable logging on Android Aug 16, 2019
apple Expose a summary of socket activity for Intra Jun 3, 2019
tools
tunnel Revert "Delay RST caused by Network Unreachable" Aug 16, 2019
.gitignore Add README, .gitignore Apr 15, 2019
CONTRIBUTING.md Add CONTRIBUTING Apr 15, 2019
LICENSE Initial commit Apr 1, 2019
Makefile Upgrade to go-tun2socks 1.16.2 Aug 14, 2019
README.md Build patched Go runtime, recompile gomobile Apr 15, 2019
build_android.sh Android: retrieve JNI binaries, don't strip debug symbols (#9) Jun 13, 2019
build_ios.sh Add missing BUILD_DIR variable (#6) Jun 4, 2019
build_linux.sh Do not commit binaries (#2) Apr 15, 2019
build_macos.sh Do not commit binaries (#2) Apr 15, 2019
build_windows.sh Do not commit binaries (#2) Apr 15, 2019
go.mod Upgrade to go-tun2socks 1.16.2 Aug 14, 2019
go.sum Upgrade to go-tun2socks 1.16.2 Aug 14, 2019

README.md

outline-go-tun2socks

Go package for building go-tun2socks libraries for macOS, iOS, and Android. Builds go-tun2socks binaries for Linux and Windows.

Prerequisites

  • macOS host (iOS, macOS)
  • Xcode (iOS, macOS)
  • make
  • Go >= 1.12
  • A C compiler (e.g.: clang, gcc)
  • gomobile (iOS, macOS, Android)
  • xgo (Windows, Linux)
  • Docker (Windows, Linux)
  • Other common utilities (e.g.: git)

Apple Golang Runtime

We use a custom Golang runtime to build the iOS and macOS framework built off Go 1.12. The patch improves memory reporting to the OS. This should not be necessary after Go 1.13 is released (scheduled for August 2019).

Additionally, Go 1.12 calls private APIs on Darwin, which is not approved for Mac App Store distribution. We have applied this patch, scheduled for release on Go 1.12.2.

You can use our pre-compiled Darwin binary, at tools/go or build it yourself:

# We assume that Go is installed in /usr/local; this may vary on your system.
cd /usr/local/
# Temporarily move the current Go version, so as not to clobber $PATH.
mv go go1.12
# Download the Go source.
git clone https://go.googlesource.com/go
cd go
git checkout release-branch.go1.12
# Apply the patches.
git fetch https://go.googlesource.com/go refs/changes/17/159117/5 && git cherry-pick FETCH_HEAD
git fetch https://go.googlesource.com/go refs/changes/40/170640/6 && git cherry-pick FETCH_HEAD
# Update the version.
echo "go1.12-dev-runtime" > VERSION
# Build the runtime.
cd src
GOROOT_BOOTSTRAP=/usr/local/go1.12/ ./make.bash
# Verify that the installed binary matches the custom version (i.e. 'go version go1.12-dev-runtime darwin/amd64').
go version

After building the framework, you can delete the custom runtime and revert to Go 1.12.

macOS Framework

As of Go 1.12, gomobile does not support building frameworks for macOS. We have patched gomobile to enable building a framework for macOS by replacing the default iOS simulator build.

Until we upstream the change, the (Darwin) binary to enable this behavior is located at tools/gomobile.

    # Find out the path of the installed gomobile (i.e. ~/go/bin/gomobile).
    which gomobile
    # Temporarily rename the installed gomobile.
    mv ~/go/bin/gomobile ~/go/bin/gomobile-prod
    # Copy the patched gomobile binary.
    ln -s `pwd`/tools/gomobile ~/go/bin/gomobile
    # Initialize gomobile.
    gomobile init
    # Build the macOS framework.
    ./build_macos
    # Revert the changes.
    rm ~/go/bin/gomobile
    mv ~/go/bin/gomobile-prod ~/go/bin/gomobile

Linux & Windows

We build binaries for Linux and Windows from source without any custom integrations. xgo and Docker are required to support cross-compilation.

Build

go get -d ./...
./build_[ios|android|macos|windows].sh
You can’t perform that action at this time.