Compare commits

...

16 Commits
2.45 ... 2.50

Author SHA1 Message Date
2dust
1a84090cc7 cleanup http 2019-11-13 11:33:47 +08:00
2dust
70dadf9964 up routing 2019-11-08 17:30:48 +08:00
2dust
9eab95e870 up test 2019-11-02 11:07:31 +08:00
2dust
f199e3bf82 Update AssemblyInfo.cs 2019-10-30 14:20:12 +08:00
2dust
7d31c2e472 up addr 2019-10-30 14:07:26 +08:00
2dust
ad406c3682 Update SpeedtestHandler.cs 2019-10-28 13:11:14 +08:00
2dust
2779670fa2 up speedtest 2019-10-27 12:55:20 +08:00
2dust
5b00bf82fb Update MainForm.cs 2019-10-24 08:42:55 +08:00
2dust
473e0cf839 Update HttpWebServerB.cs 2019-10-24 08:23:32 +08:00
2dust
ef01b4aa5e fix pac 2019-10-23 15:18:21 +08:00
2dust
c0340843eb up pac 2019-10-22 17:04:11 +08:00
2dust
e6ca25462e clean 2019-10-21 14:17:28 +08:00
2dust
53494341fc Update AssemblyInfo.cs 2019-10-21 10:38:15 +08:00
2dust
5aee97320b up speedtest 2019-10-21 10:35:54 +08:00
2dust
d5c69c7838 Clean code 2019-10-18 14:49:42 +08:00
2dust
9224ea9819 up webproxy 2019-10-17 13:29:58 +08:00
45 changed files with 3065 additions and 2471 deletions

View File

