Merge pull request #3961 from nymtech/jon/wireguard-platform-specific

Compartmentalize the platform specific modules in the wg crate
This commit is contained in:
Jon Häggblad
2023-10-05 12:41:21 +02:00
committed by GitHub
7 changed files with 19 additions and 13 deletions
+9 -2
View File
@@ -40,7 +40,11 @@ on:
jobs:
build:
runs-on: [ self-hosted, custom-linux ]
strategy:
fail-fast: false
matrix:
os: [custom-linux, custom-runner-mac-m1]
runs-on: ${{ matrix.os }}
env:
CARGO_TERM_COLOR: always
# Enable sccache via environment variable
@@ -50,6 +54,7 @@ jobs:
- name: Install Dependencies (Linux)
run: sudo apt-get update && sudo apt-get -y install libwebkit2gtk-4.0-dev build-essential curl wget libssl-dev libgtk-3-dev libudev-dev squashfs-tools protobuf-compiler
continue-on-error: true
if: matrix.os == 'custom-linux'
- name: Check out repository code
uses: actions/checkout@v2
@@ -76,6 +81,7 @@ jobs:
args: --workspace --features wireguard
- name: Build all examples
if: matrix.os == 'custom-linux'
uses: actions-rs/cargo@v1
with:
command: build
@@ -88,13 +94,14 @@ jobs:
args: --workspace --features wireguard
- name: Run expensive tests
if: github.ref == 'refs/heads/develop' || github.event.pull_request.base.ref == 'develop' || github.event.pull_request.base.ref == 'master'
if: (github.ref == 'refs/heads/develop' || github.event.pull_request.base.ref == 'develop' || github.event.pull_request.base.ref == 'master') && matrix.os == 'custom-linux'
uses: actions-rs/cargo@v1
with:
command: test
args: --workspace --features wireguard -- --ignored
- name: Annotate with clippy checks
if: matrix.os == 'custom-linux'
uses: actions-rs/clippy-check@v1
continue-on-error: true
with:
+6 -8
View File
@@ -1,20 +1,18 @@
#![cfg_attr(not(target_os = "linux"), allow(dead_code))]
use nym_task::TaskClient;
pub use error::WgError;
mod error;
#[cfg(target_os = "linux")]
mod event;
#[cfg(target_os = "linux")]
mod platform;
mod setup;
#[cfg(target_os = "linux")]
mod tun;
#[cfg(target_os = "linux")]
mod tun_device;
#[cfg(target_os = "linux")]
mod udp_listener;
// Currently the module related to setting up the virtual network device is platform specific.
#[cfg(target_os = "linux")]
use platform::linux::tun_device;
type ActivePeers =
dashmap::DashMap<std::net::SocketAddr, tokio::sync::mpsc::UnboundedSender<crate::event::Event>>;
@@ -0,0 +1 @@
pub(crate) mod tun_device;
+2
View File
@@ -0,0 +1,2 @@
#[cfg(target_os = "linux")]
pub(crate) mod linux;
+1 -1
View File
@@ -15,7 +15,7 @@ use tokio::{
time::timeout,
};
use crate::{event::Event, WgError};
use crate::{error::WgError, event::Event};
const MAX_PACKET: usize = 65535;
-2
View File
@@ -62,8 +62,6 @@ nym-statistics-common = { path = "../common/statistics" }
nym-task = { path = "../common/task" }
nym-types = { path = "../common/types" }
nym-validator-client = { path = "../common/client-libs/validator-client" }
[target.'cfg(target_os = "linux")'.dependencies]
nym-wireguard = { path = "../common/wireguard", optional = true }
[build-dependencies]