diff --git a/v2rayN/v2rayN/Forms/MainForm.Designer.cs b/v2rayN/v2rayN/Forms/MainForm.Designer.cs index d87e1cbf74a..773021fadb1 100644 --- a/v2rayN/v2rayN/Forms/MainForm.Designer.cs +++ b/v2rayN/v2rayN/Forms/MainForm.Designer.cs @@ -60,12 +60,12 @@ private void InitializeComponent() this.menuExport2ServerConfig = new System.Windows.Forms.ToolStripMenuItem(); this.menuExport2ShareUrl = new System.Windows.Forms.ToolStripMenuItem(); this.menuExport2SubContent = new System.Windows.Forms.ToolStripMenuItem(); - this.qrCodeControl = new v2rayN.Forms.QRCodeControl(); this.tsbServer = new System.Windows.Forms.ToolStripDropDownButton(); + this.qrCodeControl = new v2rayN.Forms.QRCodeControl(); this.notifyMain = new System.Windows.Forms.NotifyIcon(this.components); this.cmsMain = new System.Windows.Forms.ContextMenuStrip(this.components); - this.menuSysAgentEnabled = new System.Windows.Forms.ToolStripMenuItem(); this.menuSysAgentMode = new System.Windows.Forms.ToolStripMenuItem(); + this.menuNotEnabledHttp = new System.Windows.Forms.ToolStripMenuItem(); this.menuGlobal = new System.Windows.Forms.ToolStripMenuItem(); this.menuGlobalPAC = new System.Windows.Forms.ToolStripMenuItem(); this.menuKeep = new System.Windows.Forms.ToolStripMenuItem(); @@ -355,11 +355,6 @@ private void InitializeComponent() resources.ApplyResources(this.menuExport2SubContent, "menuExport2SubContent"); this.menuExport2SubContent.Click += new System.EventHandler(this.menuExport2SubContent_Click); // - // qrCodeControl - // - resources.ApplyResources(this.qrCodeControl, "qrCodeControl"); - this.qrCodeControl.Name = "qrCodeControl"; - // // tsbServer // this.tsbServer.DropDown = this.cmsLv; @@ -367,6 +362,11 @@ private void InitializeComponent() resources.ApplyResources(this.tsbServer, "tsbServer"); this.tsbServer.Name = "tsbServer"; // + // qrCodeControl + // + resources.ApplyResources(this.qrCodeControl, "qrCodeControl"); + this.qrCodeControl.Name = "qrCodeControl"; + // // notifyMain // this.notifyMain.ContextMenuStrip = this.cmsMain; @@ -378,7 +378,6 @@ private void InitializeComponent() this.cmsMain.ImageScalingSize = new System.Drawing.Size(20, 20); resources.ApplyResources(this.cmsMain, "cmsMain"); this.cmsMain.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.menuSysAgentEnabled, this.menuSysAgentMode, this.menuServers, this.menuAddServers2, @@ -391,15 +390,10 @@ private void InitializeComponent() this.cmsMain.ShowCheckMargin = true; this.cmsMain.ShowImageMargin = false; // - // menuSysAgentEnabled - // - this.menuSysAgentEnabled.Name = "menuSysAgentEnabled"; - resources.ApplyResources(this.menuSysAgentEnabled, "menuSysAgentEnabled"); - this.menuSysAgentEnabled.Click += new System.EventHandler(this.menuSysAgentEnabled_Click); - // // menuSysAgentMode // this.menuSysAgentMode.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.menuNotEnabledHttp, this.menuGlobal, this.menuGlobalPAC, this.menuKeep, @@ -407,6 +401,12 @@ private void InitializeComponent() this.menuSysAgentMode.Name = "menuSysAgentMode"; resources.ApplyResources(this.menuSysAgentMode, "menuSysAgentMode"); // + // menuNotEnabledHttp + // + this.menuNotEnabledHttp.Name = "menuNotEnabledHttp"; + resources.ApplyResources(this.menuNotEnabledHttp, "menuNotEnabledHttp"); + this.menuNotEnabledHttp.Click += new System.EventHandler(this.menuNotEnabledHttp_Click); + // // menuGlobal // this.menuGlobal.Name = "menuGlobal"; @@ -818,7 +818,6 @@ private void InitializeComponent() private System.Windows.Forms.ToolStripMenuItem menuGlobal; private System.Windows.Forms.ToolStripMenuItem menuGlobalPAC; private System.Windows.Forms.ToolStripMenuItem menuKeep; - private System.Windows.Forms.ToolStripMenuItem menuSysAgentEnabled; private System.Windows.Forms.ToolStripMenuItem menuCopyPACUrl; private System.Windows.Forms.ToolStripMenuItem menuAddCustomServer; private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; @@ -868,6 +867,7 @@ private void InitializeComponent() private System.Windows.Forms.ToolStripMenuItem menuRemoveDuplicateServer; private System.Windows.Forms.ToolStripMenuItem menuTcpingServer; private System.Windows.Forms.ToolStripMenuItem menuRealPingServer; + private System.Windows.Forms.ToolStripMenuItem menuNotEnabledHttp; } } diff --git a/v2rayN/v2rayN/Forms/MainForm.cs b/v2rayN/v2rayN/Forms/MainForm.cs index 91088b34c33..7a74cb15d69 100644 --- a/v2rayN/v2rayN/Forms/MainForm.cs +++ b/v2rayN/v2rayN/Forms/MainForm.cs @@ -35,7 +35,7 @@ public MainForm() Utils.ClearTempPath(); v2rayHandler.V2rayStop(); - HttpProxyHandle.Update(config, true); + HttpProxyHandle.CloseHttpAgent(config); PACServerHandle.Stop(); @@ -325,7 +325,7 @@ private void DisplayToolStatus() toolSslSocksPort.Text = $"{Global.Loopback}:{config.inbound[0].localPort}"; - if (config.sysAgentEnabled) + if (config.listenerType != 0) { toolSslHttpPort.Text = $"{Global.Loopback}:{Global.httpPort}"; if (config.listenerType == 2 || config.listenerType == 4) @@ -340,8 +340,8 @@ private void DisplayToolStatus() } } } - notifyMain.Icon = GetNotifyIcon(); + notifyMain.Icon = MainFormHandler.Instance.GetNotifyIcon(config, this.Icon); } private void ssMain_ItemClicked(object sender, ToolStripItemClickedEventArgs e) { @@ -350,46 +350,7 @@ private void ssMain_ItemClicked(object sender, ToolStripItemClickedEventArgs e) Utils.SetClipboardData(e.ClickedItem.Text); } } - - private Icon GetNotifyIcon() - { - try - { - var color = ColorTranslator.FromHtml("#3399CC"); - var index = config.sysAgentEnabled ? config.listenerType : 0; - if (index > 0) - { - color = (new Color[] { Color.Red, Color.Purple, Color.DarkGreen, Color.Orange })[index - 1]; - //color = ColorTranslator.FromHtml(new string[] { "#CC0066", "#CC6600", "#99CC99", "#666699" }[index - 1]); - } - - var width = 128; - var height = 128; - - var bitmap = new Bitmap(width, height); - var graphics = Graphics.FromImage(bitmap); - var drawBrush = new SolidBrush(color); - - graphics.FillEllipse(drawBrush, new Rectangle(0, 0, width, height)); - var zoom = 16; - graphics.DrawImage(new Bitmap(Properties.Resources.notify, width - zoom, width - zoom), zoom / 2, zoom / 2); - - bitmap.Save(Utils.GetPath("temp_icon.ico"), System.Drawing.Imaging.ImageFormat.Icon); - - Icon createdIcon = Icon.FromHandle(bitmap.GetHicon()); - - drawBrush.Dispose(); - graphics.Dispose(); - bitmap.Dispose(); - - return createdIcon; - } - catch (Exception ex) - { - Utils.SaveLog(ex.Message, ex); - return this.Icon; - } - } + #endregion #region v2ray 操作 @@ -407,8 +368,7 @@ private void LoadV2ray() Global.reloadV2ray = false; ConfigHandler.SaveConfig(ref config, false); - ChangeSysAgent(config.sysAgentEnabled); - DisplayToolStatus(); + ChangePACButtonStatus(config.listenerType); } /// @@ -418,7 +378,7 @@ private void CloseV2ray() { ConfigHandler.SaveConfig(ref config, false); - ChangeSysAgent(false); + ChangePACButtonStatus(0); v2rayHandler.V2rayStop(); } @@ -635,79 +595,13 @@ private void Speedtest(string actionType) private void menuExport2ClientConfig_Click(object sender, EventArgs e) { int index = GetLvSelectedIndex(); - if (index < 0) - { - return; - } - if (config.vmess[index].configType != (int)EConfigType.Vmess) - { - UI.Show(UIRes.I18N("NonVmessService")); - return; - } - - SaveFileDialog fileDialog = new SaveFileDialog(); - fileDialog.Filter = "Config|*.json"; - fileDialog.FilterIndex = 2; - fileDialog.RestoreDirectory = true; - if (fileDialog.ShowDialog() != DialogResult.OK) - { - return; - } - string fileName = fileDialog.FileName; - if (Utils.IsNullOrEmpty(fileName)) - { - return; - } - Config configCopy = Utils.DeepCopy(config); - configCopy.index = index; - string msg; - if (V2rayConfigHandler.Export2ClientConfig(configCopy, fileName, out msg) != 0) - { - UI.Show(msg); - } - else - { - UI.Show(string.Format(UIRes.I18N("SaveClientConfigurationIn"), fileName)); - } + MainFormHandler.Instance.Export2ClientConfig(index, config); } private void menuExport2ServerConfig_Click(object sender, EventArgs e) { int index = GetLvSelectedIndex(); - if (index < 0) - { - return; - } - if (config.vmess[index].configType != (int)EConfigType.Vmess) - { - UI.Show(UIRes.I18N("NonVmessService")); - return; - } - - SaveFileDialog fileDialog = new SaveFileDialog(); - fileDialog.Filter = "Config|*.json"; - fileDialog.FilterIndex = 2; - fileDialog.RestoreDirectory = true; - if (fileDialog.ShowDialog() != DialogResult.OK) - { - return; - } - string fileName = fileDialog.FileName; - if (Utils.IsNullOrEmpty(fileName)) - { - return; - } - Config configCopy = Utils.DeepCopy(config); - configCopy.index = index; - string msg; - if (V2rayConfigHandler.Export2ServerConfig(configCopy, fileName, out msg) != 0) - { - UI.Show(msg); - } - else - { - UI.Show(string.Format(UIRes.I18N("SaveServerConfigurationIn"), fileName)); - } + MainFormHandler.Instance.Export2ServerConfig(index, config); } private void menuExport2ShareUrl_Click(object sender, EventArgs e) @@ -962,7 +856,7 @@ void AppendText(string text) /// private void ShowMsg(string msg) { - if (txtMsgBox.Lines.Length > 500) + if (txtMsgBox.Lines.Length > 999) { ClearMsg(); } @@ -1020,6 +914,7 @@ private void ShowForm() this.Activate(); //this.notifyIcon1.Visible = false; this.ShowInTaskbar = true; + this.txtMsgBox.ScrollToCaret(); SetVisibleCore(true); } @@ -1171,97 +1066,58 @@ private void menuCopyPACUrl_Click(object sender, EventArgs e) Utils.SetClipboardData(HttpProxyHandle.GetPacUrl()); } - private void menuSysAgentEnabled_Click(object sender, EventArgs e) + private void menuNotEnabledHttp_Click(object sender, EventArgs e) { - bool isChecked = !config.sysAgentEnabled; - config.sysAgentEnabled = isChecked; - ChangeSysAgent(isChecked); + SetListenerType(0); } private void menuGlobal_Click(object sender, EventArgs e) { - config.listenerType = 1; - ChangePACButtonStatus(config.listenerType); + SetListenerType(1); } private void menuGlobalPAC_Click(object sender, EventArgs e) { - config.listenerType = 2; - ChangePACButtonStatus(config.listenerType); + SetListenerType(2); } private void menuKeep_Click(object sender, EventArgs e) { - config.listenerType = 3; - ChangePACButtonStatus(config.listenerType); + SetListenerType(3); } private void menuKeepPAC_Click(object sender, EventArgs e) { - config.listenerType = 4; - ChangePACButtonStatus(config.listenerType); + SetListenerType(4); } - private void ChangePACButtonStatus(int type) + private void SetListenerType(int type) { - if (HttpProxyHandle.Update(config, false)) - { - switch (type) - { - case 1: - menuGlobal.Checked = true; - menuGlobalPAC.Checked = false; - menuKeep.Checked = false; - menuKeepPAC.Checked = false; - break; - case 2: - menuGlobal.Checked = false; - menuGlobalPAC.Checked = true; - menuKeep.Checked = false; - menuKeepPAC.Checked = false; - break; - case 3: - menuGlobal.Checked = false; - menuGlobalPAC.Checked = false; - menuKeep.Checked = true; - menuKeepPAC.Checked = false; - break; - case 4: - menuGlobal.Checked = false; - menuGlobalPAC.Checked = false; - menuKeep.Checked = false; - menuKeepPAC.Checked = true; - break; - } - } - ConfigHandler.SaveConfig(ref config, false); - DisplayToolStatus(); + config.listenerType = type; + ChangePACButtonStatus(type); } - /// - /// 改变系统代理 - /// - /// - private void ChangeSysAgent(bool isChecked) + private void ChangePACButtonStatus(int type) { - if (isChecked) + if (type != 0) { - if (HttpProxyHandle.RestartHttpAgent(config, false)) - { - ChangePACButtonStatus(config.listenerType); - } + HttpProxyHandle.RestartHttpAgent(config, false); } else { - HttpProxyHandle.Update(config, true); HttpProxyHandle.CloseHttpAgent(config); } - menuSysAgentEnabled.Checked = - menuSysAgentMode.Enabled = isChecked; + for (int k = 0; k < menuSysAgentMode.DropDownItems.Count; k++) + { + var item = ((ToolStripMenuItem)menuSysAgentMode.DropDownItems[k]); + item.Checked = (type == k); + } + ConfigHandler.SaveConfig(ref config, false); DisplayToolStatus(); } + #endregion @@ -1400,7 +1256,7 @@ private void tsbAbout_Click(object sender, EventArgs e) private void tsbPromotion_Click(object sender, EventArgs e) { - System.Diagnostics.Process.Start($"{Global.PromotionUrl}?t={DateTime.Now.Ticks}"); + System.Diagnostics.Process.Start($"{Utils.Base64Decode(Global.PromotionUrl)}?t={DateTime.Now.Ticks}"); } #endregion @@ -1528,9 +1384,7 @@ private void SetCurrentLanguage(string value) Utils.RegWriteValue(Global.MyRegPath, Global.MyRegKeyLanguage, value); } - #endregion - } } diff --git a/v2rayN/v2rayN/Forms/MainForm.resx b/v2rayN/v2rayN/Forms/MainForm.resx index bfd73a86cc9..56fbafc2f9a 100644 --- a/v2rayN/v2rayN/Forms/MainForm.resx +++ b/v2rayN/v2rayN/Forms/MainForm.resx @@ -291,7 +291,7 @@ ImageAboveText - 448, 556 + 448, 534 cmsLv @@ -333,7 +333,7 @@ lvServers - v2rayN.Forms.ListViewFlickerFree, v2rayN, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + v2rayN.Base.ListViewFlickerFree, v2rayN, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null splitContainer1.Panel1 @@ -422,11 +422,11 @@ NoControl - - 264, 22 + + 547, 22 - - Enable Http proxy + + Not Enabled Http Proxy 547, 22 @@ -456,7 +456,7 @@ 264, 22 - Http proxy mode + Http proxy 264, 22 @@ -1118,18 +1118,18 @@ System.Windows.Forms.NotifyIcon, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - menuSysAgentEnabled - - - System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - menuSysAgentMode System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + menuNotEnabledHttp + + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + menuGlobal diff --git a/v2rayN/v2rayN/Forms/MainForm.zh-Hans.resx b/v2rayN/v2rayN/Forms/MainForm.zh-Hans.resx index abb6629f9ec..d9fdbce00ed 100644 --- a/v2rayN/v2rayN/Forms/MainForm.zh-Hans.resx +++ b/v2rayN/v2rayN/Forms/MainForm.zh-Hans.resx @@ -268,6 +268,12 @@ 批量导出订阅内容至剪贴板(多选) + + 73, 53 + + + 服务器 + 279, 534 @@ -288,26 +294,11 @@ ZW0uRHJhd2luZy5HcmFwaGljc1VuaXQBAAAAB3ZhbHVlX18ACAMAAAADAAAACw== - - 73, 53 - - - 服务器 - - - 196, 164 - - - 195, 22 - - - 启用Http代理 - - - 195, 22 + + 340, 22 - - Http代理模式 + + 关闭Http代理 340, 22 @@ -333,6 +324,12 @@ 仅开启PAC,不自动配置PAC + + 195, 22 + + + Http代理 + 195, 22 @@ -366,20 +363,17 @@ 退出 + + 196, 142 + 服务器列表 - - 信息 - 网速显示未启用 - - 61, 53 - - - 订阅 + + 信息 124, 22 @@ -393,6 +387,12 @@ 更新订阅 + + 61, 53 + + + 订阅 + 76, 53 @@ -402,7 +402,7 @@ iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAE3SURBVFhH7ZaBDQIhDEVvBEdwBDfQDXQER3AD3cARdAPd + YQUAAAAJcEhZcwAADsIAAA7CARUoSoAAAAE3SURBVFhH7ZaBDQIhDEVvBEdwBDfQDXQER3AD3cARdAPd QDfSDbQvuSb1AicFjJrwkxcN0FIolOuamv5VE2E+gLaPayWchEcE+hhTXVPhIoQmDcFYbKpoJtwEdX4X jgIrXfTwnzb6dBw22BaJVdjJmWQs1/SdBRtE0U5cBXW2oSFRO0HtSEeW2FZ1wsq9sjuRdTDVAXnNuWLY 6JnAl0sYa/Q5q1dhq35ci+Bkq2HJvbZpxGeybAAuw4Fq+cnW1wPITgHFYxvBUw+qHEIL1yq1vDKhVlH3 @@ -416,12 +416,6 @@ 重启服务 - - 85, 53 - - - 检查更新 - 232, 22 @@ -446,15 +440,21 @@ 简化PAC (请设置Core路由) + + 85, 53 + + + 检查更新 + + + 关于 + 69, 53 帮助 - - 关于 - 68, 53 @@ -464,7 +464,7 @@ iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAySURBVFhH7c6xDQAgCEVBRnVTHU2ZABuMxV3yOvJDAAA/ + YQUAAAAJcEhZcwAADsIAAA7CARUoSoAAAAAySURBVFhH7c6xDQAgCEVBRnVTHU2ZABuMxV3yOvJDAAA/ GqfZVG6X8mg1dfUAAPBQxAZd0SJruVXHWwAAAABJRU5ErkJggg== diff --git a/v2rayN/v2rayN/Forms/OptionSettingForm.Designer.cs b/v2rayN/v2rayN/Forms/OptionSettingForm.Designer.cs index 3226c21fb72..8a7a9d593b0 100644 --- a/v2rayN/v2rayN/Forms/OptionSettingForm.Designer.cs +++ b/v2rayN/v2rayN/Forms/OptionSettingForm.Designer.cs @@ -33,6 +33,8 @@ private void InitializeComponent() this.tabControl1 = new System.Windows.Forms.TabControl(); this.tabPage1 = new System.Windows.Forms.TabPage(); this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.label16 = new System.Windows.Forms.Label(); + this.cmblistenerType = new System.Windows.Forms.ComboBox(); this.chksniffingEnabled2 = new System.Windows.Forms.CheckBox(); this.chksniffingEnabled = new System.Windows.Forms.CheckBox(); this.txtremoteDNS = new System.Windows.Forms.TextBox(); @@ -60,14 +62,13 @@ private void InitializeComponent() this.txtUserdirect = new System.Windows.Forms.TextBox(); this.tabPage5 = new System.Windows.Forms.TabPage(); this.txtUserblock = new System.Windows.Forms.TextBox(); + this.tabPage8 = new System.Windows.Forms.TabPage(); + this.cmbroutingMode = new System.Windows.Forms.ComboBox(); this.panel3 = new System.Windows.Forms.Panel(); this.btnSetDefRountingRule = new System.Windows.Forms.Button(); this.labRoutingTips = new System.Windows.Forms.Label(); - this.label4 = new System.Windows.Forms.Label(); this.cmbdomainStrategy = new System.Windows.Forms.ComboBox(); this.label15 = new System.Windows.Forms.Label(); - this.label12 = new System.Windows.Forms.Label(); - this.cmbroutingMode = new System.Windows.Forms.ComboBox(); this.tabPage6 = new System.Windows.Forms.TabPage(); this.chkKcpcongestion = new System.Windows.Forms.CheckBox(); this.txtKcpwriteBufferSize = new System.Windows.Forms.TextBox(); @@ -104,6 +105,7 @@ private void InitializeComponent() this.tabPage3.SuspendLayout(); this.tabPage4.SuspendLayout(); this.tabPage5.SuspendLayout(); + this.tabPage8.SuspendLayout(); this.panel3.SuspendLayout(); this.tabPage6.SuspendLayout(); this.tabPage7.SuspendLayout(); @@ -138,6 +140,8 @@ private void InitializeComponent() // groupBox1 // resources.ApplyResources(this.groupBox1, "groupBox1"); + this.groupBox1.Controls.Add(this.label16); + this.groupBox1.Controls.Add(this.cmblistenerType); this.groupBox1.Controls.Add(this.chksniffingEnabled2); this.groupBox1.Controls.Add(this.chksniffingEnabled); this.groupBox1.Controls.Add(this.txtremoteDNS); @@ -159,6 +163,24 @@ private void InitializeComponent() this.groupBox1.Name = "groupBox1"; this.groupBox1.TabStop = false; // + // label16 + // + resources.ApplyResources(this.label16, "label16"); + this.label16.Name = "label16"; + // + // cmblistenerType + // + resources.ApplyResources(this.cmblistenerType, "cmblistenerType"); + this.cmblistenerType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cmblistenerType.FormattingEnabled = true; + this.cmblistenerType.Items.AddRange(new object[] { + resources.GetString("cmblistenerType.Items"), + resources.GetString("cmblistenerType.Items1"), + resources.GetString("cmblistenerType.Items2"), + resources.GetString("cmblistenerType.Items3"), + resources.GetString("cmblistenerType.Items4")}); + this.cmblistenerType.Name = "cmblistenerType"; + // // chksniffingEnabled2 // resources.ApplyResources(this.chksniffingEnabled2, "chksniffingEnabled2"); @@ -296,6 +318,7 @@ private void InitializeComponent() this.tabControl2.Controls.Add(this.tabPage3); this.tabControl2.Controls.Add(this.tabPage4); this.tabControl2.Controls.Add(this.tabPage5); + this.tabControl2.Controls.Add(this.tabPage8); this.tabControl2.Name = "tabControl2"; this.tabControl2.SelectedIndex = 0; // @@ -335,16 +358,32 @@ private void InitializeComponent() resources.ApplyResources(this.txtUserblock, "txtUserblock"); this.txtUserblock.Name = "txtUserblock"; // + // tabPage8 + // + resources.ApplyResources(this.tabPage8, "tabPage8"); + this.tabPage8.Controls.Add(this.cmbroutingMode); + this.tabPage8.Name = "tabPage8"; + this.tabPage8.UseVisualStyleBackColor = true; + // + // cmbroutingMode + // + resources.ApplyResources(this.cmbroutingMode, "cmbroutingMode"); + this.cmbroutingMode.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cmbroutingMode.FormattingEnabled = true; + this.cmbroutingMode.Items.AddRange(new object[] { + resources.GetString("cmbroutingMode.Items"), + resources.GetString("cmbroutingMode.Items1"), + resources.GetString("cmbroutingMode.Items2"), + resources.GetString("cmbroutingMode.Items3")}); + this.cmbroutingMode.Name = "cmbroutingMode"; + // // panel3 // resources.ApplyResources(this.panel3, "panel3"); this.panel3.Controls.Add(this.btnSetDefRountingRule); this.panel3.Controls.Add(this.labRoutingTips); - this.panel3.Controls.Add(this.label4); this.panel3.Controls.Add(this.cmbdomainStrategy); this.panel3.Controls.Add(this.label15); - this.panel3.Controls.Add(this.label12); - this.panel3.Controls.Add(this.cmbroutingMode); this.panel3.Name = "panel3"; // // btnSetDefRountingRule @@ -360,12 +399,6 @@ private void InitializeComponent() this.labRoutingTips.ForeColor = System.Drawing.Color.Brown; this.labRoutingTips.Name = "labRoutingTips"; // - // label4 - // - resources.ApplyResources(this.label4, "label4"); - this.label4.ForeColor = System.Drawing.Color.Brown; - this.label4.Name = "label4"; - // // cmbdomainStrategy // resources.ApplyResources(this.cmbdomainStrategy, "cmbdomainStrategy"); @@ -382,23 +415,6 @@ private void InitializeComponent() resources.ApplyResources(this.label15, "label15"); this.label15.Name = "label15"; // - // label12 - // - resources.ApplyResources(this.label12, "label12"); - this.label12.Name = "label12"; - // - // cmbroutingMode - // - resources.ApplyResources(this.cmbroutingMode, "cmbroutingMode"); - this.cmbroutingMode.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.cmbroutingMode.FormattingEnabled = true; - this.cmbroutingMode.Items.AddRange(new object[] { - resources.GetString("cmbroutingMode.Items"), - resources.GetString("cmbroutingMode.Items1"), - resources.GetString("cmbroutingMode.Items2"), - resources.GetString("cmbroutingMode.Items3")}); - this.cmbroutingMode.Name = "cmbroutingMode"; - // // tabPage6 // resources.ApplyResources(this.tabPage6, "tabPage6"); @@ -592,6 +608,7 @@ private void InitializeComponent() this.tabPage4.PerformLayout(); this.tabPage5.ResumeLayout(false); this.tabPage5.PerformLayout(); + this.tabPage8.ResumeLayout(false); this.panel3.ResumeLayout(false); this.panel3.PerformLayout(); this.tabPage6.ResumeLayout(false); @@ -660,7 +677,6 @@ private void InitializeComponent() private System.Windows.Forms.Panel panel3; private System.Windows.Forms.ComboBox cmbdomainStrategy; private System.Windows.Forms.Label label15; - private System.Windows.Forms.Label label12; private System.Windows.Forms.ComboBox cmbroutingMode; private System.Windows.Forms.CheckBox chksniffingEnabled; private System.Windows.Forms.CheckBox chksniffingEnabled2; @@ -670,6 +686,8 @@ private void InitializeComponent() private System.Windows.Forms.Label lbCacheDays; private System.Windows.Forms.ComboBox cbFreshrate; private System.Windows.Forms.Label lbFreshrate; - private System.Windows.Forms.Label label4; + private System.Windows.Forms.Label label16; + private System.Windows.Forms.ComboBox cmblistenerType; + private System.Windows.Forms.TabPage tabPage8; } } \ No newline at end of file diff --git a/v2rayN/v2rayN/Forms/OptionSettingForm.cs b/v2rayN/v2rayN/Forms/OptionSettingForm.cs index 06ae61643a5..6d877d06e2d 100644 --- a/v2rayN/v2rayN/Forms/OptionSettingForm.cs +++ b/v2rayN/v2rayN/Forms/OptionSettingForm.cs @@ -64,6 +64,8 @@ private void InitBase() //remoteDNS txtremoteDNS.Text = config.remoteDNS; + + cmblistenerType.SelectedIndex = config.listenerType; } /// @@ -250,7 +252,8 @@ private int SaveBase() //remoteDNS config.remoteDNS = txtremoteDNS.Text.TrimEx(); - + + config.listenerType = cmblistenerType.SelectedIndex; return 0; } @@ -372,6 +375,7 @@ private void btnSetDefRountingRule_Click(object sender, EventArgs e) txtUseragent.Text = Utils.GetEmbedText(Global.CustomRoutingFileName + Global.agentTag); txtUserdirect.Text = Utils.GetEmbedText(Global.CustomRoutingFileName + Global.directTag); txtUserblock.Text = Utils.GetEmbedText(Global.CustomRoutingFileName + Global.blockTag); + cmbroutingMode.SelectedIndex = 3; var lstUrl = new List(); lstUrl.Add(Global.CustomRoutingListUrl + Global.agentTag); diff --git a/v2rayN/v2rayN/Forms/OptionSettingForm.resx b/v2rayN/v2rayN/Forms/OptionSettingForm.resx index 179856b4a40..89755a95c67 100644 --- a/v2rayN/v2rayN/Forms/OptionSettingForm.resx +++ b/v2rayN/v2rayN/Forms/OptionSettingForm.resx @@ -121,10 +121,6 @@ True - - - NoControl - 11 @@ -145,7 +141,7 @@ Record local logs - 634, 396 + 634, 460 12 @@ -162,11 +158,11 @@ 2 - - tti + + False - 15 + 17 System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @@ -177,9 +173,15 @@ groupBox1 + + True + 5 + + 94, 21 + 9 @@ -192,38 +194,33 @@ 2 - - 18 - - - 111, 24 - 468, 60 + Top - - 15, 16 - - - 3, 3 - - + 6 + + 464, 20 + 14 tabPage3 + + cmblistenerType + 0 - 634, 396 + 634, 460 0 @@ -240,6 +237,9 @@ System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 30 + 3, 3 @@ -252,15 +252,21 @@ 120, 16 - - 281, 12 - panel3 + + System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + True + + tti + + + tabPage6 + tabPage6 @@ -273,11 +279,11 @@ 84, 16 - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 65, 12 - 628, 390 + 628, 454 tabPage7 @@ -285,18 +291,12 @@ 12 - - 662, 60 - - - Fill + + http 7 - - label5 - True @@ -306,6 +306,9 @@ 18 + + True + 206, 64 @@ -315,23 +318,20 @@ tabPage6 + + 0 + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 77, 12 - 15, 63 tabControl2 - - 16 - - - System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 2 @@ -339,9 +339,6 @@ Enable UDP - - 94, 21 - System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @@ -363,6 +360,9 @@ 654, 579 + + NoControl + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @@ -387,6 +387,9 @@ Top + + 126, 16 + 12 @@ -399,6 +402,9 @@ 1 + + $this + label11 @@ -408,11 +414,17 @@ 8 - - tabPage6 + + NoControl - - 0, 10 + + Only open Http proxy, do not automatically configure proxy server (direct mode) + + + 58, 20 + + + 3, 3 tabPage6 @@ -430,13 +442,13 @@ $this - 4 + 6 - - True + + 662, 675 - - 3 + + none System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @@ -444,14 +456,17 @@ NoControl + + tabPage7 + 0 tabPage6 - - groupBox1 + + 3 558, 16 @@ -468,17 +483,17 @@ congestion - - System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - panel3 + + groupBox2 + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 3, 3, 3, 3 89, 12 @@ -499,19 +514,22 @@ v2rayN settings - 17 + 19 - 13 + 15 + + + Not Enabled Http Proxy - 11 + 13 32 - 628, 390 + 628, 454 6, 12 @@ -528,17 +546,17 @@ System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - txtKcpdownlinkCapacity + + 132, 16 - 516, 109 + 516, 111 Boot automatically - - 654, 579 + + label14 3, 3, 3, 3 @@ -546,14 +564,23 @@ 1 + + 10 + txtKcptti + + 2 + Turn on Sniffing - - tabPage6 + + 281, 12 + + + 236, 66 355, 16 @@ -564,9 +591,6 @@ 3 - - 5, 34 - 662, 605 @@ -580,20 +604,14 @@ 78, 21 - 5, 91 + 5, 45 - - Custom DNS (multiple, separated by commas (,)) + + Log level tabControl1 - - System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 598, 16 - v2rayN.Forms.BaseForm, v2rayN, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null @@ -606,6 +624,9 @@ 0 + + Open PAC and automatically configure PAC (PAC mode) + tabPage7 @@ -621,8 +642,8 @@ 89, 12 - - 120, 16 + + btnOK 18, 66 @@ -633,6 +654,9 @@ 11 + + True + 4, 4, 4, 4 @@ -651,24 +675,30 @@ 18, 28 - - panel3 + + cmbdomainStrategy + + + 34 20 - - 29 + + 10 0 - 399, 30 + 21, 17 System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 1 + System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @@ -678,29 +708,20 @@ 19 - - label12 - - - Rule loading order: custom proxy/direct/block, selected routing mode - True - - 305, 34 - chksniffingEnabled - 3 + 5 174, 16 - 30, 90 + 30, 92 groupBox1 @@ -708,12 +729,18 @@ groupBox1 + + groupBox1 + 18, 104 tabPage2 + + mtu + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @@ -732,8 +759,8 @@ 1 - - System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 29 tabPage6 @@ -750,8 +777,11 @@ 53, 12 + + txtlocalPort2 + - 14 + 16 label8 @@ -769,25 +799,22 @@ 94, 21 - 4 + 3 - 12 + 14 - - 12 + + 1 chkudpEnabled - - NoControl - True - 33, 168 + 33, 204 tabPage1 @@ -798,11 +825,14 @@ tabPage6 + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - 2 + 4 btnSetDefRountingRule @@ -819,8 +849,8 @@ 84, 16 - - 15 + + tabPage8 True @@ -828,21 +858,24 @@ label7 - - 4, 22 - txtlocalPort txturlGFWList + + 236, 28 + tabPage7 3, 17 + + True + 4, 22 @@ -861,47 +894,41 @@ protocol + + System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + tabControl2 tbCacheDays - - Turn on Mux Multiplexing - 23, 12 - - System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 97, 20 - 402, 21 socks - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 0 + + + 3, 3 System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - tabPage7 - chkAllowLANConn 84, 16 - - Direct Domain or IP + + tabControl1 True @@ -913,58 +940,52 @@ 15, 38 - 0 + 2 - - 10 + + tabPage6 369, 62 - 10 + 12 - Proxy Domain or IP + 1.Proxy Domain or IP panel3 - - 5, 65 + + 6 - - 5, 8 + + tabControl1 Fill - - 13 - - - 654, 579 - - - chkEnableStatistics + + tabControl2 - - System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 28 - 5 - - 7 - - 97, 20 + + 2.Direct Domain or IP + + + label6 53, 12 - 193, 126 + 193, 162 369, 27 @@ -976,16 +997,13 @@ System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - 6 + 0 label2 - - 165, 20 - - - 0 + + False 3, 3 @@ -993,11 +1011,11 @@ 9 - - 9 + + groupBox1 - - 0 + + 4.Pre-defined rules 101, 12 @@ -1008,12 +1026,18 @@ 12 + + 30, 120 + 20 cmbprotocol + + lbCacheDays + True @@ -1023,9 +1047,15 @@ 431, 12 + + 1 + System.Windows.Forms.TabControl, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + tabPage6 + 4 @@ -1035,6 +1065,9 @@ cmbroutingMode + + Fill + 1 @@ -1047,8 +1080,8 @@ 60, 21 - - 28 + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 257, 60 @@ -1065,32 +1098,32 @@ cmbprotocol2 - - NoControl + + Open Http proxy and automatically configure proxy server (global mode) - - groupBox2 + + 12 - 15, 93 + 15, 129 - - mtu + + 16 5 - - panel3 - - + True + + System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + chkKcpcongestion - - 30, 118 + + Core: basic settings 0 @@ -1099,7 +1132,7 @@ 257, 25 - 3, 134 + 3, 84 True @@ -1107,8 +1140,8 @@ listening port 2 - - 11 + + 97, 20 chkAllowIn2 @@ -1116,17 +1149,14 @@ tabPage2 - - 14 - True - - 19 + + False - - 29 + + 3 tabPage4 @@ -1134,12 +1164,6 @@ 4, 22 - - http - - - 9 - 544, 21 @@ -1149,38 +1173,35 @@ System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 29 + error - - 15, 124 - - - groupBox1 + + True 59, 12 - - groupBox1 - System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - 634, 410 + 634, 460 downlinkCapacity - - tabControl1 + + 120, 16 662, 10 - - txtlocalPort2 + + System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 True @@ -1227,14 +1248,17 @@ info - + 0 + + 33 + Allow connections from the LAN - 161, 82 + 161, 84 panel3 @@ -1245,14 +1269,8 @@ groupBox1 - - txtKcpreadBufferSize - - 1 - - - panel3 + 3 panel2 @@ -1260,29 +1278,32 @@ 30 + + 89, 12 + System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - tabPage7 + + txtKcpreadBufferSize - - 7 + + True System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - Log level + + groupBox1 - - tabControl1 + + System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - protocol + + Fill 6 @@ -1302,6 +1323,12 @@ AsIs + + 15, 62 + + + 111, 62 + 8 @@ -1309,37 +1336,43 @@ tabPage7 - 642, 436 + 642, 486 - - 58, 20 + + 4, 22 + + + 14 + + + True 1 - - 15 + + 0 13 - - panel3 - - - lbCacheDays + + 13 2 - - 78, 21 + + chkEnableStatistics - - True + + 9 - - True + + 9 + + + 78, 21 System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @@ -1362,8 +1395,8 @@ 23, 12 - - True + + 11 8 @@ -1374,17 +1407,20 @@ 17 + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + 345, 100 94, 21 - - 75, 23 + + readBufferSize - - True + + 654, 579 10 @@ -1395,11 +1431,14 @@ 17 - - 628, 404 + + 23 - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 94, 21 + + + 9 7 @@ -1416,18 +1455,18 @@ System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - tabPage1 + + Bottom - - Routing mode + + 3 + + + 15 2 - - 4, 22 - http @@ -1440,26 +1479,26 @@ 97, 20 - - 126, 16 + + 32 - 209, 20 + 255, 20 tabPage6 - - 30 + + 4, 22 - - cmbdomainStrategy + + 7 False - - 257, 122 + + NoControl System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @@ -1473,14 +1512,14 @@ 1 - - 94, 21 + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 txtKcpuplinkCapacity - 115, 30 + 115, 10 groupBox1 @@ -1491,14 +1530,14 @@ chksniffingEnabled2 - - 1 + + tabPage7 System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - 642, 117 + 642, 67 groupBox2 @@ -1506,44 +1545,44 @@ 4, 22 - - Domain strategy + + $this + + + System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 tabPage5 - 6 + 8 - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Domain strategy IPIfNonMatch - - groupBox1 - - - 23 + + 4, 22 - - Block Domain or IP + + groupBox1 - - label3 + + 0 6 - - 236, 66 + + protocol tabPage7 - - $this + + 15, 16 System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @@ -1551,8 +1590,8 @@ True - - $this + + 0 8 @@ -1563,8 +1602,8 @@ 3, 3 - - True + + 19 True @@ -1572,17 +1611,17 @@ 3 - - 5 + + writeBufferSize 11 - - True + + System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 89, 12 + + 2 System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @@ -1593,11 +1632,11 @@ 31 - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 3, 3, 3, 3 - - Fill + + groupBox1 groupBox1 @@ -1605,8 +1644,8 @@ groupBox1 - - 32 + + groupBox1 System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @@ -1617,11 +1656,17 @@ 345, 24 - - Fill + + tabPage1 - - 3, 3 + + 124, 94 + + + 257, 158 + + + tabPage8 2 @@ -1629,17 +1674,20 @@ 236, 104 - - 6 + + panel3 + + + 3.Block Domain or IP 455, 12 - - Core: basic settings + + 125, 12 - - NoControl + + 165, 20 System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @@ -1650,14 +1698,11 @@ 75, 23 - - writeBufferSize - System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - 33, 192 + 33, 228 345, 62 @@ -1665,29 +1710,23 @@ uplinkCapacity - - 662, 675 + + 42, 98 - - label4 + + txtKcpdownlinkCapacity IPOnDemand - - NoControl - System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 6 - - - 0 + + 5, 14 - - 2 + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 3, 3, 3, 3 @@ -1695,20 +1734,26 @@ 32, 205 - - cmbloglevel + + 634, 460 - - 111, 62 + + label5 1 + + 628, 454 + System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - btnOK + + label16 + + + tabPage6 Set default custom routing rules @@ -1716,17 +1761,17 @@ debug - - True + + Http proxy chkmuxEnabled - - none + + label3 - - tabPage6 + + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 False @@ -1740,8 +1785,8 @@ 0 - - System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 0, 0 @@ -1749,20 +1794,20 @@ Enable UDP - - 15, 60 + + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 3, 3, 3, 3 + + True groupBox1 - 16 + 18 - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + groupBox1 267, 16 @@ -1770,29 +1815,29 @@ Global - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 75, 23 tabPage7 - - groupBox1 + + 15, 160 Fill - - readBufferSize + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 9 + + Fill - - 0 + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - tabPage7 + + 322, 10 groupBox1 @@ -1803,8 +1848,8 @@ 94, 21 - - 3 + + 97, 20 3 @@ -1812,26 +1857,29 @@ 3, 3, 3, 3 - - 236, 28 + + Custom DNS (multiple, separated by commas (,)) - - Bottom + + 654, 579 - - System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 11 + + + 6 groupBox1 - - 125, 12 + + NoControl panel2 - - 8 + + True System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @@ -1842,20 +1890,17 @@ cbFreshrate - - label6 - - - 132, 16 + + Turn on Mux Multiplexing - - tabPage6 + + cmbloglevel - - System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Only open PAC, do not automatically configure PAC - - 1 + + 111, 24 panel2 @@ -1869,17 +1914,17 @@ label9 + + 0, 10 + panel1 - - True - - - 2 + + 662, 60 - - label14 + + tabPage7 True diff --git a/v2rayN/v2rayN/Forms/OptionSettingForm.zh-Hans.resx b/v2rayN/v2rayN/Forms/OptionSettingForm.zh-Hans.resx index 09b16e2dbfa..d1502a31dba 100644 --- a/v2rayN/v2rayN/Forms/OptionSettingForm.zh-Hans.resx +++ b/v2rayN/v2rayN/Forms/OptionSettingForm.zh-Hans.resx @@ -120,7 +120,31 @@ 取消(&C) + + Core:基础设置 + + + 53, 12 + + + Http代理 + + + 关闭Http代理 + + + 开启Http代理,并自动配置代理服务器(全局模式) + + + 开启PAC,并自动配置PAC(PAC模式) + + + 仅开启Http代理,不自动配置代理服务器(直连模式) + + + 仅开启PAC,不自动配置PAC + 96, 16 @@ -190,36 +214,75 @@ 本地监听端口 - - Core:基础设置 + + Core:路由设置 + + + 3, 89 + + + 642, 481 + + + 634, 455 - 代理的Domain或IP + 1.代理的Domain或IP - - 628, 404 + + 628, 449 - 634, 410 + 634, 455 - 直连的Domain或IP + 2.直连的Domain或IP - - 628, 404 + + 628, 449 - 634, 410 + 634, 455 - 阻止的Domain或IP + 3.阻止的Domain或IP + + + 628, 449 + + + 634, 455 + + + 4.预定义规则 + + + 全局 + + + 绕过局域网地址 + + + 绕过大陆地址 + + + 绕过局域网及大陆地址 + + + 19, 26 + + + 244, 20 + + + 642, 72 NoControl - 7, 60 + 351, 14 201, 23 @@ -232,7 +295,7 @@ True - 5, 96 + 5, 49 383, 12 @@ -240,11 +303,8 @@ *设置的规则,用逗号(,)隔开;支持Domain(纯字符串/正则/子域名)和IP - - 规则加载次序:自定义的代理/直连/阻止,选择的路由模式 - - 81, 30 + 81, 14 186, 20 @@ -255,39 +315,12 @@ 域名策略 - - 295, 34 - - - 53, 12 - - - 路由模式 - - - 全局 - - - 绕过局域网地址 - - - 绕过大陆地址 - - - 绕过局域网及大陆地址 - - - 372, 30 - - - 244, 20 - - - Core:路由设置 - Core:KCP设置 + + v2rayN设置 + 77, 12 @@ -324,9 +357,6 @@ 开机自动启动(可能会不成功) - - v2rayN设置 - 确定(&O) diff --git a/v2rayN/v2rayN/Global.cs b/v2rayN/v2rayN/Global.cs index 8f0a7675e8e..7dce5b753ad 100644 --- a/v2rayN/v2rayN/Global.cs +++ b/v2rayN/v2rayN/Global.cs @@ -5,14 +5,10 @@ class Global { #region 常量 - /// - /// 更新链接 - /// - public const string UpdateUrl = @"https://github.com/2dust/v2rayN/releases"; - /// - /// 关于链接 - /// + public const string AboutUrl = @"https://github.com/2dust/v2rayN"; + public const string UpdateUrl = AboutUrl + @"/releases"; + /// /// SpeedTestUrl @@ -30,7 +26,7 @@ class Global /// /// PromotionUrl /// - public const string PromotionUrl = @"https://1.2345345.xyz/ads.html"; + public const string PromotionUrl = @"aHR0cHM6Ly8xLjIzNDQ1Ni54eXovYWRzLmh0bWw="; /// /// 本软件配置文件名 diff --git a/v2rayN/v2rayN/Handler/MainFormHandler.cs b/v2rayN/v2rayN/Handler/MainFormHandler.cs new file mode 100644 index 00000000000..d03a2cb600a --- /dev/null +++ b/v2rayN/v2rayN/Handler/MainFormHandler.cs @@ -0,0 +1,155 @@ +using Grpc.Core; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Drawing; +using System.Net; +using System.Net.Sockets; +using System.Threading; +using System.Windows.Forms; +using v2rayN.Base; +using v2rayN.Mode; + +namespace v2rayN.Handler +{ + class MainFormHandler + { + private static MainFormHandler instance; + + //private DownloadHandle downloadHandle2; + //private Config _config; + //private V2rayHandler _v2rayHandler; + //private List _selecteds; + //private Thread _workThread; + //Action _updateFunc; + public static MainFormHandler Instance + { + get + { + if (instance == null) + { + instance = new MainFormHandler(); + } + return instance; + } + } + + public Icon GetNotifyIcon(Config config, Icon def) + { + try + { + var color = ColorTranslator.FromHtml("#3399CC"); + var index = config.listenerType; + if (index > 0) + { + color = (new Color[] { Color.Red, Color.Purple, Color.DarkGreen, Color.Orange })[index - 1]; + //color = ColorTranslator.FromHtml(new string[] { "#CC0066", "#CC6600", "#99CC99", "#666699" }[index - 1]); + } + + var width = 128; + var height = 128; + + var bitmap = new Bitmap(width, height); + var graphics = Graphics.FromImage(bitmap); + var drawBrush = new SolidBrush(color); + + graphics.FillEllipse(drawBrush, new Rectangle(0, 0, width, height)); + var zoom = 16; + graphics.DrawImage(new Bitmap(Properties.Resources.notify, width - zoom, width - zoom), zoom / 2, zoom / 2); + + Icon createdIcon = Icon.FromHandle(bitmap.GetHicon()); + + drawBrush.Dispose(); + graphics.Dispose(); + bitmap.Dispose(); + + return createdIcon; + } + catch (Exception ex) + { + Utils.SaveLog(ex.Message, ex); + return def; + } + } + + public void Export2ClientConfig(int index, Config config) + { + //int index = GetLvSelectedIndex(); + if (index < 0) + { + return; + } + if (config.vmess[index].configType != (int)EConfigType.Vmess) + { + UI.Show(UIRes.I18N("NonVmessService")); + return; + } + + SaveFileDialog fileDialog = new SaveFileDialog(); + fileDialog.Filter = "Config|*.json"; + fileDialog.FilterIndex = 2; + fileDialog.RestoreDirectory = true; + if (fileDialog.ShowDialog() != DialogResult.OK) + { + return; + } + string fileName = fileDialog.FileName; + if (Utils.IsNullOrEmpty(fileName)) + { + return; + } + Config configCopy = Utils.DeepCopy(config); + configCopy.index = index; + string msg; + if (V2rayConfigHandler.Export2ClientConfig(configCopy, fileName, out msg) != 0) + { + UI.Show(msg); + } + else + { + UI.Show(string.Format(UIRes.I18N("SaveClientConfigurationIn"), fileName)); + } + } + + public void Export2ServerConfig(int index, Config config) + { + //int index = GetLvSelectedIndex(); + if (index < 0) + { + return; + } + if (config.vmess[index].configType != (int)EConfigType.Vmess) + { + UI.Show(UIRes.I18N("NonVmessService")); + return; + } + + SaveFileDialog fileDialog = new SaveFileDialog(); + fileDialog.Filter = "Config|*.json"; + fileDialog.FilterIndex = 2; + fileDialog.RestoreDirectory = true; + if (fileDialog.ShowDialog() != DialogResult.OK) + { + return; + } + string fileName = fileDialog.FileName; + if (Utils.IsNullOrEmpty(fileName)) + { + return; + } + Config configCopy = Utils.DeepCopy(config); + configCopy.index = index; + string msg; + if (V2rayConfigHandler.Export2ServerConfig(configCopy, fileName, out msg) != 0) + { + UI.Show(msg); + } + else + { + UI.Show(string.Format(UIRes.I18N("SaveServerConfigurationIn"), fileName)); + } + } + + + } +} diff --git a/v2rayN/v2rayN/Handler/SpeedtestHandler.cs b/v2rayN/v2rayN/Handler/SpeedtestHandler.cs index c2df82fc728..3c65a725fe7 100644 --- a/v2rayN/v2rayN/Handler/SpeedtestHandler.cs +++ b/v2rayN/v2rayN/Handler/SpeedtestHandler.cs @@ -1,5 +1,4 @@ -using Grpc.Core; -using System; +using System; using System.Collections.Generic; using System.Diagnostics; using System.Net; @@ -69,7 +68,7 @@ public void Close() } } - public void RunPing() + private void RunPing() { try { @@ -100,7 +99,7 @@ public void RunPing() } } - public void RunTcping() + private void RunTcping() { try { @@ -131,7 +130,7 @@ public void RunTcping() } } - public void RunRealPing() + private void RunRealPing() { try { @@ -308,7 +307,5 @@ private string GetRealPingTime(string url, WebProxy webProxy, out int responseTi return msg; } - - } } diff --git a/v2rayN/v2rayN/HttpProxyHandler/HttpProxyHandle.cs b/v2rayN/v2rayN/HttpProxyHandler/HttpProxyHandle.cs index 4f1eca5f04c..716d213ef58 100644 --- a/v2rayN/v2rayN/HttpProxyHandler/HttpProxyHandle.cs +++ b/v2rayN/v2rayN/HttpProxyHandler/HttpProxyHandle.cs @@ -10,7 +10,7 @@ namespace v2rayN.HttpProxyHandler /// class HttpProxyHandle { - public static bool Update(Config config, bool forceDisable) + private static bool Update(Config config, bool forceDisable) { int type = config.listenerType; @@ -70,7 +70,7 @@ public static bool Update(Config config, bool forceDisable) /// 启用系统代理(http) /// /// - public static void StartHttpAgent(Config config) + private static void StartHttpAgent(Config config) { try { @@ -100,11 +100,13 @@ public static void CloseHttpAgent(Config config) { try { + Update(config, true); + PrivoxyHandler.Instance.Stop(); Global.sysAgent = false; Global.socksPort = 0; - Global.httpPort = 0; + Global.httpPort = 0; } catch { @@ -116,7 +118,7 @@ public static void CloseHttpAgent(Config config) /// /// /// - public static bool RestartHttpAgent(Config config, bool forced) + public static void RestartHttpAgent(Config config, bool forced) { bool isRestart = false; //强制重启或者socks端口变化 @@ -136,9 +138,8 @@ public static bool RestartHttpAgent(Config config, bool forced) { CloseHttpAgent(config); StartHttpAgent(config); - return true; } - return false; + Update(config, false); } public static string GetPacUrl() diff --git a/v2rayN/v2rayN/HttpProxyHandler/PrivoxyHandler.cs b/v2rayN/v2rayN/HttpProxyHandler/PrivoxyHandler.cs index 6dc229d368b..baa9fa94d00 100644 --- a/v2rayN/v2rayN/HttpProxyHandler/PrivoxyHandler.cs +++ b/v2rayN/v2rayN/HttpProxyHandler/PrivoxyHandler.cs @@ -68,31 +68,33 @@ public int RunningPort public void Start(int localPort, Config config) { - if (_process == null) + try { - Process[] existingPrivoxy = Process.GetProcessesByName("v2ray_privoxy"); - foreach (Process p in existingPrivoxy.Where(IsChildProcess)) - { - KillProcess(p); - } - string privoxyConfig = Resources.privoxy_conf; - RunningPort = config.GetLocalPort(Global.InboundHttp); - privoxyConfig = privoxyConfig.Replace("__SOCKS_PORT__", localPort.ToString()); - privoxyConfig = privoxyConfig.Replace("__PRIVOXY_BIND_PORT__", RunningPort.ToString()); - if (config.allowLANConn) + if (_process == null) { - privoxyConfig = privoxyConfig.Replace("__PRIVOXY_BIND_IP__", "0.0.0.0"); - } - else - { - privoxyConfig = privoxyConfig.Replace("__PRIVOXY_BIND_IP__", Global.Loopback); - } - FileManager.ByteArrayToFile(Utils.GetTempPath(_uniqueConfigFile), Encoding.UTF8.GetBytes(privoxyConfig)); + Process[] existingPrivoxy = Process.GetProcessesByName("v2ray_privoxy"); + foreach (Process p in existingPrivoxy.Where(IsChildProcess)) + { + KillProcess(p); + } + string privoxyConfig = Resources.privoxy_conf; + RunningPort = config.GetLocalPort(Global.InboundHttp); + privoxyConfig = privoxyConfig.Replace("__SOCKS_PORT__", localPort.ToString()); + privoxyConfig = privoxyConfig.Replace("__PRIVOXY_BIND_PORT__", RunningPort.ToString()); + if (config.allowLANConn) + { + privoxyConfig = privoxyConfig.Replace("__PRIVOXY_BIND_IP__", "0.0.0.0"); + } + else + { + privoxyConfig = privoxyConfig.Replace("__PRIVOXY_BIND_IP__", Global.Loopback); + } + FileManager.ByteArrayToFile(Utils.GetTempPath(_uniqueConfigFile), Encoding.UTF8.GetBytes(privoxyConfig)); - _process = new Process - { - // Configure the process using the StartInfo properties. - StartInfo = + _process = new Process + { + // Configure the process using the StartInfo properties. + StartInfo = { FileName = "v2ray_privoxy.exe", Arguments = _uniqueConfigFile, @@ -101,15 +103,20 @@ public void Start(int localPort, Config config) UseShellExecute = true, CreateNoWindow = true } - }; - _process.Start(); + }; + _process.Start(); - /* - * Add this process to job obj associated with this ss process, so that - * when ss exit unexpectedly, this process will be forced killed by system. - */ - _privoxyJob.AddProcess(_process.Handle); + /* + * Add this process to job obj associated with this ss process, so that + * when ss exit unexpectedly, this process will be forced killed by system. + */ + _privoxyJob.AddProcess(_process.Handle); + } + } + catch (Exception ex) + { + Utils.SaveLog(ex.Message, ex); } } diff --git a/v2rayN/v2rayN/Mode/Config.cs b/v2rayN/v2rayN/Mode/Config.cs index dc714d6ed8d..df188aa55af 100644 --- a/v2rayN/v2rayN/Mode/Config.cs +++ b/v2rayN/v2rayN/Mode/Config.cs @@ -106,17 +106,8 @@ public KcpItem kcpItem get; set; } - - /// - /// 启用Http代理 - /// - public bool sysAgentEnabled - { - get; set; - } - /// - /// 监听状态 0-不改变 1-全局 2-PAC + /// 监听状态 0-not 1-http 2-PAC /// public int listenerType { diff --git a/v2rayN/v2rayN/v2rayN.csproj b/v2rayN/v2rayN/v2rayN.csproj index d39a838ab96..302c50e0a1b 100644 --- a/v2rayN/v2rayN/v2rayN.csproj +++ b/v2rayN/v2rayN/v2rayN.csproj @@ -150,12 +150,6 @@ MainForm.cs - - Form - - - RoutingRuleSettingForm.cs - Form @@ -186,6 +180,7 @@ SubSettingControl.cs + @@ -292,9 +287,6 @@ QRCodeControl.cs Designer - - RoutingRuleSettingForm.cs - SubSettingControl.cs