Skip to content

Commit abe56d2

Browse files
committed
chore: upgrade deps & bump version to 1.0.1
1 parent 05efdc6 commit abe56d2

File tree

3 files changed

+26
-15
lines changed

3 files changed

+26
-15
lines changed

.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"dalek",
66
"defguard",
77
"getrandom",
8+
"jemalloc",
89
"jemallocator",
910
"keepalive",
1011
"multizone",

Cargo.toml

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "wg-multizone"
3-
version = "1.0.0"
4-
edition = "2021"
3+
version = "1.0.1"
4+
edition = "2024"
55

66
[[bin]]
77
name = "wg-multizone"
@@ -13,16 +13,19 @@ lto = true
1313
strip = true
1414
opt-level = 3
1515

16+
[profile.dev]
17+
incremental = true
18+
1619
[dependencies]
17-
anyhow = "1.0.95"
20+
anyhow = "1.0.97"
1821
base64 = "0.22.1"
1922
hex = "^0.4.3"
20-
openssl = { version = "0.10.68", features = ["vendored"] }
21-
reqwest = { version = "0.12.10", features = ["json"] }
22-
serde = { version = "1.0.216", features = ["derive"] }
23-
serde_json = "^1.0.134"
24-
thiserror = "2.0.9"
25-
tokio = { version = "1.42.0", features = ["full"] }
23+
openssl = { version = "0.10.71", features = ["vendored"] }
24+
reqwest = { version = "0.12.15", features = ["json"] }
25+
serde = { version = "1.0.219", features = ["derive"] }
26+
serde_json = "1.0.140"
27+
thiserror = "2.0.12"
28+
tokio = { version = "1.44.1", features = ["full"] }
2629
tracing = "0.1.41"
2730
tracing-subscriber = "0.3.19"
2831
tracing-appender = "^0.2.3"
@@ -31,7 +34,7 @@ x25519-dalek = { version = "2.0.1", features = ["getrandom", "static_secrets"] }
3134
[dependencies.defguard_wireguard_rs]
3235
package = "defguard_wireguard_rs"
3336
git = "https://github.com/DefGuard/wireguard-rs.git"
34-
rev = "v0.6.1"
37+
rev = "v0.7.1"
3538

3639
[target.'cfg(not(any(target_os = "macos", target_os="windows", target_arch = "arm")))'.dependencies]
3740
tikv-jemallocator = "0.6.0"

src/main.rs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::{
22
error::Error,
3-
fs::{read_to_string, File},
3+
fs::{File, read_to_string},
44
io::Write,
55
path::Path,
66
str::FromStr,
@@ -9,12 +9,19 @@ use std::{
99

1010
use base64::Engine;
1111
use defguard_wireguard_rs::{
12-
host::Peer, key::Key, net::IpAddrMask, InterfaceConfiguration, WGApi, WireguardInterfaceApi,
12+
InterfaceConfiguration, WGApi, WireguardInterfaceApi, host::Peer, key::Key, net::IpAddrMask,
1313
};
1414
use serde::{Deserialize, Serialize};
1515
use tokio::time::sleep;
1616
use x25519_dalek::{PublicKey, StaticSecret};
1717

18+
#[cfg(not(any(target_os = "macos", target_os = "windows", target_arch = "arm")))]
19+
use tikv_jemallocator::Jemalloc;
20+
21+
#[cfg(not(any(target_os = "macos", target_os = "windows", target_arch = "arm")))]
22+
#[global_allocator]
23+
static GLOBAL: Jemalloc = Jemalloc;
24+
1825
#[derive(Debug, Clone, Serialize, Deserialize)]
1926
struct ServerConfig {
2027
pub name: Option<String>,
@@ -79,14 +86,14 @@ async fn fetch_and_apply_config(
7986
return Ok(());
8087
}
8188
let my_config = my_config.unwrap();
82-
if my_config.internal_cidr != interface_config.address
89+
if my_config.internal_cidr != interface_config.addresses[0].to_string()
8390
|| my_config.port != interface_config.port
8491
|| Some(r.mtu) != interface_config.mtu
8592
{
8693
if interface_config.port == 0 {
8794
wgapi.create_interface()?;
8895
}
89-
interface_config.address = my_config.internal_cidr.clone();
96+
interface_config.addresses = vec![IpAddrMask::from_str(&my_config.internal_cidr)?];
9097
interface_config.port = my_config.port;
9198
interface_config.mtu = Some(r.mtu);
9299
wgapi.configure_interface(&interface_config)?;
@@ -174,7 +181,7 @@ async fn main() {
174181
let mut interface_config = InterfaceConfiguration {
175182
name: config.interface_name.clone(),
176183
prvkey: base64::engine::general_purpose::STANDARD.encode(secret_key.as_bytes()),
177-
address: "".to_owned(),
184+
addresses: vec![],
178185
port: 0,
179186
peers: vec![],
180187
mtu: None,

0 commit comments

Comments
 (0)