コード例 #1
0
ファイル: PACServer.cs プロジェクト: jiahua90/V2RayGCon-1
        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);
        }
コード例 #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);
        }
コード例 #3
0
 public void Reload()
 {
     oldCustomPacList = setting.GetCustomPacSetting();
     rtboxWhiteList?.Invoke((MethodInvoker) delegate
     {
         InitControls();
     });
 }
コード例 #4
0
 public void Reload()
 {
     oldCustomPacList = setting.GetCustomPacSetting();
     VgcApis.Libs.UI.RunInUiThread(rtboxWhiteList, () =>
     {
         InitControls();
     });
 }
コード例 #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();
        }
コード例 #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();
        }
コード例 #7
0
 public void Reload()
 {
     oldCustomPacList = setting.GetCustomPacSetting();
     VgcApis.Misc.UI.Invoke(InitControls);
 }