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

Add support for various transports, and mechanism to collect connectivity report #137

Closed
wants to merge 52 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
909904e
feature: add report field to the frontend
amircybersec Dec 3, 2023
2d7a657
feat: collect reports in backend +retry/sampling
amircybersec Dec 3, 2023
87da88a
UI: remove prefix, transport optional, add error
amircybersec Dec 6, 2023
40f4ef1
Backend: support for any transport, sanitize ss://
amircybersec Dec 6, 2023
651c520
collect report on on stdout
amircybersec Dec 10, 2023
b4d82ac
define custom popup info element
amircybersec Dec 10, 2023
d608959
reimplment info with popover
amircybersec Dec 12, 2023
5854d2c
add logo element
amircybersec Dec 26, 2023
2feeaea
refactor and improve popover element
amircybersec Dec 26, 2023
87868ea
add logo and popover to the app
amircybersec Dec 26, 2023
79f7fb8
made IsSuccess more readable
amircybersec Dec 26, 2023
bcd51aa
chore: move tls library to transport (#139)
fortuna Dec 8, 2023
3461299
feat(example): config for TLS fragmentation by fixed bytes (#135)
jyyi1 Dec 13, 2023
b288ec5
Fix command
fortuna Dec 21, 2023
a31dc3e
refactor: clean up outline-connectivity (#146)
fortuna Dec 28, 2023
6e73d19
add startTime & Duration to conn operations
amircybersec Jan 1, 2024
3d6e2b5
sanitize config + get hostnames for dns test
amircybersec Jan 3, 2024
b28f3b0
revert timestamp changes
amircybersec Jan 5, 2024
4e22395
generalize config sanitizer remove gethostnames
amircybersec Jan 5, 2024
d76a38f
clean up
amircybersec Jan 5, 2024
4d88238
clean up
amircybersec Jan 5, 2024
6808b92
sanitize logic for each transport + support base64
amircybersec Jan 9, 2024
d2360d3
add test + code cleanup
amircybersec Jan 9, 2024
8ab81c0
check for 64base encoding during url parsing
amircybersec Jan 9, 2024
0913526
add support for both SIP002 and LegacyBase64 URL
amircybersec Jan 10, 2024
28a815e
clean up and extend tests
amircybersec Jan 10, 2024
33e7ac4
clean up sanitizer logic
amircybersec Jan 10, 2024
2ef51e4
parse SIP002 first then fall back to legacy base64
amircybersec Jan 10, 2024
6433f44
sanitize socks5 specifically; removed vless
amircybersec Jan 10, 2024
fcaec8a
cleaned up tests
amircybersec Jan 10, 2024
a2026b9
Update x/config/shadowsocks.go
amircybersec Jan 13, 2024
48300e6
Update x/config/shadowsocks.go
amircybersec Jan 13, 2024
1d05ef1
Update x/config/config.go
amircybersec Jan 13, 2024
5d37408
chore: revamp README (#151)
fortuna Jan 2, 2024
cb14031
feat: introduce Func Endpoints and Dialers (#153)
fortuna Jan 2, 2024
04305b2
chore: test Mobileproxy on CI (#147)
fortuna Jan 2, 2024
011fab6
chore(deps): bump golang.org/x/crypto from 0.7.0 to 0.17.0
dependabot[bot] Dec 19, 2023
abddd05
chore(deps): bump golang.org/x/crypto
dependabot[bot] Dec 18, 2023
84104a8
chore(deps): bump golang.org/x/crypto from 0.14.0 to 0.17.0 in /x
dependabot[bot] Jan 2, 2024
f95745b
feat: introduce address override (#155)
fortuna Jan 9, 2024
b38b491
feat: create DNS library (#141)
fortuna Jan 9, 2024
ca1492f
chore(deps): bump golang.org/x/net from 0.10.0 to 0.17.0
dependabot[bot] Jan 9, 2024
6091a61
chore: update examples to use new dns package (#145)
fortuna Jan 12, 2024
e6695ad
add dynamic config support
amircybersec Jan 16, 2024
4c01a7b
feat: create graphical local proxy app (#164)
fortuna Jan 17, 2024
80a4648
BREAKING: Cleanup core transport library (#165)
fortuna Jan 19, 2024
7d73010
Update iOS WebView interception instructions
daniellacosse Jan 18, 2024
1c7b24e
Revert "add dynamic config support"
amircybersec Jan 21, 2024
ed94c54
rename accessKey to transport
amircybersec Jan 22, 2024
4cc5676
rename accessKey to transport
amircybersec Jan 22, 2024
4e465d7
refactor: new dns pkg & config sanitizer
amircybersec Jan 22, 2024
64aca1d
tidy packages
amircybersec Jan 22, 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
26 changes: 22 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@ jobs:
os: [ubuntu-latest, macos-latest, windows-2019]

runs-on: ${{ matrix.os }}
env:
OUTPUT_DIR: ${{ github.workspace }}/out

steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v3

- name: Set up Go 1.20
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version-file: '${{ github.workspace }}/go.mod'
Expand All @@ -32,10 +34,26 @@ jobs:
run: go build -v ./...

- name: Build X
run: go build -C x -o bin/ -v ./...
run: go build -C x -o "${{ env.OUTPUT_DIR }}/" -v ./...

- name: Build Go Mobile
if: matrix.os == 'macos-latest' || matrix.os == 'ubuntu-latest'
run: go build -C x -o "${{ env.OUTPUT_DIR }}/" golang.org/x/mobile/cmd/gomobile golang.org/x/mobile/cmd/gobind

- name: Build Mobileproxy (Android)
if: matrix.os == 'ubuntu-latest'
run: PATH="${{ env.OUTPUT_DIR }}:$PATH" gomobile bind -ldflags='-s -w' -v -target=android -androidapi=21 -o "${{ env.OUTPUT_DIR }}/mobileproxy.aar" github.com/Jigsaw-Code/outline-sdk/x/mobileproxy
working-directory: ${{ github.workspace }}/x

- name: Build Mobileproxy (iOS)
if: matrix.os == 'macos-latest'
run: PATH="${{ env.OUTPUT_DIR }}:$PATH" gomobile bind -ldflags='-s -w' -v -target=ios -iosversion=11.0 -o "${{ env.OUTPUT_DIR }}/mobileproxy.xcframework" github.com/Jigsaw-Code/outline-sdk/x/mobileproxy
working-directory: ${{ github.workspace }}/x

- name: Test SDK
run: go test -v -race -bench '.' ./... -benchtime=100ms
# Enable nettests, which executes external network requests.
run: go test -v -race -bench '.' ./... -benchtime=100ms -tags nettest

- name: Test X
run: go test -C x -v -race -bench '.' ./... -benchtime=100ms
# Enable nettests, which executes external network requests.
run: go test -C x -v -race -bench '.' ./... -benchtime=100ms -tags nettest
71 changes: 49 additions & 22 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,25 +42,29 @@ In Go you can compile for other target operating system and architecture by spec
<summary>Examples</summary>

MacOS example:
```
% GOOS=darwin go build -C x -o ./bin/ ./outline-connectivity
% file ./x/bin/outline-connectivity
./x/bin/outline-connectivity: Mach-O 64-bit executable x86_64

```console
% GOOS=darwin go build -C x -o ./bin/ ./examples/test-connectivity
% file ./x/bin/test-connectivity
./x/bin/test-connectivity: Mach-O 64-bit executable x86_64
```

Linux example:
```
% GOOS=linux go build -C x -o ./bin/ ./outline-connectivity
% file ./x/bin/outline-connectivity
./x/bin/outline-connectivity: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, Go BuildID=n0WfUGLum4Y6OpYxZYuz/lbtEdv_kvyUCd3V_qOqb/CC_6GAQqdy_ebeYTdn99/Tk_G3WpBWi8vxqmIlIuU, with debug_info, not stripped

```console
% GOOS=linux go build -C x -o ./bin/ ./examples/test-connectivity
% file ./x/bin/test-connectivity
./x/bin/test-connectivity: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, Go BuildID=n0WfUGLum4Y6OpYxZYuz/lbtEdv_kvyUCd3V_qOqb/CC_6GAQqdy_ebeYTdn99/Tk_G3WpBWi8vxqmIlIuU, with debug_info, not stripped
```

Windows example:

```console
% GOOS=windows go build -C x -o ./bin/ ./examples/test-connectivity
% file ./x/bin/test-connectivity.exe
./x/bin/test-connectivity.exe: PE32+ executable (console) x86-64 (stripped to external PDB), for MS Windows
```
% GOOS=windows go build -C x -o ./bin/ ./outline-connectivity
% file ./x/bin/outline-connectivity.exe
./x/bin/outline-connectivity.exe: PE32+ executable (console) x86-64 (stripped to external PDB), for MS Windows
```

</details>

## Running Linux binaries
Expand All @@ -72,41 +76,49 @@ To run Linux binaries you can use a Linux container via [Podman](https://podman.
<summary>Instructions</summary>

[Install Podman](https://podman.io/docs/installation) (once). On macOS:

```sh
brew install podman
```

Create the podman service VM (once) with the [`podman machine init` command](https://docs.podman.io/en/latest/markdown/podman-machine-init.1.html):

```sh
podman machine init
```

Start the VM with the [`podman machine start` command](https://docs.podman.io/en/latest/markdown/podman-machine-start.1.html), after every time it is stopped:

```sh
podman machine start
```
```

You can see the VM running with the [`podman machine list` command](https://docs.podman.io/en/latest/markdown/podman-machine-list.1.html):
```

```console
% podman machine list
NAME VM TYPE CREATED LAST UP CPUS MEMORY DISK SIZE
podman-machine-default* qemu 3 minutes ago Currently running 1 2.147GB 107.4GB
```

When you are done with development, you can stop the machine with the [`podman machine stop` command](https://docs.podman.io/en/latest/markdown/podman-machine-stop.1.html):

```sh
podman machine stop
```

</details>

### Run

The easiest way is to run a binary is to use the [`go run` command](https://pkg.go.dev/cmd/go#hdr-Compile_and_run_Go_program) directly with the `-exec` flag and our convenience tool `run_on_podman.sh`:

```sh
GOOS=linux go run -C x -exec "$(pwd)/run_on_podman.sh" ./outline-connectivity
GOOS=linux go run -C x -exec "$(pwd)/run_on_podman.sh" ./examples/test-connectivity
```

It also works with the [`go test` command](https://pkg.go.dev/cmd/go#hdr-Test_packages):

```sh
GOOS=linux go test -exec "$(pwd)/run_on_podman.sh" ./...
```
Expand All @@ -115,14 +127,16 @@ GOOS=linux go test -exec "$(pwd)/run_on_podman.sh" ./...
<summary>Details and direct invocation</summary>

The `run_on_podman.sh` script uses the [`podman run` command](https://docs.podman.io/en/latest/markdown/podman-run.1.html) and a minimal ["distroless" container image](https://github.com/GoogleContainerTools/distroless) to run the binary you want:

```sh
podman run --arch $(uname -m) --rm -it -v "${bin}":/outline/bin gcr.io/distroless/static-debian11 /outline/bin "$@"
```

You can also use `podman run` directly to run a pre-built binary:
```
% podman run --rm -it -v ./x/bin:/outline gcr.io/distroless/static-debian11 /outline/outline-connectivity
Usage of /outline/outline-connectivity:

```console
% podman run --rm -it -v ./x/bin:/outline gcr.io/distroless/static-debian11 /outline/test-connectivity
Usage of /outline/test-connectivity:
-domain string
Domain name to resolve in the test (default "example.com.")
-key string
Expand Down Expand Up @@ -153,14 +167,16 @@ This is not the same as a real Windows environment, so make sure you test on act

Follow the instructions at https://wiki.winehq.org/Download.

On macOS:
```
On macOS:

```sh
brew tap homebrew/cask-versions
brew install --cask --no-quarantine wine-stable
```

After installation, `wine64` should be on your `PATH`. Check with `wine64 --version`:
```

```sh
wine64 --version
```

Expand All @@ -173,10 +189,21 @@ You can pass `wine64` as the `-exec` parameter in the `go` calls.
To build:

```sh
GOOS=windows go run -C x -exec "wine64" ./outline-connectivity
GOOS=windows go run -C x -exec "wine64" ./examples/test-connectivity
```

For tests:

```sh
GOOS=windows go test -exec "wine64" ./...
```

# Tests with external network dependencies

Some tests are implemented talking to external services. That's undesirable, but convenient.
We started tagging them with the `nettest` tag, so they don't run by default. To run them, you need to specify `-tags nettest`, as done in our CI.
For example:

```sh
go test -v -race -bench '.' ./... -benchtime=100ms -tags nettest
```
Loading