/outline-go-tun2socks

Primary LanguageGoApache License 2.0Apache-2.0

outline-go-tun2socks

Go package for building go-tun2socks-based clients for Outline, as a library for iOS and Android.

Prerequisites

  • macOS host (iOS, macOS)
  • make
  • Go >= 1.18
  • A C compiler (e.g.: clang, gcc)

Android

Set up

  • sdkmanager
    1. Download the command line tools from https://developer.android.com/studio.
    2. Unzip the pacakge as ~/Android/Sdk/cmdline-tools/latest/. Make sure sdkmanager is located at ~/Android/Sdk/cmdline-tools/latest/bin/sdkmanager
  • Android NDK 23
    1. Install the NDK with ~/Android/Sdk/cmdline-tools/latest/bin/sdkmanager "platforms;android-30" "ndk;23.1.7779620" (platform from outline-client, exact NDK 23 version obtained from sdkmanager --list)
    2. Set up the environment variables:
      export ANDROID_NDK_HOME=~/Android/Sdk/ndk/23.1.7779620 ANDROID_HOME=~/Android/Sdk
      
  • gomobile (installed as needed by make)

Build

make clean && make android

This will create build/android/{tun2socks.aar,tun2socks-sources.jar}

If needed, you can extract the jni files into build/android/jni with:

unzip build/android/tun2socks.aar 'jni/*' -d build/android

Apple (iOS and macOS)

Set up

  • Xcode
  • gomobile (installed as needed by make)

Build

make clean && make apple

This will create build/apple/Tun2socks.xcframework.