3using System.Threading.Tasks;
14 private static readonly Dictionary<string, ProxyPort> proxies =
new Dictionary<string, ProxyPort>();
27 public static string GetKey(
string Host,
int Port,
bool Tls,
bool TrustServer,
int ListeningPort,
bool AuthorizedAccess,
IpCidr[] RemoteIps)
29 StringBuilder sb =
new StringBuilder();
32 sb.AppendLine(Port.ToString());
33 sb.AppendLine(Tls.ToString());
34 sb.AppendLine(TrustServer.ToString());
35 sb.AppendLine(ListeningPort.ToString());
36 sb.AppendLine(AuthorizedAccess.ToString());
38 if (!(RemoteIps is
null))
40 foreach (
IpCidr Range
in RemoteIps)
42 sb.AppendLine(Range.
Address.ToString());
43 sb.AppendLine(Range.
Range.ToString());
63 public static async Task<ProxyPort>
GetProxy(
IpHostPortProxy Node,
string Key,
string Host,
int Port,
bool Tls,
bool TrustServer,
int ListeningPort,
64 bool AuthorizedAccess,
IpCidr[] RemoteIps)
70 if (!proxies.TryGetValue(Key, out Proxy))
78 Proxy = await
ProxyPort.
Create(Node, Host, Port, Tls, TrustServer, ListeningPort, AuthorizedAccess, RemoteIps);
82 if (proxies.ContainsKey(Key))
106 if (!proxies.TryGetValue(Key, out Proxy))
IP Address Rangee, expressed using CIDR format.
IPAddress Address
Parsed IP Address
Contains methods for simple hash calculations.
static string ComputeSHA1HashString(byte[] Data)
Computes the SHA-1 hash of a block of binary data.
Node representing a proxy port node.
Node acting as a TCP/IP proxy opening a port for incoming communication and proxying it to another po...
void Remove(ProxyClientConncetion Connection)
Removes a proxy client connection.
void Dispose()
IDisposable.Dispose
static async Task< ProxyPort > Create(IpHostPortProxy Node, string Host, int Port, bool Tls, bool TrustServer, int ListeningPort, bool AuthorizedAccess, IpCidr[] RemoteIps)
Creates a port proxy object.
Static class managing Port Proxies.
static async Task< ProxyPort > GetProxy(IpHostPortProxy Node, string Key, string Host, int Port, bool Tls, bool TrustServer, int ListeningPort, bool AuthorizedAccess, IpCidr[] RemoteIps)
Gets a TCP/IP proxy node
static void DestroyProxy(string Key)
Destroys a proxy node
static string GetKey(string Host, int Port, bool Tls, bool TrustServer, int ListeningPort, bool AuthorizedAccess, IpCidr[] RemoteIps)
Gets sort key for Port Proxy