feat: Initialize Zastava Webhook service with TLS and Authority authentication
- Added Program.cs to set up the web application with Serilog for logging, health check endpoints, and a placeholder admission endpoint. - Configured Kestrel server to use TLS 1.3 and handle client certificates appropriately. - Created StellaOps.Zastava.Webhook.csproj with necessary dependencies including Serilog and Polly. - Documented tasks in TASKS.md for the Zastava Webhook project, outlining current work and exit criteria for each task.
This commit is contained in:
38
Mongo2Go-4.1.0/src/Mongo2Go/Helper/PortWatcher.cs
Normal file
38
Mongo2Go-4.1.0/src/Mongo2Go/Helper/PortWatcher.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Net.Sockets;
|
||||
|
||||
namespace Mongo2Go.Helper
|
||||
{
|
||||
public class PortWatcher : IPortWatcher
|
||||
{
|
||||
public int FindOpenPort()
|
||||
{
|
||||
// Locate a free port on the local machine by binding a socket to
|
||||
// an IPEndPoint using IPAddress.Any and port 0. The socket will
|
||||
// select a free port.
|
||||
int listeningPort = 0;
|
||||
Socket portSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
|
||||
try
|
||||
{
|
||||
IPEndPoint socketEndPoint = new IPEndPoint(IPAddress.Any, 0);
|
||||
portSocket.Bind(socketEndPoint);
|
||||
socketEndPoint = (IPEndPoint)portSocket.LocalEndPoint;
|
||||
listeningPort = socketEndPoint.Port;
|
||||
}
|
||||
finally
|
||||
{
|
||||
portSocket.Close();
|
||||
}
|
||||
|
||||
return listeningPort;
|
||||
}
|
||||
|
||||
public bool IsPortAvailable(int portNumber)
|
||||
{
|
||||
IPEndPoint[] tcpConnInfoArray = IPGlobalProperties.GetIPGlobalProperties().GetActiveTcpListeners();
|
||||
return tcpConnInfoArray.All(endpoint => endpoint.Port != portNumber);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user