Skip to content

Commit

Permalink
refactor!: Make Config::port_forward depend on igd feature
Browse files Browse the repository at this point in the history
The `Config` struct will no longer have a `port_forward` field if the
`igd` feature is not enabled. This removes a case where a user could set
the config, but we would ignore it.

BREAKING CHANGE: The `port_forward` field on `Config` is only present
with the `igd` feature enabled (default).
  • Loading branch information
Chris Connelly authored and bochaco committed Sep 10, 2021
1 parent b5e2938 commit ce3e602
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ pub struct CertificateGenerationError(
pub struct Config {
/// Specify if port forwarding via UPnP should be done or not. This can be set to false if the network
/// is run locally on the network loopback or on a local area network.
#[cfg(feature = "igd")]
#[structopt(long)]
pub forward_port: bool,

Expand Down Expand Up @@ -141,6 +142,7 @@ fn parse_millis(millis: &str) -> Result<Duration, std::num::ParseIntError> {
pub(crate) struct InternalConfig {
pub(crate) client: quinn::ClientConfig,
pub(crate) server: quinn::ServerConfig,
#[cfg(feature = "igd")]
pub(crate) forward_port: bool,
pub(crate) external_port: Option<u16>,
pub(crate) external_ip: Option<IpAddr>,
Expand Down Expand Up @@ -168,6 +170,7 @@ impl InternalConfig {
Ok(Self {
client,
server,
#[cfg(feature = "igd")]
forward_port: config.forward_port,
external_port: config.external_port,
external_ip: config.external_ip,
Expand Down

0 comments on commit ce3e602

Please sign in to comment.