From b5d39b0705209bcc762bc7a49fe6485eee1826d3 Mon Sep 17 00:00:00 2001 From: Josh Patterson Date: Tue, 18 Jun 2024 14:43:33 -0400 Subject: [PATCH] Project restructure --- .../Exceptions/NtAPIResponseException.cs | 18 ---- .../Exceptions/NtExceptionBase.cs | 20 ---- .../Exceptions/NtGenericException.cs | 18 ---- .../Exceptions/NtNullException.cs | 18 ---- NetTunnel.Library/NetTunnel.Library.csproj | 5 +- ...cs => NotificationEndpointDataExchange.cs} | 6 +- .../Query/QueryCreateTunnel.cs | 4 +- .../ReliableMessages/Query/QueryGetTunnels.cs | 2 +- .../Query/QueryRegisterTunnel.cs | 4 +- .../Query/QueryUpsertEndpoint.cs | 4 +- .../{NtServiceClient.cs => ServiceClient.cs} | 24 ++--- ...figuration.cs => EndpointConfiguration.cs} | 18 ++-- ...intStatistics.cs => EndpointStatistics.cs} | 46 +++++----- NetTunnel.Library/Types/EndpointTag.cs | 6 +- ...{NtHttpHeaderRule.cs => HttpHeaderRule.cs} | 10 +- ...nfiguration.cs => ServiceConfiguration.cs} | 2 +- ...onfiguration.cs => TunnelConfiguration.cs} | 12 +-- ...unnelStatistics.cs => TunnelStatistics.cs} | 48 +++++----- NetTunnel.Library/Types/TunnelTag.cs | 4 +- .../Types/{NtUser.cs => User.cs} | 48 +++++----- NetTunnel.Service/NetTunnel.Service.csproj | 1 + NetTunnel.Service/Program.cs | 4 +- .../Properties/launchSettings.json | 31 ------- .../OutboundTunnelNotificationHandlers.cs | 8 +- .../ServiceHandlerBase.cs | 2 +- .../ServiceNotificationHandlers.cs | 10 +- .../ServiceQueryHandlers.cs | 12 +-- .../ServiceCryptographyProvider.cs | 4 +- .../{NetTunnelService.cs => SystemService.cs} | 92 +++++++++---------- .../TunnelEngine/Endpoints/BaseEndpoint.cs | 22 ++--- .../TunnelEngine/Endpoints/EndpointInbound.cs | 16 ++-- .../Endpoints/EndpointOutbound.cs | 14 +-- .../TunnelEngine/Endpoints/IEndpoint.cs | 2 +- NetTunnel.Service/TunnelEngine/HttpUtility.cs | 8 +- NetTunnel.Service/TunnelEngine/ITunnel.cs | 12 +-- .../TunnelEngine/Managers/Logger.cs | 6 +- .../TunnelEngine/Managers/TunnelManager.cs | 51 +++++----- .../TunnelEngine/Managers/UserManager.cs | 20 ++-- .../TunnelEngine/ServiceEngine.cs | 24 +++-- NetTunnel.Service/TunnelEngine/Singletons.cs | 18 ++-- NetTunnel.Service/TunnelEngine/TunnelBase.cs | 35 ++++--- .../TunnelEngine/TunnelInbound.cs | 36 ++++++-- .../TunnelEngine/TunnelOutbound.cs | 26 +++--- .../appsettings.Development.json | 8 -- NetTunnel.Service/appsettings.json | 7 -- NetTunnel.UI/Forms/FormAddEditEndpoint.cs | 16 ++-- NetTunnel.UI/Forms/FormAddUser.cs | 8 +- NetTunnel.UI/Forms/FormChangeUserPassword.cs | 8 +- NetTunnel.UI/Forms/FormConnectTunnel.cs | 8 +- NetTunnel.UI/Forms/FormLogin.cs | 4 +- NetTunnel.UI/Forms/FormMain.cs | 16 ++-- .../Forms/FormServiceConfiguration.cs | 8 +- NetTunnel.UI/Forms/FormUsers.cs | 6 +- NetTunnel.sln | 6 -- 54 files changed, 382 insertions(+), 484 deletions(-) delete mode 100644 NetTunnel.Library/Exceptions/NtAPIResponseException.cs delete mode 100644 NetTunnel.Library/Exceptions/NtExceptionBase.cs delete mode 100644 NetTunnel.Library/Exceptions/NtGenericException.cs delete mode 100644 NetTunnel.Library/Exceptions/NtNullException.cs rename NetTunnel.Library/ReliableMessages/Notification/{NotificationEndpointExchange.cs => NotificationEndpointDataExchange.cs} (69%) rename NetTunnel.Library/{NtServiceClient.cs => ServiceClient.cs} (80%) rename NetTunnel.Library/Types/{NtEndpointConfiguration.cs => EndpointConfiguration.cs} (83%) rename NetTunnel.Library/Types/{NtEndpointStatistics.cs => EndpointStatistics.cs} (92%) rename NetTunnel.Library/Types/{NtHttpHeaderRule.cs => HttpHeaderRule.cs} (88%) rename NetTunnel.Library/Types/{NtServiceConfiguration.cs => ServiceConfiguration.cs} (98%) rename NetTunnel.Library/Types/{NtTunnelConfiguration.cs => TunnelConfiguration.cs} (75%) rename NetTunnel.Library/Types/{NtTunnelStatistics.cs => TunnelStatistics.cs} (84%) rename NetTunnel.Library/Types/{NtUser.cs => User.cs} (69%) delete mode 100644 NetTunnel.Service/Properties/launchSettings.json rename NetTunnel.Service/{NetTunnelService.cs => SystemService.cs} (74%) delete mode 100644 NetTunnel.Service/appsettings.Development.json diff --git a/NetTunnel.Library/Exceptions/NtAPIResponseException.cs b/NetTunnel.Library/Exceptions/NtAPIResponseException.cs deleted file mode 100644 index 0c316ab..0000000 --- a/NetTunnel.Library/Exceptions/NtAPIResponseException.cs +++ /dev/null @@ -1,18 +0,0 @@ -using static NetTunnel.Library.Constants; - -namespace NetTunnel.Library.Exceptions -{ - public class NtAPIResponseException : NtExceptionBase - { - public NtAPIResponseException() - { - Severity = NtLogSeverity.Warning; - } - - public NtAPIResponseException(string? message) - : base($"API exception: {message}.") - { - Severity = NtLogSeverity.Exception; - } - } -} diff --git a/NetTunnel.Library/Exceptions/NtExceptionBase.cs b/NetTunnel.Library/Exceptions/NtExceptionBase.cs deleted file mode 100644 index c95e975..0000000 --- a/NetTunnel.Library/Exceptions/NtExceptionBase.cs +++ /dev/null @@ -1,20 +0,0 @@ -using static NetTunnel.Library.Constants; - -namespace NetTunnel.Library.Exceptions -{ - public class NtExceptionBase : Exception - { - public NtLogSeverity Severity { get; set; } - - public NtExceptionBase() - { - Severity = NtLogSeverity.Exception; - } - - public NtExceptionBase(string? message) - : base(message) - { - Severity = NtLogSeverity.Exception; - } - } -} diff --git a/NetTunnel.Library/Exceptions/NtGenericException.cs b/NetTunnel.Library/Exceptions/NtGenericException.cs deleted file mode 100644 index fe30436..0000000 --- a/NetTunnel.Library/Exceptions/NtGenericException.cs +++ /dev/null @@ -1,18 +0,0 @@ -using static NetTunnel.Library.Constants; - -namespace NetTunnel.Library.Exceptions -{ - public class NtGenericException : NtExceptionBase - { - public NtGenericException() - { - Severity = NtLogSeverity.Warning; - } - - public NtGenericException(string? message) - : base($"Generic exception: {message}.") - { - Severity = NtLogSeverity.Exception; - } - } -} diff --git a/NetTunnel.Library/Exceptions/NtNullException.cs b/NetTunnel.Library/Exceptions/NtNullException.cs deleted file mode 100644 index 568d197..0000000 --- a/NetTunnel.Library/Exceptions/NtNullException.cs +++ /dev/null @@ -1,18 +0,0 @@ -using static NetTunnel.Library.Constants; - -namespace NetTunnel.Library.Exceptions -{ - public class NtNullException : NtExceptionBase - { - public NtNullException() - { - Severity = NtLogSeverity.Warning; - } - - public NtNullException(string? message) - : base($"Null exception: {message}.") - { - Severity = NtLogSeverity.Exception; - } - } -} diff --git a/NetTunnel.Library/NetTunnel.Library.csproj b/NetTunnel.Library/NetTunnel.Library.csproj index d322615..548c6c4 100644 --- a/NetTunnel.Library/NetTunnel.Library.csproj +++ b/NetTunnel.Library/NetTunnel.Library.csproj @@ -20,11 +20,8 @@ + - - - - diff --git a/NetTunnel.Library/ReliableMessages/Notification/NotificationEndpointExchange.cs b/NetTunnel.Library/ReliableMessages/Notification/NotificationEndpointDataExchange.cs similarity index 69% rename from NetTunnel.Library/ReliableMessages/Notification/NotificationEndpointExchange.cs rename to NetTunnel.Library/ReliableMessages/Notification/NotificationEndpointDataExchange.cs index 5e2099f..753242a 100644 --- a/NetTunnel.Library/ReliableMessages/Notification/NotificationEndpointExchange.cs +++ b/NetTunnel.Library/ReliableMessages/Notification/NotificationEndpointDataExchange.cs @@ -2,14 +2,14 @@ namespace NetTunnel.Library.ReliableMessages.Notification { - public class NotificationEndpointExchange : IRmNotification + public class NotificationEndpointDataExchange : IRmNotification { public Guid StreamId { get; set; } public Guid TunnelId { get; set; } public Guid EndpointId { get; set; } public byte[] Bytes { get; set; } - public NotificationEndpointExchange(Guid tunnelId, Guid endpointId, Guid streamId, byte[] bytes, int length) + public NotificationEndpointDataExchange(Guid tunnelId, Guid endpointId, Guid streamId, byte[] bytes, int length) { StreamId = streamId; TunnelId = tunnelId; @@ -19,7 +19,7 @@ public NotificationEndpointExchange(Guid tunnelId, Guid endpointId, Guid streamI Array.Copy(bytes, Bytes, length); } - public NotificationEndpointExchange() + public NotificationEndpointDataExchange() { Bytes = Array.Empty(); } diff --git a/NetTunnel.Library/ReliableMessages/Query/QueryCreateTunnel.cs b/NetTunnel.Library/ReliableMessages/Query/QueryCreateTunnel.cs index 7c945da..1fc26ca 100644 --- a/NetTunnel.Library/ReliableMessages/Query/QueryCreateTunnel.cs +++ b/NetTunnel.Library/ReliableMessages/Query/QueryCreateTunnel.cs @@ -5,9 +5,9 @@ namespace NetTunnel.Library.ReliableMessages.Query { public class QueryCreateTunnel : IRmQuery { - public NtTunnelConfiguration Configuration { get; set; } + public TunnelConfiguration Configuration { get; set; } - public QueryCreateTunnel(NtTunnelConfiguration configuration) + public QueryCreateTunnel(TunnelConfiguration configuration) { Configuration = configuration; } diff --git a/NetTunnel.Library/ReliableMessages/Query/QueryGetTunnels.cs b/NetTunnel.Library/ReliableMessages/Query/QueryGetTunnels.cs index cdd6bc5..9b7d33d 100644 --- a/NetTunnel.Library/ReliableMessages/Query/QueryGetTunnels.cs +++ b/NetTunnel.Library/ReliableMessages/Query/QueryGetTunnels.cs @@ -9,7 +9,7 @@ public class QueryGetTunnels : IRmQuery public class QueryGetTunnelsReply : IRmQueryReply { - public List Collection { get; set; } = new(); + public List Collection { get; set; } = new(); public QueryGetTunnelsReply() { diff --git a/NetTunnel.Library/ReliableMessages/Query/QueryRegisterTunnel.cs b/NetTunnel.Library/ReliableMessages/Query/QueryRegisterTunnel.cs index 4bc2eef..94dd1e5 100644 --- a/NetTunnel.Library/ReliableMessages/Query/QueryRegisterTunnel.cs +++ b/NetTunnel.Library/ReliableMessages/Query/QueryRegisterTunnel.cs @@ -5,13 +5,13 @@ namespace NetTunnel.Library.ReliableMessages.Query { public class QueryRegisterTunnel : IRmQuery { - public NtTunnelConfiguration Configuration { get; set; } = new(); + public TunnelConfiguration Configuration { get; set; } = new(); public QueryRegisterTunnel() { } - public QueryRegisterTunnel(NtTunnelConfiguration configuration) + public QueryRegisterTunnel(TunnelConfiguration configuration) { Configuration = configuration; } diff --git a/NetTunnel.Library/ReliableMessages/Query/QueryUpsertEndpoint.cs b/NetTunnel.Library/ReliableMessages/Query/QueryUpsertEndpoint.cs index a0f25ce..a5edd23 100644 --- a/NetTunnel.Library/ReliableMessages/Query/QueryUpsertEndpoint.cs +++ b/NetTunnel.Library/ReliableMessages/Query/QueryUpsertEndpoint.cs @@ -6,9 +6,9 @@ namespace NetTunnel.Library.ReliableMessages.Query public class QueryUpsertEndpoint : IRmQuery { public Guid TunnelId { get; set; } - public NtEndpointConfiguration Configuration { get; set; } + public EndpointConfiguration Configuration { get; set; } - public QueryUpsertEndpoint(Guid tunnelId, NtEndpointConfiguration configuration) + public QueryUpsertEndpoint(Guid tunnelId, EndpointConfiguration configuration) { TunnelId = tunnelId; Configuration = configuration; diff --git a/NetTunnel.Library/NtServiceClient.cs b/NetTunnel.Library/ServiceClient.cs similarity index 80% rename from NetTunnel.Library/NtServiceClient.cs rename to NetTunnel.Library/ServiceClient.cs index d66e9d6..a0c63ab 100644 --- a/NetTunnel.Library/NtServiceClient.cs +++ b/NetTunnel.Library/ServiceClient.cs @@ -11,11 +11,11 @@ namespace NetTunnel.Library /// /// Used by both the UI to connect to a service and the service to connect to other services. /// - public class NtServiceClient + public class ServiceClient { public RmClient Client { get; private set; } - private readonly NtServiceConfiguration _configuration; + private readonly ServiceConfiguration _configuration; private readonly string _address; private readonly int _port; private readonly string _userName; @@ -26,7 +26,7 @@ public class NtServiceClient /// public Guid ServiceId { get; private set; } - public NtServiceClient(NtServiceConfiguration configuration, RmClient client, string address, int port, string userName, string passwordHash) + public ServiceClient(ServiceConfiguration configuration, RmClient client, string address, int port, string userName, string passwordHash) { _configuration = configuration; Client = client; @@ -38,12 +38,12 @@ public NtServiceClient(NtServiceConfiguration configuration, RmClient client, st #region Factory. - public static async Task CreateConnectAndLogin(string address, int port, string userName, string passwordHash, object? owner = null) + public static async Task CreateConnectAndLogin(string address, int port, string userName, string passwordHash, object? owner = null) { - return await CreateConnectAndLogin(new NtServiceConfiguration(), address, port, userName, passwordHash, owner); + return await CreateConnectAndLogin(new ServiceConfiguration(), address, port, userName, passwordHash, owner); } - public static async Task CreateConnectAndLogin(NtServiceConfiguration configuration, + public static async Task CreateConnectAndLogin(ServiceConfiguration configuration, string address, int port, string userName, string passwordHash, object? owner = null) { var serviceClient = Create(configuration, address, port, userName, passwordHash, owner); @@ -51,7 +51,7 @@ public static async Task CreateConnectAndLogin(NtServiceConfigu return serviceClient; } - public static NtServiceClient Create(NtServiceConfiguration configuration, string address, int port, string userName, string passwordHash, object? owner = null) + public static ServiceClient Create(ServiceConfiguration configuration, string address, int port, string userName, string passwordHash, object? owner = null) { var client = new RmClient(new RmConfiguration() { @@ -61,7 +61,7 @@ public static NtServiceClient Create(NtServiceConfiguration configuration, strin ReceiveBufferGrowthRate = configuration.ReceiveBufferGrowthRate, }); - return new NtServiceClient(configuration, client, address, port, userName, passwordHash); + return new ServiceClient(configuration, client, address, port, userName, passwordHash); } #endregion @@ -118,22 +118,22 @@ public double Ping() }).Result; } - public async Task QueryCreateTunnel(NtTunnelConfiguration configuration) + public async Task QueryCreateTunnel(TunnelConfiguration configuration) => await Client.Query(new QueryCreateTunnel(configuration)); public async Task QueryGetTunnels() => await Client.Query(new QueryGetTunnels()); - public async Task QueryRegisterTunnel(NtTunnelConfiguration Collection) + public async Task QueryRegisterTunnel(TunnelConfiguration Collection) => await Client.Query(new QueryRegisterTunnel(Collection)); - public async Task QueryUpsertEndpoint(Guid tunnelId, NtEndpointConfiguration configuration) + public async Task QueryUpsertEndpoint(Guid tunnelId, EndpointConfiguration configuration) => await Client.Query(new QueryUpsertEndpoint(tunnelId, configuration)); public void NotificationEndpointConnect(Guid tunnelId, Guid endpointId, Guid streamId) => Client.Notify(new NotificationEndpointConnect(tunnelId, endpointId, streamId)); public void NotificationEndpointExchange(Guid tunnelId, Guid endpointId, Guid streamId, byte[] bytes, int length) - => Client.Notify(new NotificationEndpointExchange(tunnelId, endpointId, streamId, bytes, length)); + => Client.Notify(new NotificationEndpointDataExchange(tunnelId, endpointId, streamId, bytes, length)); } } diff --git a/NetTunnel.Library/Types/NtEndpointConfiguration.cs b/NetTunnel.Library/Types/EndpointConfiguration.cs similarity index 83% rename from NetTunnel.Library/Types/NtEndpointConfiguration.cs rename to NetTunnel.Library/Types/EndpointConfiguration.cs index df1f975..5a8ac88 100644 --- a/NetTunnel.Library/Types/NtEndpointConfiguration.cs +++ b/NetTunnel.Library/Types/EndpointConfiguration.cs @@ -9,7 +9,7 @@ namespace NetTunnel.Library.Types /// These are sent to the tunnel service when the tunnel is connected, but once the connection /// is made - they can be altered at either end by the service UI. /// - public class NtEndpointConfiguration + public class EndpointConfiguration { public Guid EndpointId { get; set; } [Newtonsoft.Json.JsonConverter(typeof(StringEnumConverter))] @@ -21,14 +21,14 @@ public class NtEndpointConfiguration [Newtonsoft.Json.JsonConverter(typeof(StringEnumConverter))] public NtTrafficType TrafficType { get; set; } = NtTrafficType.Raw; - public List HttpHeaderRules { get; set; } = new(); + public List HttpHeaderRules { get; set; } = new(); - public NtEndpointConfiguration() + public EndpointConfiguration() { } - public NtEndpointConfiguration(Guid endpointId, string name, - string outboundAddress, int inboundPort, int outboundPort, List httpHeaderRules, NtTrafficType trafficType) + public EndpointConfiguration(Guid endpointId, string name, + string outboundAddress, int inboundPort, int outboundPort, List httpHeaderRules, NtTrafficType trafficType) { EndpointId = endpointId; Direction = NtDirection.Undefined; @@ -40,8 +40,8 @@ public NtEndpointConfiguration(Guid endpointId, string name, HttpHeaderRules.AddRange(httpHeaderRules); } - public NtEndpointConfiguration(Guid endpointId, NtDirection direction, string name, - string outboundAddress, int inboundPort, int outboundPort, List httpHeaderRules, NtTrafficType trafficType) + public EndpointConfiguration(Guid endpointId, NtDirection direction, string name, + string outboundAddress, int inboundPort, int outboundPort, List httpHeaderRules, NtTrafficType trafficType) { EndpointId = endpointId; Direction = direction; @@ -53,9 +53,9 @@ public NtEndpointConfiguration(Guid endpointId, NtDirection direction, string na HttpHeaderRules.AddRange(httpHeaderRules); } - public NtEndpointConfiguration CloneConfiguration() + public EndpointConfiguration CloneConfiguration() { - var clone = new NtEndpointConfiguration + var clone = new EndpointConfiguration { EndpointId = EndpointId, Direction = Direction, diff --git a/NetTunnel.Library/Types/NtEndpointStatistics.cs b/NetTunnel.Library/Types/EndpointStatistics.cs similarity index 92% rename from NetTunnel.Library/Types/NtEndpointStatistics.cs rename to NetTunnel.Library/Types/EndpointStatistics.cs index 8d52548..3c7344b 100644 --- a/NetTunnel.Library/Types/NtEndpointStatistics.cs +++ b/NetTunnel.Library/Types/EndpointStatistics.cs @@ -1,23 +1,23 @@ -using Newtonsoft.Json.Converters; -using static NetTunnel.Library.Constants; - -namespace NetTunnel.Library.Types -{ - public class NtEndpointStatistics - { - /// - /// Used to determine if anything has changed. - /// - public int ChangeHash { get; set; } - public ulong CurrentConnections { get; set; } - public ulong TotalConnections { get; set; } - [Newtonsoft.Json.JsonConverter(typeof(StringEnumConverter))] - public NtDirection Direction { get; set; } - public Guid TunnelId { get; set; } - public Guid EndpointId { get; set; } - public ulong BytesReceived { get; set; } - public ulong BytesSent { get; set; } - public double BytesReceivedKb => BytesReceived / 1024.0; - public double BytesSentKb => BytesSent / 1024.0; - } -} +using Newtonsoft.Json.Converters; +using static NetTunnel.Library.Constants; + +namespace NetTunnel.Library.Types +{ + public class EndpointStatistics + { + /// + /// Used to determine if anything has changed. + /// + public int ChangeHash { get; set; } + public ulong CurrentConnections { get; set; } + public ulong TotalConnections { get; set; } + [Newtonsoft.Json.JsonConverter(typeof(StringEnumConverter))] + public NtDirection Direction { get; set; } + public Guid TunnelId { get; set; } + public Guid EndpointId { get; set; } + public ulong BytesReceived { get; set; } + public ulong BytesSent { get; set; } + public double BytesReceivedKb => BytesReceived / 1024.0; + public double BytesSentKb => BytesSent / 1024.0; + } +} diff --git a/NetTunnel.Library/Types/EndpointTag.cs b/NetTunnel.Library/Types/EndpointTag.cs index 1447596..21e2d4b 100644 --- a/NetTunnel.Library/Types/EndpointTag.cs +++ b/NetTunnel.Library/Types/EndpointTag.cs @@ -2,10 +2,10 @@ { public class EndpointTag { - public NtTunnelConfiguration Tunnel { get; set; } - public NtEndpointConfiguration Endpoint { get; set; } + public TunnelConfiguration Tunnel { get; set; } + public EndpointConfiguration Endpoint { get; set; } - public EndpointTag(NtTunnelConfiguration tunnel, NtEndpointConfiguration endpoint) + public EndpointTag(TunnelConfiguration tunnel, EndpointConfiguration endpoint) { Tunnel = tunnel; Endpoint = endpoint; diff --git a/NetTunnel.Library/Types/NtHttpHeaderRule.cs b/NetTunnel.Library/Types/HttpHeaderRule.cs similarity index 88% rename from NetTunnel.Library/Types/NtHttpHeaderRule.cs rename to NetTunnel.Library/Types/HttpHeaderRule.cs index ff30a8c..8f74f82 100644 --- a/NetTunnel.Library/Types/NtHttpHeaderRule.cs +++ b/NetTunnel.Library/Types/HttpHeaderRule.cs @@ -3,7 +3,7 @@ namespace NetTunnel.Library { - public class NtHttpHeaderRule + public class HttpHeaderRule { /// /// Inbound, outbound, etc. @@ -42,7 +42,7 @@ public class NtHttpHeaderRule /// public string Description { get; set; } = string.Empty; - public NtHttpHeaderRule(NtHttpVerb verb, string name, NtHttpHeaderAction action, string value) + public HttpHeaderRule(NtHttpVerb verb, string name, NtHttpHeaderAction action, string value) { Verb = verb; Name = name; @@ -50,13 +50,13 @@ public NtHttpHeaderRule(NtHttpVerb verb, string name, NtHttpHeaderAction action, Value = value; } - public NtHttpHeaderRule() + public HttpHeaderRule() { } - public NtHttpHeaderRule CloneConfiguration() + public HttpHeaderRule CloneConfiguration() { - return new NtHttpHeaderRule + return new HttpHeaderRule { Name = Name, Value = Value, diff --git a/NetTunnel.Library/Types/NtServiceConfiguration.cs b/NetTunnel.Library/Types/ServiceConfiguration.cs similarity index 98% rename from NetTunnel.Library/Types/NtServiceConfiguration.cs rename to NetTunnel.Library/Types/ServiceConfiguration.cs index 589facd..77a4f54 100644 --- a/NetTunnel.Library/Types/NtServiceConfiguration.cs +++ b/NetTunnel.Library/Types/ServiceConfiguration.cs @@ -1,6 +1,6 @@ namespace NetTunnel.Library.Types { - public class NtServiceConfiguration + public class ServiceConfiguration { /// /// The id for this instance of the tunnel service. diff --git a/NetTunnel.Library/Types/NtTunnelConfiguration.cs b/NetTunnel.Library/Types/TunnelConfiguration.cs similarity index 75% rename from NetTunnel.Library/Types/NtTunnelConfiguration.cs rename to NetTunnel.Library/Types/TunnelConfiguration.cs index bcb424a..7a0dbbb 100644 --- a/NetTunnel.Library/Types/NtTunnelConfiguration.cs +++ b/NetTunnel.Library/Types/TunnelConfiguration.cs @@ -1,6 +1,6 @@ namespace NetTunnel.Library.Types { - public class NtTunnelConfiguration + public class TunnelConfiguration { /// /// The id of the service that owns this tunnel. @@ -12,13 +12,13 @@ public class NtTunnelConfiguration public int ManagementPort { get; set; } public string Username { get; set; } = string.Empty; public string PasswordHash { get; set; } = string.Empty; - public List Endpoints { get; set; } = new(); + public List Endpoints { get; set; } = new(); - public NtTunnelConfiguration() + public TunnelConfiguration() { } - public NtTunnelConfiguration(Guid serviceId, Guid tunnelId, string name, string address, int managementPort, string username, string passwordHash) + public TunnelConfiguration(Guid serviceId, Guid tunnelId, string name, string address, int managementPort, string username, string passwordHash) { ServiceId = serviceId; TunnelId = tunnelId; @@ -29,9 +29,9 @@ public NtTunnelConfiguration(Guid serviceId, Guid tunnelId, string name, string PasswordHash = passwordHash; } - public NtTunnelConfiguration CloneConfiguration() + public TunnelConfiguration CloneConfiguration() { - var clone = new NtTunnelConfiguration + var clone = new TunnelConfiguration { TunnelId = TunnelId, Name = Name, diff --git a/NetTunnel.Library/Types/NtTunnelStatistics.cs b/NetTunnel.Library/Types/TunnelStatistics.cs similarity index 84% rename from NetTunnel.Library/Types/NtTunnelStatistics.cs rename to NetTunnel.Library/Types/TunnelStatistics.cs index 63ba462..58dcae1 100644 --- a/NetTunnel.Library/Types/NtTunnelStatistics.cs +++ b/NetTunnel.Library/Types/TunnelStatistics.cs @@ -1,24 +1,24 @@ -using Newtonsoft.Json.Converters; -using static NetTunnel.Library.Constants; - -namespace NetTunnel.Library.Types -{ - public class NtTunnelStatistics - { - /// - /// Used to determine if anything has changed. - /// - public int ChangeHash { get; set; } - public List EndpointStatistics { get; set; } = new(); - public NtTunnelStatus Status { get; set; } - public ulong CurrentConnections { get; set; } - public ulong TotalConnections { get; set; } - [Newtonsoft.Json.JsonConverter(typeof(StringEnumConverter))] - public NtDirection Direction { get; set; } - public Guid TunnelId { get; set; } - public ulong BytesReceived { get; set; } - public ulong BytesSent { get; set; } - public double BytesReceivedKb => BytesReceived / 1024.0; - public double BytesSentKb => BytesSent / 1024.0; - } -} +using Newtonsoft.Json.Converters; +using static NetTunnel.Library.Constants; + +namespace NetTunnel.Library.Types +{ + public class TunnelStatistics + { + /// + /// Used to determine if anything has changed. + /// + public int ChangeHash { get; set; } + public List EndpointStatistics { get; set; } = new(); + public NtTunnelStatus Status { get; set; } + public ulong CurrentConnections { get; set; } + public ulong TotalConnections { get; set; } + [Newtonsoft.Json.JsonConverter(typeof(StringEnumConverter))] + public NtDirection Direction { get; set; } + public Guid TunnelId { get; set; } + public ulong BytesReceived { get; set; } + public ulong BytesSent { get; set; } + public double BytesReceivedKb => BytesReceived / 1024.0; + public double BytesSentKb => BytesSent / 1024.0; + } +} diff --git a/NetTunnel.Library/Types/TunnelTag.cs b/NetTunnel.Library/Types/TunnelTag.cs index 04e1417..63b0603 100644 --- a/NetTunnel.Library/Types/TunnelTag.cs +++ b/NetTunnel.Library/Types/TunnelTag.cs @@ -2,9 +2,9 @@ { public class TunnelTag { - public NtTunnelConfiguration Tunnel { get; set; } + public TunnelConfiguration Tunnel { get; set; } - public TunnelTag(NtTunnelConfiguration tunnel) + public TunnelTag(TunnelConfiguration tunnel) { Tunnel = tunnel; } diff --git a/NetTunnel.Library/Types/NtUser.cs b/NetTunnel.Library/Types/User.cs similarity index 69% rename from NetTunnel.Library/Types/NtUser.cs rename to NetTunnel.Library/Types/User.cs index 14af088..99d39a6 100644 --- a/NetTunnel.Library/Types/NtUser.cs +++ b/NetTunnel.Library/Types/User.cs @@ -1,24 +1,24 @@ -namespace NetTunnel.Service -{ - public class NtUser - { - public string Username { get; private set; } - public string PasswordHash { get; private set; } - - public NtUser(string username, string passwordHash) - { - Username = username.ToLower(); - PasswordHash = passwordHash.ToLower(); - } - - public void SetPasswordHash(string passwordHash) - { - PasswordHash = passwordHash.ToLower(); - } - - public NtUser Clone() - { - return new NtUser(Username, ""); - } - } -} +namespace NetTunnel.Service +{ + public class User + { + public string Username { get; private set; } + public string PasswordHash { get; private set; } + + public User(string username, string passwordHash) + { + Username = username.ToLower(); + PasswordHash = passwordHash.ToLower(); + } + + public void SetPasswordHash(string passwordHash) + { + PasswordHash = passwordHash.ToLower(); + } + + public User Clone() + { + return new User(Username, ""); + } + } +} diff --git a/NetTunnel.Service/NetTunnel.Service.csproj b/NetTunnel.Service/NetTunnel.Service.csproj index e2abd96..80de291 100644 --- a/NetTunnel.Service/NetTunnel.Service.csproj +++ b/NetTunnel.Service/NetTunnel.Service.csproj @@ -29,6 +29,7 @@ + diff --git a/NetTunnel.Service/Program.cs b/NetTunnel.Service/Program.cs index 94aedfc..e3cd622 100644 --- a/NetTunnel.Service/Program.cs +++ b/NetTunnel.Service/Program.cs @@ -16,9 +16,9 @@ public static void Main() rc.RestartService(1); }); - x.Service(s => + x.Service(s => { - s.ConstructUsing(hostSettings => new NetTunnelService()); + s.ConstructUsing(hostSettings => new SystemService()); s.WhenStarted(tc => tc.Start()); s.WhenStopped(tc => tc.Stop()); }); diff --git a/NetTunnel.Service/Properties/launchSettings.json b/NetTunnel.Service/Properties/launchSettings.json deleted file mode 100644 index 8e17d98..0000000 --- a/NetTunnel.Service/Properties/launchSettings.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "$schema": "https://json.schemastore.org/launchsettings.json", - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:35449", - "sslPort": 0 - } - }, - "profiles": { - "http": { - "commandName": "Project", - "dotnetRunMessages": true, - "launchBrowser": true, - "launchUrl": "swagger", - "applicationUrl": "http://localhost:5246", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, - "IIS Express": { - "commandName": "IISExpress", - "launchBrowser": true, - "launchUrl": "swagger", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - } - } -} diff --git a/NetTunnel.Service/ReliableMessageHandlers/OutboundTunnelNotificationHandlers.cs b/NetTunnel.Service/ReliableMessageHandlers/OutboundTunnelNotificationHandlers.cs index 3b6302f..5a18517 100644 --- a/NetTunnel.Service/ReliableMessageHandlers/OutboundTunnelNotificationHandlers.cs +++ b/NetTunnel.Service/ReliableMessageHandlers/OutboundTunnelNotificationHandlers.cs @@ -16,13 +16,13 @@ public void OnNotificationEndpointConnect(RmContext context, NotificationEndpoin //var tunnel = context.Endpoint.Parameter.EnsureNotNull(); - Singletons.Core.Logging.Write(NtLogSeverity.Debug, + Singletons.ServiceEngine.Logging.Write(NtLogSeverity.Debug, $"Received endpoint connection notification."); - Singletons.Core.Tunnels.EstablishOutboundEndpointConnection(notification.TunnelId, notification.EndpointId, notification.StreamId); + Singletons.ServiceEngine.Tunnels.EstablishOutboundEndpointConnection(notification.TunnelId, notification.EndpointId, notification.StreamId); } - public void OnNotificationEndpointExchange(RmContext context, NotificationEndpointExchange notification) + public void OnNotificationEndpointExchange(RmContext context, NotificationEndpointDataExchange notification) { //var connectionContext = GetServiceConnectionContext(context); @@ -30,7 +30,7 @@ public void OnNotificationEndpointExchange(RmContext context, NotificationEndpoi tunnel.SendEndpointData(notification.EndpointId, notification.StreamId, notification.Bytes); - Singletons.Core.Logging.Write(NtLogSeverity.Debug, + Singletons.ServiceEngine.Logging.Write(NtLogSeverity.Debug, $"Received endpoint data exchange."); } } diff --git a/NetTunnel.Service/ReliableMessageHandlers/ServiceHandlerBase.cs b/NetTunnel.Service/ReliableMessageHandlers/ServiceHandlerBase.cs index 8787798..4abcf04 100644 --- a/NetTunnel.Service/ReliableMessageHandlers/ServiceHandlerBase.cs +++ b/NetTunnel.Service/ReliableMessageHandlers/ServiceHandlerBase.cs @@ -38,7 +38,7 @@ public ServiceConnectionState EnforceCryptographyAndGetServiceConnectionContext( /// public ServiceConnectionState GetServiceConnectionContext(RmContext context) { - if (Singletons.Core.ServiceConnectionStates.TryGetValue(context.ConnectionId, out var connection)) + if (Singletons.ServiceEngine.ServiceConnectionStates.TryGetValue(context.ConnectionId, out var connection)) { if (connection.Validate($"{context.TcpClient.Client.RemoteEndPoint}")) { diff --git a/NetTunnel.Service/ReliableMessageHandlers/ServiceNotificationHandlers.cs b/NetTunnel.Service/ReliableMessageHandlers/ServiceNotificationHandlers.cs index ce7b3c4..dd66e3e 100644 --- a/NetTunnel.Service/ReliableMessageHandlers/ServiceNotificationHandlers.cs +++ b/NetTunnel.Service/ReliableMessageHandlers/ServiceNotificationHandlers.cs @@ -25,19 +25,19 @@ public void OnNotificationEndpointConnect(RmContext context, NotificationEndpoin { var connectionContext = GetServiceConnectionContext(context); - Singletons.Core.Logging.Write(NtLogSeverity.Debug, + Singletons.ServiceEngine.Logging.Write(NtLogSeverity.Debug, $"Received endpoint connection notification."); - Singletons.Core.Tunnels.EstablishOutboundEndpointConnection(notification.TunnelId, notification.EndpointId, notification.StreamId); + Singletons.ServiceEngine.Tunnels.EstablishOutboundEndpointConnection(notification.TunnelId, notification.EndpointId, notification.StreamId); } - public void OnNotificationEndpointExchange(RmContext context, NotificationEndpointExchange notification) + public void OnNotificationEndpointExchange(RmContext context, NotificationEndpointDataExchange notification) { var connectionContext = GetServiceConnectionContext(context); - Singletons.Core.Tunnels.SendEndpointData(notification.TunnelId, notification.EndpointId, notification.StreamId, notification.Bytes); + Singletons.ServiceEngine.Tunnels.SendEndpointData(notification.TunnelId, notification.EndpointId, notification.StreamId, notification.Bytes); - Singletons.Core.Logging.Write(NtLogSeverity.Debug, + Singletons.ServiceEngine.Logging.Write(NtLogSeverity.Debug, $"Received endpoint data exchange."); } } diff --git a/NetTunnel.Service/ReliableMessageHandlers/ServiceQueryHandlers.cs b/NetTunnel.Service/ReliableMessageHandlers/ServiceQueryHandlers.cs index 12dca3e..4b3862a 100644 --- a/NetTunnel.Service/ReliableMessageHandlers/ServiceQueryHandlers.cs +++ b/NetTunnel.Service/ReliableMessageHandlers/ServiceQueryHandlers.cs @@ -34,7 +34,7 @@ public QueryLoginReply OnQueryLogin(RmContext context, QueryLogin query) { var connectionContext = EnforceCryptographyAndGetServiceConnectionContext(context); - if (Singletons.Core.Users.ValidatePassword(query.UserName, query.PasswordHash)) + if (Singletons.ServiceEngine.Users.ValidatePassword(query.UserName, query.PasswordHash)) { connectionContext.SetAuthenticated(query.UserName); @@ -53,7 +53,7 @@ public QueryGetTunnelsReply OnGetTunnels(RmContext context, QueryGetTunnels quer return new QueryGetTunnelsReply { - Collection = Singletons.Core.Tunnels.Clone(), + Collection = Singletons.ServiceEngine.Tunnels.Clone(), }; } @@ -61,7 +61,7 @@ public QueryCreateTunnelReply OnQueryCreateTunnel(RmContext context, QueryCreate { var connectionContext = EnforceLoginCryptographyAndGetServiceConnectionContext(context); - Singletons.Core.Tunnels.UpsertTunnel(query.Configuration); + Singletons.ServiceEngine.Tunnels.UpsertTunnel(query.Configuration); return new QueryCreateTunnelReply(); } @@ -75,10 +75,10 @@ public QueryPingReply OnQueryCreateTunnel(RmContext context, QueryPing query) public QueryUpsertEndpointReply OnQueryUpsertEndpoint(QueryUpsertEndpoint query) { - Singletons.Core.Tunnels.UpsertEndpoint(query.TunnelId, query.Configuration); + Singletons.ServiceEngine.Tunnels.UpsertEndpoint(query.TunnelId, query.Configuration); //Since we have a tunnel, we will communicate the alteration of endpoints though the tunnel. - //var result = await Singletons.Core.InboundTunnels + //var result = await Singletons.ServiceEngine.InboundTunnels // .DispatchUpsertEndpointOutboundToAssociatedTunnelService(tunnelId, endpoint.Outbound); return new QueryUpsertEndpointReply(); @@ -88,7 +88,7 @@ public QueryRegisterTunnelReply OnRegisterTunnel(RmContext context, QueryRegiste { var connectionContext = EnforceLoginCryptographyAndGetServiceConnectionContext(context); - Singletons.Core.Tunnels.RegisterTunnel(context.ConnectionId, query.Configuration); + Singletons.ServiceEngine.Tunnels.RegisterTunnel(context.ConnectionId, query.Configuration); return new QueryRegisterTunnelReply(); } diff --git a/NetTunnel.Service/ServiceCryptographyProvider.cs b/NetTunnel.Service/ServiceCryptographyProvider.cs index 9987227..234cffd 100644 --- a/NetTunnel.Service/ServiceCryptographyProvider.cs +++ b/NetTunnel.Service/ServiceCryptographyProvider.cs @@ -7,9 +7,9 @@ internal class ServiceCryptographyProvider : IRmCryptographyProvider { private readonly ServiceEngine _serviceEngine; - public ServiceCryptographyProvider(ServiceEngine engineCore) + public ServiceCryptographyProvider(ServiceEngine serviceEngine) { - _serviceEngine = engineCore; + _serviceEngine = serviceEngine; } public byte[] Decrypt(RmContext context, byte[] encryptedPayload) diff --git a/NetTunnel.Service/NetTunnelService.cs b/NetTunnel.Service/SystemService.cs similarity index 74% rename from NetTunnel.Service/NetTunnelService.cs rename to NetTunnel.Service/SystemService.cs index a5942ea..ee2c005 100644 --- a/NetTunnel.Service/NetTunnelService.cs +++ b/NetTunnel.Service/SystemService.cs @@ -1,46 +1,46 @@ -using NetTunnel.Library; -using NetTunnel.Service.TunnelEngine; - -namespace NetTunnel.Service -{ - internal class NetTunnelService - { - private readonly SemaphoreSlim _semaphoreToRequestStop; - private readonly Thread _thread; - - public NetTunnelService() - { - _semaphoreToRequestStop = new SemaphoreSlim(0); - _thread = new Thread(DoWork); - - } - - public void Start() - { - _thread.Start(); - } - - public void Stop() - { - _semaphoreToRequestStop.Release(); - _thread.Join(); - } - - private void DoWork() - { - Thread.CurrentThread.Name = $"DoWork:{Environment.CurrentManagedThreadId}"; - - Singletons.Core.Start(); - - while (true) - { - if (_semaphoreToRequestStop.Wait(500)) - { - Singletons.Core.Logging.Write(Constants.NtLogSeverity.Verbose, $"Stopping..."); - Singletons.Core.Stop(); - break; - } - } - } - } -} +using NetTunnel.Library; +using NetTunnel.Service.TunnelEngine; + +namespace NetTunnel.Service +{ + internal class SystemService + { + private readonly SemaphoreSlim _semaphoreToRequestStop; + private readonly Thread _thread; + + public SystemService() + { + _semaphoreToRequestStop = new SemaphoreSlim(0); + _thread = new Thread(DoWork); + + } + + public void Start() + { + _thread.Start(); + } + + public void Stop() + { + _semaphoreToRequestStop.Release(); + _thread.Join(); + } + + private void DoWork() + { + Thread.CurrentThread.Name = $"DoWork:{Environment.CurrentManagedThreadId}"; + + Singletons.ServiceEngine.Start(); + + while (true) + { + if (_semaphoreToRequestStop.Wait(500)) + { + Singletons.ServiceEngine.Logging.Write(Constants.NtLogSeverity.Verbose, $"Stopping..."); + Singletons.ServiceEngine.Stop(); + break; + } + } + } + } +} diff --git a/NetTunnel.Service/TunnelEngine/Endpoints/BaseEndpoint.cs b/NetTunnel.Service/TunnelEngine/Endpoints/BaseEndpoint.cs index d1fd778..7b2797e 100644 --- a/NetTunnel.Service/TunnelEngine/Endpoints/BaseEndpoint.cs +++ b/NetTunnel.Service/TunnelEngine/Endpoints/BaseEndpoint.cs @@ -18,7 +18,7 @@ internal class BaseEndpoint public ulong CurrentConnections { get; internal set; } public Guid EndpointId { get; private set; } - internal readonly ServiceEngine _core; + internal readonly ServiceEngine _serviceEngine; internal readonly ITunnel _tunnel; public bool KeepRunning { get; internal set; } = false; @@ -26,14 +26,14 @@ internal class BaseEndpoint internal readonly PessimisticCriticalResource> _activeConnections = new(); - public NtEndpointConfiguration Configuration { get; private set; } + public EndpointConfiguration Configuration { get; private set; } - public BaseEndpoint(ServiceEngine core, ITunnel tunnel, - Guid endpointId, NtEndpointConfiguration configuration) + public BaseEndpoint(ServiceEngine serviceEngine, ITunnel tunnel, + Guid endpointId, EndpointConfiguration configuration) { Configuration = configuration; - _core = core; + _serviceEngine = serviceEngine; _tunnel = tunnel; EndpointId = endpointId; _heartbeatThread = new Thread(HeartbeatThreadProc); @@ -148,7 +148,7 @@ internal void EndpointDataExchangeThreadProc(object? obj) { //SEARCH FOR: Process:Endpoint:Connect:001: If this is an inbound endpoint, then let the remote service know that we just received a // connection so that it came make the associated outbound connection. - _tunnel.NotificationEndpointConnect(_tunnel.Configuration.TunnelId, EndpointId, activeConnection.StreamId); + _tunnel.SendNotificationOfEndpointConnect(_tunnel.Configuration.TunnelId, EndpointId, activeConnection.StreamId); } var httpHeaderBuilder = new StringBuilder(); @@ -208,7 +208,7 @@ this is EndpointOutbound && Configuration.HttpHeaderRules #endregion - _tunnel.NotificationEndpointExchange(_tunnel.Configuration.TunnelId, + _tunnel.SendNotificationOfEndpointDataExchange(_tunnel.Configuration.TunnelId, Configuration.EndpointId, activeConnection.StreamId, buffer.Bytes, buffer.Length); buffer.AutoResize(Singletons.Configuration.MaxReceiveBufferSize); @@ -221,21 +221,21 @@ this is EndpointOutbound && Configuration.HttpHeaderRules if (sockEx.SocketErrorCode == SocketError.ConnectionAborted) { //We don't typically care about this. This is something as simple as a user closing a web-browser. - _tunnel.Core.Logging.Write(Constants.NtLogSeverity.Verbose, $"EndpointDataExchangeThreadProc: {ex.Message}"); + _tunnel.ServiceEngine.Logging.Write(Constants.NtLogSeverity.Verbose, $"EndpointDataExchangeThreadProc: {ex.Message}"); } else { - _tunnel.Core.Logging.Write(Constants.NtLogSeverity.Exception, $"EndpointDataExchangeThreadProc: {ex.Message}"); + _tunnel.ServiceEngine.Logging.Write(Constants.NtLogSeverity.Exception, $"EndpointDataExchangeThreadProc: {ex.Message}"); } } else { - _tunnel.Core.Logging.Write(Constants.NtLogSeverity.Exception, $"EndpointDataExchangeThreadProc: {ex.Message}"); + _tunnel.ServiceEngine.Logging.Write(Constants.NtLogSeverity.Exception, $"EndpointDataExchangeThreadProc: {ex.Message}"); } } catch (Exception ex) { - _tunnel.Core.Logging.Write(Constants.NtLogSeverity.Exception, $"EndpointDataExchangeThreadProc: {ex.Message}"); + _tunnel.ServiceEngine.Logging.Write(Constants.NtLogSeverity.Exception, $"EndpointDataExchangeThreadProc: {ex.Message}"); } finally { diff --git a/NetTunnel.Service/TunnelEngine/Endpoints/EndpointInbound.cs b/NetTunnel.Service/TunnelEngine/Endpoints/EndpointInbound.cs index 4bc8726..456d1b6 100644 --- a/NetTunnel.Service/TunnelEngine/Endpoints/EndpointInbound.cs +++ b/NetTunnel.Service/TunnelEngine/Endpoints/EndpointInbound.cs @@ -18,8 +18,8 @@ internal class EndpointInbound : BaseEndpoint, IEndpoint public override int GetHashCode() => Configuration.GetHashCode(); - public EndpointInbound(ServiceEngine core, ITunnel tunnel, NtEndpointConfiguration configuration) - : base(core, tunnel, configuration.EndpointId, configuration) + public EndpointInbound(ServiceEngine serviceEngine, ITunnel tunnel, EndpointConfiguration configuration) + : base(serviceEngine, tunnel, configuration.EndpointId, configuration) { } @@ -29,7 +29,7 @@ public override void Start() _listener = new TcpListener(IPAddress.Any, Configuration.InboundPort); - _tunnel.Core.Logging.Write(Constants.NtLogSeverity.Verbose, + _tunnel.ServiceEngine.Logging.Write(Constants.NtLogSeverity.Verbose, $"Starting inbound endpoint '{Configuration.Name}' on port {Configuration.InboundPort}."); _inboundConnectionThread = new Thread(InboundConnectionThreadProc); @@ -46,7 +46,7 @@ public override void Stop() Utility.TryAndIgnore(_listener.Dispose); } - _tunnel.Core.Logging.Write(Constants.NtLogSeverity.Verbose, + _tunnel.ServiceEngine.Logging.Write(Constants.NtLogSeverity.Verbose, $"Stopping inbound endpoint '{Configuration.Name}' on port {Configuration.InboundPort}."); _activeConnections.Use((o) => @@ -58,7 +58,7 @@ public override void Stop() o.Clear(); }); - _tunnel.Core.Logging.Write(Constants.NtLogSeverity.Verbose, + _tunnel.ServiceEngine.Logging.Write(Constants.NtLogSeverity.Verbose, $"Stopped inbound endpoint '{Configuration.Name}' on port {Configuration.InboundPort}."); } @@ -70,7 +70,7 @@ void InboundConnectionThreadProc() { _listener.EnsureNotNull().Start(); - _core.Logging.Write(Constants.NtLogSeverity.Verbose, + _serviceEngine.Logging.Write(Constants.NtLogSeverity.Verbose, $"Listening inbound endpoint '{Configuration.Name}' on port {Configuration.InboundPort}"); while (KeepRunning) @@ -87,7 +87,7 @@ void InboundConnectionThreadProc() var activeConnection = new ActiveEndpointConnection(dataExchangeThread, tcpClient, Guid.NewGuid()); _activeConnections.Use((o) => o.Add(activeConnection.StreamId, activeConnection)); - _core.Logging.Write(Constants.NtLogSeverity.Debug, + _serviceEngine.Logging.Write(Constants.NtLogSeverity.Debug, $"Accepted inbound endpoint connection: {activeConnection.StreamId}"); dataExchangeThread.Start(activeConnection); @@ -97,7 +97,7 @@ void InboundConnectionThreadProc() } catch (Exception ex) { - _core.Logging.Write(Constants.NtLogSeverity.Exception, + _serviceEngine.Logging.Write(Constants.NtLogSeverity.Exception, $"InboundConnectionThreadProc: {ex.Message}"); } finally diff --git a/NetTunnel.Service/TunnelEngine/Endpoints/EndpointOutbound.cs b/NetTunnel.Service/TunnelEngine/Endpoints/EndpointOutbound.cs index 9295149..e089600 100644 --- a/NetTunnel.Service/TunnelEngine/Endpoints/EndpointOutbound.cs +++ b/NetTunnel.Service/TunnelEngine/Endpoints/EndpointOutbound.cs @@ -12,8 +12,8 @@ internal class EndpointOutbound : BaseEndpoint, IEndpoint public override int GetHashCode() => Configuration.GetHashCode(); - public EndpointOutbound(ServiceEngine core, ITunnel tunnel, NtEndpointConfiguration configuration) - : base(core, tunnel, configuration.EndpointId, configuration) + public EndpointOutbound(ServiceEngine serviceEngine, ITunnel tunnel, EndpointConfiguration configuration) + : base(serviceEngine, tunnel, configuration.EndpointId, configuration) { } @@ -21,7 +21,7 @@ public override void Start() { base.Start(); - _tunnel.Core.Logging.Write(Constants.NtLogSeverity.Verbose, + _tunnel.ServiceEngine.Logging.Write(Constants.NtLogSeverity.Verbose, $"Starting outbound endpoint '{Configuration.Name}' on port {Configuration.OutboundPort}."); } @@ -29,7 +29,7 @@ public override void Stop() { base.Stop(); - _tunnel.Core.Logging.Write(Constants.NtLogSeverity.Verbose, + _tunnel.ServiceEngine.Logging.Write(Constants.NtLogSeverity.Verbose, $"Stopping outbound endpoint '{Configuration.Name}' on port {Configuration.OutboundPort}."); _activeConnections.Use((o) => @@ -41,7 +41,7 @@ public override void Stop() o.Clear(); }); - _tunnel.Core.Logging.Write(Constants.NtLogSeverity.Verbose, + _tunnel.ServiceEngine.Logging.Write(Constants.NtLogSeverity.Verbose, $"Stopped outbound endpoint '{Configuration.Name}' on port {Configuration.OutboundPort}."); } @@ -61,7 +61,7 @@ public void EstablishOutboundEndpointConnection(Guid streamId) var activeConnection = new ActiveEndpointConnection(dataExchangeThread, tcpClient, streamId); var outboundConnection = _activeConnections.Use((o) => o.TryAdd(streamId, activeConnection)); - _core.Logging.Write(Constants.NtLogSeverity.Debug, + _serviceEngine.Logging.Write(Constants.NtLogSeverity.Debug, $"Established outbound endpoint connection: {activeConnection.StreamId}"); dataExchangeThread.Start(activeConnection); @@ -69,7 +69,7 @@ public void EstablishOutboundEndpointConnection(Guid streamId) } catch (Exception ex) { - _core.Logging.Write(Constants.NtLogSeverity.Exception, + _serviceEngine.Logging.Write(Constants.NtLogSeverity.Exception, $"EstablishOutboundEndpointConnection: {ex.Message}"); throw; } diff --git a/NetTunnel.Service/TunnelEngine/Endpoints/IEndpoint.cs b/NetTunnel.Service/TunnelEngine/Endpoints/IEndpoint.cs index 88070a8..c6d3c2a 100644 --- a/NetTunnel.Service/TunnelEngine/Endpoints/IEndpoint.cs +++ b/NetTunnel.Service/TunnelEngine/Endpoints/IEndpoint.cs @@ -17,6 +17,6 @@ public interface IEndpoint public ulong BytesSent { get; } public ulong TotalConnections { get; } public ulong CurrentConnections { get; } - public NtEndpointConfiguration Configuration { get; } + public EndpointConfiguration Configuration { get; } } } diff --git a/NetTunnel.Service/TunnelEngine/HttpUtility.cs b/NetTunnel.Service/TunnelEngine/HttpUtility.cs index 6bb5d6e..b78e981 100644 --- a/NetTunnel.Service/TunnelEngine/HttpUtility.cs +++ b/NetTunnel.Service/TunnelEngine/HttpUtility.cs @@ -21,7 +21,7 @@ public enum HTTPHeaderResult NotPresent } - public static HTTPHeaderResult Process(ref StringBuilder httpHeaderBuilder, NtEndpointConfiguration endpointConfig, PumpBuffer buffer) + public static HTTPHeaderResult Process(ref StringBuilder httpHeaderBuilder, EndpointConfiguration endpointConfig, PumpBuffer buffer) { try { @@ -94,7 +94,7 @@ public static HTTPHeaderResult Process(ref StringBuilder httpHeaderBuilder, NtEn catch (Exception ex) { httpHeaderBuilder.Clear(); - Singletons.Core.Logging.Write(ex, "An error occurred while parsing the HTTP request header."); + Singletons.ServiceEngine.Logging.Write(ex, "An error occurred while parsing the HTTP request header."); } return HTTPHeaderResult.NotPresent; @@ -119,7 +119,7 @@ public static int FindDelimiterIndexInByteArray(byte[] buffer, int bufferLength, return -1; } - public static string ApplyHttpHeaderRules(NtEndpointConfiguration endpointConfig, + public static string ApplyHttpHeaderRules(EndpointConfiguration endpointConfig, string httpHeader, NtHttpHeaderType headerType, string httpRequestVerb, string headerDelimiter) { try @@ -156,7 +156,7 @@ public static string ApplyHttpHeaderRules(NtEndpointConfiguration endpointConfig } catch (Exception ex) { - Singletons.Core.Logging.Write(ex, "Failed to process HTTP Header rules."); + Singletons.ServiceEngine.Logging.Write(ex, "Failed to process HTTP Header rules."); } return httpHeader; diff --git a/NetTunnel.Service/TunnelEngine/ITunnel.cs b/NetTunnel.Service/TunnelEngine/ITunnel.cs index de6dd62..6362183 100644 --- a/NetTunnel.Service/TunnelEngine/ITunnel.cs +++ b/NetTunnel.Service/TunnelEngine/ITunnel.cs @@ -6,23 +6,23 @@ namespace NetTunnel.Service.TunnelEngine { internal interface ITunnel { - public NtTunnelConfiguration Configuration { get; } + public TunnelConfiguration Configuration { get; } public NtTunnelStatus Status { get; set; } public ulong BytesReceived { get; set; } public ulong BytesSent { get; set; } public ulong TotalConnections { get; set; } public ulong CurrentConnections { get; set; } - public ServiceEngine Core { get; } + public ServiceEngine ServiceEngine { get; } public List Endpoints { get; } public void Start(); public void Stop(); - public EndpointInbound UpsertEndpoint(NtEndpointConfiguration configuration); + public EndpointInbound UpsertEndpoint(EndpointConfiguration configuration); public void DeleteEndpoint(Guid endpointId); - public NtTunnelConfiguration CloneConfiguration(); + public TunnelConfiguration CloneConfiguration(); - public void NotificationEndpointExchange(Guid tunnelId, Guid endpointId, Guid streamId, byte[] bytes, int length); - public void NotificationEndpointConnect(Guid tunnelId, Guid endpointId, Guid streamId); + public void SendNotificationOfEndpointDataExchange(Guid tunnelId, Guid endpointId, Guid streamId, byte[] bytes, int length); + public void SendNotificationOfEndpointConnect(Guid tunnelId, Guid endpointId, Guid streamId); } } diff --git a/NetTunnel.Service/TunnelEngine/Managers/Logger.cs b/NetTunnel.Service/TunnelEngine/Managers/Logger.cs index c5b2966..c3b5292 100644 --- a/NetTunnel.Service/TunnelEngine/Managers/Logger.cs +++ b/NetTunnel.Service/TunnelEngine/Managers/Logger.cs @@ -6,12 +6,12 @@ namespace NetTunnel.Service.TunnelEngine.Managers { internal class Logger { - private readonly ServiceEngine _core; + private readonly ServiceEngine _serviceEngine; private readonly object _lock = new(); - public Logger(ServiceEngine core) + public Logger(ServiceEngine serviceEngine) { - _core = core; + _serviceEngine = serviceEngine; } public void Write(Exception ex) diff --git a/NetTunnel.Service/TunnelEngine/Managers/TunnelManager.cs b/NetTunnel.Service/TunnelEngine/Managers/TunnelManager.cs index b2c9380..5ddf9b3 100644 --- a/NetTunnel.Service/TunnelEngine/Managers/TunnelManager.cs +++ b/NetTunnel.Service/TunnelEngine/Managers/TunnelManager.cs @@ -10,22 +10,22 @@ namespace NetTunnel.Service.TunnelEngine.Managers { internal class TunnelManager { - private readonly ServiceEngine _Core; + private readonly ServiceEngine _serviceEngine; protected readonly PessimisticCriticalResource> Collection = new(); - public TunnelManager(ServiceEngine core) + public TunnelManager(ServiceEngine serviceEngine) { - _Core = core; + _serviceEngine = serviceEngine; LoadFromDisk(); } #region Start / Stop. public void Start(Guid tunnelId) => Collection.Use((o) - => o.Where(o => o.Configuration.TunnelId == tunnelId).Single().Start()); + => o.Single(o => o.Configuration.TunnelId == tunnelId).Start()); public void Stop(Guid tunnelId) => Collection.Use((o) - => o.Where(o => o.Configuration.TunnelId == tunnelId).Single().Stop()); + => o.Single(o => o.Configuration.TunnelId == tunnelId).Stop()); public void StartAll() => Collection.Use((o) => o.ForEach((o) => o.Start())); @@ -41,7 +41,7 @@ public void StopAll() /// The local service is adding a new outbound tunnel configuration to the local service. /// /// - public void UpsertTunnel(NtTunnelConfiguration config) + public void UpsertTunnel(TunnelConfiguration config) { Collection.Use((o) => { @@ -52,7 +52,7 @@ public void UpsertTunnel(NtTunnelConfiguration config) o.Remove(existingTunnel); } - var newTunnel = new TunnelOutbound(_Core, config); + var newTunnel = new TunnelOutbound(_serviceEngine, config); o.Add(newTunnel.EnsureNotNull()); SaveToDisk(); @@ -63,7 +63,7 @@ public void UpsertTunnel(NtTunnelConfiguration config) /// A remote service is registering its outbound tunnel configuration with the local service. /// /// - public void RegisterTunnel(Guid connectionId, NtTunnelConfiguration config) + public void RegisterTunnel(Guid connectionId, TunnelConfiguration config) { Collection.Use((o) => { @@ -80,7 +80,7 @@ public void RegisterTunnel(Guid connectionId, NtTunnelConfiguration config) endpoint.Direction = endpoint.Direction == NtDirection.Inbound ? NtDirection.Outbound : NtDirection.Inbound; } - var newTunnel = new TunnelInbound(_Core, connectionId, config); + var newTunnel = new TunnelInbound(_serviceEngine, connectionId, config); o.Add(newTunnel.EnsureNotNull()); newTunnel.Start(); @@ -92,11 +92,11 @@ public void RegisterTunnel(Guid connectionId, NtTunnelConfiguration config) /// /// /// - public void UpsertEndpoint(Guid tunnelId, NtEndpointConfiguration endpointConfiguration) + public void UpsertEndpoint(Guid tunnelId, EndpointConfiguration endpointConfiguration) { Collection.Use((o) => { - var tunnel = o.Where(o => o.Configuration.TunnelId == tunnelId).Single(); + var tunnel = o.Single(o => o.Configuration.TunnelId == tunnelId); tunnel.UpsertEndpoint(endpointConfiguration); SaveToDisk(); @@ -112,7 +112,7 @@ public void DeleteEndpoint(Guid tunnelId, Guid endpointId) { Collection.Use((o) => { - var tunnel = o.Where(o => o.Configuration.TunnelId == tunnelId).Single(); + var tunnel = o.Single(o => o.Configuration.TunnelId == tunnelId); tunnel.DeleteEndpoint(endpointId); SaveToDisk(); @@ -134,9 +134,9 @@ public void EstablishOutboundEndpointConnection(Guid tunnelId, Guid endpointId, { Collection.Use((o) => { - var tunnel = o.Where(o => o.Configuration.TunnelId == tunnelId).Single(); + var tunnel = o.Single(o => o.Configuration.TunnelId == tunnelId); - var endpoint = tunnel.Endpoints.Where(o => o.EndpointId == endpointId).Single() as EndpointOutbound + var endpoint = tunnel.Endpoints.Single(o => o.EndpointId == endpointId) as EndpointOutbound ?? throw new Exception("The endpoint could not be converted to outbound."); endpoint.EstablishOutboundEndpointConnection(streamId); @@ -147,9 +147,10 @@ public void SendEndpointData(Guid tunnelId, Guid endpointId, Guid StreamId, byte { Collection.Use((o) => { - o.Where(o => o.Configuration.TunnelId == tunnelId) - .Single().Endpoints.Where(o => o.EndpointId == endpointId) - .Single().SendEndpointData(StreamId, bytes); + var tunnel = o.Single(o => o.Configuration.TunnelId == tunnelId); + var endpoint = tunnel.Endpoints.Single(o => o.EndpointId == endpointId); + + endpoint.SendEndpointData(StreamId, bytes); }); } @@ -172,19 +173,19 @@ private void LoadFromDisk() { o.Clear(); - CommonApplicationData.LoadFromDisk>(FriendlyName)? + CommonApplicationData.LoadFromDisk>(FriendlyName)? .Where(t => t.ServiceId == Singletons.Configuration.ServiceId).ToList() - .ForEach(c => o.Add(new TunnelOutbound(_Core, c))); + .ForEach(c => o.Add(new TunnelOutbound(_serviceEngine, c))); }); } #endregion - public List Clone() + public List Clone() { return Collection.Use((o) => { - List clones = new(); + List clones = new(); foreach (var tunnel in o) { clones.Add(tunnel.CloneConfiguration()); @@ -193,15 +194,15 @@ public List Clone() }); } - public List GetStatistics() + public List GetStatistics() { - var result = new List(); + var result = new List(); Collection.Use((o) => { foreach (var tunnel in o) { - var tunnelStats = new NtTunnelStatistics() + var tunnelStats = new TunnelStatistics() { Direction = tunnel.Configuration.ServiceId == Singletons.Configuration.ServiceId ? NtDirection.Outbound : NtDirection.Inbound, Status = tunnel.Status, @@ -215,7 +216,7 @@ public List GetStatistics() foreach (var endpoint in tunnel.Endpoints) { - var endpointStats = new NtEndpointStatistics() + var endpointStats = new EndpointStatistics() { Direction = endpoint.Configuration.Direction, BytesReceived = endpoint.BytesReceived, diff --git a/NetTunnel.Service/TunnelEngine/Managers/UserManager.cs b/NetTunnel.Service/TunnelEngine/Managers/UserManager.cs index 5e1afcb..5256bdc 100644 --- a/NetTunnel.Service/TunnelEngine/Managers/UserManager.cs +++ b/NetTunnel.Service/TunnelEngine/Managers/UserManager.cs @@ -6,27 +6,27 @@ namespace NetTunnel.Service.TunnelEngine.Managers { internal class UserManager { - private readonly ServiceEngine _core; + private readonly ServiceEngine _serviceEngine; - private readonly PessimisticCriticalResource> _collection = new(); + private readonly PessimisticCriticalResource> _collection = new(); - public UserManager(ServiceEngine core) + public UserManager(ServiceEngine serviceEngine) { - _core = core; + _serviceEngine = serviceEngine; LoadFromDisk(); } public void Add(string username, string passwordHash) - => Add(new NtUser(username, passwordHash)); + => Add(new User(username, passwordHash)); - public void Add(NtUser user) => _collection.Use((o) + public void Add(User user) => _collection.Use((o) => o.Add(user)); - public void Delete(NtUser user) => _collection.Use((o) + public void Delete(User user) => _collection.Use((o) => o.RemoveAll(t => t.Username == user.Username)); - public void ChangePassword(NtUser user) + public void ChangePassword(User user) { _collection.Use((o) => { @@ -44,7 +44,7 @@ public bool ValidateLogin(string username, string passwordHash) public bool ValidatePassword(string username, string passwordHash) { - if (_core.Users.ValidateLogin(username, passwordHash)) + if (_serviceEngine.Users.ValidateLogin(username, passwordHash)) { return true; } @@ -60,7 +60,7 @@ private void LoadFromDisk() { o.Clear(); - CommonApplicationData.LoadFromDisk(Constants.FriendlyName, new List()).ForEach(o => Add(o)); + CommonApplicationData.LoadFromDisk(Constants.FriendlyName, new List()).ForEach(o => Add(o)); if (o.Count == 0) { diff --git a/NetTunnel.Service/TunnelEngine/ServiceEngine.cs b/NetTunnel.Service/TunnelEngine/ServiceEngine.cs index 84bd929..8d4d5c5 100644 --- a/NetTunnel.Service/TunnelEngine/ServiceEngine.cs +++ b/NetTunnel.Service/TunnelEngine/ServiceEngine.cs @@ -55,8 +55,8 @@ public ServiceEngine() _messageServer.AddHandler(new ServiceNotificationHandlers()); _messageServer.AddHandler(new ServiceQueryHandlers()); - _messageServer.OnConnected += CoreServer_OnConnected; - _messageServer.OnDisconnected += CoreServer_OnDisconnected; + _messageServer.OnConnected += ServiceEngine_OnConnected; + _messageServer.OnDisconnected += ServiceEngine_OnDisconnected; _messageServer.OnException += (RmContext? context, Exception ex, IRmPayload? payload) => { @@ -66,25 +66,31 @@ public ServiceEngine() } - public void NotificationEndpointConnect(Guid connectionId, Guid tunnelId, Guid endpointId, Guid streamId) + /// + ///SEARCH FOR: Process:Endpoint:Connect:003: The local client is communicating through the tunnel that an inbound endpoint + /// connection has been made so that it can make the associated outbound endpoint connection. + /// + /// + /// + /// + /// + public void SendNotificationOfEndpointConnect(Guid connectionId, Guid tunnelId, Guid endpointId, Guid streamId) { - //SEARCH FOR: Process:Endpoint:Connect:003: The local client is communicating through the tunnel that an inbound endpoint - // connection has been made so that it can make the associated outbound endpoint connection. _messageServer.Notify(connectionId, new NotificationEndpointConnect(tunnelId, endpointId, streamId)); } - public void NotificationEndpointExchange(Guid connectionId, Guid tunnelId, Guid endpointId, Guid streamId, byte[] bytes, int length) + public void SendNotificationOfEndpointDataExchange(Guid connectionId, Guid tunnelId, Guid endpointId, Guid streamId, byte[] bytes, int length) { - _messageServer.Notify(connectionId, new NotificationEndpointExchange(tunnelId, endpointId, streamId, bytes, length)); + _messageServer.Notify(connectionId, new NotificationEndpointDataExchange(tunnelId, endpointId, streamId, bytes, length)); } - private void CoreServer_OnConnected(RmContext context) + private void ServiceEngine_OnConnected(RmContext context) { ServiceConnectionStates.Add(context.ConnectionId, new ServiceConnectionState(context.ConnectionId, $"{context.TcpClient.Client.RemoteEndPoint}")); } - private void CoreServer_OnDisconnected(RmContext context) + private void ServiceEngine_OnDisconnected(RmContext context) { ServiceConnectionStates.Remove(context.ConnectionId); } diff --git a/NetTunnel.Service/TunnelEngine/Singletons.cs b/NetTunnel.Service/TunnelEngine/Singletons.cs index 86b97ff..49011c0 100644 --- a/NetTunnel.Service/TunnelEngine/Singletons.cs +++ b/NetTunnel.Service/TunnelEngine/Singletons.cs @@ -5,35 +5,35 @@ namespace NetTunnel.Service.TunnelEngine { internal static class Singletons { - private static ServiceEngine? _core = null; - public static ServiceEngine Core + private static ServiceEngine? _serviceEngine = null; + public static ServiceEngine ServiceEngine { get { - _core ??= new ServiceEngine(); - return _core; + _serviceEngine ??= new ServiceEngine(); + return _serviceEngine; } } - public static void UpdateConfiguration(NtServiceConfiguration configuration) + public static void UpdateConfiguration(ServiceConfiguration configuration) { _configuration = configuration; CommonApplicationData.SaveToDisk(Library.Constants.FriendlyName, _configuration); } - private static NtServiceConfiguration? _configuration = null; - public static NtServiceConfiguration Configuration + private static ServiceConfiguration? _configuration = null; + public static ServiceConfiguration Configuration { get { if (_configuration == null) { - _configuration = CommonApplicationData.LoadFromDisk(Library.Constants.FriendlyName); + _configuration = CommonApplicationData.LoadFromDisk(Library.Constants.FriendlyName); if (_configuration == null) { //We didn't find a config file, create one with default values. - _configuration = new NtServiceConfiguration(); + _configuration = new ServiceConfiguration(); CommonApplicationData.SaveToDisk(Library.Constants.FriendlyName, _configuration); } diff --git a/NetTunnel.Service/TunnelEngine/TunnelBase.cs b/NetTunnel.Service/TunnelEngine/TunnelBase.cs index 5e97681..a5cf429 100644 --- a/NetTunnel.Service/TunnelEngine/TunnelBase.cs +++ b/NetTunnel.Service/TunnelEngine/TunnelBase.cs @@ -28,14 +28,14 @@ public int ChangeHash #region Public Properties. - public NtTunnelConfiguration Configuration { get; private set; } + public TunnelConfiguration Configuration { get; private set; } public NtTunnelStatus Status { get; set; } public ulong BytesReceived { get; set; } public ulong BytesSent { get; set; } public ulong TotalConnections { get; set; } public ulong CurrentConnections { get; set; } - public ServiceEngine Core { get; private set; } + public ServiceEngine ServiceEngine { get; private set; } public bool KeepRunning { get; private set; } = false; //public Guid TunnelId { get; private set; } //public string Name { get; private set; } @@ -44,23 +44,23 @@ public int ChangeHash #endregion - public TunnelBase(ServiceEngine core, NtTunnelConfiguration configuration) + public TunnelBase(ServiceEngine serviceEngine, TunnelConfiguration configuration) { - Core = core; + ServiceEngine = serviceEngine; Configuration = configuration.CloneConfiguration(); Configuration.Endpoints.Where(o => o.Direction == NtDirection.Inbound) - .ToList().ForEach(o => Endpoints.Add(new EndpointInbound(Core, this, o))); + .ToList().ForEach(o => Endpoints.Add(new EndpointInbound(ServiceEngine, this, o))); Configuration.Endpoints.Where(o => o.Direction == NtDirection.Outbound) - .ToList().ForEach(o => Endpoints.Add(new EndpointOutbound(Core, this, o))); + .ToList().ForEach(o => Endpoints.Add(new EndpointOutbound(ServiceEngine, this, o))); } public IEndpoint? GetEndpointById(Guid pairId) => Endpoints.Where(o => o.EndpointId == pairId).SingleOrDefault(); - public NtTunnelConfiguration CloneConfiguration() + public TunnelConfiguration CloneConfiguration() { return Configuration.CloneConfiguration(); } @@ -71,7 +71,7 @@ public virtual void Start() { return; } - Core.Logging.Write(NtLogSeverity.Verbose, + ServiceEngine.Logging.Write(NtLogSeverity.Verbose, $"Starting tunnel '{Configuration.Name}'."); KeepRunning = true; @@ -79,7 +79,7 @@ public virtual void Start() _heartbeatThread = new Thread(HeartbeatThreadProc); _heartbeatThread.Start(); - Core.Logging.Write(NtLogSeverity.Verbose, + ServiceEngine.Logging.Write(NtLogSeverity.Verbose, $"Starting endpoints for tunnel '{Configuration.Name}'."); Endpoints.ForEach(x => x.Start()); @@ -87,7 +87,7 @@ public virtual void Start() public virtual void Stop() { - Core.Logging.Write(NtLogSeverity.Verbose, + ServiceEngine.Logging.Write(NtLogSeverity.Verbose, $"Stopping tunnel '{Configuration.Name}'."); Endpoints.ForEach(o => o.Stop()); @@ -97,19 +97,18 @@ public virtual void Stop() Status = NtTunnelStatus.Stopped; - Core.Logging.Write(NtLogSeverity.Verbose, + ServiceEngine.Logging.Write(NtLogSeverity.Verbose, $"Stopped tunnel '{Configuration.Name}'."); } public void SendEndpointData(Guid endpointId, Guid StreamId, byte[] bytes) { - Endpoints.Where(o => o.EndpointId == endpointId) - .Single().SendEndpointData(StreamId, bytes); + Endpoints.Single(o => o.EndpointId == endpointId).SendEndpointData(StreamId, bytes); } #region Add/Delete Endpoints. - public EndpointInbound UpsertEndpoint(NtEndpointConfiguration configuration) + public EndpointInbound UpsertEndpoint(EndpointConfiguration configuration) { var existingEndpoint = GetEndpointById(configuration.EndpointId); if (existingEndpoint != null) @@ -117,7 +116,7 @@ public EndpointInbound UpsertEndpoint(NtEndpointConfiguration configuration) DeleteEndpoint(existingEndpoint.EndpointId); } - var endpoint = new EndpointInbound(Core, this, configuration); + var endpoint = new EndpointInbound(ServiceEngine, this, configuration); Configuration.Endpoints.Add(configuration); Endpoints.Add(endpoint); return endpoint; @@ -147,7 +146,7 @@ private void HeartbeatThreadProc() if ((DateTime.UtcNow - lastHeartBeat).TotalMilliseconds > Singletons.Configuration.TunnelAndEndpointHeartbeatDelayMs) { //var pingTime = _client.Ping(); - //Core.Logging.Write(NtLogSeverity.Debug, + //ServiceEngine.Logging.Write(NtLogSeverity.Debug, // $"Roundtrip time for '{Configuration.Name}': {pingTime:n0}ms"); ; lastHeartBeat = DateTime.UtcNow; @@ -157,10 +156,10 @@ private void HeartbeatThreadProc() } } - public virtual void NotificationEndpointExchange(Guid tunnelId, Guid endpointId, Guid streamId, byte[] bytes, int length) + public virtual void SendNotificationOfEndpointDataExchange(Guid tunnelId, Guid endpointId, Guid streamId, byte[] bytes, int length) => throw new NotImplementedException("This function should be overridden."); - public virtual void NotificationEndpointConnect(Guid tunnelId, Guid endpointId, Guid streamId) + public virtual void SendNotificationOfEndpointConnect(Guid tunnelId, Guid endpointId, Guid streamId) => throw new NotImplementedException("This function should be overridden."); } } diff --git a/NetTunnel.Service/TunnelEngine/TunnelInbound.cs b/NetTunnel.Service/TunnelEngine/TunnelInbound.cs index 535a8f1..143e5ca 100644 --- a/NetTunnel.Service/TunnelEngine/TunnelInbound.cs +++ b/NetTunnel.Service/TunnelEngine/TunnelInbound.cs @@ -2,26 +2,46 @@ namespace NetTunnel.Service.TunnelEngine { + /// + /// An inbound tunnel does not have a TCP channel, they all share the same + /// ServiceEngine._messageServer to send/receive and route data for the service. + /// internal class TunnelInbound : TunnelBase, ITunnel { public Guid ConnectionId { get; private set; } - public TunnelInbound(ServiceEngine core, Guid connectionId, NtTunnelConfiguration configuration) - : base(core, configuration) + /// + /// When a connection comes in and registers a tunnel, we create a new instance of TunnelInbound + /// with the connectionId of the connection that requested the tunnel registration. + /// + /// That ConnectionId is the id that we use to communicate back to the remove tunnel service. + /// + /// + /// + /// + public TunnelInbound(ServiceEngine serviceEngine, Guid connectionId, TunnelConfiguration configuration) + : base(serviceEngine, configuration) { ConnectionId = connectionId; } - public override void NotificationEndpointExchange(Guid tunnelId, Guid endpointId, Guid streamId, byte[] bytes, int length) + public override void SendNotificationOfEndpointDataExchange(Guid tunnelId, Guid endpointId, Guid streamId, byte[] bytes, int length) { - Core.NotificationEndpointExchange(ConnectionId, tunnelId, endpointId, streamId, bytes, length); + //Inbound tunnels communicate all data through the ServiceEngine._messageServer based on the ConnectionId. + ServiceEngine.SendNotificationOfEndpointDataExchange(ConnectionId, tunnelId, endpointId, streamId, bytes, length); } - public override void NotificationEndpointConnect(Guid tunnelId, Guid endpointId, Guid streamId) + /// + ///SEARCH FOR: Process:Endpoint:Connect:002: client connection is asking us to let the remote service know that a new inbound + /// endpoint connection has been made and that is needs to make the associated outbound endpoint connection. + /// + /// + /// + /// The ID of the remote stream. This is how we identify which actual endpoint connection this connection is paired to. + public override void SendNotificationOfEndpointConnect(Guid tunnelId, Guid endpointId, Guid streamId) { - //SEARCH FOR: Process:Endpoint:Connect:002: client connection is asking us to let the remote service know that a new inbound - // endpoint connection has been made and that is needs to make the associated outbound endpoint connection. - Core.NotificationEndpointConnect(ConnectionId, tunnelId, endpointId, streamId); + //Inbound tunnels communicate all data through the ServiceEngine._messageServer based on the ConnectionId. + ServiceEngine.SendNotificationOfEndpointConnect(ConnectionId, tunnelId, endpointId, streamId); } public override void Start() diff --git a/NetTunnel.Service/TunnelEngine/TunnelOutbound.cs b/NetTunnel.Service/TunnelEngine/TunnelOutbound.cs index f7be4b7..161ddfc 100644 --- a/NetTunnel.Service/TunnelEngine/TunnelOutbound.cs +++ b/NetTunnel.Service/TunnelEngine/TunnelOutbound.cs @@ -9,13 +9,13 @@ namespace NetTunnel.Service.TunnelEngine { internal class TunnelOutbound : TunnelBase, ITunnel { - private readonly NtServiceClient _client; + private readonly ServiceClient _client; private Thread? _establishConnectionThread; - public TunnelOutbound(ServiceEngine core, NtTunnelConfiguration configuration) - : base(core, configuration) + public TunnelOutbound(ServiceEngine serviceEngine, TunnelConfiguration configuration) + : base(serviceEngine, configuration) { - _client = NtServiceClient.Create(Singletons.Configuration, + _client = ServiceClient.Create(Singletons.Configuration, Configuration.Address, Configuration.ManagementPort, Configuration.Username, Configuration.PasswordHash, this); _client.Client.AddHandler(new OutboundTunnelNotificationHandlers()); @@ -26,29 +26,29 @@ public TunnelOutbound(ServiceEngine core, NtTunnelConfiguration configuration) _client.Client.OnException += (context, ex, payload) => { - Core.Logging.Write(NtLogSeverity.Exception, $"RPC client exception: '{ex.Message}'" + ServiceEngine.Logging.Write(NtLogSeverity.Exception, $"RPC client exception: '{ex.Message}'" + (payload != null ? $", Payload: {payload?.GetType()?.Name}" : string.Empty)); }; } - public override void NotificationEndpointExchange(Guid tunnelId, Guid endpointId, Guid streamId, byte[] bytes, int length) + public override void SendNotificationOfEndpointDataExchange(Guid tunnelId, Guid endpointId, Guid streamId, byte[] bytes, int length) => _client.NotificationEndpointExchange(tunnelId, endpointId, streamId, bytes, length); - public override void NotificationEndpointConnect(Guid tunnelId, Guid endpointId, Guid streamId) + public override void SendNotificationOfEndpointConnect(Guid tunnelId, Guid endpointId, Guid streamId) => _client.NotificationEndpointConnect(tunnelId, endpointId, streamId); private void _client_OnDisconnected(RmContext context) { Status = NtTunnelStatus.Disconnected; - Core.Logging.Write(NtLogSeverity.Warning, $"Tunnel '{Configuration.Name}' disconnected."); + ServiceEngine.Logging.Write(NtLogSeverity.Warning, $"Tunnel '{Configuration.Name}' disconnected."); } private void _client_OnConnected(RmContext context) { Status = NtTunnelStatus.Established; - Core.Logging.Write(NtLogSeverity.Verbose, + ServiceEngine.Logging.Write(NtLogSeverity.Verbose, $"Tunnel '{Configuration.Name}' connection successful."); } @@ -87,7 +87,7 @@ private void EstablishConnectionThread() { Status = NtTunnelStatus.Connecting; - Core.Logging.Write(NtLogSeverity.Verbose, + ServiceEngine.Logging.Write(NtLogSeverity.Verbose, $"Tunnel '{Configuration.Name}' connecting to service at {Configuration.Address}:{Configuration.ManagementPort}."); //Make the outbound connection to the remote tunnel service. @@ -105,12 +105,12 @@ private void EstablishConnectionThread() if (ex.SocketErrorCode == SocketError.ConnectionRefused) { - Core.Logging.Write(NtLogSeverity.Warning, + ServiceEngine.Logging.Write(NtLogSeverity.Warning, $"EstablishConnectionThread: {ex.Message}"); } else { - Core.Logging.Write(NtLogSeverity.Exception, + ServiceEngine.Logging.Write(NtLogSeverity.Exception, $"EstablishConnectionThread: {ex.Message}"); } } @@ -118,7 +118,7 @@ private void EstablishConnectionThread() { Status = NtTunnelStatus.Disconnected; //TODO: Are we really disconnected here?? - Core.Logging.Write(NtLogSeverity.Exception, + ServiceEngine.Logging.Write(NtLogSeverity.Exception, $"EstablishConnectionThread: {ex.Message}"); } finally diff --git a/NetTunnel.Service/appsettings.Development.json b/NetTunnel.Service/appsettings.Development.json deleted file mode 100644 index ff66ba6..0000000 --- a/NetTunnel.Service/appsettings.Development.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft.AspNetCore": "Warning" - } - } -} diff --git a/NetTunnel.Service/appsettings.json b/NetTunnel.Service/appsettings.json index 338937e..82213a6 100644 --- a/NetTunnel.Service/appsettings.json +++ b/NetTunnel.Service/appsettings.json @@ -1,10 +1,3 @@ { - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft.AspNetCore": "Warning" - } - }, - "AllowedHosts": "*" } diff --git a/NetTunnel.UI/Forms/FormAddEditEndpoint.cs b/NetTunnel.UI/Forms/FormAddEditEndpoint.cs index fc522b5..e484aa8 100644 --- a/NetTunnel.UI/Forms/FormAddEditEndpoint.cs +++ b/NetTunnel.UI/Forms/FormAddEditEndpoint.cs @@ -8,15 +8,15 @@ namespace NetTunnel.UI.Forms { public partial class FormAddEditEndpoint : Form { - private readonly NtServiceClient? _client; - private readonly NtTunnelConfiguration? _tunnel; + private readonly ServiceClient? _client; + private readonly TunnelConfiguration? _tunnel; private readonly NtDirection _direction = NtDirection.Undefined; - private readonly NtEndpointConfiguration? _existingEndpoint; + private readonly EndpointConfiguration? _existingEndpoint; /// /// Creates a form for a editing an existing endpoint. /// - public FormAddEditEndpoint(NtServiceClient client, NtTunnelConfiguration tunnel, NtEndpointConfiguration existingEndpoint) + public FormAddEditEndpoint(ServiceClient client, TunnelConfiguration tunnel, EndpointConfiguration existingEndpoint) { InitializeComponent(); @@ -33,7 +33,7 @@ public FormAddEditEndpoint(NtServiceClient client, NtTunnelConfiguration tunnel, /// /// Creates a form for a adding a new endpoint. /// - public FormAddEditEndpoint(NtServiceClient client, NtTunnelConfiguration tunnel, NtDirection direction) + public FormAddEditEndpoint(ServiceClient client, TunnelConfiguration tunnel, NtDirection direction) { InitializeComponent(); @@ -119,7 +119,7 @@ private void buttonSave_Click(object sender, EventArgs e) textBoxOutboundAddress.GetAndValidateText("You must specify a termination endpoint address (ip, hostname or domain). "); textBoxOutboundPort.GetAndValidateNumeric(1, 65535, "You must specify a valid termination port between [min] and [max]."); - var endpointHttpHeaderRules = new List(); + var endpointHttpHeaderRules = new List(); foreach (DataGridViewRow row in dataGridViewHTTPHeaders.Rows) { @@ -127,7 +127,7 @@ private void buttonSave_Click(object sender, EventArgs e) { var headerType = Enum.Parse($"{row.Cells[columnType.Index].Value}"); - endpointHttpHeaderRules.Add(new NtHttpHeaderRule + endpointHttpHeaderRules.Add(new HttpHeaderRule { Enabled = bool.Parse(row.Cells[columnEnabled.Index].Value?.ToString() ?? "True"), HeaderType = Enum.Parse($"{row.Cells[columnType.Index].Value}"), @@ -141,7 +141,7 @@ private void buttonSave_Click(object sender, EventArgs e) var endpointId = _existingEndpoint?.EndpointId ?? Guid.NewGuid(); //The endpointId is the same on both services. - var endpoint = new NtEndpointConfiguration(endpointId, _direction, + var endpoint = new EndpointConfiguration(endpointId, _direction, textBoxName.Text, textBoxOutboundAddress.Text, textBoxInboundPort.ValueAs(), textBoxOutboundPort.ValueAs(), endpointHttpHeaderRules, Enum.Parse($"{comboBoxTrafficType.SelectedValue}")); diff --git a/NetTunnel.UI/Forms/FormAddUser.cs b/NetTunnel.UI/Forms/FormAddUser.cs index b581fbf..d833812 100644 --- a/NetTunnel.UI/Forms/FormAddUser.cs +++ b/NetTunnel.UI/Forms/FormAddUser.cs @@ -7,15 +7,15 @@ namespace NetTunnel.UI.Forms { public partial class FormAddUser : Form { - private readonly NtServiceClient? _client; - public NtUser? CreatedUser { get; set; } + private readonly ServiceClient? _client; + public User? CreatedUser { get; set; } public FormAddUser() { InitializeComponent(); } - public FormAddUser(NtServiceClient? client) + public FormAddUser(ServiceClient? client) { InitializeComponent(); @@ -38,7 +38,7 @@ private void buttonSave_Click(object sender, EventArgs e) if (textBoxPassword.Text != textBoxConfirmPassword.Text) throw new Exception("The password and confirm-passwords must match."); - CreatedUser = new NtUser(textBoxUsername.Text, Utility.ComputeSha256Hash(textBoxPassword.Text)); + CreatedUser = new User(textBoxUsername.Text, Utility.ComputeSha256Hash(textBoxPassword.Text)); buttonSave.InvokeEnableControl(false); diff --git a/NetTunnel.UI/Forms/FormChangeUserPassword.cs b/NetTunnel.UI/Forms/FormChangeUserPassword.cs index 4b7672b..26c4951 100644 --- a/NetTunnel.UI/Forms/FormChangeUserPassword.cs +++ b/NetTunnel.UI/Forms/FormChangeUserPassword.cs @@ -7,15 +7,15 @@ namespace NetTunnel.UI.Forms { public partial class FormChangeUserPassword : Form { - private readonly NtServiceClient? _client; - public NtUser? User { get; private set; } + private readonly ServiceClient? _client; + public User? User { get; private set; } public FormChangeUserPassword() { InitializeComponent(); } - public FormChangeUserPassword(NtServiceClient? client, NtUser user) + public FormChangeUserPassword(ServiceClient? client, User user) { InitializeComponent(); @@ -42,7 +42,7 @@ private void buttonSave_Click(object sender, EventArgs e) if (textBoxPassword.Text != textBoxConfirmPassword.Text) throw new Exception("The password and confirm-passwords must match."); - var user = new NtUser(textBoxUsername.Text, Utility.ComputeSha256Hash(textBoxPassword.Text)); + var user = new User(textBoxUsername.Text, Utility.ComputeSha256Hash(textBoxPassword.Text)); buttonSave.InvokeEnableControl(false); /* diff --git a/NetTunnel.UI/Forms/FormConnectTunnel.cs b/NetTunnel.UI/Forms/FormConnectTunnel.cs index 8d5752a..c9bda10 100644 --- a/NetTunnel.UI/Forms/FormConnectTunnel.cs +++ b/NetTunnel.UI/Forms/FormConnectTunnel.cs @@ -7,14 +7,14 @@ namespace NetTunnel.UI.Forms { public partial class FormConnectTunnel : Form { - private readonly NtServiceClient? _client; + private readonly ServiceClient? _client; public FormConnectTunnel() { InitializeComponent(); } - public FormConnectTunnel(NtServiceClient client) + public FormConnectTunnel(ServiceClient client) { InitializeComponent(); @@ -71,7 +71,7 @@ private void buttonConnect_Click(object sender, EventArgs e) var tunnelId = Guid.NewGuid(); //The TunnelId is the same on both services. - var tunnel = new NtTunnelConfiguration(_client.ServiceId, tunnelId, textBoxName.Text, + var tunnel = new TunnelConfiguration(_client.ServiceId, tunnelId, textBoxName.Text, textBoxRemoteAddress.Text, textBoxManagementPort.ValueAs(), textBoxRemoteUsername.Text, Utility.ComputeSha256Hash(textBoxRemotePassword.Text)); @@ -81,7 +81,7 @@ private void buttonConnect_Click(object sender, EventArgs e) try { //Just to test the login. - var remoteClient = NtServiceClient.CreateConnectAndLogin(tunnel.Address, + var remoteClient = ServiceClient.CreateConnectAndLogin(tunnel.Address, tunnel.ManagementPort, tunnel.Username, tunnel.PasswordHash).ContinueWith(async x => { if (!x.IsCompletedSuccessfully) diff --git a/NetTunnel.UI/Forms/FormLogin.cs b/NetTunnel.UI/Forms/FormLogin.cs index 9d14ce7..a2e88ac 100644 --- a/NetTunnel.UI/Forms/FormLogin.cs +++ b/NetTunnel.UI/Forms/FormLogin.cs @@ -6,7 +6,7 @@ namespace NetTunnel.UI.Forms { public partial class FormLogin : Form { - public NtServiceClient? ResultingClient { get; private set; } = null; + public ServiceClient? ResultingClient { get; private set; } = null; public FormLogin() { @@ -39,7 +39,7 @@ private void buttonLogin_Click(object sender, EventArgs e) string passwordHash = Utility.ComputeSha256Hash(textBoxPassword.Text); string address = textBoxAddress.GetAndValidateText("A hostname or IP address is required."); - NtServiceClient.CreateConnectAndLogin(address, port, username, passwordHash).ContinueWith(x => + ServiceClient.CreateConnectAndLogin(address, port, username, passwordHash).ContinueWith(x => { if (!x.IsCompletedSuccessfully) { diff --git a/NetTunnel.UI/Forms/FormMain.cs b/NetTunnel.UI/Forms/FormMain.cs index 3478932..e63fdd4 100644 --- a/NetTunnel.UI/Forms/FormMain.cs +++ b/NetTunnel.UI/Forms/FormMain.cs @@ -11,7 +11,7 @@ public partial class FormMain : Form private int _allTunnelAndEndpointHashes = -1; private bool _needToRepopulateTunnels = false; - private Library.NtServiceClient? _client; + private Library.ServiceClient? _client; private bool _inTimerTick = false; private volatile int _gridPopulationScope = 0; @@ -151,7 +151,7 @@ private void _timer_Tick(object? sender, EventArgs e) - void PopulateEndpointStatistics(List statistics) + void PopulateEndpointStatistics(List statistics) { if (listViewEndpoints.InvokeRequired) { @@ -198,7 +198,7 @@ void PopulateEndpointStatistics(List statistics) } } - void PopulateTunnelStatistics(List statistics) + void PopulateTunnelStatistics(List statistics) { if (listViewTunnels.InvokeRequired) { @@ -651,7 +651,7 @@ private void RepopulateTunnelsGrid_LockRequired() }); - void AddTunnelToGrid(NtTunnelConfiguration tunnel) + void AddTunnelToGrid(TunnelConfiguration tunnel) { if (listViewTunnels.InvokeRequired) { @@ -672,7 +672,7 @@ void AddTunnelToGrid(NtTunnelConfiguration tunnel) } } - private void RepopulateEndpointsGrid(NtTunnelConfiguration tunnel) + private void RepopulateEndpointsGrid(TunnelConfiguration tunnel) { try { @@ -691,7 +691,7 @@ private void RepopulateEndpointsGrid(NtTunnelConfiguration tunnel) } } - private void RepopulateEndpointsGrid_LockRequired(NtTunnelConfiguration tunnel) + private void RepopulateEndpointsGrid_LockRequired(TunnelConfiguration tunnel) { listViewEndpoints.Items.Clear(); @@ -701,7 +701,7 @@ private void RepopulateEndpointsGrid_LockRequired(NtTunnelConfiguration tunnel) tunnel.Endpoints.Where(o => o.Direction == NtDirection.Outbound) .ToList().ForEach(x => AddEndpointOutboundToGrid(tunnel, x)); - void AddEndpointInboundToGrid(NtTunnelConfiguration tunnel, NtEndpointConfiguration endpoint) + void AddEndpointInboundToGrid(TunnelConfiguration tunnel, EndpointConfiguration endpoint) { if (listViewEndpoints.InvokeRequired) { @@ -722,7 +722,7 @@ void AddEndpointInboundToGrid(NtTunnelConfiguration tunnel, NtEndpointConfigurat } } - void AddEndpointOutboundToGrid(NtTunnelConfiguration tunnel, NtEndpointConfiguration endpoint) + void AddEndpointOutboundToGrid(TunnelConfiguration tunnel, EndpointConfiguration endpoint) { if (listViewEndpoints.InvokeRequired) { diff --git a/NetTunnel.UI/Forms/FormServiceConfiguration.cs b/NetTunnel.UI/Forms/FormServiceConfiguration.cs index 8eaf645..ba64de1 100644 --- a/NetTunnel.UI/Forms/FormServiceConfiguration.cs +++ b/NetTunnel.UI/Forms/FormServiceConfiguration.cs @@ -6,14 +6,14 @@ namespace NetTunnel.UI.Forms { public partial class FormServiceConfiguration : Form { - private readonly NtServiceClient? _client; + private readonly ServiceClient? _client; public FormServiceConfiguration() { InitializeComponent(); } - public FormServiceConfiguration(NtServiceClient client) + public FormServiceConfiguration(ServiceClient client) { InitializeComponent(); @@ -72,7 +72,7 @@ public FormServiceConfiguration(NtServiceClient client) CancelButton = buttonCancel; } - public void SetFormConfigurationValues(NtServiceConfiguration configuration) + public void SetFormConfigurationValues(ServiceConfiguration configuration) { if (InvokeRequired) { @@ -99,7 +99,7 @@ private void buttonSave_Click(object sender, EventArgs e) { try { - var configuration = new NtServiceConfiguration(); + var configuration = new ServiceConfiguration(); #region Get and validate form values . diff --git a/NetTunnel.UI/Forms/FormUsers.cs b/NetTunnel.UI/Forms/FormUsers.cs index ca67dd4..e70f71c 100644 --- a/NetTunnel.UI/Forms/FormUsers.cs +++ b/NetTunnel.UI/Forms/FormUsers.cs @@ -6,14 +6,14 @@ namespace NetTunnel.UI.Forms { public partial class FormUsers : Form { - private readonly NtServiceClient? _client; + private readonly ServiceClient? _client; public FormUsers() { InitializeComponent(); } - public FormUsers(NtServiceClient client) + public FormUsers(ServiceClient client) { InitializeComponent(); _client = client; @@ -34,7 +34,7 @@ private void FormUsers_Load(object sender, EventArgs e) */ } - void AddUserToGrid(NtUser? user) + void AddUserToGrid(User? user) { if (user == null) return; diff --git a/NetTunnel.sln b/NetTunnel.sln index c104ceb..32d352b 100644 --- a/NetTunnel.sln +++ b/NetTunnel.sln @@ -15,8 +15,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution @Installers\Standalone Management.Iss = @Installers\Standalone Management.Iss EndProjectSection EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NTDLS.ReliableMessaging", "..\NTDLS.ReliableMessaging\NTDLS.ReliableMessaging\NTDLS.ReliableMessaging.csproj", "{D92FA60C-2EF3-40B5-8465-4DEDF272F3EC}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -35,10 +33,6 @@ Global {1D602D6B-348B-41FE-ABC8-9A98FD6CD247}.Debug|Any CPU.Build.0 = Debug|Any CPU {1D602D6B-348B-41FE-ABC8-9A98FD6CD247}.Release|Any CPU.ActiveCfg = Release|Any CPU {1D602D6B-348B-41FE-ABC8-9A98FD6CD247}.Release|Any CPU.Build.0 = Release|Any CPU - {D92FA60C-2EF3-40B5-8465-4DEDF272F3EC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D92FA60C-2EF3-40B5-8465-4DEDF272F3EC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D92FA60C-2EF3-40B5-8465-4DEDF272F3EC}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D92FA60C-2EF3-40B5-8465-4DEDF272F3EC}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE