Skip to content

Commit

Permalink
feat: use tor connector when bulding client
Browse files Browse the repository at this point in the history
  • Loading branch information
oleonardolima committed Jun 15, 2024
1 parent fcad4c9 commit 83c4154
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 29 deletions.
36 changes: 18 additions & 18 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ hex = "0.4.3"

bitcoin = { version = "0.30.2", features = ["base64"] }
bip39 = "2.0.0"
fedimint-api-client = { git = "https://github.com/oleonardolima/fedimint/", branch = "feat/add-mvp-tor-support-connection-to-hostnames" }
fedimint-client = { git = "https://github.com/oleonardolima/fedimint/", branch = "feat/add-mvp-tor-support-connection-to-hostnames" }
fedimint-core = { git = "https://github.com/oleonardolima/fedimint/", branch = "feat/add-mvp-tor-support-connection-to-hostnames" }
fedimint-wallet-client = { git = "https://github.com/oleonardolima/fedimint/", branch = "feat/add-mvp-tor-support-connection-to-hostnames" }
fedimint-mint-client = { git = "https://github.com/oleonardolima/fedimint/", branch = "feat/add-mvp-tor-support-connection-to-hostnames" }
fedimint-ln-client = { git = "https://github.com/oleonardolima/fedimint/", branch = "feat/add-mvp-tor-support-connection-to-hostnames" }
fedimint-bip39 = { git = "https://github.com/oleonardolima/fedimint/", branch = "feat/add-mvp-tor-support-connection-to-hostnames" }
fedimint-ln-common = { git = "https://github.com/oleonardolima/fedimint/", branch = "feat/add-mvp-tor-support-connection-to-hostnames" }
fedimint-api-client = { git = "https://github.com/oleonardolima/fedimint/", rev = "2b54c1cbbec42499c805862724496f45006393db" }
fedimint-client = { git = "https://github.com/oleonardolima/fedimint/", rev = "2b54c1cbbec42499c805862724496f45006393db" }
fedimint-core = { git = "https://github.com/oleonardolima/fedimint/", rev = "2b54c1cbbec42499c805862724496f45006393db" }
fedimint-wallet-client = { git = "https://github.com/oleonardolima/fedimint/", rev = "2b54c1cbbec42499c805862724496f45006393db" }
fedimint-mint-client = { git = "https://github.com/oleonardolima/fedimint/", rev = "2b54c1cbbec42499c805862724496f45006393db" }
fedimint-ln-client = { git = "https://github.com/oleonardolima/fedimint/", rev = "2b54c1cbbec42499c805862724496f45006393db" }
fedimint-bip39 = { git = "https://github.com/oleonardolima/fedimint/", rev = "2b54c1cbbec42499c805862724496f45006393db" }
fedimint-ln-common = { git = "https://github.com/oleonardolima/fedimint/", rev = "2b54c1cbbec42499c805862724496f45006393db" }

[dev-dependencies]
tempdir = "0.3.7"
2 changes: 1 addition & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set dotenv-load := true
FEATURE_FLAG := if env('USE_VENDOR_FEATURE', '0') == "1" { "--features vendored" } else { "" }

run:
RUST_LOG=harbor=debug,iced_wgpu=error,wgpu_core=error,info cargo run {{FEATURE_FLAG}}
RUST_LOG=harbor=debug,fedimint=trace,jsonrpsee=trace,arti=trace,iced_wgpu=error,wgpu_core=error,info cargo run {{FEATURE_FLAG}}

watch:
RUST_LOG=harbor=debug,iced_wgpu=error,wgpu_core=error,info cargo watch -x "run {{FEATURE_FLAG}}"
Expand Down
3 changes: 2 additions & 1 deletion src/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use anyhow::anyhow;
use bip39::Mnemonic;
use bitcoin::address::NetworkUnchecked;
use bitcoin::{Address, Network};
use fedimint_api_client::api::Connector;
use fedimint_core::config::{ClientConfig, FederationId};
use fedimint_core::invite_code::InviteCode;
use fedimint_core::Amount;
Expand Down Expand Up @@ -302,7 +303,7 @@ impl HarborCore {

async fn get_federation_info(&self, invite_code: InviteCode) -> anyhow::Result<ClientConfig> {
let download = Instant::now();
let config = fedimint_api_client::download_from_invite_code(&invite_code)
let config = fedimint_api_client::download_from_invite_code(Connector::Tor, &invite_code)
.await
.map_err(|e| {
error!("Could not download federation info: {e}");
Expand Down
5 changes: 4 additions & 1 deletion src/fedimint_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use async_trait::async_trait;
use bip39::Mnemonic;
use bitcoin::hashes::hex::FromHex;
use bitcoin::Network;
use fedimint_api_client::api::Connector;
use fedimint_bip39::Bip39RootSecretStrategy;
use fedimint_client::oplog::UpdateStreamOrOutcome;
use fedimint_client::secret::{get_default_client_secret, RootSecretStrategy};
Expand Down Expand Up @@ -85,6 +86,8 @@ impl FedimintClient {

client_builder.with_primary_module(1);

client_builder.with_tor_connector();

trace!("Building fedimint client db");
let secret = Bip39RootSecretStrategy::<12>::to_root_secret(mnemonic);

Expand All @@ -100,7 +103,7 @@ impl FedimintClient {
)
} else if let FederationInviteOrId::Invite(i) = invite_or_id {
let download = Instant::now();
let config = fedimint_api_client::download_from_invite_code(&i)
let config = fedimint_api_client::download_from_invite_code(Connector::Tor, &i)
.await
.map_err(|e| {
error!("Could not download federation info: {e}");
Expand Down

0 comments on commit 83c4154

Please sign in to comment.