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 daita as a Cargo cfg variable #6231

Merged
merged 46 commits into from
May 17, 2024
Merged
Show file tree
Hide file tree
Changes from 37 commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
bbc9d42
Add `wireguard-go-rs`
Serock3 May 2, 2024
4675b75
Change `daita` feature to a cfg variable/condition
Serock3 May 7, 2024
74f2ea3
Replace `box<dyn Tunnel>` with `TunnelT`
Serock3 May 7, 2024
d960019
Add `wireguard-go-rs/libwg` to `git submodule update` in CI
Serock3 May 7, 2024
985c956
WIP init submodules for CI
Serock3 May 7, 2024
daec751
Fix `wireguard-gp` path in `git submodule update`
Serock3 May 8, 2024
523c62e
Build `wireguard-go` on macos
Serock3 May 8, 2024
4d6bd90
Don't panic in `wireguard-go-rs\build.rs` for windows
Serock3 May 8, 2024
44cb519
Fix `daemon.yml` for macos
Serock3 May 8, 2024
98656e2
Fix broken `#[cfg(..)]` gate
Serock3 May 8, 2024
f8e0c0b
fixup! WIP init submodules for CI
Serock3 May 8, 2024
45c3bc4
Fix `clippy.yml` for macos
Serock3 May 8, 2024
31ce863
Change `daita` feature to a cfg variable/condition
Serock3 May 7, 2024
4b78c07
Add license to `wireguard-go-rs`
Serock3 May 8, 2024
7df912e
Fix rebase bug in build.rs
Serock3 May 8, 2024
c11bba1
Remove double import
Serock3 May 8, 2024
a692e96
fixup! Fix `daemon.yml` for macos
Serock3 May 8, 2024
8b0e103
fixup! Fix `clippy.yml` for macos
Serock3 May 8, 2024
53868da
Bump nightly rust version
Serock3 May 8, 2024
97d8919
Fix udeps for macos and android
Serock3 May 8, 2024
90969c6
Fix only add daita tag when building wireguard-go for Linux
MarkusPettersson98 May 13, 2024
645b22c
fixup! Fix only add daita tag when building wireguard-go for Linux
MarkusPettersson98 May 13, 2024
95a7800
Remove unused `build.sh`
MarkusPettersson98 May 13, 2024
26a8a4d
fixup! Fix only add daita tag when building wireguard-go for Linux
MarkusPettersson98 May 13, 2024
82dccc8
Do not enable the now missing `daita` feature in `build.sh`
MarkusPettersson98 May 13, 2024
e734806
Windows should not depend on `cmaybenot`
MarkusPettersson98 May 13, 2024
1d9ce56
Fix cargo build script warning
MarkusPettersson98 May 13, 2024
22a838d
Init `wireguard-go` submodule for android
Serock3 May 13, 2024
64678b1
Fix permissions for android submodule init
Serock3 May 13, 2024
779bf68
Bump `cargo udeps` temporarily
MarkusPettersson98 May 14, 2024
1ded7de
Install `go` on macos runners in Github workflows
MarkusPettersson98 May 14, 2024
4f80112
Fix only `Linux` and `Windows` should depend on `maybenot`
MarkusPettersson98 May 14, 2024
0b8dc1f
Modify `build-wireguard-go.sh` to accept `--daita`
MarkusPettersson98 May 14, 2024
5ee334e
Remove version from `wireguard-go-rs`
MarkusPettersson98 May 15, 2024
641f74e
Modify `wireguard-go-rs` build
MarkusPettersson98 May 15, 2024
c521b43
Ignore `libwg.a`
MarkusPettersson98 May 15, 2024
00f210d
Prune Github actions from explicit submodule checkouts
MarkusPettersson98 May 15, 2024
4e816dd
fixup! Modify `wireguard-go-rs` build
MarkusPettersson98 May 15, 2024
3a739cd
Fix `libwg` failing to build on fresh checkout
MarkusPettersson98 May 15, 2024
54a92b9
fixup! Prune Github actions from explicit submodule checkouts
MarkusPettersson98 May 15, 2024
6af681a
Bump `wireguard-go`
MarkusPettersson98 May 15, 2024
9a4f1b7
Bump `wireguard-go`
MarkusPettersson98 May 17, 2024
071118f
Remove `maybenot` as a direct dependency on Linux
MarkusPettersson98 May 17, 2024
15c5f31
Bump `wireguard-go`
MarkusPettersson98 May 17, 2024
43d58ee
Fix do not build `libmaybenot` twice
MarkusPettersson98 May 17, 2024
b37ece8
Bump `wireguard-go`
MarkusPettersson98 May 17, 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
10 changes: 10 additions & 0 deletions .github/workflows/android-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ jobs:
- name: Checkout repository
if: steps.cache-relay-list.outputs.cache-hit != 'true'
uses: actions/checkout@v4
with:
submodules: true

