Esempio n. 1
0
 private void button1_Click(object sender, EventArgs e)
 {
     label4.Text = "";
     if (string.IsNullOrWhiteSpace(textBox1.Text) && !checkBox1.Checked)
     {
         label4.Text = "You Must enter a Login. ";
     }
     if (string.IsNullOrWhiteSpace(textBox2.Text) && !checkBox1.Checked)
     {
         label4.Text += "You Must enter a Password. ";
     }
     if (string.IsNullOrWhiteSpace(label4.Text))
     {
         var a = new ProxyAuth(textBox1.Text, textBox2.Text, checkBox1.Checked);
         if (a.Authenticated)
         {
             if (OnLoginSuccessEvent != null)
             {
                 OnLoginSuccessEvent(a);
             }
         }
         else
         {
             label4.Text = "Failed to authenticate, try again.";
         }
     }
 }
Esempio n. 2
0
 private void StopService()
 {
     if (_Hub != null)
     {
         _Hub.Dispose();
     }
     _ProxyAuth = null;
 }
Esempio n. 3
0
        /// <summary>
        /// Adds a new endpoint to the local proxy server
        /// </summary>
        /// <param name="auth">ProxyAuth</param>
        /// <returns>Port where the new proxy will be opened</returns>
        public int AddEndpoint(ProxyAuth auth)
        {
            IPGlobalProperties ipGlobalProperties = IPGlobalProperties.GetIPGlobalProperties();

            IPEndPoint[] conArr = ipGlobalProperties.GetActiveTcpListeners();

            for (int i = 50000; i < 60000; i++)
            {
                if (conArr.Any(x => x.Port == i))
                {
                    continue;
                }

                proxyServer.AddEndPoint(new ExplicitProxyEndPoint(IPAddress.Any, i, true));

                proxyAuths.Add(i, auth);
                return(i);
            }
            throw new Exception("Couldn't find any available tcp port!");
        }
Esempio n. 4
0
 void _Login_OnLoginSuccessEvent(ProxyAuth auth)
 {
     tabPage2.Controls.Clear();
     tabPage2.Controls.Add(_ProxyClients);
     _ProxyClients.ProxyAuth = auth;
 }