@@ -3,7 +3,7 @@ using System.Net;
using System.Text;
using System.Threading;
namespace v2rayN.HttpProxyHandler
namespace v2rayN.Base
{
public class HttpWebServer
{
@@ -61,6 +61,7 @@ namespace v2rayN.HttpProxyHandler
try
{
string address = ctx.Request.LocalEndPoint.Address.ToString();
Utils.SaveLog("Webserver Request " + address);
string rstr = _responderMethod(address);
byte[] buf = Encoding.UTF8.GetBytes(rstr);
ctx.Response.StatusCode = 200;

View File

@@ -1,12 +1,10 @@
using System;
using System.Collections;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading;
namespace v2rayN.HttpProxyHandler
namespace v2rayN.Base
{
public class HttpWebServerB
{
@@ -41,8 +39,15 @@ namespace v2rayN.HttpProxyHandler
while (true)
{
if (!listener.Pending())
{
Thread.Sleep(100);
continue;
}
TcpClient socket = listener.AcceptTcpClient();
Thread thread = new Thread(new ParameterizedThreadStart(ProcessThread));
thread.IsBackground = true;
thread.Start(socket);
Thread.Sleep(1);
}
@@ -64,6 +69,7 @@ namespace v2rayN.HttpProxyHandler
if (_responderMethod != null)
{
var address = ((IPEndPoint)socket.Client.LocalEndPoint).Address.ToString();
Utils.SaveLog("WebserverB Request " + address);
string pac = _responderMethod(address);
if (inputStream.CanWrite)

View File

@@ -1,7 +1,7 @@
using System.Drawing;
using System.Windows.Forms;
namespace v2rayN.Forms
namespace v2rayN.Base
{
class ListViewFlickerFree : ListView
{

View File

@@ -2,7 +2,7 @@
using System.IO;
using System.Linq;
namespace v2rayN
namespace v2rayN.Base
{
static class StringEx
{

View File

@@ -1,7 +1,7 @@
using System;
using System.Net;
namespace v2rayN.HttpProxyHandler
namespace v2rayN.Base
{
class WebClientEx : WebClient
{

View File

@@ -31,7 +31,7 @@
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.lvServers = new v2rayN.Forms.ListViewFlickerFree();
this.lvServers = new v2rayN.Base.ListViewFlickerFree();
this.cmsLv = new System.Windows.Forms.ContextMenuStrip(this.components);
this.menuAddVmessServer = new System.Windows.Forms.ToolStripMenuItem();
this.menuAddShadowsocksServer = new System.Windows.Forms.ToolStripMenuItem();
@@ -60,12 +60,12 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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";
@@ -784,7 +784,7 @@
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.TextBox txtMsgBox;
private v2rayN.Forms.ListViewFlickerFree lvServers;
private v2rayN.Base.ListViewFlickerFree lvServers;
private System.Windows.Forms.NotifyIcon notifyMain;
private System.Windows.Forms.ContextMenuStrip cmsMain;
private System.Windows.Forms.ToolStripMenuItem menuExit;
@@ -818,7 +818,6 @@
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 System.Windows.Forms.ToolStripMenuItem menuRemoveDuplicateServer;
private System.Windows.Forms.ToolStripMenuItem menuTcpingServer;
private System.Windows.Forms.ToolStripMenuItem menuRealPingServer;
private System.Windows.Forms.ToolStripMenuItem menuNotEnabledHttp;
}
}

View File

@@ -8,6 +8,7 @@ using System.Windows.Forms;
using v2rayN.Handler;
using v2rayN.HttpProxyHandler;
using v2rayN.Mode;
using v2rayN.Base;
namespace v2rayN.Forms
{
@@ -15,7 +16,7 @@ namespace v2rayN.Forms
{
private V2rayHandler v2rayHandler;
private PACListHandle pacListHandle;
private V2rayUpdateHandle v2rayUpdateHandle;
private DownloadHandle downloadHandle;
private List<int> lvSelecteds = new List<int>();
private StatisticsHandler statistics = null;
@@ -32,6 +33,14 @@ namespace v2rayN.Forms
Application.ApplicationExit += (sender, args) =>
{
Utils.ClearTempPath();
v2rayHandler.V2rayStop();
HttpProxyHandle.CloseHttpAgent(config);
PACServerHandle.Stop();
ConfigHandler.SaveConfig(ref config);
statistics?.SaveToFile();
statistics?.Close();
};
}
@@ -78,18 +87,9 @@ namespace v2rayN.Forms
if (e.CloseReason == CloseReason.UserClosing)
{
e.Cancel = true;
statistics?.SaveToFile();
HideForm();
return;
}
if (e.CloseReason == CloseReason.ApplicationExitCall)
{
ConfigHandler.SaveConfig(ref config);
statistics?.SaveToFile();
statistics?.Close();
}
}
private void MainForm_Resize(object sender, EventArgs e)
@@ -109,24 +109,24 @@ namespace v2rayN.Forms
//config.uiItem.mainQRCodeWidth = splitContainer1.SplitterDistance;
}
private const int WM_QUERYENDSESSION = 0x0011;
protected override void WndProc(ref Message m)
{
switch (m.Msg)
{
case WM_QUERYENDSESSION:
Utils.SaveLog("Windows shutdown UnsetProxy");
//CloseV2ray();
ConfigHandler.ToJsonFile(config);
statistics?.SaveToFile();
ProxySetting.UnsetProxy();
m.Result = (IntPtr)1;
break;
default:
base.WndProc(ref m);
break;
}
}
//private const int WM_QUERYENDSESSION = 0x0011;
//protected override void WndProc(ref Message m)
//{
// switch (m.Msg)
// {
// case WM_QUERYENDSESSION:
// Utils.SaveLog("Windows shutdown UnsetProxy");
// ConfigHandler.ToJsonFile(config);
// statistics?.SaveToFile();
// ProxySetting.UnsetProxy();
// m.Result = (IntPtr)1;
// break;
// default:
// base.WndProc(ref m);
// break;
// }
//}
#endregion
#region listview menu
@@ -325,9 +325,9 @@ namespace v2rayN.Forms
toolSslSocksPort.Text = $"{Global.Loopback}:{config.inbound[0].localPort}";
if (config.sysAgentEnabled)
if (config.listenerType != 0)
{
toolSslHttpPort.Text = $"{Global.Loopback}:{Global.sysAgentPort}";
toolSslHttpPort.Text = $"{Global.Loopback}:{Global.httpPort}";
if (config.listenerType == 2 || config.listenerType == 4)
{
if (PACServerHandle.IsRunning)
@@ -340,8 +340,8 @@ namespace v2rayN.Forms
}
}
}
notifyMain.Icon = GetNotifyIcon();
notifyMain.Icon = MainFormHandler.Instance.GetNotifyIcon(config, this.Icon);
}
private void ssMain_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
{
@@ -350,46 +350,7 @@ namespace v2rayN.Forms
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
@@ -405,10 +366,9 @@ namespace v2rayN.Forms
}
v2rayHandler.LoadV2ray(config);
Global.reloadV2ray = false;
ConfigHandler.ToJsonFile(config);
ConfigHandler.SaveConfig(ref config, false);
ChangeSysAgent(config.sysAgentEnabled);
DisplayToolStatus();
ChangePACButtonStatus(config.listenerType);
}
/// <summary>
@@ -416,9 +376,9 @@ namespace v2rayN.Forms
/// </summary>
private void CloseV2ray()
{
ConfigHandler.ToJsonFile(config);
ConfigHandler.SaveConfig(ref config, false);
ChangeSysAgent(false);
ChangePACButtonStatus(0);
v2rayHandler.V2rayStop();
}
@@ -593,122 +553,55 @@ namespace v2rayN.Forms
private void menuPingServer_Click(object sender, EventArgs e)
{
GetLvSelectedIndex();
ClearTestResult();
var statistics = new SpeedtestHandler(ref config, ref v2rayHandler, lvSelecteds, "ping", UpdateSpeedtestHandler);
Speedtest("ping");
}
private void menuTcpingServer_Click(object sender, EventArgs e)
{
GetLvSelectedIndex();
ClearTestResult();
var statistics = new SpeedtestHandler(ref config, ref v2rayHandler, lvSelecteds, "tcping", UpdateSpeedtestHandler);
Speedtest("tcping");
}
private void menuRealPingServer_Click(object sender, EventArgs e)
{
if (!config.sysAgentEnabled)
{
UI.Show(UIRes.I18N("NeedHttpGlobalProxy"));
return;
}
//if (!config.sysAgentEnabled)
//{
// UI.Show(UIRes.I18N("NeedHttpGlobalProxy"));
// return;
//}
UI.Show(UIRes.I18N("SpeedServerTips"));
//UI.Show(UIRes.I18N("SpeedServerTips"));
GetLvSelectedIndex();
ClearTestResult();
var statistics = new SpeedtestHandler(ref config, ref v2rayHandler, lvSelecteds, "realping", UpdateSpeedtestHandler);
Speedtest("realping");
}
private void menuSpeedServer_Click(object sender, EventArgs e)
{
if (!config.sysAgentEnabled)
{
UI.Show(UIRes.I18N("NeedHttpGlobalProxy"));
return;
}
//if (!config.sysAgentEnabled)
//{
// UI.Show(UIRes.I18N("NeedHttpGlobalProxy"));
// return;
//}
UI.Show(UIRes.I18N("SpeedServerTips"));
//UI.Show(UIRes.I18N("SpeedServerTips"));
Speedtest("speedtest");
}
private void Speedtest(string actionType)
{
GetLvSelectedIndex();
var statistics = new SpeedtestHandler(ref config, ref v2rayHandler, lvSelecteds, "speedtest", UpdateSpeedtestHandler);
ClearTestResult();
var statistics = new SpeedtestHandler(ref config, ref v2rayHandler, lvSelecteds, actionType, UpdateSpeedtestHandler);
}
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>(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>(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)
@@ -963,7 +856,7 @@ namespace v2rayN.Forms
/// <param name="msg"></param>
private void ShowMsg(string msg)
{
if (txtMsgBox.Lines.Length > 500)
if (txtMsgBox.Lines.Length > 999)
{
ClearMsg();
}
@@ -1006,15 +899,10 @@ namespace v2rayN.Forms
private void menuExit_Click(object sender, EventArgs e)
{
CloseV2ray();
this.Visible = false;
this.Close();
statistics?.Close();
//this.Dispose();
//System.Environment.Exit(System.Environment.ExitCode);
Application.Exit();
}
@@ -1026,6 +914,7 @@ namespace v2rayN.Forms
this.Activate();
//this.notifyIcon1.Visible = false;
this.ShowInTaskbar = true;
this.txtMsgBox.ScrollToCaret();
SetVisibleCore(true);
}
@@ -1044,7 +933,7 @@ namespace v2rayN.Forms
#endregion
#region
private void SetTestResult(int k, string txt)
{
config.vmess[k].testResult = txt;
@@ -1177,96 +1066,58 @@ namespace v2rayN.Forms
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 SetListenerType(int type)
{
config.listenerType = type;
ChangePACButtonStatus(type);
}
private void ChangePACButtonStatus(int type)
{
if (HttpProxyHandle.Update(config, false))
if (type != 0)
{
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;
}
}
DisplayToolStatus();
}
/// <summary>
/// 改变系统代理
/// </summary>
/// <param name="isChecked"></param>
private void ChangeSysAgent(bool isChecked)
{
if (isChecked)
{
if (HttpProxyHandle.RestartHttpAgent(config, true))
{
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
@@ -1279,10 +1130,10 @@ namespace v2rayN.Forms
private void tsbCheckUpdateCore_Click(object sender, EventArgs e)
{
if (v2rayUpdateHandle == null)
if (downloadHandle == null)
{
v2rayUpdateHandle = new V2rayUpdateHandle();
v2rayUpdateHandle.AbsoluteCompleted += (sender2, args) =>
downloadHandle = new DownloadHandle();
downloadHandle.AbsoluteCompleted += (sender2, args) =>
{
if (args.Success)
{
@@ -1298,7 +1149,7 @@ namespace v2rayN.Forms
}
else
{
v2rayUpdateHandle.DownloadFileAsync(config, url);
downloadHandle.DownloadFileAsync(config, url, null);
}
}));
}
@@ -1307,7 +1158,7 @@ namespace v2rayN.Forms
AppendText(false, args.Msg);
}
};
v2rayUpdateHandle.UpdateCompleted += (sender2, args) =>
downloadHandle.UpdateCompleted += (sender2, args) =>
{
if (args.Success)
{
@@ -1318,7 +1169,7 @@ namespace v2rayN.Forms
{
CloseV2ray();
string fileName = v2rayUpdateHandle.DownloadFileName;
string fileName = downloadHandle.DownloadFileName;
fileName = Utils.GetPath(fileName);
using (ZipArchive archive = ZipFile.OpenRead(fileName))
{
@@ -1346,14 +1197,14 @@ namespace v2rayN.Forms
AppendText(false, args.Msg);
}
};
v2rayUpdateHandle.Error += (sender2, args) =>
downloadHandle.Error += (sender2, args) =>
{
AppendText(true, args.GetException().Message);
};
}
AppendText(false, UIRes.I18N("MsgStartUpdatingV2rayCore"));
v2rayUpdateHandle.AbsoluteV2rayCore(config);
downloadHandle.AbsoluteV2rayCore(config);
}
private void tsbCheckUpdatePACList_Click(object sender, EventArgs e)
@@ -1405,7 +1256,7 @@ namespace v2rayN.Forms
private void tsbPromotion_Click(object sender, EventArgs e)
{
System.Diagnostics.Process.Start(Global.PromotionUrl);
System.Diagnostics.Process.Start($"{Utils.Base64Decode(Global.PromotionUrl)}?t={DateTime.Now.Ticks}");
}
#endregion
@@ -1473,8 +1324,8 @@ namespace v2rayN.Forms
continue;
}
V2rayUpdateHandle v2rayUpdateHandle3 = new V2rayUpdateHandle();
v2rayUpdateHandle3.UpdateCompleted += (sender2, args) =>
DownloadHandle downloadHandle3 = new DownloadHandle();
downloadHandle3.UpdateCompleted += (sender2, args) =>
{
if (args.Success)
{
@@ -1503,12 +1354,12 @@ namespace v2rayN.Forms
AppendText(false, args.Msg);
}
};
v2rayUpdateHandle3.Error += (sender2, args) =>
downloadHandle3.Error += (sender2, args) =>
{
AppendText(true, args.GetException().Message);
};
v2rayUpdateHandle3.WebDownloadString(url);
downloadHandle3.WebDownloadString(url);
AppendText(false, $"{hashCode}{UIRes.I18N("MsgStartGettingSubscriptions")}");
}
@@ -1533,9 +1384,7 @@ namespace v2rayN.Forms
Utils.RegWriteValue(Global.MyRegPath, Global.MyRegKeyLanguage, value);
}
#endregion
}
}

View File

@@ -291,7 +291,7 @@
<value>ImageAboveText</value>
</data>
<data name="cmsLv.Size" type="System.Drawing.Size, System.Drawing">
<value>448, 556</value>
<value>448, 534</value>
</data>
<data name="&gt;&gt;cmsLv.Name" xml:space="preserve">
<value>cmsLv</value>
@@ -333,7 +333,7 @@
<value>lvServers</value>
</data>
<data name="&gt;&gt;lvServers.Type" xml:space="preserve">
<value>v2rayN.Forms.ListViewFlickerFree, v2rayN, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</value>
<value>v2rayN.Base.ListViewFlickerFree, v2rayN, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;lvServers.Parent" xml:space="preserve">
<value>splitContainer1.Panel1</value>
@@ -422,11 +422,11 @@
<data name="cmsMain.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="menuSysAgentEnabled.Size" type="System.Drawing.Size, System.Drawing">
<value>264, 22</value>
<data name="menuNotEnabledHttp.Size" type="System.Drawing.Size, System.Drawing">
<value>547, 22</value>
</data>
<data name="menuSysAgentEnabled.Text" xml:space="preserve">
<value>Enable Http proxy</value>
<data name="menuNotEnabledHttp.Text" xml:space="preserve">
<value>Not Enabled Http Proxy</value>
</data>
<data name="menuGlobal.Size" type="System.Drawing.Size, System.Drawing">
<value>547, 22</value>
@@ -456,7 +456,7 @@
<value>264, 22</value>
</data>
<data name="menuSysAgentMode.Text" xml:space="preserve">
<value>Http proxy mode</value>
<value>Http proxy</value>
</data>
<data name="menuServers.Size" type="System.Drawing.Size, System.Drawing">
<value>264, 22</value>
@@ -1118,18 +1118,18 @@
<data name="&gt;&gt;notifyMain.Type" xml:space="preserve">
<value>System.Windows.Forms.NotifyIcon, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;menuSysAgentEnabled.Name" xml:space="preserve">
<value>menuSysAgentEnabled</value>
</data>
<data name="&gt;&gt;menuSysAgentEnabled.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;menuSysAgentMode.Name" xml:space="preserve">
<value>menuSysAgentMode</value>
</data>
<data name="&gt;&gt;menuSysAgentMode.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;menuNotEnabledHttp.Name" xml:space="preserve">
<value>menuNotEnabledHttp</value>
</data>
<data name="&gt;&gt;menuNotEnabledHttp.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;menuGlobal.Name" xml:space="preserve">
<value>menuGlobal</value>
</data>

View File

@@ -268,6 +268,12 @@
<data name="menuExport2SubContent.Text" xml:space="preserve">
<value>批量导出订阅内容至剪贴板(多选)</value>
</data>
<data name="tsbServer.Size" type="System.Drawing.Size, System.Drawing">
<value>73, 53</value>
</data>
<data name="tsbServer.Text" xml:space="preserve">
<value> 服务器 </value>
</data>
<data name="cmsLv.Size" type="System.Drawing.Size, System.Drawing">
<value>279, 534</value>
</data>
@@ -288,26 +294,11 @@
ZW0uRHJhd2luZy5HcmFwaGljc1VuaXQBAAAAB3ZhbHVlX18ACAMAAAADAAAACw==
</value>
</data>
<data name="tsbServer.Size" type="System.Drawing.Size, System.Drawing">
<value>73, 53</value>
<data name="menuNotEnabledHttp.Size" type="System.Drawing.Size, System.Drawing">
<value>340, 22</value>
</data>
<data name="tsbServer.Text" xml:space="preserve">
<value> 服务器 </value>
</data>
<data name="cmsMain.Size" type="System.Drawing.Size, System.Drawing">
<value>196, 164</value>
</data>
<data name="menuSysAgentEnabled.Size" type="System.Drawing.Size, System.Drawing">
<value>195, 22</value>
</data>
<data name="menuSysAgentEnabled.Text" xml:space="preserve">
<value>启用Http代理</value>
</data>
<data name="menuSysAgentMode.Size" type="System.Drawing.Size, System.Drawing">
<value>195, 22</value>
</data>
<data name="menuSysAgentMode.Text" xml:space="preserve">
<value>Http代理模式</value>
<data name="menuNotEnabledHttp.Text" xml:space="preserve">
<value>关闭Http代理</value>
</data>
<data name="menuGlobal.Size" type="System.Drawing.Size, System.Drawing">
<value>340, 22</value>
@@ -333,6 +324,12 @@
<data name="menuKeepPAC.Text" xml:space="preserve">
<value>仅开启PAC,不自动配置PAC</value>
</data>
<data name="menuSysAgentMode.Size" type="System.Drawing.Size, System.Drawing">
<value>195, 22</value>
</data>
<data name="menuSysAgentMode.Text" xml:space="preserve">
<value>Http代理</value>
</data>
<data name="menuServers.Size" type="System.Drawing.Size, System.Drawing">
<value>195, 22</value>
</data>
@@ -366,20 +363,17 @@
<data name="menuExit.Text" xml:space="preserve">
<value>退出</value>
</data>
<data name="cmsMain.Size" type="System.Drawing.Size, System.Drawing">
<value>196, 142</value>
</data>
<data name="groupBox1.Text" xml:space="preserve">
<value>服务器列表</value>
</data>
<data name="groupBox2.Text" xml:space="preserve">
<value>信息</value>
</data>
<data name="toolSslServerSpeed.Text" xml:space="preserve">
<value>网速显示未启用</value>
</data>
<data name="tsbSub.Size" type="System.Drawing.Size, System.Drawing">
<value>61, 53</value>
</data>
<data name="tsbSub.Text" xml:space="preserve">
<value> 订阅 </value>
<data name="groupBox2.Text" xml:space="preserve">
<value>信息</value>
</data>
<data name="tsbSubSetting.Size" type="System.Drawing.Size, System.Drawing">
<value>124, 22</value>
@@ -393,6 +387,12 @@
<data name="tsbSubUpdate.Text" xml:space="preserve">
<value>更新订阅</value>
</data>
<data name="tsbSub.Size" type="System.Drawing.Size, System.Drawing">
<value>61, 53</value>
</data>
<data name="tsbSub.Text" xml:space="preserve">
<value> 订阅 </value>
</data>
<data name="tsbOptionSetting.Size" type="System.Drawing.Size, System.Drawing">
<value>76, 53</value>
</data>
@@ -402,7 +402,7 @@
<data name="tsbReload.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAE3SURBVFhH7ZaBDQIhDEVvBEdwBDfQDXQER3AD3cARdAPd
YQUAAAAJcEhZcwAADsIAAA7CARUoSoAAAAE3SURBVFhH7ZaBDQIhDEVvBEdwBDfQDXQER3AD3cARdAPd
QDfSDbQvuSb1AicFjJrwkxcN0FIolOuamv5VE2E+gLaPayWchEcE+hhTXVPhIoQmDcFYbKpoJtwEdX4X
jgIrXfTwnzb6dBw22BaJVdjJmWQs1/SdBRtE0U5cBXW2oSFRO0HtSEeW2FZ1wsq9sjuRdTDVAXnNuWLY
6JnAl0sYa/Q5q1dhq35ci+Bkq2HJvbZpxGeybAAuw4Fq+cnW1wPITgHFYxvBUw+qHEIL1yq1vDKhVlH3
@@ -416,12 +416,6 @@
<data name="tsbReload.Text" xml:space="preserve">
<value> 重启服务 </value>
</data>
<data name="tsbCheckUpdate.Size" type="System.Drawing.Size, System.Drawing">
<value>85, 53</value>
</data>
<data name="tsbCheckUpdate.Text" xml:space="preserve">
<value> 检查更新 </value>
</data>
<data name="tsbCheckUpdateN.Size" type="System.Drawing.Size, System.Drawing">
<value>232, 22</value>
</data>
@@ -446,15 +440,21 @@
<data name="tsbCheckClearPACList.Text" xml:space="preserve">
<value>简化PAC (请设置Core路由)</value>
</data>
<data name="tsbCheckUpdate.Size" type="System.Drawing.Size, System.Drawing">
<value>85, 53</value>
</data>
<data name="tsbCheckUpdate.Text" xml:space="preserve">
<value> 检查更新 </value>
</data>
<data name="tsbAbout.Text" xml:space="preserve">
<value>关于</value>
</data>
<data name="tsbHelp.Size" type="System.Drawing.Size, System.Drawing">
<value>69, 53</value>
</data>
<data name="tsbHelp.Text" xml:space="preserve">
<value> 帮助 </value>
</data>
<data name="tsbAbout.Text" xml:space="preserve">
<value>关于</value>
</data>
<data name="tsbPromotion.Size" type="System.Drawing.Size, System.Drawing">
<value>68, 53</value>
</data>
@@ -464,7 +464,7 @@
<data name="tsbClose.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAySURBVFhH7c6xDQAgCEVBRnVTHU2ZABuMxV3yOvJDAAA/
YQUAAAAJcEhZcwAADsIAAA7CARUoSoAAAAAySURBVFhH7c6xDQAgCEVBRnVTHU2ZABuMxV3yOvJDAAA/
GqfZVG6X8mg1dfUAAPBQxAZd0SJruVXHWwAAAABJRU5ErkJggg==
</value>
</data>

View File

@@ -28,12 +28,13 @@
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(OptionSettingForm));
this.btnClose = new System.Windows.Forms.Button();
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();
@@ -61,13 +62,13 @@
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.cmbdomainStrategy = new System.Windows.Forms.ComboBox();
this.labRoutingTips = 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();
@@ -95,7 +96,6 @@
this.panel2 = new System.Windows.Forms.Panel();
this.btnOK = new System.Windows.Forms.Button();
this.panel1 = new System.Windows.Forms.Panel();
this.configBindingSource = new System.Windows.Forms.BindingSource(this.components);
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
this.groupBox1.SuspendLayout();
@@ -105,40 +105,43 @@
this.tabPage3.SuspendLayout();
this.tabPage4.SuspendLayout();
this.tabPage5.SuspendLayout();
this.tabPage8.SuspendLayout();
this.panel3.SuspendLayout();
this.tabPage6.SuspendLayout();
this.tabPage7.SuspendLayout();
this.panel2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.configBindingSource)).BeginInit();
this.SuspendLayout();
//
// btnClose
//
this.btnClose.DialogResult = System.Windows.Forms.DialogResult.Cancel;
resources.ApplyResources(this.btnClose, "btnClose");
this.btnClose.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnClose.Name = "btnClose";
this.btnClose.UseVisualStyleBackColor = true;
this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
//
// tabControl1
//
resources.ApplyResources(this.tabControl1, "tabControl1");
this.tabControl1.Controls.Add(this.tabPage1);
this.tabControl1.Controls.Add(this.tabPage2);
this.tabControl1.Controls.Add(this.tabPage6);
this.tabControl1.Controls.Add(this.tabPage7);
resources.ApplyResources(this.tabControl1, "tabControl1");
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
//
// tabPage1
//
this.tabPage1.Controls.Add(this.groupBox1);
resources.ApplyResources(this.tabPage1, "tabPage1");
this.tabPage1.Controls.Add(this.groupBox1);
this.tabPage1.Name = "tabPage1";
this.tabPage1.UseVisualStyleBackColor = true;
//
// 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);
@@ -157,10 +160,27 @@
this.groupBox1.Controls.Add(this.label5);
this.groupBox1.Controls.Add(this.txtlocalPort);
this.groupBox1.Controls.Add(this.label2);
resources.ApplyResources(this.groupBox1, "groupBox1");
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");
@@ -204,12 +224,12 @@
//
// cmbprotocol2
//
resources.ApplyResources(this.cmbprotocol2, "cmbprotocol2");
this.cmbprotocol2.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbprotocol2.FormattingEnabled = true;
this.cmbprotocol2.Items.AddRange(new object[] {
resources.GetString("cmbprotocol2.Items"),
resources.GetString("cmbprotocol2.Items1")});
resources.ApplyResources(this.cmbprotocol2, "cmbprotocol2");
this.cmbprotocol2.Name = "cmbprotocol2";
//
// label3
@@ -224,8 +244,8 @@
//
// cmbprotocol
//
this.cmbprotocol.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
resources.ApplyResources(this.cmbprotocol, "cmbprotocol");
this.cmbprotocol.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbprotocol.FormattingEnabled = true;
this.cmbprotocol.Items.AddRange(new object[] {
resources.GetString("cmbprotocol.Items"),
@@ -251,6 +271,7 @@
//
// cmbloglevel
//
resources.ApplyResources(this.cmbloglevel, "cmbloglevel");
this.cmbloglevel.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbloglevel.FormattingEnabled = true;
this.cmbloglevel.Items.AddRange(new object[] {
@@ -259,7 +280,6 @@
resources.GetString("cmbloglevel.Items2"),
resources.GetString("cmbloglevel.Items3"),
resources.GetString("cmbloglevel.Items4")});
resources.ApplyResources(this.cmbloglevel, "cmbloglevel");
this.cmbloglevel.Name = "cmbloglevel";
//
// label5
@@ -279,32 +299,33 @@
//
// tabPage2
//
this.tabPage2.Controls.Add(this.groupBox2);
resources.ApplyResources(this.tabPage2, "tabPage2");
this.tabPage2.Controls.Add(this.groupBox2);
this.tabPage2.Name = "tabPage2";
this.tabPage2.UseVisualStyleBackColor = true;
//
// groupBox2
//
resources.ApplyResources(this.groupBox2, "groupBox2");
this.groupBox2.Controls.Add(this.tabControl2);
this.groupBox2.Controls.Add(this.panel3);
resources.ApplyResources(this.groupBox2, "groupBox2");
this.groupBox2.Name = "groupBox2";
this.groupBox2.TabStop = false;
//
// tabControl2
//
resources.ApplyResources(this.tabControl2, "tabControl2");
this.tabControl2.Controls.Add(this.tabPage3);
this.tabControl2.Controls.Add(this.tabPage4);
this.tabControl2.Controls.Add(this.tabPage5);
resources.ApplyResources(this.tabControl2, "tabControl2");
this.tabControl2.Controls.Add(this.tabPage8);
this.tabControl2.Name = "tabControl2";
this.tabControl2.SelectedIndex = 0;
//
// tabPage3
//
this.tabPage3.Controls.Add(this.txtUseragent);
resources.ApplyResources(this.tabPage3, "tabPage3");
this.tabPage3.Controls.Add(this.txtUseragent);
this.tabPage3.Name = "tabPage3";
this.tabPage3.UseVisualStyleBackColor = true;
//
@@ -315,8 +336,8 @@
//
// tabPage4
//
this.tabPage4.Controls.Add(this.txtUserdirect);
resources.ApplyResources(this.tabPage4, "tabPage4");
this.tabPage4.Controls.Add(this.txtUserdirect);
this.tabPage4.Name = "tabPage4";
this.tabPage4.UseVisualStyleBackColor = true;
//
@@ -327,8 +348,8 @@
//
// tabPage5
//
this.tabPage5.Controls.Add(this.txtUserblock);
resources.ApplyResources(this.tabPage5, "tabPage5");
this.tabPage5.Controls.Add(this.txtUserblock);
this.tabPage5.Name = "tabPage5";
this.tabPage5.UseVisualStyleBackColor = true;
//
@@ -337,15 +358,32 @@
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
//
this.panel3.Controls.Add(this.btnSetDefRountingRule);
this.panel3.Controls.Add(this.cmbdomainStrategy);
this.panel3.Controls.Add(this.labRoutingTips);
this.panel3.Controls.Add(this.label15);
this.panel3.Controls.Add(this.label12);
this.panel3.Controls.Add(this.cmbroutingMode);
resources.ApplyResources(this.panel3, "panel3");
this.panel3.Controls.Add(this.btnSetDefRountingRule);
this.panel3.Controls.Add(this.labRoutingTips);
this.panel3.Controls.Add(this.cmbdomainStrategy);
this.panel3.Controls.Add(this.label15);
this.panel3.Name = "panel3";
//
// btnSetDefRountingRule
@@ -355,47 +393,31 @@
this.btnSetDefRountingRule.UseVisualStyleBackColor = true;
this.btnSetDefRountingRule.Click += new System.EventHandler(this.btnSetDefRountingRule_Click);
//
// labRoutingTips
//
resources.ApplyResources(this.labRoutingTips, "labRoutingTips");
this.labRoutingTips.ForeColor = System.Drawing.Color.Brown;
this.labRoutingTips.Name = "labRoutingTips";
//
// cmbdomainStrategy
//
resources.ApplyResources(this.cmbdomainStrategy, "cmbdomainStrategy");
this.cmbdomainStrategy.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbdomainStrategy.FormattingEnabled = true;
this.cmbdomainStrategy.Items.AddRange(new object[] {
resources.GetString("cmbdomainStrategy.Items"),
resources.GetString("cmbdomainStrategy.Items1"),
resources.GetString("cmbdomainStrategy.Items2")});
resources.ApplyResources(this.cmbdomainStrategy, "cmbdomainStrategy");
this.cmbdomainStrategy.Name = "cmbdomainStrategy";
//
// labRoutingTips
//
this.labRoutingTips.ForeColor = System.Drawing.Color.Brown;
resources.ApplyResources(this.labRoutingTips, "labRoutingTips");
this.labRoutingTips.Name = "labRoutingTips";
//
// label15
//
resources.ApplyResources(this.label15, "label15");
this.label15.Name = "label15";
//
// label12
//
resources.ApplyResources(this.label12, "label12");
this.label12.Name = "label12";
//
// 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")});
resources.ApplyResources(this.cmbroutingMode, "cmbroutingMode");
this.cmbroutingMode.Name = "cmbroutingMode";
//
// tabPage6
//
resources.ApplyResources(this.tabPage6, "tabPage6");
this.tabPage6.Controls.Add(this.chkKcpcongestion);
this.tabPage6.Controls.Add(this.txtKcpwriteBufferSize);
this.tabPage6.Controls.Add(this.label10);
@@ -409,7 +431,6 @@
this.tabPage6.Controls.Add(this.label7);
this.tabPage6.Controls.Add(this.txtKcpmtu);
this.tabPage6.Controls.Add(this.label6);
resources.ApplyResources(this.tabPage6, "tabPage6");
this.tabPage6.Name = "tabPage6";
this.tabPage6.UseVisualStyleBackColor = true;
//
@@ -481,6 +502,7 @@
//
// tabPage7
//
resources.ApplyResources(this.tabPage7, "tabPage7");
this.tabPage7.Controls.Add(this.cbFreshrate);
this.tabPage7.Controls.Add(this.tbCacheDays);
this.tabPage7.Controls.Add(this.lbFreshrate);
@@ -490,15 +512,14 @@
this.tabPage7.Controls.Add(this.txturlGFWList);
this.tabPage7.Controls.Add(this.label13);
this.tabPage7.Controls.Add(this.chkAutoRun);
resources.ApplyResources(this.tabPage7, "tabPage7");
this.tabPage7.Name = "tabPage7";
this.tabPage7.UseVisualStyleBackColor = true;
//
// cbFreshrate
//
resources.ApplyResources(this.cbFreshrate, "cbFreshrate");
this.cbFreshrate.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbFreshrate.FormattingEnabled = true;
resources.ApplyResources(this.cbFreshrate, "cbFreshrate");
this.cbFreshrate.Name = "cbFreshrate";
//
// tbCacheDays
@@ -546,9 +567,9 @@
//
// panel2
//
resources.ApplyResources(this.panel2, "panel2");
this.panel2.Controls.Add(this.btnClose);
this.panel2.Controls.Add(this.btnOK);
resources.ApplyResources(this.panel2, "panel2");
this.panel2.Name = "panel2";
//
// btnOK
@@ -563,10 +584,6 @@
resources.ApplyResources(this.panel1, "panel1");
this.panel1.Name = "panel1";
//
// configBindingSource
//
this.configBindingSource.DataSource = typeof(v2rayN.Mode.Config);
//
// OptionSettingForm
//
resources.ApplyResources(this, "$this");
@@ -591,6 +608,7 @@
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);
@@ -598,7 +616,6 @@
this.tabPage7.ResumeLayout(false);
this.tabPage7.PerformLayout();
this.panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.configBindingSource)).EndInit();
this.ResumeLayout(false);
}
@@ -660,7 +677,6 @@
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 System.Windows.Forms.Label lbCacheDays;
private System.Windows.Forms.ComboBox cbFreshrate;
private System.Windows.Forms.Label lbFreshrate;
private System.Windows.Forms.BindingSource configBindingSource;
private System.Windows.Forms.Label label16;
private System.Windows.Forms.ComboBox cmblistenerType;
private System.Windows.Forms.TabPage tabPage8;
}
}

