Skip to content

Commit

Permalink
Merge branch 'default-force-direct-false' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
dlon committed Feb 16, 2024
2 parents 1a6cc86 + b6a428d commit c8a3a3b
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions mullvad-api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ pub struct ApiEndpoint {
/// # Note
///
/// By default, `force_direct` will be `true` if the `api-override` feature
/// is enabled. This is supposedely less error prone, as common targets such
/// as Devmole might be unreachable from behind a bridge server.
/// is enabled and overrides are in use. This is supposedly less error prone, as
/// common targets such as Devmole might be unreachable from behind a bridge server.
///
/// To disable `force_direct`, set the environment variable
/// `MULLVAD_API_FORCE_DIRECT=0` before starting the daemon.
Expand Down Expand Up @@ -175,11 +175,11 @@ impl ApiEndpoint {
let mut api = ApiEndpoint {
host: None,
address: None,
disable_address_cache: true,
disable_address_cache: host_var.is_some() || address_var.is_some(),
disable_tls: false,
force_direct: force_direct
.map(|force_direct_env| force_direct_env.to_lowercase() != "0")
.unwrap_or(true),
.map(|force_direct| force_direct != "0")
.unwrap_or_else(|| host_var.is_some() || address_var.is_some()),
};

match (host_var, address_var) {
Expand Down Expand Up @@ -229,14 +229,15 @@ impl ApiEndpoint {
.unwrap_or(api.disable_tls);

log::debug!(
"Overriding API. Using {host} at {scheme}{addr}",
"Overriding API. Using {host} at {scheme}{addr} (force direct={direct})",
host = api.host(),
addr = api.address(),
scheme = if api.disable_tls {
"http://"
} else {
"https://"
}
},
direct = api.force_direct,
);
}
api
Expand Down

0 comments on commit c8a3a3b

Please sign in to comment.