Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add outline-go-tun2socks, except android #1744

Merged
merged 78 commits into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from 76 commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
623f690
init tun2socks
daniellacosse Oct 5, 2023
6958582
Merge branch 'master' into daniellacosse/go_tun2socks
daniellacosse Oct 9, 2023
38fd959
move to src/tun2socks
daniellacosse Oct 9, 2023
9079f6e
addt'l feedback
daniellacosse Oct 9, 2023
33c05c3
wip: working on build script
daniellacosse Oct 9, 2023
766516c
Merge branch 'master' into daniellacosse/go_tun2socks
daniellacosse Oct 9, 2023
e037b03
Merge branch 'master' into daniellacosse/go_tun2socks
daniellacosse Nov 13, 2023
1a4d61e
update go.mod and references
daniellacosse Nov 13, 2023
6ef1700
attempt #1 adding to build process
daniellacosse Nov 13, 2023
d8440d2
cleanup
daniellacosse Nov 13, 2023
50bf620
update CI
daniellacosse Nov 13, 2023
ee66c4d
okay it all works
daniellacosse Nov 13, 2023
b28d736
setup go
daniellacosse Nov 14, 2023
4524856
try gomobile init
daniellacosse Nov 14, 2023
a4ff501
build go binaries instead
daniellacosse Nov 14, 2023
a290d1c
try env.PATH
daniellacosse Nov 14, 2023
70078ca
gah just inline it lol
daniellacosse Nov 14, 2023
2611e58
build go binaries in action and revert github config
daniellacosse Nov 14, 2023
c01cb21
make the bindir
daniellacosse Nov 14, 2023
409d09f
properly link bins for electron
daniellacosse Nov 14, 2023
4cc2732
scope folder
daniellacosse Nov 16, 2023
0424f6e
copy android lib, improve spawn stream error log
daniellacosse Nov 16, 2023
71bfeae
apparently we have to do this
daniellacosse Nov 16, 2023
51fea86
try this
daniellacosse Nov 16, 2023
5f9989a
try -out
daniellacosse Nov 20, 2023
6604455
safer paths
daniellacosse Nov 20, 2023
5ea79d5
try goos android
daniellacosse Nov 20, 2023
5f41f48
this?
daniellacosse Nov 20, 2023
ccb4dad
topsy turvy upside down day
daniellacosse Nov 20, 2023
d5333bf
oops
daniellacosse Nov 20, 2023
0c48e70
detect os platforms
daniellacosse Nov 20, 2023
ad60a33
revert ci os container changes
daniellacosse Nov 20, 2023
9374e15
build windows on mac??
daniellacosse Nov 20, 2023
9eca094
oh derp
daniellacosse Nov 20, 2023
c337edf
take into consideration host platform
daniellacosse Nov 21, 2023
f2bb095
oops, revert mac change
daniellacosse Nov 21, 2023
1b8fbd6
fix setup_linux_android
daniellacosse Nov 21, 2023
ca554cd
try ldf flags
daniellacosse Nov 21, 2023
182a94d
remove ldf
daniellacosse Nov 21, 2023
3de7cec
update mac location and add tunnel target to linux/android
daniellacosse Nov 21, 2023
0d437ca
oops forgot target
daniellacosse Nov 21, 2023
7f67fbc
try go:build android and improve error output missing message
daniellacosse Nov 21, 2023
1477913
Merge branch 'master' into daniellacosse/go_tun2socks
daniellacosse Nov 27, 2023
119f0a3
build tun2socks before apple tests
daniellacosse Nov 27, 2023
64ebd35
not sure this will work in the CI, but hey
daniellacosse Nov 27, 2023
f4a6b95
so weird lol
daniellacosse Nov 29, 2023
5f63c5c
apple fix??
daniellacosse Nov 29, 2023
a056a85
builder path issue
daniellacosse Nov 29, 2023
d0075f5
revert android build
daniellacosse Dec 6, 2023
ed5f8ba
Update tools.go
daniellacosse Dec 6, 2023
aee2ea1
ios simulator, go 1.20
daniellacosse Dec 6, 2023
559e64c
Update build_and_test_debug.yml
daniellacosse Dec 8, 2023
df0b01b
update versions and remove build folder
daniellacosse Dec 8, 2023
fa078f0
update engine??
daniellacosse Dec 8, 2023
5d3aeee
engines dot x
daniellacosse Dec 8, 2023
eacaad5
additional cleanup
daniellacosse Dec 8, 2023
1e3b016
Update src/electron/README.md
daniellacosse Dec 11, 2023
c804b83
Update src/tun2socks/build.action.mjs
daniellacosse Dec 11, 2023
0c61a37
Update build_and_test_debug.yml
daniellacosse Dec 11, 2023
121147b
use go file and split ios/macos calls
daniellacosse Dec 11, 2023
6157685
create intermediary tun2socks folder and try to fix electron pathing …
daniellacosse Dec 11, 2023
e96091a
Update README.md
daniellacosse Dec 11, 2023
59141c4
this should fix linux? still working out windows
daniellacosse Dec 12, 2023
6e1906a
did I revert it correctly? 😅
daniellacosse Dec 13, 2023
b3bb834
now i'm all confused...
daniellacosse Dec 13, 2023
0162c76
this?
daniellacosse Dec 13, 2023
a4cc2e8
upgrade gomobile and add macos to the thing
daniellacosse Dec 14, 2023
c71236c
Merge branch 'master' into daniellacosse/go_tun2socks
daniellacosse Dec 14, 2023
ddcd75d
add TODOs
daniellacosse Dec 15, 2023
c17a7b0
use makefile
daniellacosse Jan 4, 2024
e8d3aa9
Merge branch 'master' into daniellacosse/go_tun2socks
daniellacosse Jan 4, 2024
9b6b1ce
update IMPORT_PATH
daniellacosse Jan 8, 2024
2195bd2
split up pkg names
daniellacosse Jan 8, 2024
cfd2130
?
daniellacosse Jan 8, 2024
2beffe7
??
daniellacosse Jan 8, 2024
a6f0348
Merge branch 'master' into daniellacosse/go_tun2socks
daniellacosse Jan 8, 2024
35b3b44
set androida api
daniellacosse Jan 10, 2024
37f9e14
add todos
daniellacosse Jan 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
daniellacosse marked this conversation as resolved.
Show resolved Hide resolved
/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/[email protected]
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
Comment on lines +7 to +8
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ugh, IMPORT_HOST just hurts readability. I see it was already there, no need to change in this PR.

Suggested change
IMPORT_HOST=github.com
IMPORT_PATH=$(IMPORT_HOST)/Jigsaw-Code/outline-client
IMPORT_PATH=github.com/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 -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


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)"


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
daniellacosse marked this conversation as resolved.
Show resolved Hide resolved
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",
daniellacosse marked this conversation as resolved.
Show resolved Hide resolved
"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(' ')}]...`));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit will this print secrets to the debug output? I guess if we are using environment variables then it's ok.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I was worried about this as well. Generally I think everything sensitive is in env variables but IDK for sure

GH actions does obscure the secrets you have from the log, and we're only debug-building there, so I think risk is close to zero

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
Loading