Skip to content

Commit

Permalink
multiverse: allow setting a proxy
Browse files Browse the repository at this point in the history
This is handy when running mitmproxy on multiverse.
  • Loading branch information
bnjbvr committed Apr 11, 2024
1 parent e12f917 commit 7c68096
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions labs/multiverse/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,7 @@ async fn configure_client(server_name: String, config_path: String) -> anyhow::R
let server_name = ServerName::parse(&server_name)?;

let config_path = PathBuf::from(config_path);
let client = Client::builder()
let mut client_builder = Client::builder()
.store_config(
StoreConfig::default()
.crypto_store(
Expand All @@ -805,9 +805,13 @@ async fn configure_client(server_name: String, config_path: String) -> anyhow::R
auto_enable_cross_signing: true,
backup_download_strategy: BackupDownloadStrategy::AfterDecryptionFailure,
auto_enable_backups: true,
})
.build()
.await?;
});

if let Ok(proxy_url) = std::env::var("PROXY") {
client_builder = client_builder.proxy(proxy_url).disable_ssl_verification();
}

let client = client_builder.build().await?;

// Try reading a session, otherwise create a new one.
let session_path = config_path.join("session.json");
Expand Down

0 comments on commit 7c68096

Please sign in to comment.