From deb0d26c082e95194ebac5566c63f89b42d1fa9c Mon Sep 17 00:00:00 2001 From: Andy Wang Date: Tue, 1 Oct 2024 21:48:42 +0100 Subject: [PATCH 1/3] Build and push docker image on release --- .github/workflows/release.yml | 30 +++++++++++++++++++++++++++++- Dockerfile | 5 +++++ 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 Dockerfile diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1b59569..44aae4c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,4 +19,32 @@ jobs: with: files: release/* env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + build-docker: + runs-on: ubuntu-latest + steps: + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + cbeuw/cloak + tags: | + type=ref,event=branch + type=ref,event=pr + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Build and push + uses: docker/build-push-action@v6 + with: + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..2a06bff --- /dev/null +++ b/Dockerfile @@ -0,0 +1,5 @@ +FROM golang:latest + +RUN git clone https://github.com/cbeuw/Cloak.git +WORKDIR Cloak +RUN make From e362e81d19af97648559472dad1e392c90ca5e6d Mon Sep 17 00:00:00 2001 From: Andy Wang Date: Tue, 1 Oct 2024 22:34:55 +0100 Subject: [PATCH 2/3] Add backwards compatibility CI job --- .github/workflows/build.yml | 73 +++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1001587..c844d27 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,3 +15,76 @@ jobs: - uses: codecov/codecov-action@v1 with: file: coverage.txt + + compat-test: + runs-on: ubuntu-latest + strategy: + matrix: + encryption-method: [ plain, chacha20-poly1305 ] + num-conn: [ 0, 1, 4 ] + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-go@v2 + with: + go-version: '^1.22' + - name: Build Cloak + run: make + - name: Create configs + run: | + mkdir config + cat << EOF > config/ckclient.json + { + "Transport": "direct", + "ProxyMethod": "iperf", + "EncryptionMethod": "${{ matrix.encryption-method }}", + "UID": "Q4GAXHVgnDLXsdTpw6bmoQ==", + "PublicKey": "4dae/bF43FKGq+QbCc5P/E/MPM5qQeGIArjmJEHiZxc=", + "ServerName": "cloudflare.com", + "BrowserSig": "firefox", + "NumConn": ${{ matrix.num-conn }} + } + EOF + cat << EOF > config/ckserver.json + { + "ProxyBook": { + "iperf": [ + "tcp", + "127.0.0.1:5201" + ] + }, + "BindAddr": [ + ":8443" + ], + "BypassUID": [ + "Q4GAXHVgnDLXsdTpw6bmoQ==" + ], + "RedirAddr": "cloudflare.com", + "PrivateKey": "AAaskZJRPIAbiuaRLHsvZPvE6gzOeSjg+ZRg1ENau0Y=" + } + EOF + - name: Start iperf3 server + run: docker run -d --name iperf-server --network host ajoergensen/iperf3:latest --server + - name: Test new client against old server + run: | + docker run -d --name old-cloak-server --network host -v $PWD/config:/go/Cloak/config cbeuw/cloak:latest build/ck-server -c config/ckserver.json --verbosity debug + build/ck-client -c config/ckclient.json -s 127.0.0.1 -p 8443 --verbosity debug | tee new-cloak-client.log & + docker run --network host ajoergensen/iperf3:latest --client 127.0.0.1 -p 1984 + docker stop old-cloak-server + - name: Test old client against new server + run: | + build/ck-server -c config/ckserver.json --verbosity debug | tee new-cloak-server.log & + docker run -d --name old-cloak-client --network host -v $PWD/config:/go/Cloak/config cbeuw/cloak:latest build/ck-client -c config/ckclient.json -s 127.0.0.1 -p 8443 --verbosity debug + docker run --network host ajoergensen/iperf3:latest --client 127.0.0.1 -p 1984 + docker stop old-cloak-client + - name: Dump docker logs + if: always() + run: | + docker container logs iperf-server > iperf-server.log + docker container logs old-cloak-server > old-cloak-server.log + docker container logs old-cloak-client > old-cloak-client.log + - name: Upload logs + if: always() + uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.encryption-method }}-${{ matrix.num-conn }}-conn-logs + path: ./*.log From bfaf46d2e94946f3c5c27bdc2b6d45b2f299c8a0 Mon Sep 17 00:00:00 2001 From: Andy Wang Date: Thu, 3 Oct 2024 22:53:28 +0100 Subject: [PATCH 3/3] Update actions --- .github/workflows/build.yml | 13 +++++++------ .github/workflows/release.yml | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c844d27..ff85f31 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,14 +7,15 @@ jobs: matrix: os: [ ubuntu-latest, macos-latest, windows-latest ] steps: - - uses: actions/checkout@v2 - - uses: actions/setup-go@v2 + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 with: go-version: '^1.22' # The Go version to download (if necessary) and use. - run: go test -race -coverprofile coverage.txt -coverpkg ./... -covermode atomic ./... - - uses: codecov/codecov-action@v1 + - uses: codecov/codecov-action@v4 with: - file: coverage.txt + files: coverage.txt + token: ${{ secrets.CODECOV_TOKEN }} compat-test: runs-on: ubuntu-latest @@ -23,8 +24,8 @@ jobs: encryption-method: [ plain, chacha20-poly1305 ] num-conn: [ 0, 1, 4 ] steps: - - uses: actions/checkout@v2 - - uses: actions/setup-go@v2 + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 with: go-version: '^1.22' - name: Build Cloak diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 44aae4c..62c9bf5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,7 +9,7 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Build run: | export PATH=${PATH}:`go env GOPATH`/bin