Add client config entries for specifying tor end point ip address and port
MODIFY
WalletWasabi.Gui/Config.cs
WalletWasabi.Gui/Config.cs
@@ -7,6 +7,7 @@ using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Threading.Tasks;
+using System.Net;
using WalletWasabi.Crypto;
using WalletWasabi.Helpers;
using WalletWasabi.Interfaces;
@@ -42,6 +43,12 @@ namespace WalletWasabi.Gui
[JsonProperty(PropertyName = "RegTestBlindingRsaPubKey")]
public string RegTestBlindingRsaPubKey { get; private set; }
+ [JsonProperty(PropertyName = "TorSocks5IPAddress")]
+ public string TorSocks5IPAddress { get; private set; }
+
+ [JsonProperty(PropertyName = "TorSocks5Port")]
+ public string TorSocks5Port { get; private set; }
+
private Uri _backendUri;
public Uri GetCurrentBackendUri()
@@ -64,6 +71,18 @@ namespace WalletWasabi.Gui
return _backendUri;
}
+ private IPEndPoint _torIpEndPoint;
+ public IPEndPoint GetTorEndPoint()
+ {
+ if (_torIpEndPoint != null) return _torIpEndPoint;
+ if (TorSocks5Port == null && TorSocks5IPAddress == null) return null;
+
+ var ipAddress = IPAddress.Parse(TorSocks5IPAddress ?? "127.0.0.1");
+ var port = int.Parse(TorSocks5Port ?? "9050");
+
+ return _torIpEndPoint = new IPEndPoint(ipAddress, port);
+ }
+
private BlindingRsaPubKey _blindingRsaPubKey;
public BlindingRsaPubKey GetBlindingRsaPubKey()
@@ -123,6 +142,22 @@ namespace WalletWasabi.Gui
Encoding.UTF8);
}
+ private void OverwriteWith(Config config)
+ {
+ Network = config.Network ?? Network;
+
+ MainNetBackendUri = config.MainNetBackendUri ?? MainNetBackendUri;
+ TestNetBackendUri = config.TestNetBackendUri ?? TestNetBackendUri;
+ RegTestBackendUri = config.RegTestBackendUri ?? RegTestBackendUri;
+
+ MainNetBlindingRsaPubKey = config.MainNetBlindingRsaPubKey ?? MainNetBlindingRsaPubKey;
+ TestNetBlindingRsaPubKey = config.TestNetBlindingRsaPubKey ?? TestNetBlindingRsaPubKey;
+ RegTestBlindingRsaPubKey = config.RegTestBlindingRsaPubKey ?? RegTestBlindingRsaPubKey;
+
+ TorSocks5IPAddress = config.TorSocks5IPAddress ?? TorSocks5IPAddress;
+ TorSocks5Port = config.TorSocks5Port ?? TorSocks5Port;
+ }
+
/// <inheritdoc />
public async Task LoadOrCreateDefaultFileAsync()
{
@@ -145,17 +180,7 @@ namespace WalletWasabi.Gui
else
{
string jsonString = await File.ReadAllTextAsync(FilePath, Encoding.UTF8);
- var config = JsonConvert.DeserializeObject<Config>(jsonString);
-
- Network = config.Network ?? Network;
-
- MainNetBackendUri = config.MainNetBackendUri ?? MainNetBackendUri;
- TestNetBackendUri = config.TestNetBackendUri ?? TestNetBackendUri;
- RegTestBackendUri = config.RegTestBackendUri ?? RegTestBackendUri;
-
- MainNetBlindingRsaPubKey = config.MainNetBlindingRsaPubKey ?? MainNetBlindingRsaPubKey;
- TestNetBlindingRsaPubKey = config.TestNetBlindingRsaPubKey ?? TestNetBlindingRsaPubKey;
- RegTestBlindingRsaPubKey = config.RegTestBlindingRsaPubKey ?? RegTestBlindingRsaPubKey;
+ OverwriteWith(JsonConvert.DeserializeObject<Config>(jsonString));
}
_backendUri = GetCurrentBackendUri();

MODIFY
WalletWasabi.Gui/Global.cs
WalletWasabi.Gui/Global.cs
@@ -123,7 +123,7 @@ namespace WalletWasabi.Gui
RegTestMemPoolServingNode = null;
}
- IndexDownloader = new IndexDownloader(Network, IndexFilePath, Config.GetCurrentBackendUri());
+ IndexDownloader = new IndexDownloader(Network, IndexFilePath, Config.GetCurrentBackendUri(), Config.GetTorEndPoint());
UpdateChecker = new UpdateChecker(IndexDownloader.WasabiClient);
@@ -144,7 +144,7 @@ namespace WalletWasabi.Gui
public static async Task InitializeWalletServiceAsync(KeyManager keyManager)
{
- ChaumianClient = new CcjClient(Network, BlindingPubKey, keyManager, Config.GetCurrentBackendUri());
+ ChaumianClient = new CcjClient(Network, BlindingPubKey, keyManager, Config.GetCurrentBackendUri(), Config.GetTorEndPoint());
WalletService = new WalletService(keyManager, IndexDownloader, ChaumianClient, MemPoolService, Nodes, DataDir);
ChaumianClient.Start(0, 7);

Add client config entries for specifying tor end point ip address and port