From d6c7d1d12215f2034b0855e2e863978d82453efd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Ciarcin=CC=81ski?= Date: Wed, 13 Aug 2025 12:44:00 +0200 Subject: [PATCH 01/13] Fix Windows build and handling Quit --- src-tauri/Cargo.lock | 16 ++++++++-------- src-tauri/src/bin/defguard-client.rs | 9 ++++++--- src-tauri/src/utils.rs | 9 ++++----- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index e5582a5a..72f0bb71 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -850,9 +850,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.44" +version = "4.5.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c1f056bae57e3e54c3375c41ff79619ddd13460a17d7438712bd0d83fda4ff8" +checksum = "1fc0e74a703892159f5ae7d3aac52c8e6c392f5ae5f359c70b5881d60aaac318" dependencies = [ "clap_builder", "clap_derive", @@ -872,9 +872,9 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.41" +version = "4.5.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef4f52386a59ca4c860f7393bcf8abd8dfd91ecccc0f774635ff68e92eeef491" +checksum = "14cb31bb0a7d536caef2639baa7fad459e15c3144efefa6dbd1c84562c4739f6" dependencies = [ "heck 0.5.0", "proc-macro2", @@ -4708,9 +4708,9 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.12.22" +version = "0.12.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbc931937e6ca3a06e3b6c0aa7841849b160a90351d6ab467a8b9b9959767531" +checksum = "d429f34c8092b2d42c7c93cec323bb4adeb7c67698f70839adec842ec10c7ceb" dependencies = [ "base64 0.22.1", "bytes", @@ -5138,9 +5138,9 @@ dependencies = [ [[package]] name = "serde-untagged" -version = "0.1.7" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "299d9c19d7d466db4ab10addd5703e4c615dec2a5a16dbbafe191045e87ee66e" +checksum = "34836a629bcbc6f1afdf0907a744870039b1e14c0561cb26094fa683b158eff3" dependencies = [ "erased-serde", "serde", diff --git a/src-tauri/src/bin/defguard-client.rs b/src-tauri/src/bin/defguard-client.rs index 67a57d79..f3d717cc 100644 --- a/src-tauri/src/bin/defguard-client.rs +++ b/src-tauri/src/bin/defguard-client.rs @@ -306,10 +306,13 @@ fn main() { }); debug!("Ctrl-C handler has been set up successfully"); } - RunEvent::ExitRequested { api, .. } => { + RunEvent::ExitRequested { code, api, .. } => { debug!("Received exit request"); - // Prevent shutdown on window close. - api.prevent_exit(); + // `code` is `None` when the exit is requested by user interaction. + if code.is_none() { + // Prevent shutdown on window close. + api.prevent_exit(); + } } // Handle shutdown. RunEvent::Exit => { diff --git a/src-tauri/src/utils.rs b/src-tauri/src/utils.rs index fa7ac7b7..548a5f55 100644 --- a/src-tauri/src/utils.rs +++ b/src-tauri/src/utils.rs @@ -41,6 +41,9 @@ use crate::{ ConnectionType, }; +#[cfg(target_os = "windows")] +use crate::active_connections::find_connection; + pub(crate) static DEFAULT_ROUTE_IPV4: &str = "0.0.0.0/0"; pub(crate) static DEFAULT_ROUTE_IPV6: &str = "::/0"; @@ -927,11 +930,7 @@ async fn check_connection( } } - if appstate - .find_connection(id, connection_type) - .await - .is_some() - { + if find_connection(id, connection_type).await.is_some() { debug!("{connection_type} {name} has already a connected state, skipping synchronization"); return Ok(()); } From 3d80bc06eeb945290d0945213d9d11e5e2e14a7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Ciarcin=CC=81ski?= Date: Wed, 13 Aug 2025 12:52:20 +0200 Subject: [PATCH 02/13] workflow: bump node version to 22 --- .github/workflows/lint.yaml | 10 +++++----- .github/workflows/release.yaml | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index a5a414c1..5437fb57 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -1,16 +1,16 @@ -name: 'lint' +name: "lint" on: push: branches: - main - dev - - 'release/**' + - "release/**" pull_request: branches: - main - dev - - 'release/**' + - "release/**" jobs: lint-web: @@ -19,10 +19,10 @@ jobs: steps: - uses: actions/checkout@v4 with: - submodules: 'recursive' + submodules: "recursive" - uses: actions/setup-node@v4 with: - node-version: '20' + node-version: "22" - uses: pnpm/action-setup@v2 with: diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 2e23d235..0aadeef2 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -81,7 +81,7 @@ jobs: echo "VERSION=$VERSION" >> $GITHUB_ENV - uses: actions/setup-node@v3 with: - node-version: "20" + node-version: "22" - uses: pnpm/action-setup@v2 with: version: 9 @@ -240,7 +240,7 @@ jobs: echo "VERSION=$VERSION" >> $GITHUB_ENV - uses: actions/setup-node@v3 with: - node-version: "20" + node-version: "22" - uses: pnpm/action-setup@v2 with: version: 9 @@ -322,7 +322,7 @@ jobs: echo "VERSION=$env:VERSION" >> $env:GITHUB_ENV - uses: actions/setup-node@v3 with: - node-version: "20" + node-version: "22" - uses: pnpm/action-setup@v2 with: version: 9 From 8f599d4471cba124fb4cec17a3e53a790cbad210 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Ciarcin=CC=81ski?= Date: Wed, 13 Aug 2025 13:01:53 +0200 Subject: [PATCH 03/13] Bump actions/cache to v4 --- .github/workflows/lint.yaml | 2 +- .github/workflows/release.yaml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 5437fb57..3f6848d7 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -34,7 +34,7 @@ jobs: run: | echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV - - uses: actions/cache@v3 + - uses: actions/cache@v4 name: Setup pnpm cache with: path: ${{ env.STORE_PATH }} diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 0aadeef2..91f77b1b 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -90,7 +90,7 @@ jobs: shell: bash run: | echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV - - uses: actions/cache@v3 + - uses: actions/cache@v4 name: Setup pnpm cache with: path: ${{ env.STORE_PATH }} @@ -248,7 +248,7 @@ jobs: - name: Get pnpm store directory shell: bash run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV - - uses: actions/cache@v3 + - uses: actions/cache@v4 name: Setup pnpm cache with: path: ${{ env.STORE_PATH }} @@ -330,7 +330,7 @@ jobs: - name: Get pnpm store directory shell: bash run: echo "STORE_PATH=$(pnpm store path --silent)" >> $env:GITHUB_ENV - - uses: actions/cache@v3 + - uses: actions/cache@v4 name: Setup pnpm cache with: path: ${{ env.STORE_PATH }} From 2fefc60fcb28a55904bfd9c9025849fa83c89744 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Ciarcin=CC=81ski?= Date: Wed, 13 Aug 2025 13:05:33 +0200 Subject: [PATCH 04/13] Bump actions/checkout to v5 --- .github/workflows/lint.yaml | 2 +- .github/workflows/release.yaml | 8 ++++---- .github/workflows/test.yml | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 3f6848d7..06f67c63 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -17,7 +17,7 @@ jobs: runs-on: [self-hosted, Linux, X64] steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 with: submodules: "recursive" - uses: actions/setup-node@v4 diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 91f77b1b..685cd79f 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -12,7 +12,7 @@ jobs: architecture: [arm64, amd64] runs-on: [self-hosted, macOS] steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 with: repository: WireGuard/wireguard-go ref: master @@ -71,7 +71,7 @@ jobs: deb_arch: amd64 binary_arch: x86_64 steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 with: submodules: "recursive" - name: Write release version @@ -230,7 +230,7 @@ jobs: APPLE_ID: "kamil@defguard.net" APPLE_TEAM_ID: "82GZ7KN29J" steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 with: submodules: "recursive" - name: Write release version @@ -312,7 +312,7 @@ jobs: - create-release runs-on: windows-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 with: submodules: "recursive" - name: Write release version diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 80fd06f8..5df4202c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -31,7 +31,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v5 with: submodules: recursive - name: Debug From 580f071672c7253c803028861ca8b25c8a5932e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Ciarcin=CC=81ski?= Date: Wed, 13 Aug 2025 13:21:25 +0200 Subject: [PATCH 05/13] Temp. disable cargo-deny-action --- .github/workflows/test.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5df4202c..e2ad3794 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -56,9 +56,9 @@ jobs: mkdir ../dist rustup component add clippy cargo clippy --all-targets --all-features -- -D warnings - - name: Run cargo deny - uses: EmbarkStudios/cargo-deny-action@v2 - with: - manifest-path: ./src-tauri/Cargo.toml + # - name: Run cargo deny + # uses: EmbarkStudios/cargo-deny-action@v2 + # with: + # manifest-path: ./src-tauri/Cargo.toml - name: Run tests run: cargo test --locked --no-fail-fast From 575afd244f44cc143ae5a20f7aa2218d4e4839cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Ciarcin=CC=81ski?= Date: Wed, 13 Aug 2025 13:26:00 +0200 Subject: [PATCH 06/13] Restore cargo-deny-action --- .github/workflows/test.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e2ad3794..5df4202c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -56,9 +56,9 @@ jobs: mkdir ../dist rustup component add clippy cargo clippy --all-targets --all-features -- -D warnings - # - name: Run cargo deny - # uses: EmbarkStudios/cargo-deny-action@v2 - # with: - # manifest-path: ./src-tauri/Cargo.toml + - name: Run cargo deny + uses: EmbarkStudios/cargo-deny-action@v2 + with: + manifest-path: ./src-tauri/Cargo.toml - name: Run tests run: cargo test --locked --no-fail-fast From 4a5a5c17e2745e454c2a251c7d318f100137bcc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Ciarcin=CC=81ski?= Date: Wed, 13 Aug 2025 13:49:15 +0200 Subject: [PATCH 07/13] workflow: fix working-directory --- .github/workflows/test.yml | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5df4202c..4300950b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -25,9 +25,6 @@ jobs: test: runs-on: [self-hosted, Linux, X64] container: rust:1 - defaults: - run: - working-directory: ./src-tauri steps: - name: Checkout @@ -41,24 +38,22 @@ jobs: - name: Install required packages run: | apt-get update - apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev libayatana-appindicator3-dev librsvg2-dev patchelf libssl-dev libxdo-dev unzip - - name: Install protobuf compiler - run: | - PB_REL='https://github.com/protocolbuffers/protobuf/releases' - PB_VERSION='3.20.0' && curl -LO $PB_REL/download/v$PB_VERSION/protoc-$PB_VERSION-linux-x86_64.zip - unzip protoc-$PB_VERSION-linux-x86_64.zip bin/protoc include/google/* -d /usr/local + apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev libayatana-appindicator3-dev librsvg2-dev patchelf libssl-dev libxdo-dev unzip protobuf-compiler - name: Check format run: | rustup component add rustfmt cargo fmt -- --check + working-directory: ./src-tauri - name: Run clippy linter run: | mkdir ../dist rustup component add clippy cargo clippy --all-targets --all-features -- -D warnings + working-directory: ./src-tauri - name: Run cargo deny uses: EmbarkStudios/cargo-deny-action@v2 with: manifest-path: ./src-tauri/Cargo.toml - name: Run tests run: cargo test --locked --no-fail-fast + working-directory: ./src-tauri From 7bd89655821e8a38322b3353be7e7feac4349db1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Ciarcin=CC=81ski?= Date: Wed, 13 Aug 2025 14:07:52 +0200 Subject: [PATCH 08/13] Restore working-directory --- .github/workflows/lint.yaml | 2 +- .github/workflows/test.yml | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 06f67c63..2de6dc4c 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -19,7 +19,7 @@ jobs: steps: - uses: actions/checkout@v5 with: - submodules: "recursive" + submodules: recursive - uses: actions/setup-node@v4 with: node-version: "22" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4300950b..63c1543c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -25,6 +25,9 @@ jobs: test: runs-on: [self-hosted, Linux, X64] container: rust:1 + defaults: + run: + working-directory: ./src-tauri steps: - name: Checkout From 96c4444a4c5f824d46f46c020f9056327dfc22c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Ciarcin=CC=81ski?= Date: Wed, 13 Aug 2025 14:17:01 +0200 Subject: [PATCH 09/13] avoid working-directory --- .github/workflows/test.yml | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 63c1543c..4e2cf2d7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -25,9 +25,9 @@ jobs: test: runs-on: [self-hosted, Linux, X64] container: rust:1 - defaults: - run: - working-directory: ./src-tauri + # defaults: + # run: + # working-directory: ./src-tauri steps: - name: Checkout @@ -45,18 +45,15 @@ jobs: - name: Check format run: | rustup component add rustfmt - cargo fmt -- --check - working-directory: ./src-tauri + cd src-tauri && cargo fmt -- --check - name: Run clippy linter run: | mkdir ../dist rustup component add clippy - cargo clippy --all-targets --all-features -- -D warnings - working-directory: ./src-tauri + cd src-tauri && cargo clippy --all-targets --all-features -- -D warnings - name: Run cargo deny uses: EmbarkStudios/cargo-deny-action@v2 with: manifest-path: ./src-tauri/Cargo.toml - name: Run tests - run: cargo test --locked --no-fail-fast - working-directory: ./src-tauri + run: cd src-tauri && cargo test --locked --no-fail-fast From c5c92b330671f554b53f82a84a2d9d362793fe21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Ciarcin=CC=81ski?= Date: Wed, 13 Aug 2025 14:22:36 +0200 Subject: [PATCH 10/13] runner work-around --- .github/workflows/test.yml | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4e2cf2d7..d3141ebd 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -24,10 +24,12 @@ env: jobs: test: runs-on: [self-hosted, Linux, X64] - container: rust:1 - # defaults: - # run: - # working-directory: ./src-tauri + container: + image: rust:1 + options: --user root + defaults: + run: + working-directory: ./src-tauri steps: - name: Checkout @@ -45,15 +47,15 @@ jobs: - name: Check format run: | rustup component add rustfmt - cd src-tauri && cargo fmt -- --check + cargo fmt -- --check - name: Run clippy linter run: | mkdir ../dist rustup component add clippy - cd src-tauri && cargo clippy --all-targets --all-features -- -D warnings + cargo clippy --all-targets --all-features -- -D warnings - name: Run cargo deny uses: EmbarkStudios/cargo-deny-action@v2 with: manifest-path: ./src-tauri/Cargo.toml - name: Run tests - run: cd src-tauri && cargo test --locked --no-fail-fast + run: cargo test --locked --no-fail-fast From 0ebdcefc137f9d9ade0872164dc3c1774aaeb8de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Ciarcin=CC=81ski?= Date: Wed, 13 Aug 2025 14:31:11 +0200 Subject: [PATCH 11/13] debug runner --- .github/workflows/test.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d3141ebd..f16aa33a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -37,7 +37,9 @@ jobs: with: submodules: recursive - name: Debug - run: echo ${{ github.ref_name }} + run: | + echo ${{ github.ref_name }} + ls -al - name: Cache uses: Swatinem/rust-cache@v2 - name: Install required packages From cef011e3b25d89db7a18da708a7457df2a84769a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Ciarcin=CC=81ski?= Date: Wed, 13 Aug 2025 14:32:08 +0200 Subject: [PATCH 12/13] debug runner --- .github/workflows/test.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f16aa33a..49db7636 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -32,14 +32,14 @@ jobs: working-directory: ./src-tauri steps: - - name: Checkout - uses: actions/checkout@v5 - with: - submodules: recursive - name: Debug run: | echo ${{ github.ref_name }} ls -al + - name: Checkout + uses: actions/checkout@v5 + with: + submodules: recursive - name: Cache uses: Swatinem/rust-cache@v2 - name: Install required packages From 663cf3afa62bee2c371b11e8855500faefd51cb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Ciarcin=CC=81ski?= Date: Wed, 13 Aug 2025 16:23:02 +0200 Subject: [PATCH 13/13] workflow disable debug --- .github/workflows/test.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 49db7636..f1655dc2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -32,10 +32,6 @@ jobs: working-directory: ./src-tauri steps: - - name: Debug - run: | - echo ${{ github.ref_name }} - ls -al - name: Checkout uses: actions/checkout@v5 with: