Skip to content

Commit fbb88ee

Browse files
authored
change some logs under linux (#79)
* change some logs under linux * fmt
1 parent 996fd55 commit fbb88ee

6 files changed

+41
-17
lines changed

Cargo.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "defguard_wireguard_rs"
3-
version = "0.5.4"
3+
version = "0.5.5"
44
edition = "2021"
55
description = "A unified multi-platform high-level API for managing WireGuard interfaces"
66
license = "Apache-2.0"

src/utils.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ pub(crate) fn clear_dns(ifname: &str) -> Result<(), WireguardInterfaceError> {
156156
let mut cmd = Command::new("resolvconf");
157157
let output = cmd.args(args).output()?;
158158
check_command_output_status(output)?;
159-
info!("DNS configuration removed successfully for interface {ifname}");
159+
debug!("DNS configuration removed successfully for interface {ifname}");
160160
Ok(())
161161
}
162162

src/wgapi_freebsd.rs

+9-3
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,17 @@ impl WireguardInterfaceApi for WGApi<Kernel> {
7575
);
7676
self.assign_address(&address)?;
7777
// configure interface
78-
debug!("Setting host configuration for interface {}", self.ifname);
78+
debug!(
79+
"Applying the WireGuard host configuration for interface {}",
80+
self.ifname
81+
);
7982
let host = config.try_into()?;
8083
bsd::set_host(&self.ifname, &host)?;
81-
debug!("Host configuration set for interface {}.", self.ifname);
82-
trace!("Host configuration: {host:?}");
84+
debug!(
85+
"WireGuard host configuration set for interface {}.",
86+
self.ifname
87+
);
88+
trace!("WireGuard host configuration: {host:?}");
8389

8490
// Set maximum transfer unit (MTU).
8591
if let Some(mtu) = config.mtu {

src/wgapi_linux.rs

+23-8
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,15 @@ impl WireguardInterfaceApi for WGApi<Kernel> {
4040
);
4141

4242
// flush all IP addresses
43-
debug!("Flushing all IP addresses from interface {}", self.ifname);
43+
debug!(
44+
"Flushing all existing IP addresses from interface {} before assigning a new one",
45+
self.ifname
46+
);
4447
netlink::flush_interface(&self.ifname)?;
45-
debug!("All IP addresses flushed from interface {}", self.ifname);
48+
debug!(
49+
"All existing IP addresses flushed from interface {}",
50+
self.ifname
51+
);
4652

4753
// assign IP address to interface
4854
debug!(
@@ -57,11 +63,17 @@ impl WireguardInterfaceApi for WGApi<Kernel> {
5763
);
5864

5965
// configure interface
60-
debug!("Setting host configuration for interface {}", self.ifname);
66+
debug!(
67+
"Applying the WireGuard host configuration for interface {}",
68+
self.ifname
69+
);
6170
let host = config.try_into()?;
6271
netlink::set_host(&self.ifname, &host)?;
63-
debug!("Host configuration set for interface {}.", self.ifname);
64-
trace!("Host configuration: {host:?}");
72+
debug!(
73+
"WireGuard host configuration set for interface {}.",
74+
self.ifname
75+
);
76+
trace!("WireGuard host configuration: {host:?}");
6577

6678
// set maximum transfer unit
6779
if let Some(mtu) = config.mtu {
@@ -102,12 +114,15 @@ impl WireguardInterfaceApi for WGApi<Kernel> {
102114

103115
fn remove_interface(&self) -> Result<(), WireguardInterfaceError> {
104116
debug!(
105-
"Removing interface {}. Getting its host configuration first...",
117+
"Removing interface {}. Getting its WireGuard host configuration first...",
106118
self.ifname
107119
);
108120
let host = netlink::get_host(&self.ifname)?;
109-
debug!("Host configuration read for interface {}", self.ifname);
110-
trace!("Host configuration: {host:?}");
121+
debug!(
122+
"WireGuard host configuration read for interface {}",
123+
self.ifname
124+
);
125+
trace!("WireGuard host configuration: {host:?}");
111126
if let Some(fwmark) = host.fwmark {
112127
if fwmark != 0 {
113128
debug!("Cleaning fwmark rules for interface {}", self.ifname);

src/wgapi_userspace.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -184,13 +184,16 @@ impl WireguardInterfaceApi for WGApi<Userspace> {
184184

185185
// configure interface
186186
debug!(
187-
"Applying the interface configuration to interface {}",
187+
"Applying the WireGuard host configuration for interface {}",
188188
self.ifname
189189
);
190190
let host = config.try_into()?;
191191
self.write_host(&host)?;
192-
debug!("Interface configuration set for interface {}.", self.ifname);
193-
trace!("Interface configuration: {host:?}");
192+
debug!(
193+
"WireGuard host configuration set for interface {}.",
194+
self.ifname
195+
);
196+
trace!("WireGuard host configuration: {host:?}");
194197

195198
// Set maximum transfer unit (MTU).
196199
if let Some(mtu) = config.mtu {

0 commit comments

Comments
 (0)