Rename DestinationUriAction -> BaseUriGetter.
MODIFY
WalletWasabi.Tests/UnitTests/Clients/MockTorHttpClient.cs
WalletWasabi.Tests/UnitTests/Clients/MockTorHttpClient.cs
@@ -10,7 +10,7 @@ namespace WalletWasabi.Tests.UnitTests.Clients
{
public class MockTorHttpClient : IHttpClient
{
- public Func<Uri> DestinationUriAction => () => new Uri("https://payment.server.org/pj");
+ public Func<Uri> BaseUriGetter => () => new Uri("https://payment.server.org/pj");
public bool DefaultIsolateStream => false;

MODIFY
WalletWasabi.Tests/UnitTests/Transactions/PayjoinTests.cs
WalletWasabi.Tests/UnitTests/Transactions/PayjoinTests.cs
@@ -413,6 +413,6 @@ namespace WalletWasabi.Tests.UnitTests.Transactions
}
private static PayjoinClient NewPayjoinClient(MockTorHttpClient client)
- => new PayjoinClient(client.DestinationUriAction.Invoke(), client);
+ => new PayjoinClient(client.BaseUriGetter.Invoke(), client);
}
}

MODIFY
WalletWasabi/Tor/Http/BackendHttpClient.cs
WalletWasabi/Tor/Http/BackendHttpClient.cs
@@ -25,7 +25,7 @@ namespace WalletWasabi.Tor.Http
/// Sends an HTTP request to Wasabi Backend.
/// </summary>
/// <param name="method">HTTP method</param>
- /// <param name="apiQuery">API query part to append to <see cref="IHttpClient.DestinationUriAction"/>.</param>
+ /// <param name="apiQuery">API query part to append to <see cref="IHttpClient.BaseUriGetter"/>.</param>
/// <param name="content">HTTP request content. Only for <see cref="HttpMethod.Post"/> method.</param>
/// <param name="token">Cancellation token to cancel the asynchronous operation.</param>
public Task<HttpResponseMessage> SendAsync(HttpMethod method, string apiQuery, HttpContent? content = null, CancellationToken token = default)

MODIFY
WalletWasabi/Tor/Http/ClearnetHttpClient.cs
WalletWasabi/Tor/Http/ClearnetHttpClient.cs
@@ -27,10 +27,10 @@ namespace WalletWasabi.Tor.Http
public ClearnetHttpClient(Func<Uri> destinationUriAction)
{
- DestinationUriAction = destinationUriAction;
+ BaseUriGetter = destinationUriAction;
}
- public Func<Uri> DestinationUriAction { get; }
+ public Func<Uri> BaseUriGetter { get; }
/// <summary>Predefined HTTP client that handles HTTP requests when Tor is disabled.</summary>
private static HttpClient HttpClient { get; }

MODIFY
WalletWasabi/Tor/Http/IHttpClient.cs
WalletWasabi/Tor/Http/IHttpClient.cs
@@ -8,10 +8,10 @@ namespace WalletWasabi.Tor.Http
/// <summary>
/// Interface defining HTTP client capable of sending either absolute or relative HTTP requests.
/// </summary>
- /// <remarks>Relative HTTP requests are allowed only when <see cref="DestinationUriAction"/> returns non-<see langword="null"/> value.</remarks>
+ /// <remarks>Relative HTTP requests are allowed only when <see cref="BaseUriGetter"/> returns non-<see langword="null"/> value.</remarks>
public interface IHttpClient
{
- Func<Uri?> DestinationUriAction { get; }
+ Func<Uri?> BaseUriGetter { get; }
/// <summary>
/// Whether each HTTP(s) request should use a separate Tor circuit by default or not to increase privacy.
@@ -36,7 +36,7 @@ namespace WalletWasabi.Tor.Http
/// <exception cref="InvalidOperationException"/>
async Task<HttpResponseMessage> SendAsync(HttpMethod method, string relativeUri, HttpContent? content = null, CancellationToken cancel = default)
{
- Uri? baseUri = DestinationUriAction.Invoke();
+ Uri? baseUri = BaseUriGetter.Invoke();
if (baseUri is null)
{

MODIFY
WalletWasabi/Tor/Http/TorHttpClient.cs
WalletWasabi/Tor/Http/TorHttpClient.cs
@@ -32,10 +32,10 @@ namespace WalletWasabi.Tor.Http
public TorHttpClient(Func<Uri> baseUriAction, EndPoint? torSocks5EndPoint, bool isolateStream = false)
{
- DestinationUriAction = Guard.NotNull(nameof(baseUriAction), baseUriAction);
+ BaseUriGetter = Guard.NotNull(nameof(baseUriAction), baseUriAction);
// Connecting to loopback's URIs cannot be done via Tor.
- TorSocks5EndPoint = DestinationUriAction().IsLoopback ? null : torSocks5EndPoint;
+ TorSocks5EndPoint = BaseUriGetter().IsLoopback ? null : torSocks5EndPoint;
TorSocks5Client = null;
DefaultIsolateStream = isolateStream;
}
@@ -58,7 +58,7 @@ namespace WalletWasabi.Tor.Http
public static Exception? LatestTorException { get; private set; } = null;
- public Func<Uri> DestinationUriAction { get; }
+ public Func<Uri> BaseUriGetter { get; }
public EndPoint? TorSocks5EndPoint { get; private set; }
/// <inheritdoc/>
@@ -70,7 +70,7 @@ namespace WalletWasabi.Tor.Http
private Task<HttpResponseMessage> ClearnetRequestAsync(HttpRequestMessage request, bool isolateStream, CancellationToken cancellationToken = default)
{
- return new ClearnetHttpClient(DestinationUriAction).SendAsync(request, isolateStream, cancellationToken);
+ return new ClearnetHttpClient(BaseUriGetter).SendAsync(request, isolateStream, cancellationToken);
}
/// <exception cref="HttpRequestException">When HTTP request fails to be processed. Inner exception may be an instance of <see cref="TorException"/>.</exception>
@@ -79,7 +79,7 @@ namespace WalletWasabi.Tor.Http
{
Guard.NotNull(nameof(method), method);
relativeUri = Guard.NotNull(nameof(relativeUri), relativeUri);
- var requestUri = new Uri(DestinationUriAction(), relativeUri);
+ var requestUri = new Uri(BaseUriGetter(), relativeUri);
using var request = new HttpRequestMessage(method, requestUri);
if (content is { })

Rename DestinationUriAction -> BaseUriGetter.

Signed-off-by: Kiminuo <kiminuo@protonmail.com>