diff --git a/src/Core/Core.csproj b/src/Core/Core.csproj
deleted file mode 100644
index 27d9738..0000000
--- a/src/Core/Core.csproj
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
- net8.0
- enable
- enable
- MaksIT.$(MSBuildProjectName.Replace(" ", "_"))
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/Core/Extensions/ObjectExtensions.cs b/src/Core/Extensions/ObjectExtensions.cs
deleted file mode 100644
index 0c5f2b1..0000000
--- a/src/Core/Extensions/ObjectExtensions.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using System.Text.Json.Serialization;
-using System.Text.Json;
-
-namespace MaksIT.Core.Extensions;
-public static class ObjectExtensions {
-
- ///
- ///
- ///
- ///
- ///
- ///
- public static string ToJson(this T? obj) => obj.ToJson(null);
-
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- public static string ToJson(this T? obj, List? converters) {
- if (obj == null)
- return "{}";
-
- var options = new JsonSerializerOptions {
- PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
- DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
- WriteIndented = true
- };
-
- converters?.ForEach(x => options.Converters.Add(x));
-
- return JsonSerializer.Serialize(obj, options);
- }
-}
diff --git a/src/Core/Extensions/StringExtensions.cs b/src/Core/Extensions/StringExtensions.cs
deleted file mode 100644
index bdd5fb8..0000000
--- a/src/Core/Extensions/StringExtensions.cs
+++ /dev/null
@@ -1,55 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Text.Json.Serialization;
-using System.Text.Json;
-using System.Threading.Tasks;
-
-namespace MaksIT.Core.Extensions;
-public static class StringExtensions {
- ///
- /// Converts JSON string to object
- ///
- ///
- ///
- ///
- public static T? ToObject(this string? s) => ToObjectCore(s, null);
-
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- public static T? ToObject(this string? s, List converters) => ToObjectCore(s, converters);
-
- private static T? ToObjectCore(string? s, List? converters) {
- var options = new JsonSerializerOptions {
- PropertyNameCaseInsensitive = true
- };
-
- converters?.ForEach(x => options.Converters.Add(x));
-
- return s != null
- ? JsonSerializer.Deserialize(s, options)
- : default;
- }
-
- public static Guid? ToNullabeGuid(this string? s) {
- if (Guid.TryParse(s, out var result)) {
- return result;
- }
-
- return null;
- }
-
- public static Guid ToGuid(this string s) {
- if (Guid.TryParse(s, out var result)) {
- return result;
- }
-
- return Guid.Empty;
- }
-}
diff --git a/src/Core/LockManager.cs b/src/Core/LockManager.cs
deleted file mode 100644
index 44ed543..0000000
--- a/src/Core/LockManager.cs
+++ /dev/null
@@ -1,93 +0,0 @@
-using System;
-using System.Collections.Concurrent;
-using System.Threading.RateLimiting;
-
-public class LockManager : IDisposable {
- private readonly SemaphoreSlim _semaphore = new SemaphoreSlim(1, 1);
- private readonly ConcurrentDictionary _reentrantCounts = new ConcurrentDictionary();
- private readonly TokenBucketRateLimiter _rateLimiter = new TokenBucketRateLimiter(new TokenBucketRateLimiterOptions {
- TokenLimit = 5, // max 5 requests per second (adjust as needed)
- QueueProcessingOrder = QueueProcessingOrder.OldestFirst,
- QueueLimit = 100,
- ReplenishmentPeriod = TimeSpan.FromSeconds(1),
- TokensPerPeriod = 5,
- AutoReplenishment = true
- });
-
- public async Task ExecuteWithLockAsync(Func> action) {
- var lease = await _rateLimiter.AcquireAsync(1);
- if (!lease.IsAcquired) throw new InvalidOperationException("Rate limit exceeded");
-
- var threadId = Thread.CurrentThread.ManagedThreadId;
- if (!_reentrantCounts.ContainsKey(threadId)) _reentrantCounts[threadId] = 0;
- if (_reentrantCounts[threadId] == 0) await _semaphore.WaitAsync();
- _reentrantCounts[threadId]++;
- try {
- return await action();
- }
- finally {
- _reentrantCounts[threadId]--;
- if (_reentrantCounts[threadId] == 0) _semaphore.Release();
- lease.Dispose();
- }
- }
-
- public async Task ExecuteWithLockAsync(Func action) {
- var lease = await _rateLimiter.AcquireAsync(1);
- if (!lease.IsAcquired) throw new InvalidOperationException("Rate limit exceeded");
-
- var threadId = Thread.CurrentThread.ManagedThreadId;
- if (!_reentrantCounts.ContainsKey(threadId)) _reentrantCounts[threadId] = 0;
- if (_reentrantCounts[threadId] == 0) await _semaphore.WaitAsync();
- _reentrantCounts[threadId]++;
- try {
- await action();
- }
- finally {
- _reentrantCounts[threadId]--;
- if (_reentrantCounts[threadId] == 0) _semaphore.Release();
- lease.Dispose();
- }
- }
-
- public async Task ExecuteWithLockAsync(Func action) {
- var lease = await _rateLimiter.AcquireAsync(1);
- if (!lease.IsAcquired) throw new InvalidOperationException("Rate limit exceeded");
-
- var threadId = Thread.CurrentThread.ManagedThreadId;
- if (!_reentrantCounts.ContainsKey(threadId)) _reentrantCounts[threadId] = 0;
- if (_reentrantCounts[threadId] == 0) await _semaphore.WaitAsync();
- _reentrantCounts[threadId]++;
- try {
- return await Task.Run(action);
- }
- finally {
- _reentrantCounts[threadId]--;
- if (_reentrantCounts[threadId] == 0) _semaphore.Release();
- lease.Dispose();
- }
- }
-
- public async Task ExecuteWithLockAsync(Action action) {
- var lease = await _rateLimiter.AcquireAsync(1);
- if (!lease.IsAcquired) throw new InvalidOperationException("Rate limit exceeded");
-
- var threadId = Thread.CurrentThread.ManagedThreadId;
- if (!_reentrantCounts.ContainsKey(threadId)) _reentrantCounts[threadId] = 0;
- if (_reentrantCounts[threadId] == 0) await _semaphore.WaitAsync();
- _reentrantCounts[threadId]++;
- try {
- await Task.Run(action);
- }
- finally {
- _reentrantCounts[threadId]--;
- if (_reentrantCounts[threadId] == 0) _semaphore.Release();
- lease.Dispose();
- }
- }
-
- public void Dispose() {
- _semaphore.Dispose();
- _rateLimiter.Dispose();
- }
-}
diff --git a/src/Core/Logger/ConsoleLogger.cs b/src/Core/Logger/ConsoleLogger.cs
deleted file mode 100644
index 5804482..0000000
--- a/src/Core/Logger/ConsoleLogger.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-
-using Microsoft.Extensions.Logging;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace MaksIT.Core.Logger;
-
-public class MyCustomLogger : ILogger {
- public IDisposable? BeginScope(TState state) where TState : notnull {
- throw new NotImplementedException();
- }
-
- public bool IsEnabled(LogLevel logLevel) {
- throw new NotImplementedException();
- }
-
- public void Log(LogLevel logLevel, EventId eventId, TState state, Exception? exception, Func formatter) {
- throw new NotImplementedException();
- }
-}
-
diff --git a/src/Core/Logger/ConsoleLoggerProvider.cs b/src/Core/Logger/ConsoleLoggerProvider.cs
deleted file mode 100644
index 9aaa2b4..0000000
--- a/src/Core/Logger/ConsoleLoggerProvider.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-using Microsoft.Extensions.Logging;
-using System;
-using System.Collections.Concurrent;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace MaksIT.Core.Logger;
-
-public class MyCustomLoggerProvider : ILoggerProvider {
- public ILogger CreateLogger(string categoryName) {
- throw new NotImplementedException();
- }
-
- public void Dispose() {
- throw new NotImplementedException();
- }
-}
\ No newline at end of file
diff --git a/src/Core/Logger/ConsoleLoggerServiceExtension.cs b/src/Core/Logger/ConsoleLoggerServiceExtension.cs
deleted file mode 100644
index c9d2f37..0000000
--- a/src/Core/Logger/ConsoleLoggerServiceExtension.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-using Microsoft.Extensions.Logging;
-
-
-namespace MaksIT.Core.Logger;
-
-public static class MyCustomLoggerExtensions {
-
-}
\ No newline at end of file
diff --git a/src/Core/OperatingSystem.cs b/src/Core/OperatingSystem.cs
deleted file mode 100644
index fb45bec..0000000
--- a/src/Core/OperatingSystem.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-using System.Runtime.InteropServices;
-
-namespace MaksIT.Core;
-public static class OperatingSystem {
- public static bool IsWindows() =>
- RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
-
- public static bool IsMacOS() =>
- RuntimeInformation.IsOSPlatform(OSPlatform.OSX);
-
- public static bool IsLinux() =>
- RuntimeInformation.IsOSPlatform(OSPlatform.Linux);
-}
diff --git a/src/LetsEncrypt.sln b/src/LetsEncrypt.sln
index 1194f3f..5ec5fe7 100644
--- a/src/LetsEncrypt.sln
+++ b/src/LetsEncrypt.sln
@@ -5,8 +5,6 @@ VisualStudioVersion = 17.6.33815.320
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LetsEncrypt", "LetsEncrypt\LetsEncrypt.csproj", "{7DE431E5-889C-434E-AD02-9F89D7A0ED27}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Core", "Core\Core.csproj", "{27A58A5F-B52A-44F2-9639-84C6F02EA75D}"
-EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{3374FDB1-C95E-4103-8E14-5BBF0BDC4E9D}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LetsEncryptServer", "LetsEncryptServer\LetsEncryptServer.csproj", "{B5F39E04-C2E3-49BF-82C2-9DEBAA949E3D}"
@@ -29,10 +27,6 @@ Global
{7DE431E5-889C-434E-AD02-9F89D7A0ED27}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7DE431E5-889C-434E-AD02-9F89D7A0ED27}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7DE431E5-889C-434E-AD02-9F89D7A0ED27}.Release|Any CPU.Build.0 = Release|Any CPU
- {27A58A5F-B52A-44F2-9639-84C6F02EA75D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {27A58A5F-B52A-44F2-9639-84C6F02EA75D}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {27A58A5F-B52A-44F2-9639-84C6F02EA75D}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {27A58A5F-B52A-44F2-9639-84C6F02EA75D}.Release|Any CPU.Build.0 = Release|Any CPU
{B5F39E04-C2E3-49BF-82C2-9DEBAA949E3D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B5F39E04-C2E3-49BF-82C2-9DEBAA949E3D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B5F39E04-C2E3-49BF-82C2-9DEBAA949E3D}.Release|Any CPU.ActiveCfg = Release|Any CPU
diff --git a/src/LetsEncrypt/LetsEncrypt.csproj b/src/LetsEncrypt/LetsEncrypt.csproj
index ffe6384..cecad42 100644
--- a/src/LetsEncrypt/LetsEncrypt.csproj
+++ b/src/LetsEncrypt/LetsEncrypt.csproj
@@ -8,16 +8,13 @@
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
diff --git a/src/LetsEncryptServer/LetsEncryptServer.csproj b/src/LetsEncryptServer/LetsEncryptServer.csproj
index 737e764..0478957 100644
--- a/src/LetsEncryptServer/LetsEncryptServer.csproj
+++ b/src/LetsEncryptServer/LetsEncryptServer.csproj
@@ -9,8 +9,8 @@
-
-
+
+
diff --git a/src/LetsEncryptServer/Services/CacheService.cs b/src/LetsEncryptServer/Services/CacheService.cs
index e478adb..8345927 100644
--- a/src/LetsEncryptServer/Services/CacheService.cs
+++ b/src/LetsEncryptServer/Services/CacheService.cs
@@ -2,6 +2,7 @@
using MaksIT.Core.Extensions;
+using MaksIT.Core.Threading;
using MaksIT.LetsEncrypt.Entities;
using MaksIT.Results;
using Microsoft.Extensions.Options;
diff --git a/src/ReverseProxy/ReverseProxy.csproj b/src/ReverseProxy/ReverseProxy.csproj
index 722f2de..36f9dcb 100644
--- a/src/ReverseProxy/ReverseProxy.csproj
+++ b/src/ReverseProxy/ReverseProxy.csproj
@@ -8,7 +8,7 @@
-
+