- name: Generate
if: steps.cache-relay-list.outputs.cache-hit != 'true'
Expand Down Expand Up @@ -164,6 +166,8 @@ jobs:

- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true

- name: Calculate native lib cache hash
id: native-lib-cache-hash
Expand Down Expand Up @@ -232,6 +236,8 @@ jobs:

- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true

- name: Run gradle task
uses: burrunan/gradle-cache-action@v1
Expand Down Expand Up @@ -259,6 +265,8 @@ jobs:

- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true

- uses: actions/download-artifact@v4
with:
Expand Down Expand Up @@ -363,6 +371,8 @@ jobs:

- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true

- uses: actions/download-artifact@v4
with:
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/cargo-vendor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: true

- name: Install Rust
uses: actions-rs/[email protected]
Expand Down
16 changes: 13 additions & 3 deletions .github/workflows/clippy.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: Rust - Run Clippy to check lints
on:

Check warning on line 3 in .github/workflows/clippy.yml

View workflow job for this annotation

GitHub Actions / check-formatting

3:1 [truthy] truthy value should be one of [false, true]
pull_request:
paths:
- .github/workflows/clippy.yml
Expand Down Expand Up @@ -37,15 +37,14 @@
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: true

- name: Install Protoc
uses: arduino/setup-protoc@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Checkout binaries submodule
run: git submodule update --init --depth=1 dist-assets/binaries

- uses: actions-rs/[email protected]
with:
toolchain: stable
Expand All @@ -58,6 +57,12 @@
sudo apt-get update
sudo apt-get install libdbus-1-dev

- name: Install Go
if: matrix.os == 'linux-latest' || matrix.os == 'macos-latest'
uses: actions/setup-go@v5
with:
go-version: 1.21.3

- name: Clippy check
shell: bash
env:
Expand All @@ -83,6 +88,11 @@
- name: Checkout repository
uses: actions/checkout@v3

- name: Checkout wireguard-go submodule
run: |
git config --global --add safe.directory '*'
git submodule update --init --depth=1 wireguard-go-rs/libwg/wireguard-go

- name: Clippy check
env:
RUSTFLAGS: --deny warnings
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/daemon.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: Daemon+CLI - Build and test
on:

Check warning on line 3 in .github/workflows/daemon.yml

View workflow job for this annotation

GitHub Actions / check-formatting

3:1 [truthy] truthy value should be one of [false, true]
pull_request:
paths:
- '**'
Expand Down Expand Up @@ -68,10 +68,10 @@
- name: Checkout repository
uses: actions/checkout@v3

- name: Checkout binaries submodule
- name: Checkout submodules
run: |
git config --global --add safe.directory '*'
git submodule update --init --depth=1 dist-assets/binaries
git submodule update --init --depth=1 dist-assets/binaries wireguard-go-rs/libwg/wireguard-go

# The container image already has rustup and Rust, but only the stable toolchain
- name: Install Rust toolchain
Expand All @@ -86,6 +86,11 @@
- name: Checkout repository
uses: actions/checkout@v2

- name: Checkout wireguard-go submodule
run: |
git config --global --add safe.directory '*'
git submodule update --init --depth=1 wireguard-go-rs/libwg/wireguard-go