View File

@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Windows.Forms;
using v2rayN.Handler;
using v2rayN.Base;
namespace v2rayN.Forms
{
@@ -43,8 +44,8 @@ namespace v2rayN.Forms
chkudpEnabled.Checked = config.inbound[0].udpEnabled;
chksniffingEnabled.Checked = config.inbound[0].sniffingEnabled;
txtlocalPort2.Text = "socks + 1";
cmbprotocol2.Text = "http";
txtlocalPort2.Text = $"{config.inbound[0].localPort + 1}";
cmbprotocol2.Text = Global.InboundHttp;
if (config.inbound.Count > 1)
{
@@ -63,6 +64,8 @@ namespace v2rayN.Forms
//remoteDNS
txtremoteDNS.Text = config.remoteDNS;
cmblistenerType.SelectedIndex = config.listenerType;
}
/// <summary>
@@ -126,7 +129,7 @@ namespace v2rayN.Forms
cbFreshrate.DisplayMember = "Text";
cbFreshrate.ValueMember = "ID";
switch(config.statisticsFreshRate)
switch (config.statisticsFreshRate)
{
case (int)Global.StatisticsFreshRate.quick:
cbFreshrate.SelectedItem = cbSource[0];
@@ -249,7 +252,8 @@ namespace v2rayN.Forms
//remoteDNS
config.remoteDNS = txtremoteDNS.Text.TrimEx();
config.listenerType = cmblistenerType.SelectedIndex;
return 0;
}
@@ -368,10 +372,15 @@ namespace v2rayN.Forms
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<string>();
lstUrl.Add(Global.CustomRoutingListUrl + "proxy");
lstUrl.Add(Global.CustomRoutingListUrl + "direct");
lstUrl.Add(Global.CustomRoutingListUrl + "block");
lstUrl.Add(Global.CustomRoutingListUrl + Global.agentTag);
lstUrl.Add(Global.CustomRoutingListUrl + Global.directTag);
lstUrl.Add(Global.CustomRoutingListUrl + Global.blockTag);
var lstTxt = new List<TextBox>();
lstTxt.Add(txtUseragent);
@@ -381,8 +390,8 @@ namespace v2rayN.Forms
for (int k = 0; k < lstUrl.Count; k++)
{
var txt = lstTxt[k];
V2rayUpdateHandle v2rayUpdateHandle3 = new V2rayUpdateHandle();
v2rayUpdateHandle3.UpdateCompleted += (sender2, args) =>
DownloadHandle downloadHandle = new DownloadHandle();
downloadHandle.UpdateCompleted += (sender2, args) =>
{
if (args.Success)
{
@@ -398,12 +407,12 @@ namespace v2rayN.Forms
AppendText(false, args.Msg);
}
};
v2rayUpdateHandle3.Error += (sender2, args) =>
downloadHandle.Error += (sender2, args) =>
{
AppendText(true, args.GetException().Message);
};
v2rayUpdateHandle3.WebDownloadString(lstUrl[k]);
downloadHandle.WebDownloadString(lstUrl[k]);
}
}
void AppendText(bool notify, string text)
@@ -414,7 +423,13 @@ namespace v2rayN.Forms
class ComboItem
{
public int ID { get; set; }
public string Text { get; set; }
public int ID
{
get; set;
}
public string Text
{
get; set;
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -120,7 +120,31 @@
<data name="btnClose.Text" xml:space="preserve">
<value>取消(&amp;C)</value>
</data>
<data name="tabPage1.Text" xml:space="preserve">
<value> Core:基础设置 </value>
</data>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="label16.Size" type="System.Drawing.Size, System.Drawing">
<value>53, 12</value>
</data>
<data name="label16.Text" xml:space="preserve">
<value>Http代理</value>
</data>
<data name="cmblistenerType.Items" xml:space="preserve">
<value>关闭Http代理</value>
</data>
<data name="cmblistenerType.Items1" xml:space="preserve">
<value>开启Http代理,并自动配置代理服务器(全局模式)</value>
</data>
<data name="cmblistenerType.Items2" xml:space="preserve">
<value>开启PAC,并自动配置PAC(PAC模式)</value>
</data>
<data name="cmblistenerType.Items3" xml:space="preserve">
<value>仅开启Http代理,不自动配置代理服务器(直连模式)</value>
</data>
<data name="cmblistenerType.Items4" xml:space="preserve">
<value>仅开启PAC,不自动配置PAC</value>
</data>
<data name="chksniffingEnabled2.Size" type="System.Drawing.Size, System.Drawing">
<value>96, 16</value>
</data>
@@ -190,55 +214,47 @@
<data name="label2.Text" xml:space="preserve">
<value>本地监听端口</value>
</data>
<data name="tabPage1.Text" xml:space="preserve">
<value> Core:基础设置 </value>
<data name="tabPage2.Text" xml:space="preserve">
<value> Core:路由设置 </value>
</data>
<data name="tabControl2.Location" type="System.Drawing.Point, System.Drawing">
<value>3, 89</value>
</data>
<data name="tabControl2.Size" type="System.Drawing.Size, System.Drawing">
<value>642, 481</value>
</data>
<data name="tabPage3.Size" type="System.Drawing.Size, System.Drawing">
<value>634, 455</value>
</data>
<data name="tabPage3.Text" xml:space="preserve">
<value> 代理的Domain或IP </value>
<value> 1.代理的Domain或IP </value>
</data>
<data name="txtUseragent.Size" type="System.Drawing.Size, System.Drawing">
<value>628, 449</value>
</data>
<data name="tabPage4.Size" type="System.Drawing.Size, System.Drawing">
<value>634, 455</value>
</data>
<data name="tabPage4.Text" xml:space="preserve">
<value> 直连的Domain或IP </value>
<value> 2.直连的Domain或IP </value>
</data>
<data name="txtUserdirect.Size" type="System.Drawing.Size, System.Drawing">
<value>628, 449</value>
</data>
<data name="tabPage5.Size" type="System.Drawing.Size, System.Drawing">
<value>634, 455</value>
</data>
<data name="tabPage5.Text" xml:space="preserve">
<value> 阻止的Domain或IP </value>
<value> 3.阻止的Domain或IP </value>
</data>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="btnSetDefRountingRule.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
<data name="txtUserblock.Size" type="System.Drawing.Size, System.Drawing">
<value>628, 449</value>
</data>
<data name="btnSetDefRountingRule.Location" type="System.Drawing.Point, System.Drawing">
<value>381, 43</value>
<data name="tabPage8.Size" type="System.Drawing.Size, System.Drawing">
<value>634, 455</value>
</data>
<data name="btnSetDefRountingRule.Size" type="System.Drawing.Size, System.Drawing">
<value>201, 23</value>
</data>
<data name="btnSetDefRountingRule.Text" xml:space="preserve">
<value>一键设置默认自定义路由规则</value>
</data>
<data name="cmbdomainStrategy.Size" type="System.Drawing.Size, System.Drawing">
<value>232, 20</value>
</data>
<assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="labRoutingTips.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="labRoutingTips.Size" type="System.Drawing.Size, System.Drawing">
<value>383, 12</value>
</data>
<data name="labRoutingTips.Text" xml:space="preserve">
<value>*设置的规则,用逗号(,)隔开;支持Domain(纯字符串/正则/子域名)和IP</value>
</data>
<data name="label15.Size" type="System.Drawing.Size, System.Drawing">
<value>53, 12</value>
</data>
<data name="label15.Text" xml:space="preserve">
<value>域名策略</value>
</data>
<data name="label12.Size" type="System.Drawing.Size, System.Drawing">
<value>53, 12</value>
</data>
<data name="label12.Text" xml:space="preserve">
<value>路由模式</value>
<data name="tabPage8.Text" xml:space="preserve">
<value> 4.预定义规则 </value>
</data>
<data name="cmbroutingMode.Items" xml:space="preserve">
<value>全局</value>
@@ -252,15 +268,77 @@
<data name="cmbroutingMode.Items3" xml:space="preserve">
<value>绕过局域网及大陆地址</value>
</data>
<data name="cmbroutingMode.Size" type="System.Drawing.Size, System.Drawing">
<value>232, 20</value>
<data name="cmbroutingMode.Location" type="System.Drawing.Point, System.Drawing">
<value>19, 26</value>
</data>
<data name="tabPage2.Text" xml:space="preserve">
<value> Core:路由设置 </value>
<data name="cmbroutingMode.Size" type="System.Drawing.Size, System.Drawing">
<value>244, 20</value>
</data>
<data name="panel3.Size" type="System.Drawing.Size, System.Drawing">
<value>642, 72</value>
</data>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="btnSetDefRountingRule.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="btnSetDefRountingRule.Location" type="System.Drawing.Point, System.Drawing">
<value>351, 14</value>
</data>
<data name="btnSetDefRountingRule.Size" type="System.Drawing.Size, System.Drawing">
<value>201, 23</value>
</data>
<data name="btnSetDefRountingRule.Text" xml:space="preserve">
<value>一键设置默认自定义路由规则</value>
</data>
<assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="labRoutingTips.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="labRoutingTips.Location" type="System.Drawing.Point, System.Drawing">
<value>5, 49</value>
</data>
<data name="labRoutingTips.Size" type="System.Drawing.Size, System.Drawing">
<value>383, 12</value>
</data>
<data name="labRoutingTips.Text" xml:space="preserve">
<value>*设置的规则,用逗号(,)隔开;支持Domain(纯字符串/正则/子域名)和IP</value>
</data>
<data name="cmbdomainStrategy.Location" type="System.Drawing.Point, System.Drawing">
<value>81, 14</value>
</data>
<data name="cmbdomainStrategy.Size" type="System.Drawing.Size, System.Drawing">
<value>186, 20</value>
</data>
<data name="label15.Size" type="System.Drawing.Size, System.Drawing">
<value>53, 12</value>
</data>
<data name="label15.Text" xml:space="preserve">
<value>域名策略</value>
</data>
<data name="tabPage6.Text" xml:space="preserve">
<value> Core:KCP设置 </value>
</data>
<data name="tabPage7.Text" xml:space="preserve">
<value> v2rayN设置 </value>
</data>
<data name="lbFreshrate.Size" type="System.Drawing.Size, System.Drawing">
<value>77, 12</value>
</data>
<data name="lbFreshrate.Text" xml:space="preserve">
<value>统计刷新频率</value>
</data>
<data name="lbCacheDays.Size" type="System.Drawing.Size, System.Drawing">
<value>305, 12</value>
</data>
<data name="lbCacheDays.Text" xml:space="preserve">
<value>缓存天数0-30 0关闭缓存单独每天的数据使用情况</value>
</data>
<data name="chkEnableStatistics.Size" type="System.Drawing.Size, System.Drawing">
<value>384, 16</value>
</data>
<data name="chkEnableStatistics.Text" xml:space="preserve">
<value>启用统计实时网速显示和使用流量显示需要重启v2rayN客户端</value>
</data>
<data name="chkAllowLANConn.Size" type="System.Drawing.Size, System.Drawing">
<value>144, 16</value>
</data>
@@ -279,22 +357,10 @@
<data name="chkAutoRun.Text" xml:space="preserve">
<value>开机自动启动(可能会不成功)</value>
</data>
<data name="tabPage7.Text" xml:space="preserve">
<value> v2rayN设置 </value>
</data>
<data name="btnOK.Text" xml:space="preserve">
<value>确定(&amp;O)</value>
</data>
<data name="$this.Text" xml:space="preserve">
<value>参数设置</value>
</data>
<data name="chkEnableStatistics.Text" xml:space="preserve">
<value>启用统计实时网速显示和使用流量显示需要重启v2rayN客户端</value>
</data>
<data name="lbCacheDays.Text" xml:space="preserve">
<value>缓存天数0-30 0关闭缓存单独每天的数据使用情况</value>
</data>
<data name="lbFreshrate.Text" xml:space="preserve">
<value>统计刷新频率</value>
</data>
</root>

View File

@@ -1,5 +1,6 @@
using System;
using System.Windows.Forms;
using v2rayN.Base;
using v2rayN.Mode;
namespace v2rayN.Forms

View File

@@ -5,14 +5,10 @@ namespace v2rayN
{
#region
/// <summary>
/// 更新链接
/// </summary>
public const string UpdateUrl = @"https://github.com/2dust/v2rayN/releases";
/// <summary>
/// 关于链接
/// </summary>
public const string AboutUrl = @"https://github.com/2dust/v2rayN";
public const string UpdateUrl = AboutUrl + @"/releases";
/// <summary>
/// SpeedTestUrl
@@ -25,10 +21,12 @@ namespace v2rayN
/// </summary>
public const string CustomRoutingListUrl = @"https://raw.githubusercontent.com/2dust/v2rayCustomRoutingList/master/";
public const string GFWLIST_URL = "https://raw.githubusercontent.com/gfwlist/gfwlist/master/gfwlist.txt";
/// <summary>
/// PromotionUrl
/// </summary>
public const string PromotionUrl = @"https://1.2345345.xyz/ads.html";
public const string PromotionUrl = @"aHR0cHM6Ly8xLjIzNDQ1Ni54eXovYWRzLmh0bWw=";
/// <summary>
/// 本软件配置文件名
@@ -61,6 +59,8 @@ namespace v2rayN
/// </summary>
public const string BlankPacFileName = "v2rayN.Sample.BlankPac.txt";
public const string CustomRoutingFileName = "v2rayN.Sample.custom_routing_";
/// <summary>
/// 默认加密方式
@@ -96,12 +96,19 @@ namespace v2rayN
/// 阻止 tag值
/// </summary>
public const string blockTag = "block";
/// <summary>
///
/// </summary>
public const string StreamSecurity = "tls";
public const string InboundSocks = "socks";
public const string InboundHttp = "http";
public const string Loopback = "127.0.0.1";
public const string InboundAPITagName = "api";
public const string InboundAPIProtocal = "dokodemo-door";
/// <summary>
/// vmess
/// </summary>
@@ -147,12 +154,6 @@ namespace v2rayN
/// </summary>
public const string CustomIconName = "v2rayN.ico";
public const string Loopback = "127.0.0.1";
public const string InboundAPITagName = "api";
public const string InboundProxyTagName = "proxy";
public const string InboundAPIProtocal = "dokodemo-door";
public enum StatisticsFreshRate
{
quick = 1000,
@@ -169,32 +170,50 @@ namespace v2rayN
/// <summary>
/// 是否需要重启服务V2ray
/// </summary>
public static bool reloadV2ray { get; set; }
public static bool reloadV2ray
{
get; set;
}
/// <summary>
/// 是否开启全局代理(http)
/// </summary>
public static bool sysAgent { get; set; }
public static bool sysAgent
{
get; set;
}
/// <summary>
/// socks端口
/// socks端口
/// </summary>
public static int socksPort { get; set; }
public static int socksPort
{
get; set;
}
/// <summary>
/// 全局代理端口(http)
/// http端口
/// </summary>
public static int sysAgentPort { get; set; }
public static int httpPort
{
get; set;
}
/// <summary>
/// PAC监听端口
/// PAC端口
/// </summary>
public static int pacPort { get; set; }
public static int pacPort
{
get; set;
}
/// <summary>
///
/// </summary>
public static int statePort { get; set; }
public static int statePort
{
get; set;
}
#endregion

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.IO;
using System.Net;
using v2rayN.Mode;
using v2rayN.Base;
namespace v2rayN.Handler
{
@@ -56,7 +57,7 @@ namespace v2rayN.Handler
{
config.inbound = new List<InItem>();
InItem inItem = new InItem();
inItem.protocol = "socks";
inItem.protocol = Global.InboundSocks;
inItem.localPort = 10808;
inItem.udpEnabled = true;
inItem.sniffingEnabled = true;
@@ -75,7 +76,7 @@ namespace v2rayN.Handler
//http协议不由core提供,只保留socks
if (config.inbound.Count > 0)
{
config.inbound[0].protocol = "socks";
config.inbound[0].protocol = Global.InboundSocks;
}
}
//路由规则
@@ -120,6 +121,10 @@ namespace v2rayN.Handler
//{
// config.pacPort = 8888;
//}
if (Utils.IsNullOrEmpty(config.urlGFWList))
{
config.urlGFWList = Global.GFWLIST_URL;
}
if (config.subItem == null)
{
@@ -302,9 +307,9 @@ namespace v2rayN.Handler
/// </summary>
/// <param name="config"></param>
/// <returns></returns>
public static int SaveConfig(ref Config config)
public static int SaveConfig(ref Config config, bool reload = true)
{
Global.reloadV2ray = true;
Global.reloadV2ray = reload;
ToJsonFile(config);
@@ -315,7 +320,7 @@ namespace v2rayN.Handler
/// 存储文件
/// </summary>
/// <param name="config"></param>
public static void ToJsonFile(Config config)
private static void ToJsonFile(Config config)
{
Utils.ToJsonFile(config, Utils.GetPath(configRes));
}
@@ -514,11 +519,11 @@ namespace v2rayN.Handler
{
string newFileName = string.Empty;
newFileName = string.Format("{0}.json", Utils.GetGUID());
newFileName = Path.Combine(Utils.GetTempPath(), newFileName);
//newFileName = Path.Combine(Utils.GetTempPath(), newFileName);
try
{
File.Copy(fileName, newFileName);
File.Copy(fileName, Path.Combine(Utils.GetTempPath(), newFileName));
}
catch
{
@@ -578,7 +583,7 @@ namespace v2rayN.Handler
vmessItem.address = vmessItem.address.TrimEx();
vmessItem.id = vmessItem.id.TrimEx();
vmessItem.security = vmessItem.security.TrimEx();
if (index >= 0)
{
//修改

View File

@@ -1,20 +1,15 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Text;
using Newtonsoft.Json;
using v2rayN.Base;
using v2rayN.Mode;
using v2rayN.Properties;
using v2rayN.HttpProxyHandler;
using System.Diagnostics;
namespace v2rayN.Handler
{
/// <summary>
///Update V2ray Core
///Download
/// </summary>
class V2rayUpdateHandle
class DownloadHandle
{
public event EventHandler<ResultEventArgs> AbsoluteCompleted;
@@ -92,7 +87,7 @@ namespace v2rayN.Handler
}
public void DownloadFileAsync(Config config, string url)
public void DownloadFileAsync(Config config, string url, WebProxy webProxy)
{
try
{
@@ -106,7 +101,10 @@ namespace v2rayN.Handler
progressPercentage = -1;
WebClientEx ws = new WebClientEx();
ws.Proxy = new WebProxy(Global.Loopback, Global.sysAgentPort);
if (webProxy != null)
{
ws.Proxy = webProxy;// new WebProxy(Global.Loopback, Global.httpPort);
}
ws.DownloadFileCompleted += ws_DownloadFileCompleted;
ws.DownloadProgressChanged += ws_DownloadProgressChanged;

View File

@@ -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<int> _selecteds;
//private Thread _workThread;
//Action<int, string> _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>(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>(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));
}
}
}
}

View File

@@ -1,5 +1,4 @@
using Grpc.Core;
using System;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Net;
@@ -11,7 +10,7 @@ namespace v2rayN.Handler
{
class SpeedtestHandler
{
private V2rayUpdateHandle v2rayUpdateHandle2;
private DownloadHandle downloadHandle2;
private Config _config;
private V2rayHandler _v2rayHandler;
private List<int> _selecteds;
@@ -37,16 +36,19 @@ namespace v2rayN.Handler
if (actionType == "ping")
{
_workThread = new Thread(new ThreadStart(RunPing));
_workThread.IsBackground = true;
_workThread.Start();
}
if (actionType == "tcping")
{
_workThread = new Thread(new ThreadStart(RunTcping));
_workThread.IsBackground = true;
_workThread.Start();
}
else if (actionType == "realping")
{
_workThread = new Thread(new ThreadStart(RunRealPing));
_workThread.IsBackground = true;
_workThread.Start();
}
else if (actionType == "speedtest")
@@ -66,7 +68,7 @@ namespace v2rayN.Handler
}
}
public void RunPing()
private void RunPing()
{
try
{
@@ -88,7 +90,7 @@ namespace v2rayN.Handler
}
}
Thread.Sleep(1);
Thread.Sleep(100);
}
catch (Exception ex)
@@ -97,7 +99,7 @@ namespace v2rayN.Handler
}
}
public void RunTcping()
private void RunTcping()
{
try
{
@@ -119,7 +121,7 @@ namespace v2rayN.Handler
}
}
Thread.Sleep(1);
Thread.Sleep(100);
}
catch (Exception ex)
@@ -128,10 +130,18 @@ namespace v2rayN.Handler
}
}
public void RunRealPing()
private void RunRealPing()
{
try
{
string msg = string.Empty;
Global.reloadV2ray = true;
_v2rayHandler.LoadV2ray(_config, _selecteds);
Thread.Sleep(5000);
var httpPort = _config.GetLocalPort("speedtest");
for (int k = 0; k < _selecteds.Count; k++)
{
int index = _selecteds[k];
@@ -139,20 +149,12 @@ namespace v2rayN.Handler
{
continue;
}
try
{
if (ConfigHandler.SetDefaultServer(ref _config, index) == 0)
{
_v2rayHandler.LoadV2ray(_config);
}
else
{
return;
}
Thread.Sleep(1000 * 5);
var webProxy = new WebProxy(Global.Loopback, httpPort + index);
int responseTime = -1;
var status = GetRealPingTime(Global.SpeedPingTestUrl, out responseTime);
var status = GetRealPingTime(Global.SpeedPingTestUrl, webProxy, out responseTime);
if (!Utils.IsNullOrEmpty(status))
{
_updateFunc(index, string.Format("{0}", status));
@@ -166,9 +168,12 @@ namespace v2rayN.Handler
{
Utils.SaveLog(ex.Message, ex);
}
Thread.Sleep(100);
}
Thread.Sleep(1);
Global.reloadV2ray = true;
_v2rayHandler.LoadV2ray(_config);
Thread.Sleep(100);
}
catch (Exception ex)
@@ -184,12 +189,17 @@ namespace v2rayN.Handler
return;
}
Global.reloadV2ray = true;
_v2rayHandler.LoadV2ray(_config, _selecteds);
Thread.Sleep(5000);
string url = Global.SpeedTestUrl;
testCounter = 0;
if (v2rayUpdateHandle2 == null)
if (downloadHandle2 == null)
{
v2rayUpdateHandle2 = new V2rayUpdateHandle();
v2rayUpdateHandle2.UpdateCompleted += (sender2, args) =>
downloadHandle2 = new DownloadHandle();
downloadHandle2.UpdateCompleted += (sender2, args) =>
{
if (args.Success)
{
@@ -204,7 +214,7 @@ namespace v2rayN.Handler
_updateFunc(ItemIndex, args.Msg);
}
};
v2rayUpdateHandle2.Error += (sender2, args) =>
downloadHandle2.Error += (sender2, args) =>
{
_updateFunc(ItemIndex, args.GetException().Message);
if (ServerSpeedTestSub(testCounter, url) != 0)
@@ -213,6 +223,7 @@ namespace v2rayN.Handler
}
};
}
if (ServerSpeedTestSub(testCounter, url) != 0)
{
return;
@@ -223,23 +234,19 @@ namespace v2rayN.Handler
{
if (index >= _selecteds.Count)
{
return -1;
}
if (ConfigHandler.SetDefaultServer(ref _config, _selecteds[index]) == 0)
{
Global.reloadV2ray = true;
_v2rayHandler.LoadV2ray(_config);
testCounter++;
v2rayUpdateHandle2.DownloadFileAsync(_config, url);
return 0;
}
else
{
return -1;
}
var httpPort = _config.GetLocalPort("speedtest");
index = _selecteds[index];
testCounter++;
var webProxy = new WebProxy(Global.Loopback, httpPort + index);
downloadHandle2.DownloadFileAsync(_config, url, webProxy);
return 0;
}
private int GetTcpingTime(string url, int port)
@@ -248,7 +255,7 @@ namespace v2rayN.Handler
try
{
IPHostEntry ipHostInfo = System.Net.Dns.Resolve(url);
IPHostEntry ipHostInfo = System.Net.Dns.GetHostEntry(url);
IPAddress ipAddress = ipHostInfo.AddressList[0];
var timer = new Stopwatch();
@@ -267,7 +274,7 @@ namespace v2rayN.Handler
return responseTime;
}
private string GetRealPingTime(string url, out int responseTime)
private string GetRealPingTime(string url, WebProxy webProxy, out int responseTime)
{
string msg = string.Empty;
responseTime = -1;
@@ -276,7 +283,7 @@ namespace v2rayN.Handler
{
HttpWebRequest myHttpWebRequest = (HttpWebRequest)WebRequest.Create(url);
myHttpWebRequest.Timeout = 5000;
myHttpWebRequest.Proxy = new WebProxy(Global.Loopback, Global.sysAgentPort);
myHttpWebRequest.Proxy = webProxy;//new WebProxy(Global.Loopback, Global.httpPort);
var timer = new Stopwatch();
timer.Start();
@@ -300,7 +307,5 @@ namespace v2rayN.Handler
return msg;
}
}
}

View File

@@ -6,7 +6,9 @@ using System.Net;
using System.Net.Sockets;
using System.Threading;
using v2rayN.Mode;
using v2rayN.Properties;
using v2rayN.Protos.Statistics;
using v2rayN.Tool;
namespace v2rayN.Handler
{
@@ -66,6 +68,23 @@ namespace v2rayN.Handler
public StatisticsHandler(Mode.Config config, Action<ulong, ulong, ulong, ulong, List<Mode.ServerStatistics>> update)
{
try
{
if (Environment.Is64BitOperatingSystem)
{
FileManager.UncompressFile(Utils.GetPath("grpc_csharp_ext.x64.dll"), Resources.grpc_csharp_ext_x64_dll);
}
else
{
FileManager.UncompressFile(Utils.GetPath("grpc_csharp_ext.x86.dll"), Resources.grpc_csharp_ext_x86_dll);
}
}
catch (IOException ex)
{
Utils.SaveLog(ex.Message, ex);
}
config_ = config;
enabled_ = config.enableStatistics;
UpdateUI = false;
@@ -86,6 +105,7 @@ namespace v2rayN.Handler
GrpcInit();
workThread_ = new Thread(new ThreadStart(Run));
workThread_.IsBackground = true;
workThread_.Start();
}
@@ -192,7 +212,7 @@ namespace v2rayN.Handler
name = nStr[1];
type = nStr[3];
if (name == Global.InboundProxyTagName)
if (name == Global.agentTag)
{
if (type == "uplink")
{

View File

@@ -1,10 +1,10 @@
using System;
using System.Collections.Generic;
using System.IO;
using v2rayN.Mode;
using System.Net;
using System.Text;
using System.Linq;
using System.Net;
using v2rayN.Base;
using v2rayN.Mode;
namespace v2rayN.Handler
{
@@ -655,7 +655,7 @@ namespace v2rayN.Handler
if (!v2rayConfig.routing.rules.Exists(item => { return item.outboundTag == tag; }))
{
var apiRoutingRule = new Mode.RulesItem();
apiRoutingRule.inboundTag = tag;
apiRoutingRule.inboundTag = new List<string> { tag };
apiRoutingRule.outboundTag = tag;
apiRoutingRule.type = "field";
v2rayConfig.routing.rules.Add(apiRoutingRule);
@@ -688,11 +688,21 @@ namespace v2rayN.Handler
return -1;
}
string addressFileName = config.address();
if (File.Exists(fileName))
{
File.Delete(fileName);
}
string addressFileName = config.address();
if (!File.Exists(addressFileName))
{
addressFileName = Path.Combine(Utils.GetTempPath(), addressFileName);
}
if (!File.Exists(addressFileName))
{
msg = UIRes.I18N("FailedGenDefaultConfiguration");
return -1;
}
File.Copy(addressFileName, fileName);
msg = string.Format(UIRes.I18N("SuccessfulConfiguration"), config.getSummary());
@@ -1365,5 +1375,90 @@ namespace v2rayN.Handler
#endregion
#region Gen speedtest config
public static int GenerateClientSpeedtestConfig(Config config, List<int> selecteds, string fileName, out string msg)
{
msg = string.Empty;
try
{
if (config == null
|| config.index < 0
|| config.vmess.Count <= 0
|| config.index > config.vmess.Count - 1
)
{
msg = UIRes.I18N("CheckServerSettings");
return -1;
}
msg = UIRes.I18N("InitialConfiguration");
string result = Utils.GetEmbedText(SampleClient);
if (Utils.IsNullOrEmpty(result))
{
msg = UIRes.I18N("FailedGetDefaultConfiguration");
return -1;
}
V2rayConfig v2rayConfig = Utils.FromJson<V2rayConfig>(result);
if (v2rayConfig == null)
{
msg = UIRes.I18N("FailedGenDefaultConfiguration");
return -1;
}
log(config, ref v2rayConfig, false);
//routing(config, ref v2rayConfig);
dns(config, ref v2rayConfig);
var httpPort = config.GetLocalPort("speedtest");
for (int k = 0; k < selecteds.Count; k++)
{
int index = selecteds[k];
if (config.vmess[index].configType == (int)EConfigType.Custom)
{
continue;
}
config.index = index;
var inbound = new Inbounds();
inbound.listen = Global.Loopback;
inbound.port = httpPort + index;
inbound.protocol = Global.InboundHttp;
inbound.tag = Global.InboundHttp + inbound.port.ToString();
v2rayConfig.inbounds.Add(inbound);
var v2rayConfigCopy = Utils.FromJson<V2rayConfig>(result);
outbound(config, ref v2rayConfigCopy);
v2rayConfigCopy.outbounds[0].tag = Global.agentTag + inbound.port.ToString();
v2rayConfig.outbounds.Add(v2rayConfigCopy.outbounds[0]);
var rule = new Mode.RulesItem();
rule.inboundTag = new List<string> { inbound.tag };
rule.outboundTag = v2rayConfigCopy.outbounds[0].tag;
rule.type = "field";
v2rayConfig.routing.rules.Add(rule);
}
Utils.ToJsonFile(v2rayConfig, fileName);
msg = string.Format(UIRes.I18N("SuccessfulConfiguration"), config.getSummary());
}
catch (Exception ex)
{
msg = UIRes.I18N("FailedGenDefaultConfiguration");
return -1;
}
return 0;
}
#endregion
}
}

View File

@@ -52,6 +52,27 @@ namespace v2rayN.Handler
}
}
/// <summary>
/// 载入V2ray
/// </summary>
public void LoadV2ray(Config config, List<int> _selecteds)
{
if (Global.reloadV2ray)
{
string msg = string.Empty;
string fileName = Utils.GetPath(v2rayConfigRes);
if (V2rayConfigHandler.GenerateClientSpeedtestConfig(config, _selecteds, fileName, out msg) != 0)
{
ShowMsg(false, msg);
}
else
{
ShowMsg(true, msg);
V2rayRestart();
}
}
}
/// <summary>
/// V2ray重启
/// </summary>
@@ -118,7 +139,7 @@ namespace v2rayN.Handler
}
}
if (Utils.IsNullOrEmpty(fileName))
{
{
string msg = string.Format(UIRes.I18N("NotFoundCore"), @"https://github.com/v2ray/v2ray-core/releases");
ShowMsg(true, msg);
return;

View File

@@ -10,22 +10,7 @@ namespace v2rayN.HttpProxyHandler
/// </summary>
class HttpProxyHandle
{
private static string GetTimestamp(DateTime value)
{
return value.ToString("MMddHHmmssfff");
}
public static void ReSetPACProxy(Config config)
{
if (config.listenerType == 2)
{
//SysProxyHandle.SetIEProxy(false, false, null, null);
//PACServerHandle.Stop();
}
Update(config, false);
}
public static bool Update(Config config, bool forceDisable)
private static bool Update(Config config, bool forceDisable)
{
int type = config.listenerType;
@@ -38,45 +23,40 @@ namespace v2rayN.HttpProxyHandler
{
if (type != 0)
{
var port = Global.sysAgentPort;
var port = Global.httpPort;
if (port <= 0)
{
return false;
}
if (type == 1)
{
PACServerHandle.Stop();
PACFileWatcherHandle.StopWatch();
//PACServerHandle.Stop();
SysProxyHandle.SetIEProxy(true, true, $"{Global.Loopback}:{port}", null);
}
else if (type == 2)
{
string pacUrl = GetPacUrl();
SysProxyHandle.SetIEProxy(true, false, null, pacUrl);
PACServerHandle.Stop();
//PACServerHandle.Stop();
PACServerHandle.Init(config);
PACFileWatcherHandle.StartWatch(config);
}
else if (type == 3)
{
PACServerHandle.Stop();
PACFileWatcherHandle.StopWatch();
//PACServerHandle.Stop();
SysProxyHandle.SetIEProxy(false, false, null, null);
}
else if (type == 4)
{
string pacUrl = GetPacUrl();
SysProxyHandle.SetIEProxy(false, false, null, null);
PACServerHandle.Stop();
//PACServerHandle.Stop();
PACServerHandle.Init(config);
PACFileWatcherHandle.StartWatch(config);
}
}
else
{
SysProxyHandle.SetIEProxy(false, false, null, null);
PACServerHandle.Stop();
PACFileWatcherHandle.StopWatch();
//PACServerHandle.Stop();
}
}
catch (Exception ex)
@@ -90,11 +70,11 @@ namespace v2rayN.HttpProxyHandler
/// 启用系统代理(http)
/// </summary>
/// <param name="config"></param>
public static void StartHttpAgent(Config config)
private static void StartHttpAgent(Config config)
{
try
{
int localPort = config.GetLocalPort("socks");
int localPort = config.GetLocalPort(Global.InboundSocks);
if (localPort > 0)
{
PrivoxyHandler.Instance.Start(localPort, config);
@@ -102,8 +82,8 @@ namespace v2rayN.HttpProxyHandler
{
Global.sysAgent = true;
Global.socksPort = localPort;
Global.sysAgentPort = PrivoxyHandler.Instance.RunningPort;
Global.pacPort = Global.sysAgentPort + 1;
Global.httpPort = PrivoxyHandler.Instance.RunningPort;
Global.pacPort = config.GetLocalPort("pac");
}
}
}
@@ -120,16 +100,13 @@ namespace v2rayN.HttpProxyHandler
{
try
{
////开启全局代理则关闭
//if (Global.sysAgent)
//{
Update(config, true);
PrivoxyHandler.Instance.Stop();
Global.sysAgent = false;
Global.socksPort = 0;
Global.sysAgentPort = 0;
Global.pacPort = 0;
//}
Global.httpPort = 0;
}
catch
{
@@ -141,7 +118,7 @@ namespace v2rayN.HttpProxyHandler
/// </summary>
/// <param name="config"></param>
/// <param name="forced"></param>
public static bool RestartHttpAgent(Config config, bool forced)
public static void RestartHttpAgent(Config config, bool forced)
{
bool isRestart = false;
//强制重启或者socks端口变化
@@ -151,7 +128,7 @@ namespace v2rayN.HttpProxyHandler
}
else
{
int localPort = config.GetLocalPort("socks");
int localPort = config.GetLocalPort(Global.InboundSocks);
if (localPort != Global.socksPort)
{
isRestart = true;
@@ -161,16 +138,13 @@ namespace v2rayN.HttpProxyHandler
{
CloseHttpAgent(config);
StartHttpAgent(config);
return true;
}
return false;
Update(config, false);
}
public static string GetPacUrl()
{
string pacUrl = $"http://{Global.Loopback}:{Global.pacPort}/pac/?t={GetTimestamp(DateTime.Now)}";
string pacUrl = $"http://{Global.Loopback}:{Global.pacPort}/pac/?t={ DateTime.Now.ToString("HHmmss")}";
return pacUrl;
}
}

View File

@@ -1,45 +0,0 @@
using System.IO;
using System.Windows.Forms;
using v2rayN.Mode;
namespace v2rayN.HttpProxyHandler
{
/// <summary>
/// 提供PAC功能支持
/// </summary>
class PACFileWatcherHandle
{
private static FileSystemWatcher fileSystemWatcher;
private static long fileSize;
public static void StartWatch(Config config)
{
if (fileSystemWatcher == null)
{
fileSystemWatcher = new FileSystemWatcher(Utils.StartupPath());
fileSystemWatcher.Filter = "pac.txt";
fileSystemWatcher.NotifyFilter = NotifyFilters.Size;
fileSystemWatcher.Changed += (sender, args) =>
{
var fileInfo = new FileInfo(args.FullPath);
if (fileSize != fileInfo.Length)
{
fileSize = fileInfo.Length;
HttpProxyHandle.ReSetPACProxy(config);
}
};
}
fileSystemWatcher.EnableRaisingEvents = true;
}
public static void StopWatch()
{
if (fileSystemWatcher != null)
{
fileSystemWatcher.EnableRaisingEvents = false;
}
}
}
}

View File

@@ -4,6 +4,7 @@ using System.IO;
using System.Net;
using System.Text;
using Newtonsoft.Json;
using v2rayN.Base;
using v2rayN.Mode;
using v2rayN.Properties;
@@ -28,13 +29,13 @@ namespace v2rayN.HttpProxyHandler
}
}
private const string GFWLIST_URL = "https://raw.githubusercontent.com/gfwlist/gfwlist/master/gfwlist.txt";
private static readonly IEnumerable<char> IgnoredLineBegins = new[] { '!', '[' };
public void UpdatePACFromGFWList(Config config)
{
string url = GFWLIST_URL;
string url = Global.GFWLIST_URL;
if (!Utils.IsNullOrEmpty(config.urlGFWList))
{
url = config.urlGFWList;

View File

@@ -5,6 +5,7 @@ using System.Text;
using v2rayN.Mode;
using v2rayN.Properties;
using v2rayN.Tool;
using v2rayN.Base;
namespace v2rayN.HttpProxyHandler
{
@@ -27,14 +28,16 @@ namespace v2rayN.HttpProxyHandler
public static void Init(Config config)
{
//if (InitServer("*"))
//{
// pacPort = Global.pacPort;
//}
if (InitServer(Global.Loopback))
Global.pacPort = config.GetLocalPort("pac");
if (InitServer("*"))
{
pacPort = Global.pacPort;
}
//else if (InitServer(Global.Loopback))
//{
// pacPort = Global.pacPort;
//}
else if (InitServerB(Global.Loopback))
{
pacPort = Global.pacPort;
@@ -66,7 +69,6 @@ namespace v2rayN.HttpProxyHandler
server = new HttpWebServer(SendResponse, prefixes);
server.Run();
//pacPort = Global.pacPort;
}
}
Utils.SaveLog("Webserver at " + address);
@@ -94,7 +96,6 @@ namespace v2rayN.HttpProxyHandler
if (serverB == null)
{
serverB = new HttpWebServerB(Global.pacPort, SendResponse);
//pacPort = Global.pacPort;
}
}
Utils.SaveLog("WebserverB at " + address);
@@ -123,18 +124,23 @@ namespace v2rayN.HttpProxyHandler
public static void Stop()
{
//try
//{
// if (server != null)
// {
// server.Stop();
// server = null;
// }
//}
//catch (Exception ex)
//{
// Utils.SaveLog("Webserver Stop " + ex.Message);
//}
try
{
if (server != null)
{
server.Stop();
server = null;
}
if (serverB != null)
{
serverB.Stop();
serverB = null;
}
}
catch (Exception ex)
{
Utils.SaveLog("Webserver Stop " + ex.Message);
}
//try
//{
@@ -158,7 +164,7 @@ namespace v2rayN.HttpProxyHandler
private static string GetPacList(string address)
{
var port = Global.sysAgentPort;
var port = Global.httpPort;
if (port <= 0)
{
return "No port";

View File

@@ -24,8 +24,6 @@ namespace v2rayN.HttpProxyHandler
private static string _uniqueConfigFile;
private static Job _privoxyJob;
private Process _process;
private int _runningPort;
private bool _isRunning;
static PrivoxyHandler()
{
@@ -36,7 +34,6 @@ namespace v2rayN.HttpProxyHandler
_privoxyJob = new Job();
FileManager.UncompressFile(Utils.GetTempPath("v2ray_privoxy.exe"), Resources.privoxy_exe);
FileManager.UncompressFile(Utils.GetTempPath("mgwz.dll"), Resources.mgwz_dll);
}
catch (IOException ex)
{
@@ -66,47 +63,38 @@ namespace v2rayN.HttpProxyHandler
public int RunningPort
{
get
{
return _runningPort;
}
}
public bool IsRunning
{
get
{
return _isRunning;
}
get; set;
}
public void Start(int localPort, Config config)
{
if (_process == null)
try
{
Process[] existingPrivoxy = Process.GetProcessesByName("v2ray_privoxy");
foreach (Process p in existingPrivoxy.Where(IsChildProcess))
if (_process == null)
{
KillProcess(p);
}
string privoxyConfig = Resources.privoxy_conf;
_runningPort = GetFreePort(localPort);
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[] 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,
@@ -115,15 +103,20 @@ namespace v2rayN.HttpProxyHandler
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);
_isRunning = true;
/*
* 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);
}
}
@@ -134,7 +127,7 @@ namespace v2rayN.HttpProxyHandler
KillProcess(_process);
_process.Dispose();
_process = null;
_isRunning = false;
RunningPort = 0;
}
}
@@ -191,25 +184,5 @@ namespace v2rayN.HttpProxyHandler
}
}
private int GetFreePort(int localPort)
{
int defaultPort = 8123;
try
{
//// TCP stack please do me a favor
//TcpListener l = new TcpListener(IPAddress.Loopback, 0);
//l.Start();
//var port = ((IPEndPoint)l.LocalEndpoint).Port;
//l.Stop();
//return port;
return localPort + 1;
}
catch (Exception ex)
{
// in case access denied
Utils.SaveLog(ex.Message, ex);
return defaultPort;
}
}
}
}

View File

@@ -1,8 +1,9 @@
using System;
using Newtonsoft.Json;
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using Newtonsoft.Json;
using v2rayN.Base;
using v2rayN.Mode;
using v2rayN.Properties;
using v2rayN.Tool;

View File

@@ -1,6 +1,6 @@
using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using v2rayN.Base;
namespace v2rayN.Mode
{
@@ -13,93 +13,138 @@ namespace v2rayN.Mode
/// <summary>
/// 本地监听
/// </summary>
public List<InItem> inbound { get; set; }
public List<InItem> inbound
{
get; set;
}
/// <summary>
/// 允许日志
/// </summary>
public bool logEnabled { get; set; }
public bool logEnabled
{
get; set;
}
/// <summary>
/// 日志等级
/// </summary>
public string loglevel { get; set; }
public string loglevel
{
get; set;
}
/// <summary>
/// 活动配置序号
/// </summary>
public int index { get; set; }
public int index
{
get; set;
}
/// <summary>
/// vmess服务器信息
/// </summary>
public List<VmessItem> vmess { get; set; }
public List<VmessItem> vmess
{
get; set;
}
/// <summary>
/// 允许Mux多路复用
/// </summary>
public bool muxEnabled { get; set; }
public bool muxEnabled
{
get; set;
}
/// <summary>
/// 域名解析策略
/// </summary>
public string domainStrategy { get; set; }
public string domainStrategy
{
get; set;
}
/// <summary>
/// 路由模式
/// </summary>
public string routingMode { get; set; }
public string routingMode
{
get; set;
}
/// <summary>
/// 用户自定义需代理的网址或ip
/// </summary>
public List<string> useragent { get; set; }
public List<string> useragent
{
get; set;
}
/// <summary>
/// 用户自定义直连的网址或ip
/// </summary>
public List<string> userdirect { get; set; }
public List<string> userdirect
{
get; set;
}
/// <summary>
/// 用户自定义阻止的网址或ip
/// </summary>
public List<string> userblock { get; set; }
public List<string> userblock
{
get; set;
}
/// <summary>
/// KcpItem
/// </summary>
public KcpItem kcpItem { get; set; }
public KcpItem kcpItem
{
get; set;
}
/// <summary>
/// 启用Http代理
/// 监听状态 0-not 1-http 2-PAC
/// </summary>
public bool sysAgentEnabled { get; set; }
/// <summary>
/// 监听状态 0-不改变 1-全局 2-PAC
/// </summary>
public int listenerType { get; set; }
public int listenerType
{
get; set;
}
/// <summary>
/// 自定义GFWList url
/// </summary>
public string urlGFWList { get; set; }
public string urlGFWList
{
get; set;
}
/// <summary>
/// 允许来自局域网的连接
/// </summary>
public bool allowLANConn { get; set; }
public bool allowLANConn
{
get; set;
}
/// <summary>
/// 启用实时网速和流量统计
/// </summary>
public bool enableStatistics { get; set; }
public bool enableStatistics
{
get; set;
}
/// <summary>
/// 视图刷新率
/// </summary>
public int statisticsFreshRate { get; set; }
public int statisticsFreshRate
{
get; set;
}
/// <summary>
/// 统计数据缓存天数 [0, 30]
@@ -107,9 +152,13 @@ namespace v2rayN.Mode
/// * 无论如何不会关闭总流量的缓存
/// </summary>
private uint cacheDays;
public uint CacheDays {
get { return cacheDays; }
set
public uint CacheDays
{
get
{
return cacheDays;
}
set
{
if (value < 0) cacheDays = 0;
else if (value > 30) cacheDays = 30;
@@ -120,15 +169,24 @@ namespace v2rayN.Mode
/// <summary>
/// 自定义远程DNS
/// </summary>
public string remoteDNS { get; set; }
public string remoteDNS
{
get; set;
}
/// <summary>
/// 订阅
/// </summary>
public List<SubItem> subItem { get; set; }
public List<SubItem> subItem
{
get; set;
}
/// <summary>
/// UI
/// </summary>
public UIItem uiItem { get; set; }
public UIItem uiItem
{
get; set;
}
#region
@@ -236,6 +294,19 @@ namespace v2rayN.Mode
public int GetLocalPort(string protocol)
{
if (protocol == Global.InboundHttp)
{
return GetLocalPort(Global.InboundSocks) + 1;
}
else if (protocol == "pac")
{
return GetLocalPort(Global.InboundSocks) + 2;
}
else if (protocol == "speedtest")
{
return GetLocalPort(Global.InboundSocks) + 103;
}
int localPort = 0;
foreach (InItem inItem in inbound)
{
@@ -352,77 +423,125 @@ namespace v2rayN.Mode
/// <summary>
/// 版本(现在=2)
/// </summary>
public int configVersion { get; set; }
public int configVersion
{
get; set;
}
/// <summary>
/// 远程服务器地址
/// </summary>
public string address { get; set; }
public string address
{
get; set;
}
/// <summary>
/// 远程服务器端口
/// </summary>
public int port { get; set; }
public int port
{
get; set;
}
/// <summary>
/// 远程服务器ID
/// </summary>
public string id { get; set; }
public string id
{
get; set;
}
/// <summary>
/// 远程服务器额外ID
/// </summary>
public int alterId { get; set; }
public int alterId
{
get; set;
}
/// <summary>
/// 本地安全策略
/// </summary>
public string security { get; set; }
public string security
{
get; set;
}
/// <summary>
/// tcp,kcp,ws
/// </summary>
public string network { get; set; }
public string network
{
get; set;
}
/// <summary>
/// 备注或别名
/// </summary>
public string remarks { get; set; }
public string remarks
{
get; set;
}
/// <summary>
/// 伪装类型
/// </summary>
public string headerType { get; set; }
public string headerType
{
get; set;
}
/// <summary>
/// 伪装的域名
/// </summary>
public string requestHost { get; set; }
public string requestHost
{
get; set;
}
/// <summary>
/// ws h2 path
/// </summary>
public string path { get; set; }
public string path
{
get; set;
}
/// <summary>
/// 底层传输安全
/// </summary>
public string streamSecurity { get; set; }
public string streamSecurity
{
get; set;
}
/// <summary>
/// 是否允许不安全连接(用于客户端)
/// </summary>
public string allowInsecure { get; set; }
public string allowInsecure
{
get; set;
}
/// <summary>
/// config type(1=normal,2=custom)
/// </summary>
public int configType { get; set; }
public int configType
{
get; set;
}
/// <summary>
///
/// </summary>
public string testResult { get; set; }
public string testResult
{
get; set;
}
/// <summary>
/// SubItem id
/// </summary>
public string subid { get; set; }
public string subid
{
get; set;
}
}
[Serializable]
@@ -431,17 +550,26 @@ namespace v2rayN.Mode
/// <summary>
/// 本地监听端口
/// </summary>
public int localPort { get; set; }
public int localPort
{
get; set;
}
/// <summary>
/// 协议默认为socks
/// </summary>
public string protocol { get; set; }
public string protocol
{
get; set;
}
/// <summary>
/// 允许udp
/// </summary>
public bool udpEnabled { get; set; }
public bool udpEnabled
{
get; set;
}
/// <summary>
/// 开启流量探测
@@ -455,31 +583,52 @@ namespace v2rayN.Mode
/// <summary>
///
/// </summary>
public int mtu { get; set; }
public int mtu
{
get; set;
}
/// <summary>
///
/// </summary>
public int tti { get; set; }
public int tti
{
get; set;
}
/// <summary>
///
/// </summary>
public int uplinkCapacity { get; set; }
public int uplinkCapacity
{
get; set;
}
/// <summary>
///
/// </summary>
public int downlinkCapacity { get; set; }
public int downlinkCapacity
{
get; set;
}
/// <summary>
///
/// </summary>
public bool congestion { get; set; }
public bool congestion
{
get; set;
}
/// <summary>
///
/// </summary>
public int readBufferSize { get; set; }
public int readBufferSize
{
get; set;
}
/// <summary>
///
/// </summary>
public int writeBufferSize { get; set; }
public int writeBufferSize
{
get; set;
}
}
@@ -489,17 +638,26 @@ namespace v2rayN.Mode
/// <summary>
///
/// </summary>
public string id { get; set; }
public string id
{
get; set;
}
/// <summary>
/// 备注
/// </summary>
public string remarks { get; set; }
public string remarks
{
get; set;
}
/// <summary>
/// url
/// </summary>
public string url { get; set; }
public string url
{
get; set;
}
/// <summary>
/// enable

View File

@@ -310,7 +310,7 @@ namespace v2rayN.Mode
/// </summary>
public string port { get; set; }
public string inboundTag { get; set; }
public List<string> inboundTag { get; set; }
/// <summary>
///
/// </summary>

View File

@@ -33,4 +33,4 @@ using System.Runtime.InteropServices;
// 方法是按如下所示使用“*”:
//[assembly: AssemblyVersion("1.0.*")]
//[assembly: AssemblyVersion("1.0.0")]
[assembly: AssemblyFileVersion("2.45")]
[assembly: AssemblyFileVersion("2.49")]

View File

@@ -19,7 +19,7 @@ namespace v2rayN.Properties {
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
@@ -91,25 +91,35 @@ namespace v2rayN.Properties {
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// 查找 System.Byte[] 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap help {
internal static byte[] grpc_csharp_ext_x64_dll {
get {
object obj = ResourceManager.GetObject("help", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
object obj = ResourceManager.GetObject("grpc_csharp_ext_x64_dll", resourceCulture);
return ((byte[])(obj));
}
}
/// <summary>
/// 查找 System.Byte[] 类型的本地化资源。
/// </summary>
internal static byte[] mgwz_dll {
internal static byte[] grpc_csharp_ext_x86_dll {
get {
object obj = ResourceManager.GetObject("mgwz_dll", resourceCulture);
object obj = ResourceManager.GetObject("grpc_csharp_ext_x86_dll", resourceCulture);
return ((byte[])(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap help {
get {
object obj = ResourceManager.GetObject("help", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
@@ -157,6 +167,7 @@ namespace v2rayN.Properties {
///show-on-task-bar 0
///activity-animation 0
///forward-socks5 / 127.0.0.1:__SOCKS_PORT__ .
///max-client-connections 2048
///hide-console
/// 的本地化字符串。
/// </summary>

View File

@@ -127,12 +127,15 @@
<data name="checkupdate" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\resources\checkupdate.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="grpc_csharp_ext_x64_dll" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\resources\grpc_csharp_ext.x64.dll.gz;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="grpc_csharp_ext_x86_dll" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\resources\grpc_csharp_ext.x86.dll.gz;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="help" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\resources\help.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="mgwz_dll" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\resources\mgwz.dll.gz;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="minimize" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\minimize.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -76,7 +76,7 @@
"domainStrategy": "IPIfNonMatch",
"rules": [
{
"inboundTag": "api",
"inboundTag": ["api"],
"outboundTag": "api",
"type": "field"
}

View File

@@ -0,0 +1 @@
geosite:category-ads,

View File

@@ -0,0 +1,132 @@
domain:12306.com,
domain:51ym.me,
domain:52pojie.cn,
domain:8686c.com,
domain:abercrombie.com,
domain:adobesc.com,
domain:air-matters.com,
domain:air-matters.io,
domain:airtable.com,
domain:akadns.net,
domain:apache.org,
domain:api.crisp.chat,
domain:api.termius.com,
domain:appshike.com,
domain:appstore.com,
domain:aweme.snssdk.com,
domain:bababian.com,
domain:battle.net,
domain:beatsbydre.com,
domain:bet365.com,
domain:bilibili.cn,
domain:ccgslb.com,
domain:ccgslb.net,
domain:chunbo.com,
domain:chunboimg.com,
domain:clashroyaleapp.com,
domain:cloudsigma.com,
domain:cloudxns.net,
domain:cmfu.com,
domain:culturedcode.com,
domain:dct-cloud.com,
domain:didialift.com,
domain:douyutv.com,
domain:duokan.com,
domain:dytt8.net,
domain:easou.com,
domain:ecitic.net,
domain:eclipse.org,
domain:eudic.net,
domain:ewqcxz.com,
domain:fir.im,
domain:frdic.com,
domain:fresh-ideas.cc,
domain:godic.net,
domain:goodread.com,
domain:haibian.com,
domain:hdslb.net,
domain:hollisterco.com,
domain:hongxiu.com,
domain:hxcdn.net,
domain:images.unsplash.com,
domain:img4me.com,
domain:ipify.org,
domain:ixdzs.com,
domain:jd.hk,
domain:jianshuapi.com,
domain:jomodns.com,
domain:jsboxbbs.com,
domain:knewone.com,
domain:kuaidi100.com,
domain:lemicp.com,
domain:letvcloud.com,
domain:lizhi.io,
domain:localizecdn.com,
domain:lucifr.com,
domain:luoo.net,
domain:mai.tn,
domain:maven.org,
domain:miwifi.com,
domain:moji.com,
domain:moke.com,
domain:mtalk.google.com,
domain:mxhichina.com,
domain:myqcloud.com,
domain:myunlu.com,
domain:netease.com,
domain:nfoservers.com,
domain:nssurge.com,
domain:nuomi.com,
domain:ourdvs.com,
domain:overcast.fm,
domain:paypal.com,
domain:paypalobjects.com,
domain:pgyer.com,
domain:qdaily.com,
domain:qdmm.com,
domain:qin.io,
domain:qingmang.me,
domain:qingmang.mobi,
domain:qqurl.com,
domain:rarbg.to,
domain:rrmj.tv,
domain:ruguoapp.com,
domain:sm.ms,
domain:snwx.com,
domain:soku.com,
domain:startssl.com,
domain:store.steampowered.com,
domain:symcd.com,
domain:teamviewer.com,
domain:tmzvps.com,
domain:trello.com,
domain:trellocdn.com,
domain:ttmeiju.com,
domain:udache.com,
domain:uxengine.net,
domain:weather.bjango.com,
domain:weather.com,
domain:webqxs.com,
domain:weico.cc,
domain:wenku8.net,
domain:werewolf.53site.com,
domain:windowsupdate.com,
domain:wkcdn.com,
domain:workflowy.com,
domain:xdrig.com,
domain:xiaojukeji.com,
domain:xiaomi.net,
domain:xiaomicp.com,
domain:ximalaya.com,
domain:xitek.com,
domain:xmcdn.com,
domain:xslb.net,
domain:xteko.com,
domain:yach.me,
domain:yixia.com,
domain:yunjiasu-cdn.net,
domain:zealer.com,
domain:zgslb.net,
domain:zimuzu.tv,
domain:zmz002.com,
domain:samsungdm.com,

View File

@@ -0,0 +1,33 @@
geosite:google,
geosite:github,
geosite:netflix,
geosite:steam,
geosite:telegram,
geosite:tumblr,
geosite:speedtest,
geosite:bbc,
domain:gvt1.com,
domain:textnow.com,
domain:twitch.tv,
domain:wikileaks.org,
domain:naver.com,
91.108.4.0/22,
91.108.8.0/22,
91.108.12.0/22,
91.108.20.0/22,
91.108.36.0/23,
91.108.38.0/23,
91.108.56.0/22,
149.154.160.0/20,
149.154.164.0/22,
149.154.172.0/22,
74.125.0.0/16,
173.194.0.0/16,
172.217.0.0/16,
216.58.200.0/24,
216.58.220.0/24,
91.108.56.116,
91.108.56.0/24,
109.239.140.0/24,
149.154.167.0/24,
149.154.175.0/24,

View File

@@ -18,6 +18,7 @@ using ZXing;
using ZXing.Common;
using ZXing.QrCode;
using System.Security.Principal;
using v2rayN.Base;
namespace v2rayN
{

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Grpc.Tools" version="2.23.0" targetFramework="net46" developmentDependency="true" />
<package id="Grpc.Tools" version="2.24.0" targetFramework="net46" developmentDependency="true" />
</packages>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\Grpc.Tools.2.23.0\build\Grpc.Tools.props" Condition="Exists('..\packages\Grpc.Tools.2.23.0\build\Grpc.Tools.props')" />
<Import Project="..\packages\Grpc.Tools.2.24.0\build\Grpc.Tools.props" Condition="Exists('..\packages\Grpc.Tools.2.24.0\build\Grpc.Tools.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -114,6 +114,7 @@
<HintPath>LIB\System.Memory.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System.Messaging" />
<Reference Include="System.Net" />
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
@@ -140,7 +141,7 @@
<Compile Include="Forms\AddServer4Form.Designer.cs">
<DependentUpon>AddServer4Form.cs</DependentUpon>
</Compile>
<Compile Include="Forms\ListViewFlickerFree.cs">
<Compile Include="Base\ListViewFlickerFree.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Forms\MainForm.cs">
@@ -179,25 +180,30 @@
<Compile Include="Forms\SubSettingControl.Designer.cs">
<DependentUpon>SubSettingControl.cs</DependentUpon>
</Compile>
<Compile Include="Handler\MainFormHandler.cs" />
<Compile Include="Handler\SpeedtestHandler.cs" />
<Compile Include="Handler\StatisticsHandler.cs" />
<Compile Include="Handler\V2rayUpdateHandle.cs" />
<Compile Include="HttpProxyHandler\HttpWebServer.cs" />
<Compile Include="HttpProxyHandler\HttpWebServerB.cs" />
<Compile Include="HttpProxyHandler\PACFileWatcherHandle.cs" />
<Compile Include="Handler\DownloadHandle.cs" />
<Compile Include="Base\HttpWebServer.cs" />
<Compile Include="Base\HttpWebServerB.cs" />
<Compile Include="HttpProxyHandler\PrivoxyHandler.cs" />
<Compile Include="HttpProxyHandler\PACListHandle.cs" />
<Compile Include="HttpProxyHandler\PACServerHandle.cs" />
<Compile Include="HttpProxyHandler\ProxySetting.cs" />
<Compile Include="HttpProxyHandler\SysProxyHandle.cs" />
<Compile Include="HttpProxyHandler\HttpProxyHandle.cs" />
<Compile Include="HttpProxyHandler\WebClientEx.cs">
<Compile Include="Base\WebClientEx.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Mode\EMove.cs" />
<Compile Include="Mode\ServerStatistics.cs" />
<Compile Include="Mode\SysproxyConfig.cs" />
<Compile Include="Mode\EConfigType.cs" />
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Resx\ResUI.zh-Hans.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
@@ -208,7 +214,7 @@
<DesignTime>True</DesignTime>
<DependentUpon>ResUI.resx</DependentUpon>
</Compile>
<Compile Include="StringEx.cs">
<Compile Include="Base\StringEx.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Forms\AddServerForm.cs">
@@ -319,14 +325,9 @@
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<EmbeddedResource Include="app.config">
<SubType>Designer</SubType>
</EmbeddedResource>
@@ -340,8 +341,13 @@
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<EmbeddedResource Include="Sample\custom_routing_block" />
<EmbeddedResource Include="Sample\custom_routing_direct" />
<EmbeddedResource Include="Sample\custom_routing_proxy" />
<Protobuf Include="Protos\Statistics.proto" />
<None Include="Resources\abp.js.gz" />
<None Include="Resources\grpc_csharp_ext.x64.dll.gz" />
<None Include="Resources\grpc_csharp_ext.x86.dll.gz" />
<None Include="Resources\pac.txt.gz" />
<None Include="Resources\sysproxy.exe.gz" />
<None Include="Resources\sysproxy64.exe.gz" />
@@ -392,7 +398,6 @@
<EmbeddedResource Include="Sample\SampleServerConfig.txt" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\mgwz.dll.gz" />
<None Include="Resources\privoxy.exe.gz" />
<None Include="Resources\restart.png" />
</ItemGroup>
@@ -420,12 +425,6 @@
<EmbeddedResource Include="LIB\System.Runtime.CompilerServices.Unsafe.dll" />
<EmbeddedResource Include="LIB\zxing.dll" />
<EmbeddedResource Include="LIB\zxing.presentation.dll" />
<Content Include="grpc_csharp_ext.x64.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="grpc_csharp_ext.x86.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<EmbeddedResource Include="LIB\netstandard.dll" />
<Content Include="Resources\help.png" />
<None Include="Resources\notify.png" />
@@ -439,12 +438,12 @@
<Import Project="..\packages\Grpc.Core.2.23.0\build\net45\Grpc.Core.targets" Condition="Exists('..\packages\Grpc.Core.2.23.0\build\net45\Grpc.Core.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
<ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Grpc.Tools.2.23.0\build\Grpc.Tools.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Grpc.Tools.2.23.0\build\Grpc.Tools.props'))" />
<Error Condition="!Exists('..\packages\Grpc.Tools.2.23.0\build\Grpc.Tools.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Grpc.Tools.2.23.0\build\Grpc.Tools.targets'))" />
<Error Condition="!Exists('..\packages\Grpc.Tools.2.24.0\build\Grpc.Tools.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Grpc.Tools.2.24.0\build\Grpc.Tools.props'))" />
<Error Condition="!Exists('..\packages\Grpc.Tools.2.24.0\build\Grpc.Tools.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Grpc.Tools.2.24.0\build\Grpc.Tools.targets'))" />
</Target>
<Import Project="..\packages\Grpc.Tools.2.23.0\build\Grpc.Tools.targets" Condition="Exists('..\packages\Grpc.Tools.2.23.0\build\Grpc.Tools.targets')" />
<Import Project="..\packages\Grpc.Tools.2.24.0\build\Grpc.Tools.targets" Condition="Exists('..\packages\Grpc.Tools.2.24.0\build\Grpc.Tools.targets')" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">