mirror of
https://github.com/arampoire/onetun.git
synced 2026-01-16 12:00:24 -05:00
Cleanup usage of anyhow with_context
This commit is contained in:
parent
3ccd000ea8
commit
ce40f85efa
9 changed files with 55 additions and 69 deletions
|
|
@ -41,7 +41,7 @@ impl WireGuardTunnel {
|
|||
let endpoint = config.endpoint_addr;
|
||||
let udp = UdpSocket::bind(config.endpoint_bind_addr)
|
||||
.await
|
||||
.with_context(|| "Failed to create UDP socket for WireGuard connection")?;
|
||||
.context("Failed to create UDP socket for WireGuard connection")?;
|
||||
|
||||
Ok(Self {
|
||||
source_peer_ip,
|
||||
|
|
@ -65,7 +65,7 @@ impl WireGuardTunnel {
|
|||
self.udp
|
||||
.send_to(packet, self.endpoint)
|
||||
.await
|
||||
.with_context(|| "Failed to send encrypted IP packet to WireGuard endpoint.")?;
|
||||
.context("Failed to send encrypted IP packet to WireGuard endpoint.")?;
|
||||
debug!(
|
||||
"Sent {} bytes to WireGuard endpoint (encrypted IP packet)",
|
||||
packet.len()
|
||||
|
|
@ -244,7 +244,7 @@ impl WireGuardTunnel {
|
|||
None,
|
||||
)
|
||||
.map_err(|s| anyhow::anyhow!("{}", s))
|
||||
.with_context(|| "Failed to initialize boringtun Tunn")
|
||||
.context("Failed to initialize boringtun Tunn")
|
||||
}
|
||||
|
||||
/// Determine the inner protocol of the incoming IP packet (TCP/UDP).
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue