Example #1
0
        public string GetCurPacFileContent()
        {
            var bs        = setting.GetBasicSetting();
            var url       = VgcApis.Models.Consts.Webs.FakeRequestUrl;
            var reqParams = GenReqParamFromUrl(url, bs);

            var pacResp = pacGenerator.GenPacFileResponse(
                bs.isUseCustomPac,
                reqParams,
                setting.GetCustomPacSetting(),
                customPacFileCache);

            return(pacResp.Item1);
        }
Example #2
0
        void WebRequestDispatcher(HttpListenerContext context)
        {
            var request = context.Request;

            // e.g. http://localhost:3000/pac/?&port=5678&ip=1.2.3.4&proto=socks&type=whitelist&key=rnd
            var reqUrl      = request.Url.AbsoluteUri;
            var queryParams = Lib.Utils.GetQureryParamsFrom(reqUrl);

            var bs        = setting.GetBasicSetting();
            var defValues = new Model.Data.QueryParams(bs);

            queryParams.ReplaceNullValueWith(defValues);
            var pacParams = queryParams.ToPacUrlParams();

            var pacResp = pacGenerator.GenPacFileResponse(
                bs.isUseCustomPac,
                pacParams,
                setting.GetCustomPacSetting(),
                customPacFileCache);

            var response = context.Response;

            if (!pacParams.isDebug)
            {
                Write(response, pacResp.Item1, pacResp.Item2);
                return;
            }

            var debugResp = GenPacDebuggerResponse(
                GenPrefix(bs.pacServPort),
                pacResp.Item1);

            Write(response, debugResp.Item1, debugResp.Item2);
        }
Example #3
0
 public void Reload()
 {
     oldCustomPacList = setting.GetCustomPacSetting();
     rtboxWhiteList?.Invoke((MethodInvoker) delegate
     {
         InitControls();
     });
 }
Example #4
0
 public void Reload()
 {
     oldCustomPacList = setting.GetCustomPacSetting();
     VgcApis.Libs.UI.RunInUiThread(rtboxWhiteList, () =>
     {
         InitControls();
     });
 }
Example #5
0
        public TabPacCustomList(
            Services.PsSettings setting,

            RichTextBox rtboxWhiteList,
            RichTextBox rtboxBlackList)
        {
            this.setting = setting;

            // oldCustomPacList != customPacList
            oldCustomPacList = setting.GetCustomPacSetting();

            this.rtboxBlackList = rtboxBlackList;
            this.rtboxWhiteList = rtboxWhiteList;

            InitControls();
        }
Example #6
0
        public TabPacCustomList(
            Services.PsSettings setting,

            RichTextBox rtboxWhiteList,
            RichTextBox rtboxBlackList,

            Button btnSetSortWhitelist,
            Button btnSetSortBlacklist)
        {
            this.setting = setting;

            // oldCustomPacList != customPacList
            oldCustomPacList = setting.GetCustomPacSetting();

            this.rtboxBlackList      = rtboxBlackList;
            this.rtboxWhiteList      = rtboxWhiteList;
            this.btnSetSortWhitelist = btnSetSortWhitelist;
            this.btnSetSortBlacklist = btnSetSortBlacklist;

            InitControls();
            BindEvents();
        }
Example #7
0
 public void Reload()
 {
     oldCustomPacList = setting.GetCustomPacSetting();
     VgcApis.Misc.UI.Invoke(InitControls);
 }