Skip to content

Commit

Permalink
chore: add outline-go-tun2socks, except android (#1744)
Browse files Browse the repository at this point in the history
* 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 <fortuna@users.noreply.github.com>

* 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 <93548144+jyyi1@users.noreply.github.com>

* Update src/tun2socks/build.action.mjs

Co-authored-by: J. Yi <93548144+jyyi1@users.noreply.github.com>

* 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 <fortuna@users.noreply.github.com>

* 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 <fortuna@users.noreply.github.com>
Co-authored-by: J. Yi <93548144+jyyi1@users.noreply.github.com>
  • Loading branch information
3 people authored Jan 10, 2024
1 parent 9133950 commit e8dcd79
Show file tree
Hide file tree
Showing 41 changed files with 1,998 additions and 50 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
* @Jigsaw-Code/outline-dev

/src/tun2socks/ @Jigsaw-Code/outline-networking-owners
/src/cordova/plugin/ @Jigsaw-Code/outline-networking-owners
/third_party/ @Jigsaw-Code/outline-networking-owners
/tools/ @Jigsaw-Code/outline-networking-owners
Expand Down
40 changes: 40 additions & 0 deletions .github/workflows/build_and_test_debug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ on:
branches:
- master

# TODO: run go tests
jobs:
web_test:
name: Web Test
Expand Down Expand Up @@ -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

Expand All @@ -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

Expand All @@ -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

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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/setup-java@v1.4.3
with:
Expand Down
30 changes: 15 additions & 15 deletions .gitignore
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/
76 changes: 76 additions & 0 deletions Makefile
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ To join our Outline Community, [sign up for the IFF Mattermost](https://internet

## Requirements for all builds

All builds require [Node](https://nodejs.org/) 18 (lts/hydrogen), in addition to other per-platform requirements.
All builds require [Node](https://nodejs.org/) 18 (lts/hydrogen), and [Go](https://golang.org/) 1.20 installed in addition to other per-platform requirements.

> 💡 NOTE: if you have `nvm` installed, run `nvm use` to switch to the correct node version!
Expand Down
20 changes: 12 additions & 8 deletions go.mod
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
)
33 changes: 20 additions & 13 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
github.com/Jigsaw-Code/outline-sdk v0.0.2 h1:uCuyJMaWj57IYEG/Hdml8YMdk9chU60ZkSxJXBhyGHU=
github.com/Jigsaw-Code/outline-sdk v0.0.2/go.mod h1:hhlKz0+r9wSDFT8usvN8Zv/BFToCIFAUn1P2Qk8G2CM=
github.com/Jigsaw-Code/outline-sdk v0.0.9 h1:FuyrqJ5OBh5y8mpXkSomdGJreGi8bAOWRXRNB2B+Hdc=
github.com/Jigsaw-Code/outline-sdk v0.0.9/go.mod h1:hhlKz0+r9wSDFT8usvN8Zv/BFToCIFAUn1P2Qk8G2CM=
github.com/Jigsaw-Code/outline-sdk/x v0.0.0-20230807220427-893de7fdc6b8 h1:BxOHmmuppPM8K0DGUsfvajKF4PKfGxv9boNDhmbszFU=
github.com/Jigsaw-Code/outline-sdk/x v0.0.0-20230807220427-893de7fdc6b8/go.mod h1:tBqJXpVm+kym+EAUdwNodcFxy872FfjVErfj8Br+gs0=
github.com/crazy-max/xgo v0.30.0 h1:2uunjwLBrVu5LKIS1dIDXz9U5OIX4H5LEsC3P6wFTto=
github.com/crazy-max/xgo v0.30.0/go.mod h1:m/aqfKaN/cYzfw+Pzk7Mk0tkmShg3/rCS4Zdhdugi4o=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/eycorsican/go-tun2socks v1.16.11 h1:+hJDNgisrYaGEqoSxhdikMgMJ4Ilfwm/IZDrWRrbaH8=
Expand All @@ -18,27 +20,32 @@ github.com/riobard/go-bloom v0.0.0-20200614022211-cdc8013cb5b3/go.mod h1:HgjTstv
github.com/shadowsocks/go-shadowsocks2 v0.1.5 h1:PDSQv9y2S85Fl7VBeOMF9StzeXZyK1HakRm86CUbr28=
github.com/shadowsocks/go-shadowsocks2 v0.1.5/go.mod h1:AGGpIoek4HRno4xzyFiAtLHkOpcoznZEkAccaI/rplM=
github.com/songgao/water v0.0.0-20190725173103-fd331bda3f4b/go.mod h1:P5HUIBuIWKbyjl083/loAegFkfbFNx5i2qEP4CNbm7E=
github.com/songgao/water v0.0.0-20200317203138-2b4b6d7c09d8 h1:TG/diQgUe0pntT/2D9tmUCz4VNwm9MfrtPr0SU2qSX8=
github.com/songgao/water v0.0.0-20200317203138-2b4b6d7c09d8/go.mod h1:P5HUIBuIWKbyjl083/loAegFkfbFNx5i2qEP4CNbm7E=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
golang.org/x/crypto v0.9.0 h1:LF6fAI+IutBocDJ2OT0Q1g8plpYljMZ4+lty+dsqw3g=
golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0=
golang.org/x/mod v0.10.0 h1:lFO9qtOdlre5W1jxS3r/4szv2/6iXxScdzjoBMXNhYk=
golang.org/x/mod v0.10.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/crypto v0.16.0 h1:mMMrFzRSCF0GvB7Ne27XVtVAaXLrPmgPC7/v0tkwHaY=
golang.org/x/crypto v0.16.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4=
golang.org/x/mobile v0.0.0-20231127183840-76ac6878050a h1:sYbmY3FwUWCBTodZL1S3JUuOvaW6kM2o+clDzzDNBWg=
golang.org/x/mobile v0.0.0-20231127183840-76ac6878050a/go.mod h1:Ede7gF0KGoHlj822RtphAHK1jLdrcuRBZg0sF1Q+SPc=
golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0=
golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20191021144547-ec77196f6094/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M=
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
golang.org/x/sync v0.2.0 h1:PUR+T4wwASmuSTYdKjYHI5TD22Wy5ogLU5qZCOLxBrI=
golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c=
golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U=
golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE=
golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM=
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc=
golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/tools v0.9.1 h1:8WMNJAz3zrtPmnYC7ISf5dEn3MT0gY7jBJfw27yrrLo=
golang.org/x/tools v0.9.1/go.mod h1:owI94Op576fPu3cIGQeHs3joujW/2Oc6MtlxbF5dfNc=
golang.org/x/tools v0.16.0 h1:GO788SKMRunPIBCXiQyo2AaexLstOrVhuAL5YwsckQM=
golang.org/x/tools v0.16.0/go.mod h1:kYVVN6I1mBNoB1OX+noeBjbRk4IUEPa7JJ+TJMEooJ0=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"action:help": "npm run action list",
"action:list": "npm run action list",
"action": "node ./src/build/run_action.mjs",
"clean": "rimraf output node_modules www platforms plugins third_party/jsign/*.jar",
"clean": "rimraf build output node_modules www platforms plugins third_party/jsign/*.jar",
"format:all": "prettier --write \"**/*.{cjs,mjs,html,js,json,md,ts}\"",
"format": "pretty-quick --staged --pattern \"**/*.{cjs,mjs,html,js,json,md,ts}\"",
"lint:ts": "eslint --ext ts,mjs src",
Expand Down
2 changes: 1 addition & 1 deletion src/build/run_action.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -141,5 +141,5 @@ async function main() {
}

if (import.meta.url === url.pathToFileURL(process.argv[1]).href) {
await main();
await main(...process.argv.slice(2));
}
16 changes: 12 additions & 4 deletions src/build/spawn_stream.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const spawnStream = (command, ...parameters) =>
const stdout = [];
const stderr = [];

console.debug(`Running [${[command, ...parameters.map(e => `'${e}'`)].join(' ')}]`);
console.debug(chalk.gray(`Running [${[command, ...parameters.map(e => `'${e}'`)].join(' ')}]...`));
const childProcess = spawn(command, parameters, {env: process.env});

const forEachMessageLine = (buffer, callback) => {
Expand All @@ -47,14 +47,22 @@ export const spawnStream = (command, ...parameters) =>
if (code === 0) {
return resolve(stdout.join(''));
}

console.error(
chalk.red(
`ERROR(spawn_stream): ${chalk.underline(
[command, ...parameters].join(' ')
)} failed with exit code ${chalk.bold(code)}. Printing stderr:`
)} failed with exit code ${chalk.bold(code)}.}`
)
);
stderr.forEach(error => console.error(chalk.rgb(128, 64, 64)(error)));
return reject(code);

if (!(stderr.length && stderr.every(line => line))) {
console.error(chalk.bgRedBright('No error output was given... Please fix this so it gives an error output :('));
} else {
console.error(chalk.bgRedBright('Printing stderr:'));
stderr.forEach(error => console.error(chalk.rgb(128, 64, 64)(error)));
}

return reject(stderr.join(''));
});
});
3 changes: 1 addition & 2 deletions src/cordova/apple/OutlineAppleLib/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ let package = Package(
),
.binaryTarget(
name: "Tun2socks",
url: "https://github.com/Jigsaw-Code/outline-go-tun2socks/releases/download/v3.4.0/apple.zip",
checksum: "6c6880fa7d419a5fddc10588edffa0b23b5a44f0f840cf6865372127285bcc42"
path: "../../../../output/build/apple/Tun2socks.xcframework"
),
.testTarget(
name: "OutlineTunnelTest",
Expand Down
1 change: 1 addition & 0 deletions src/cordova/build.action.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export async function main(...parameters) {
const {platform, buildMode, verbose} = getBuildParameters(parameters);

await runAction('www/build', ...parameters);
await runAction('tun2socks/build', ...parameters);
await runAction('cordova/setup', ...parameters);

if (verbose) {
Expand Down
2 changes: 1 addition & 1 deletion src/cordova/plugin/android/scripts/copy_third_party.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const path = require('node:path');
const ANDROID_LIBS_FOLDER_PATH = path.join('plugins', 'cordova-plugin-outline', 'android', 'libs');
const TUN2SOCKS_ANDROID_FOLDER_PATH = path.join('third_party', 'outline-go-tun2socks', 'android');

module.exports = async function(context) {
module.exports = async function (context) {
console.log('Copying Android third party libraries...');
await fs.mkdir(ANDROID_LIBS_FOLDER_PATH, {recursive: true});
await fs.copyFile(
Expand Down
Loading

0 comments on commit e8dcd79

Please sign in to comment.