-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add outline-go-tun2socks, except android (#1744)
* init tun2socks * move to src/tun2socks * addt'l feedback * wip: working on build script * update go.mod and references * attempt #1 adding to build process * cleanup * update CI * okay it all works * setup go * try gomobile init * build go binaries instead * try env.PATH * gah just inline it lol * build go binaries in action and revert github config * make the bindir * properly link bins for electron * scope folder * copy android lib, improve spawn stream error log * apparently we have to do this * try this * try -out * safer paths * try goos android * this? * topsy turvy upside down day * oops * detect os platforms * revert ci os container changes * build windows on mac?? * oh derp * take into consideration host platform * oops, revert mac change * fix setup_linux_android * try ldf flags * remove ldf * update mac location and add tunnel target to linux/android * oops forgot target * try go:build android and improve error output missing message * build tun2socks before apple tests * not sure this will work in the CI, but hey * so weird lol * apple fix?? * builder path issue * revert android build * Update tools.go Co-authored-by: Vinicius Fortuna <[email protected]> * ios simulator, go 1.20 * Update build_and_test_debug.yml * update versions and remove build folder * update engine?? * engines dot x * additional cleanup * Update src/electron/README.md Co-authored-by: J. Yi <[email protected]> * Update src/tun2socks/build.action.mjs Co-authored-by: J. Yi <[email protected]> * Update build_and_test_debug.yml * use go file and split ios/macos calls * create intermediary tun2socks folder and try to fix electron pathing issue * Update README.md Co-authored-by: Vinicius Fortuna <[email protected]> * this should fix linux? still working out windows * did I revert it correctly? 😅 * now i'm all confused... * this? * upgrade gomobile and add macos to the thing * add TODOs * use makefile * update IMPORT_PATH * split up pkg names * ? * ?? * set androida api * add todos --------- Co-authored-by: Vinicius Fortuna <[email protected]> Co-authored-by: J. Yi <[email protected]>
- Loading branch information
1 parent
9133950
commit e8dcd79
Showing
41 changed files
with
1,998 additions
and
50 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,7 @@ on: | |
branches: | ||
- master | ||
|
||
# TODO: run go tests | ||
jobs: | ||
web_test: | ||
name: Web Test | ||
|
@@ -63,6 +64,11 @@ jobs: | |
- name: Install NPM Dependencies | ||
run: npm ci | ||
|
||
- name: Install Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version-file: '${{ github.workspace }}/go.mod' | ||
|
||
- name: Build Linux Client | ||
run: npm run action electron/build linux | ||
|
||
|
@@ -87,6 +93,11 @@ jobs: | |
- name: Install NPM Dependencies | ||
run: npm ci | ||
|
||
- name: Install Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version-file: '${{ github.workspace }}/go.mod' | ||
|
||
- name: Build Windows Client | ||
run: npm run action electron/build windows | ||
|
||
|
@@ -111,6 +122,14 @@ jobs: | |
- name: Install NPM Dependencies | ||
run: npm ci | ||
|
||
- name: Install Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version-file: '${{ github.workspace }}/go.mod' | ||
|
||
- name: Build Tun2Socks (required for Test OutlineAppleLib) | ||
run: npm run action tun2socks/build macos | ||
|
||
- name: Test OutlineAppleLib | ||
run: npm run action cordova/test macos | ||
|
||
|
@@ -144,6 +163,14 @@ jobs: | |
- name: Install NPM Dependencies | ||
run: npm ci | ||
|
||
- name: Install Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version-file: '${{ github.workspace }}/go.mod' | ||
|
||
- name: Build Tun2Socks (required for Test OutlineAppleLib) | ||
run: npm run action tun2socks/build ios | ||
|
||
- name: Test OutlineAppleLib | ||
run: npm run action cordova/test ios | ||
|
||
|
@@ -177,6 +204,14 @@ jobs: | |
- name: Install NPM Dependencies | ||
run: npm ci | ||
|
||
- name: Install Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version-file: '${{ github.workspace }}/go.mod' | ||
|
||
- name: Build Tun2Socks (required for Test OutlineAppleLib) | ||
run: npm run action tun2socks/build maccatalyst | ||
|
||
- name: Test OutlineAppleLib | ||
run: npm run action cordova/test maccatalyst | ||
|
||
|
@@ -207,6 +242,11 @@ jobs: | |
- name: Install NPM Dependencies | ||
run: npm ci | ||
|
||
- name: Install Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version-file: '${{ github.workspace }}/go.mod' | ||
|
||
- name: Install Java | ||
uses: actions/[email protected] | ||
with: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,28 @@ | ||
.idea | ||
.vs/ | ||
.vscode | ||
*.DS_Store | ||
/output | ||
/build | ||
info.txt | ||
*.env | ||
*.pdb | ||
*.sw? | ||
/node_modules | ||
/build | ||
/output | ||
/platforms | ||
/plugins | ||
/www | ||
/third_party/Potatso/Pods | ||
xcuserdata/ | ||
.vs/ | ||
/www | ||
coverage | ||
info.txt | ||
keystore.p12 | ||
obj/ | ||
Outline.apk | ||
Outline.apks | ||
packages/ | ||
*.pdb | ||
toc.pb | ||
tools/OutlineService/OutlineService/bin/* | ||
!tools/OutlineService/OutlineService/bin/*.exe | ||
*.sw? | ||
tools/smartdnsblock/bin/* | ||
!tools/OutlineService/OutlineService/bin/*.exe | ||
!tools/smartdnsblock/bin/*.exe | ||
keystore.p12 | ||
Outline.apk | ||
Outline.apks | ||
universal.apk | ||
toc.pb | ||
coverage | ||
*.env | ||
xcuserdata/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
BUILDDIR=$(CURDIR)/output/build | ||
GOBIN=$(CURDIR)/output/bin | ||
|
||
GOMOBILE=$(GOBIN)/gomobile | ||
# Add GOBIN to $PATH so `gomobile` can find `gobind`. | ||
GOBIND=env PATH="$(GOBIN):$(PATH)" "$(GOMOBILE)" bind | ||
IMPORT_HOST=github.com | ||
IMPORT_PATH=$(IMPORT_HOST)/Jigsaw-Code/outline-client | ||
|
||
.PHONY: android apple linux windows | ||
|
||
all: android apple linux windows | ||
|
||
ROOT_PKG=src/tun2socks | ||
# Don't strip Android debug symbols so we can upload them to crash reporting tools. | ||
ANDROID_BUILD_CMD=$(GOBIND) -a -ldflags '-w' -target=android -androidapi 19 -tags android -work | ||
|
||
android: $(BUILDDIR)/android/tun2socks.aar | ||
|
||
$(BUILDDIR)/android/tun2socks.aar: $(GOMOBILE) | ||
mkdir -p "$(BUILDDIR)/android" | ||
$(ANDROID_BUILD_CMD) -o "$@" $(IMPORT_PATH)/$(ROOT_PKG)/outline/tun2socks $(IMPORT_PATH)/$(ROOT_PKG)/outline/shadowsocks | ||
|
||
# TODO(fortuna): -s strips symbols and is obsolete. Why are we using it? | ||
$(BUILDDIR)/ios/Tun2socks.xcframework: $(GOMOBILE) | ||
# -iosversion should match what outline-client supports. | ||
$(GOBIND) -iosversion=11.0 -target=ios,iossimulator -o $@ -ldflags '-s -w' -bundleid org.outline.tun2socks $(IMPORT_PATH)/$(ROOT_PKG)/outline/tun2socks $(IMPORT_PATH)/$(ROOT_PKG)/outline/shadowsocks | ||
|
||
$(BUILDDIR)/macos/Tun2socks.xcframework: $(GOMOBILE) | ||
# MACOSX_DEPLOYMENT_TARGET and -iosversion should match what outline-client supports. | ||
export MACOSX_DEPLOYMENT_TARGET=10.14; $(GOBIND) -iosversion=13.1 -target=macos,maccatalyst -o $@ -ldflags '-s -w' -bundleid org.outline.tun2socks $(IMPORT_PATH)/$(ROOT_PKG)/outline/tun2socks $(IMPORT_PATH)/$(ROOT_PKG)/outline/shadowsocks | ||
|
||
apple: $(BUILDDIR)/apple/Tun2socks.xcframework | ||
|
||
$(BUILDDIR)/apple/Tun2socks.xcframework: $(BUILDDIR)/ios/Tun2socks.xcframework $(BUILDDIR)/macos/Tun2socks.xcframework | ||
find $^ -name "Tun2socks.framework" -type d | xargs -I {} echo " -framework {} " | \ | ||
xargs xcrun xcodebuild -create-xcframework -output "$@" | ||
|
||
XGO=$(GOBIN)/xgo | ||
TUN2SOCKS_VERSION=v1.16.11 | ||
XGO_LDFLAGS='-s -w -X main.version=$(TUN2SOCKS_VERSION)' | ||
ELECTRON_PKG=$(ROOT_PKG)/outline/electron | ||
|
||
# TODO: build directly when on linux | ||
LINUX_BUILDDIR=$(BUILDDIR)/linux | ||
|
||
linux: $(LINUX_BUILDDIR)/tun2socks | ||
|
||
$(LINUX_BUILDDIR)/tun2socks: $(XGO) | ||
mkdir -p "$(LINUX_BUILDDIR)/$(IMPORT_PATH)" | ||
$(XGO) -ldflags $(XGO_LDFLAGS) --targets=linux/amd64 -dest "$(LINUX_BUILDDIR)" -pkg $(ELECTRON_PKG) . | ||
mv "$(LINUX_BUILDDIR)/$(IMPORT_PATH)-linux-amd64" "$@" | ||
rm -r "$(LINUX_BUILDDIR)/$(IMPORT_HOST)" | ||
|
||
# TODO: build directly when on windows | ||
WINDOWS_BUILDDIR=$(BUILDDIR)/windows | ||
|
||
windows: $(WINDOWS_BUILDDIR)/tun2socks.exe | ||
|
||
$(WINDOWS_BUILDDIR)/tun2socks.exe: $(XGO) | ||
mkdir -p "$(WINDOWS_BUILDDIR)/$(IMPORT_PATH)" | ||
$(XGO) -ldflags $(XGO_LDFLAGS) --targets=windows/386 -dest "$(WINDOWS_BUILDDIR)" -pkg $(ELECTRON_PKG) . | ||
mv "$(WINDOWS_BUILDDIR)/$(IMPORT_PATH)-windows-386.exe" "$@" | ||
rm -r "$(WINDOWS_BUILDDIR)/$(IMPORT_HOST)" | ||
|
||
|
||
$(GOMOBILE): go.mod | ||
env GOBIN="$(GOBIN)" go install golang.org/x/mobile/cmd/gomobile | ||
env GOBIN="$(GOBIN)" $(GOMOBILE) init | ||
|
||
$(XGO): go.mod | ||
env GOBIN="$(GOBIN)" go install github.com/crazy-max/xgo | ||
|
||
go.mod: tools.go | ||
go mod tidy | ||
touch go.mod |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,27 @@ | ||
module github.com/Jigsaw-Code/outline-apps | ||
module github.com/Jigsaw-Code/outline-client | ||
|
||
go 1.20 | ||
|
||
require ( | ||
github.com/Jigsaw-Code/outline-sdk v0.0.2 | ||
github.com/Jigsaw-Code/outline-sdk v0.0.9 | ||
github.com/Jigsaw-Code/outline-sdk/x v0.0.0-20230807220427-893de7fdc6b8 | ||
github.com/crazy-max/xgo v0.30.0 | ||
github.com/eycorsican/go-tun2socks v1.16.11 | ||
github.com/stretchr/testify v1.8.4 | ||
golang.org/x/sys v0.11.0 | ||
golang.org/x/mobile v0.0.0-20231127183840-76ac6878050a | ||
golang.org/x/sys v0.15.0 | ||
) | ||
|
||
require ( | ||
github.com/davecgh/go-spew v1.1.1 // indirect | ||
github.com/eycorsican/go-tun2socks v1.16.11 // indirect | ||
github.com/miekg/dns v1.1.54 // indirect | ||
github.com/pmezard/go-difflib v1.0.0 // indirect | ||
github.com/shadowsocks/go-shadowsocks2 v0.1.5 // indirect | ||
golang.org/x/crypto v0.9.0 // indirect | ||
golang.org/x/mod v0.10.0 // indirect | ||
golang.org/x/net v0.10.0 // indirect | ||
golang.org/x/tools v0.9.1 // indirect | ||
github.com/songgao/water v0.0.0-20200317203138-2b4b6d7c09d8 // indirect | ||
golang.org/x/crypto v0.16.0 // indirect | ||
golang.org/x/mod v0.14.0 // indirect | ||
golang.org/x/net v0.19.0 // indirect | ||
golang.org/x/sync v0.5.0 // indirect | ||
golang.org/x/tools v0.16.0 // indirect | ||
gopkg.in/yaml.v3 v3.0.1 // indirect | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.