aboutsummaryrefslogtreecommitdiff
path: root/src/config.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/config.rs')
-rw-r--r--src/config.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/config.rs b/src/config.rs
new file mode 100644
index 0000000..5ae4e1e
--- /dev/null
+++ b/src/config.rs
@@ -0,0 +1,16 @@
1use crate::wg::config::WireguardConfig;
2use crate::Configuration;
3use anyhow::{anyhow, Result};
4
5pub fn run(wg_conf: &WireguardConfig, conf: &Configuration, peer_name: String, is_full: bool) -> Result<()> {
6 let peer = match wg_conf.get_peer(peer_name.as_str()) {
7 Some(p) => p,
8 None => {
9 return Err(anyhow!("No such peer: {}", peer_name));
10 }
11 };
12
13 println!("{}", peer.gen_config(wg_conf, conf.dns.clone(), conf.endpoint.clone(), conf.port, is_full)?);
14
15 Ok(())
16} \ No newline at end of file