Skip to content

Commit

Permalink
Readded RM nuget.
Browse files Browse the repository at this point in the history
  • Loading branch information
NTDLS committed Jun 8, 2024
1 parent 992f9a6 commit 16ea21b
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 16 deletions.
4 changes: 2 additions & 2 deletions NetTunnel.Service/FramePayloads/EncryptionProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public byte[] Decrypt(byte[] encryptedPayload)
{
lock (_streamCryptography)
{
Console.WriteLine($"Decrypt {encryptedPayload.Length:n0} bytes.");
//Console.WriteLine($"Decrypt {encryptedPayload.Length:n0} bytes.");
_streamCryptography.Cipher(ref encryptedPayload);
_streamCryptography.ResetStream();
}
Expand All @@ -27,7 +27,7 @@ public byte[] Encrypt(byte[] payload)
{
lock (_streamCryptography)
{
Console.WriteLine($"Encrypt {payload.Length:n0} bytes.");
//Console.WriteLine($"Encrypt {payload.Length:n0} bytes.");
_streamCryptography.Cipher(ref payload);
_streamCryptography.ResetStream();
}
Expand Down
2 changes: 1 addition & 1 deletion NetTunnel.Service/NetTunnel.Service.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.6" />
<PackageReference Include="NTDLS.NASCCL" Version="1.1.1" />
<PackageReference Include="NTDLS.ReliableMessaging" Version="1.7.6" />
<PackageReference Include="NTDLS.SecureKeyExchange" Version="2.2.1" />
<PackageReference Include="NTDLS.Semaphore" Version="3.3.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.6.2" />
<PackageReference Include="Topshelf" Version="4.3.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\NTDLS.ReliableMessaging\NTDLS.ReliableMessaging\NTDLS.ReliableMessaging.csproj" />
<ProjectReference Include="..\NetTunnel.ClientAPI\NetTunnel.ClientAPI.csproj" />
<ProjectReference Include="..\NetTunnel.Library\NetTunnel.Library.csproj" />
</ItemGroup>
Expand Down
20 changes: 15 additions & 5 deletions NetTunnel.Service/TunnelEngine/Endpoints/EndpointInbound.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,21 @@ internal class EndpointInbound : BaseEndpoint, IEndpoint
{
private Thread? _inboundConnectionThread;

private readonly TcpListener _listener;
private TcpListener? _listener;
private readonly NtEndpointInboundConfiguration _configuration;

public EndpointInbound(TunnelEngineCore core, ITunnel tunnel, NtEndpointInboundConfiguration configuration)
: base(core, tunnel, configuration.EndpointId, configuration.Name, configuration.TransmissionPort)
{
_listener = new TcpListener(IPAddress.Any, configuration.TransmissionPort);
_configuration = configuration;
}

public override void Start()
{
base.Start();

_listener = new TcpListener(IPAddress.Any, _configuration.TransmissionPort);

_tunnel.Core.Logging.Write(Constants.NtLogSeverity.Verbose, $"Starting inbound endpoint '{Name}' on port {TransmissionPort}.");

_inboundConnectionThread = new Thread(InboundConnectionThreadProc);
Expand All @@ -35,7 +38,11 @@ public override void Stop()
{
base.Stop();

Utility.TryAndIgnore(_listener.Stop);
if (_listener != null)
{
Utility.TryAndIgnore(_listener.Stop);
Utility.TryAndIgnore(_listener.Dispose);
}

_tunnel.Core.Logging.Write(Constants.NtLogSeverity.Verbose, $"Stopping inbound endpoint '{Name}' on port {TransmissionPort}.");

Expand All @@ -57,7 +64,7 @@ void InboundConnectionThreadProc()

try
{
_listener.Start();
_listener.EnsureNotNull().Start();

_core.Logging.Write(Constants.NtLogSeverity.Verbose, $"Listening inbound endpoint '{Name}' on port {TransmissionPort}");

Expand Down Expand Up @@ -87,7 +94,10 @@ void InboundConnectionThreadProc()
}
finally
{
Utility.TryAndIgnore(_listener.Stop);
if (_listener != null)
{
Utility.TryAndIgnore(_listener.Stop);
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,6 @@ public void DeleteEndpoint(Guid tunnelId, Guid endpointId)
endpoint.Stop();
tunnel.DeleteEndpoint(endpointId);
endpoint.Start();
});
}

Expand Down
6 changes: 0 additions & 6 deletions NetTunnel.sln
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
@Installers\Installer.Iss = @Installers\Installer.Iss
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NTDLS.ReliableMessaging", "..\NTDLS.ReliableMessaging\NTDLS.ReliableMessaging\NTDLS.ReliableMessaging.csproj", "{04467632-7717-4A9E-A1E9-628957D16CA0}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -40,10 +38,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
{04467632-7717-4A9E-A1E9-628957D16CA0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{04467632-7717-4A9E-A1E9-628957D16CA0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{04467632-7717-4A9E-A1E9-628957D16CA0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{04467632-7717-4A9E-A1E9-628957D16CA0}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down

0 comments on commit 16ea21b

Please sign in to comment.