mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2024-11-16 19:56:50 +08:00
refactor: IRuntime::patch_config()
This commit is contained in:
parent
2ab75db9c9
commit
30b0c45539
|
@ -26,11 +26,13 @@ impl IRuntime {
|
||||||
config.insert(key.into(), value.clone());
|
config.insert(key.into(), value.clone());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let patch_tun = patch.get("tun");
|
||||||
|
if patch_tun.is_some() {
|
||||||
let tun = config.get("tun");
|
let tun = config.get("tun");
|
||||||
let mut tun = tun.map_or(Mapping::new(), |val| {
|
let mut tun = tun.map_or(Mapping::new(), |val| {
|
||||||
val.as_mapping().cloned().unwrap_or(Mapping::new())
|
val.as_mapping().cloned().unwrap_or(Mapping::new())
|
||||||
});
|
});
|
||||||
let patch_tun = patch.get("tun");
|
|
||||||
let patch_tun = patch_tun.map_or(Mapping::new(), |val| {
|
let patch_tun = patch_tun.map_or(Mapping::new(), |val| {
|
||||||
val.as_mapping().cloned().unwrap_or(Mapping::new())
|
val.as_mapping().cloned().unwrap_or(Mapping::new())
|
||||||
});
|
});
|
||||||
|
@ -39,7 +41,9 @@ impl IRuntime {
|
||||||
tun.insert(key.into(), value.clone());
|
tun.insert(key.into(), value.clone());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
config.insert("tun".into(), Value::from(tun));
|
config.insert("tun".into(), Value::from(tun));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user