示例#1
0
文件: listen.cs 项目: spofa/onesafe
        public void DoWork()
        {
            _httpListener.Prefixes.Add("http://127.0.0.1:7878/"); // add prefix "http://localhost:5000/"
            _httpListener.Start();                                // start server (Run application as Administrator!)


            Thread t = new Thread(() =>
            {
                // Call update class fetch server info


                FetchServerIP = "127.0.0.1";


                //  MessageBox.Show("listen" + FetchServerIP);

                // Call update class fetch server info


                // setting proxy address to IE
                obfsproxy.proxy proxy = new obfsproxy.proxy();
                proxy.SetSquidProxy("http://127.0.0.1:7878");
                // setting proxy address to IE



                while (true)
                {
                    try

                    {
                        Downloadfilename1 = Downloadfilename.Replace("ServerIP", FetchServerIP);



                        context = _httpListener.GetContext();                              // get a context
                                                                                           // Now, you'll find the request URL in context.Request.Url
                        byte[] _responseArray = Encoding.UTF8.GetBytes(Downloadfilename1); // get the bytes to response


                        context.Response.OutputStream.Write(_responseArray, 0, _responseArray.Length); // write bytes to the output stream
                        context.Response.KeepAlive = false;                                            // set the KeepAlive bool to false
                        context.Response.Close();                                                      // close the connection
                                                                                                       //  label2.Text = label2.Text + "开始响应";
                        Console.WriteLine("Respone given to a request.");

                        Thread.Sleep(5000);
                    }


                    catch (Exception e)
                    {
                    }
                }
            });

            _threadList.Add(t);
            t.Start();
        }
示例#2
0
        private void global_Click(object sender, EventArgs e)
        {
            obfsproxy.proxy proxy = new obfsproxy.proxy();

            StatusInfo.Text = "Obfsproxy mode : obfs4  模式: 全局";

            proxy.AdslSetSquidProxy("127.0.0.1", "1012");


            smart.Checked = false;
        }
示例#3
0
        private void smart_Click(object sender, EventArgs e)
        {
            StatusInfo.Text = "Obfsproxy mode : obfs4 模式: 智能";



            obfsproxy.proxy proxy = new obfsproxy.proxy();

            proxy.SetSquidProxy("http://127.0.0.1:7878");


            global.Checked = false;
        }
示例#4
0
        private void 退出ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Killobfsproxy();

            obfsproxy.proxy proxy = new obfsproxy.proxy();

            proxy.CancelProxySetting();

            notifyIcon1.Icon = null;
            notifyIcon1.Dispose();
            //  MessageBox.Show("TEST");
            Application.DoEvents();
            System.Environment.Exit(0);
        }