Skip to content

Commit

Permalink
Simplify TunConfig setup
Browse files Browse the repository at this point in the history
  • Loading branch information
dlon committed Aug 13, 2024
1 parent 869b8ad commit 526f05d
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions talpid-wireguard/src/wireguard_go/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use std::{
};
#[cfg(target_os = "android")]
use talpid_tunnel::tun_provider::Error as TunProviderError;
use talpid_tunnel::tun_provider::{Tun, TunConfig, TunProvider};
use talpid_tunnel::tun_provider::{Tun, TunProvider};
use talpid_types::BoxedError;

use super::{
Expand Down Expand Up @@ -130,15 +130,11 @@ impl WgGoTunnel {
let mut tun_provider = tun_provider.lock().unwrap();

let tun_config = tun_provider.config_mut();

*tun_config = TunConfig {
addresses: config.tunnel.addresses.clone(),
ipv4_gateway: config.ipv4_gateway,
ipv6_gateway: config.ipv6_gateway,
routes: routes.collect(),
mtu: config.mtu,
..tun_config.clone()
};
tun_config.addresses = config.tunnel.addresses.clone();
tun_config.ipv4_gateway = config.ipv4_gateway;
tun_config.ipv6_gateway = config.ipv6_gateway;
tun_config.routes = routes.collect();
tun_config.mtu = config.mtu;

for _ in 1..=MAX_PREPARE_TUN_ATTEMPTS {
let tunnel_device = tun_provider
Expand Down

0 comments on commit 526f05d

Please sign in to comment.