- name: Install Protoc
uses: arduino/setup-protoc@v3
with:
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/desktop-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,10 @@ jobs:
run: echo "HOME=/root" >> $GITHUB_ENV
- name: Checkout repository
uses: actions/checkout@v3
- name: Checkout binaries submodule
- name: Checkout submodules
run: |
git config --global --add safe.directory '*'
git submodule update --init --depth=1 dist-assets/binaries
git submodule update --init --depth=1 dist-assets/binaries wireguard-go-rs/libwg/wireguard-go
- name: Build app
env:
USE_MOLD: false
Expand Down Expand Up @@ -159,9 +159,9 @@ jobs:
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Checkout submodules
run: git submodule update --init --depth=1
uses: actions/checkout@v4
with:
submodules: true
- name: Install Protoc
uses: arduino/setup-protoc@v3
with:
Expand Down Expand Up @@ -231,9 +231,9 @@ jobs:
runs-on: [self-hosted, desktop-test, macOS] # app-test-macos-arm
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Checkout submodules
run: git submodule update --init --depth=1
uses: actions/checkout@v4
with:
submodules: true
- name: Install Go
uses: actions/setup-go@v3
with:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3

- name: Checkout wireguard-go submodule
run: git submodule update --init --depth=1 wireguard-go-rs/libwg/wireguard-go

- name: Install Rust
uses: actions-rs/[email protected]
with:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/rust-supply-chain.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: Rust - Supply chain
on:

Check warning on line 3 in .github/workflows/rust-supply-chain.yml

View workflow job for this annotation

GitHub Actions / check-formatting

3:1 [truthy] truthy value should be one of [false, true]
pull_request:
paths:
- .github/workflows/rust-supply-chain.yml
Expand All @@ -16,6 +16,9 @@
- name: Checkout repository
uses: actions/checkout@v3

- name: Checkout wireguard-go submodule
run: git submodule update --init --depth=1 wireguard-go-rs/libwg/wireguard-go

- name: Run cargo deny
uses: EmbarkStudios/cargo-deny-action@v1
with:
Expand Down
33 changes: 24 additions & 9 deletions .github/workflows/rust-unused-dependencies.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: Rust - Unused dependencies
on:

Check warning on line 3 in .github/workflows/rust-unused-dependencies.yml

View workflow job for this annotation

GitHub Actions / check-formatting

3:1 [truthy] truthy value should be one of [false, true]
pull_request:
paths:
- .github/workflows/rust-unused-dependencies.yml
Expand All @@ -10,7 +10,7 @@
workflow_dispatch:
env:
# Pinning nightly just to avoid random breakage. It's fine to bump this at any time
RUST_NIGHTLY_TOOLCHAIN: nightly-2024-02-06
RUST_NIGHTLY_TOOLCHAIN: nightly-2024-05-07
jobs:
prepare-containers:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -41,17 +41,17 @@
- name: Checkout repository
uses: actions/checkout@v3

- name: Checkout binaries submodule
- name: Checkout submodules
run: |
git config --global --add safe.directory '*'
git submodule update --init --depth=1 dist-assets/binaries
git submodule update --init --depth=1 dist-assets/binaries wireguard-go-rs/libwg/wireguard-go

- name: Install nightly Rust toolchain
run: rustup default $RUST_NIGHTLY_TOOLCHAIN

- uses: taiki-e/install-action@v2
with:
tool: cargo-udeps
tool: cargo-udeps@0.1.48

- name: Check for unused dependencies
shell: bash
Expand All @@ -72,27 +72,36 @@
- name: Checkout repository
uses: actions/checkout@v3

- name: Checkout wireguard-go submodule
run: |
git config --global --add safe.directory '*'
git submodule update --init --depth=1 wireguard-go-rs/libwg/wireguard-go

- name: Install nightly Rust toolchain
run: |
rustup default $RUST_NIGHTLY_TOOLCHAIN
rustup target add aarch64-linux-android

- uses: taiki-e/install-action@v2
with:
tool: cargo-udeps
tool: cargo-udeps@0.1.48

- name: Check for unused dependencies
run: cargo udeps --target aarch64-linux-android --package mullvad-jni

cargo-udeps-windows:
runs-on: windows-latest

cargo-udeps:
strategy:
matrix:
os: [macos-latest, windows-latest]
os: [windows-latest, macos-latest]
runs-on: ${{ matrix.os }}

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: true

- name: Install Protoc
uses: arduino/setup-protoc@v3
Expand All @@ -108,7 +117,13 @@

- uses: taiki-e/install-action@v2
with:
tool: cargo-udeps
tool: [email protected]

- name: Install Go
if: matrix.os == 'macos-latest'
uses: actions/setup-go@v3
with:
go-version: 1.21.3

- name: Check for unused dependencies
shell: bash
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/rustfmt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3

- name: Checkout wireguard-go submodule
run: git submodule update --init --depth=1 wireguard-go-rs/libwg/wireguard-go

- name: Install nightly Rust
uses: actions-rs/[email protected]
with:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/translations.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: Translation check
on:

Check warning on line 3 in .github/workflows/translations.yml

View workflow job for this annotation

GitHub Actions / check-formatting

3:1 [truthy] truthy value should be one of [false, true]
pull_request:
paths:
- .github/workflows/translations.yml
Expand All @@ -16,6 +16,9 @@
- name: Checkout repository
uses: actions/checkout@v2

- name: Checkout wireguard-go submodule
run: git submodule update --init --depth=1 wireguard-go-rs/libwg/wireguard-go

- name: Read volta info
id: volta
uses: zoexx/[email protected]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unicode-check.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: Bidirectional Unicode scan
on: [pull_request, workflow_dispatch]

Check warning on line 3 in .github/workflows/unicode-check.yml

View workflow job for this annotation

GitHub Actions / check-formatting

3:1 [truthy] truthy value should be one of [false, true]
jobs:
build-linux:
runs-on: ubuntu-latest
Expand All @@ -9,7 +9,7 @@
uses: actions/checkout@v3

- name: Checkout submodules
run: git submodule update --init
run: git submodule update --init --depth=1 dist-assets/binaries wireguard-go-rs/libwg/wireguard-go

- name: Scan for code points
run: ./ci/check-trojan-source.sh .
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
/android/play-api-key.json
/wireguard/libwg/libwg.exp
/wireguard/libwg/exports.def
/wireguard-go-rs/libwg/libwg.a
**/.vs/
*.bak
android/.idea
Expand Down
13 changes: 1 addition & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,6 @@ else
CARGO_ARGS+=(--features api-override)
fi

# Enable DAITA on supported platforms
if [[ "$(uname -s)" == "MINGW"* || "$(uname -s)" == "Linux" ]]; then
CARGO_ARGS+=(--features daita)
fi

# Make Windows builds include a manifest in the daemon binary declaring it must
# be run as admin.
if [[ "$(uname -s)" == "MINGW"* ]]; then
Expand Down
3 changes: 0 additions & 3 deletions mullvad-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ rust-version.workspace = true
[lints]
workspace = true

[features]
daita = ["mullvad-management-interface/daita", "mullvad-types/daita", "talpid-types/daita"]

[[bin]]
name = "mullvad"
path = "src/main.rs"
Expand Down
7 changes: 7 additions & 0 deletions mullvad-cli/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,11 @@ fn main() {
));
res.compile().expect("Unable to generate windows resources");
}
let target_os = std::env::var("CARGO_CFG_TARGET_OS").expect("CARGO_CFG_TARGET_OS not set");

// Enable Daita by default on Linux and Windows.
println!("cargo::rustc-check-cfg=cfg(daita)");
if let "linux" | "windows" = target_os.as_str() {
println!(r#"cargo::rustc-cfg=daita"#);
}
}
2 changes: 1 addition & 1 deletion mullvad-cli/src/cmds/relay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ impl Relay {
allowed_ips: all_of_the_internet(),
endpoint: SocketAddr::new(IpAddr::V4(Ipv4Addr::UNSPECIFIED), port),
psk: None,
#[cfg(feature = "daita")]
#[cfg(daita)]
constant_packet_size: false,
},
exit_peer: None,
Expand Down
Loading
Loading