aboutsummaryrefslogtreecommitdiff
path: root/src/config/runtime.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/config/runtime.rs')
-rw-r--r--src/config/runtime.rs13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/config/runtime.rs b/src/config/runtime.rs
index bffea52..45a29c3 100644
--- a/src/config/runtime.rs
+++ b/src/config/runtime.rs
@@ -1,9 +1,9 @@
use std::fs::File;
use std::io::Read;
-use std::net::{SocketAddr, ToSocketAddrs};
+use std::net::{Ipv4Addr, SocketAddr, ToSocketAddrs};
use std::time::Duration;
-use anyhow::{anyhow, bail, Result};
+use anyhow::{anyhow, bail, Context, Result};
use crate::config::{ConfigOpts, ConfigOptsAcme, ConfigOptsBase, ConfigOptsConsul};
@@ -31,7 +31,7 @@ pub struct RuntimeConfigFirewall {
#[derive(Debug)]
pub struct RuntimeConfigIgd {
- pub private_ip: Option<String>,
+ pub private_ip: Option<Ipv4Addr>,
pub expiration_time: Duration,
pub refresh_time: Duration,
}
@@ -137,7 +137,12 @@ impl RuntimeConfigFirewall {
impl RuntimeConfigIgd {
pub(super) fn new(opts: &ConfigOptsBase) -> Result<Self> {
- let private_ip = opts.private_ip.clone();
+ let private_ip = opts
+ .private_ip
+ .as_ref()
+ .map(|x| x.parse())
+ .transpose()
+ .context("parse private_ip")?;
let expiration_time = Duration::from_secs(
opts.expiration_time
.unwrap_or(super::EXPIRATION_TIME)