From c7d60e1aaa37a617e38387a65ec276fe1d8a1518 Mon Sep 17 00:00:00 2001 From: Arian Rezazadeh Date: Fri, 6 Sep 2024 10:49:36 +0330 Subject: [PATCH] feat: support amnezia clients --- Dockerfile | 6 +++++- src/wireguard.rs | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index ec13787..7377dca 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,11 +8,15 @@ WORKDIR /app COPY . . RUN cargo build --release --target x86_64-unknown-linux-musl +# amnezia +FROM ghcr.io/arian8j2/wireguard:amnezia as amnezia + # runner FROM alpine:3.19.2 COPY --from=builder /app/target/x86_64-unknown-linux-musl/release/uptime-reporter /bin/uptime-reporter +COPY --from=amnezia /bin/wg-quick /bin/wg /bin/wireguard-go /bin -RUN apk add --no-cache curl iputils-ping wireguard-tools +RUN apk add --no-cache curl iputils-ping bash VOLUME /app WORKDIR /app diff --git a/src/wireguard.rs b/src/wireguard.rs index 3d884ae..c36875e 100644 --- a/src/wireguard.rs +++ b/src/wireguard.rs @@ -13,7 +13,7 @@ pub async fn create_interface(name: &str) -> anyhow::Result<()> { .await .with_context(|| format!("couldn't read config file at {config_file_path}"))?; - utils::run_command("ip", &["link", "add", name, "type", "wireguard"]).await?; + utils::run_command("wireguard-go", &[name]).await?; // stripped version of common config is needed because `wg setconf` doesn't accept many usual // attributes like `MTU`, `DNS`, `Address` and ...