1using System.Collections.Generic;
3using System.Threading.Tasks;
13 private static readonly Dictionary<string, ProxyPort> proxies =
new Dictionary<string, ProxyPort>();
26 public static string GetKey(
string Host,
int Port,
bool Tls,
bool TrustServer,
int ListeningPort,
bool AuthorizedAccess,
IpCidr[] RemoteIps)
28 StringBuilder sb =
new StringBuilder();
31 sb.AppendLine(Port.ToString());
32 sb.AppendLine(Tls.ToString());
33 sb.AppendLine(TrustServer.ToString());
34 sb.AppendLine(ListeningPort.ToString());
35 sb.AppendLine(AuthorizedAccess.ToString());
37 if (!(RemoteIps is
null))
39 foreach (
IpCidr Range
in RemoteIps)
41 sb.AppendLine(Range.
Address.ToString());
42 sb.AppendLine(Range.
Range.ToString());
62 public static async Task<ProxyPort>
GetProxy(
IpHostPortProxy Node,
string Key,
string Host,
int Port,
bool Tls,
bool TrustServer,
int ListeningPort,
63 bool AuthorizedAccess,
IpCidr[] RemoteIps)
69 if (!proxies.TryGetValue(Key, out Proxy))
77 Proxy = await
ProxyPort.
Create(Node, Host, Port, Tls, TrustServer, ListeningPort, AuthorizedAccess, RemoteIps);
81 if (proxies.ContainsKey(Key))
105 if (!proxies.TryGetValue(Key, out Proxy))
Contains methods for simple hash calculations.
static string ComputeSHA1HashString(byte[] Data)
Computes the SHA-1 hash of a block of binary data.
IP Address Rangee, expressed using CIDR format.
IPAddress Address
Parsed IP Address
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