2020-03-30 00:28:22 +09:00
|
|
|
using BTCPayServer.HostedServices;
|
2021-03-01 14:44:53 +01:00
|
|
|
using BTCPayServer.Payments.PayJoin.Sender;
|
2020-03-30 00:28:22 +09:00
|
|
|
using BTCPayServer.Services;
|
2020-01-06 13:57:32 +01:00
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
2020-03-30 00:28:22 +09:00
|
|
|
using Microsoft.Extensions.Hosting;
|
2021-03-01 14:44:53 +01:00
|
|
|
using BTCPayServer.BIP78.Sender;
|
2020-01-06 13:57:32 +01:00
|
|
|
|
|
|
|
namespace BTCPayServer.Payments.PayJoin
|
|
|
|
{
|
|
|
|
public static class PayJoinExtensions
|
|
|
|
{
|
2020-03-30 00:28:22 +09:00
|
|
|
public static void AddPayJoinServices(this IServiceCollection services)
|
2020-01-06 13:57:32 +01:00
|
|
|
{
|
2020-03-30 00:28:22 +09:00
|
|
|
services.AddSingleton<DelayedTransactionBroadcaster>();
|
|
|
|
services.AddSingleton<IHostedService, HostedServices.DelayedTransactionBroadcasterHostedService>();
|
2020-04-09 17:38:55 +09:00
|
|
|
services.AddSingleton<HostedServices.Socks5HttpProxyServer>();
|
|
|
|
services.AddSingleton<IHostedService, HostedServices.Socks5HttpProxyServer>(s => s.GetRequiredService<Socks5HttpProxyServer>());
|
2020-03-30 00:28:22 +09:00
|
|
|
services.AddSingleton<PayJoinRepository>();
|
2021-03-01 14:44:53 +01:00
|
|
|
services.AddSingleton<IPayjoinServerCommunicator, PayjoinServerCommunicator>();
|
2020-03-30 00:28:22 +09:00
|
|
|
services.AddSingleton<PayjoinClient>();
|
2020-04-09 17:38:55 +09:00
|
|
|
services.AddTransient<Socks5HttpClientHandler>();
|
2021-03-01 14:44:53 +01:00
|
|
|
services.AddHttpClient(PayjoinServerCommunicator.PayjoinOnionNamedClient)
|
2020-11-13 14:01:51 +09:00
|
|
|
.ConfigureHttpClient(h => h.DefaultRequestHeaders.ConnectionClose = true)
|
|
|
|
.ConfigurePrimaryHttpMessageHandler<Socks5HttpClientHandler>();
|
2020-01-06 13:57:32 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|