pull/1195/head
2dust 2020-12-25 20:43:28 +08:00
parent 47dce69aa4
commit b390776219
44 changed files with 4178 additions and 3913 deletions

View File

@ -1,101 +0,0 @@
using System;
using System.Net;
using System.Text;
using System.Threading;
namespace v2rayN.Base
{
public class HttpWebServer
{
private HttpListener _listener;
private Func<string, string> _responderMethod;
public HttpWebServer(string[] prefixes, Func<string, string> method)
{
try
{
_listener = new HttpListener();
if (!HttpListener.IsSupported)
throw new NotSupportedException(
"Needs Windows XP SP2, Server 2003 or later.");
// URI prefixes are required, for example
// "http://localhost:8080/index/".
if (prefixes == null || prefixes.Length == 0)
throw new ArgumentException("prefixes");
// A responder method is required
if (method == null)
throw new ArgumentException("method");
foreach (string s in prefixes)
_listener.Prefixes.Add(s);
_responderMethod = method;
_listener.Start();
}
catch (Exception ex)
{
Utils.SaveLog(ex.Message, ex);
throw;
}
}
public HttpWebServer(Func<string, string> method, params string[] prefixes)
: this(prefixes, method) { }
public void Run()
{
ThreadPool.QueueUserWorkItem((o) =>
{
Utils.SaveLog("Webserver running...");
try
{
while (_listener.IsListening)
{
ThreadPool.QueueUserWorkItem((c) =>
{
HttpListenerContext ctx = c as HttpListenerContext;
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;
ctx.Response.ContentType = "application/x-ns-proxy-autoconfig";
ctx.Response.ContentLength64 = buf.Length;
ctx.Response.OutputStream.Write(buf, 0, buf.Length);
}
catch
{
} // suppress any exceptions
finally
{
// always close the stream
ctx.Response.OutputStream.Close();
}
}, _listener.GetContext());
}
}
catch (Exception ex)
{
Utils.SaveLog(ex.Message, ex);
} // suppress any exceptions
});
}
public void Stop()
{
if (_listener != null)
{
_listener.Stop();
_listener.Close();
_listener = null;
}
}
}
}

View File

@ -1,141 +0,0 @@
using System;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Threading;
namespace v2rayN.Base
{
public class HttpWebServerB
{
private TcpListener listener;
private int port;
private Func<string, string> _responderMethod;
public HttpWebServerB(int port, Func<string, string> method)
{
this.port = port;
this._responderMethod = method;
Thread thread = new Thread(StartListen)
{
IsBackground = true
};
thread.Start();
}
public void Stop()
{
if (listener != null)
{
listener.Stop();
listener = null;
}
}
private void StartListen()
{
try
{
listener = new TcpListener(IPAddress.Any, port);
listener.Start();
Utils.SaveLog("WebserverB running...");
while (true)
{
if (!listener.Pending())
{
Thread.Sleep(100);
continue;
}
TcpClient socket = listener.AcceptTcpClient();
Thread thread = new Thread(new ParameterizedThreadStart(ProcessThread))
{
IsBackground = true
};
thread.Start(socket);
Thread.Sleep(1);
}
}
catch
{
Utils.SaveLog("WebserverB start fail.");
}
}
private void ProcessThread(object obj)
{
try
{
TcpClient socket = obj as TcpClient;
BufferedStream inputStream = new BufferedStream(socket.GetStream());
StreamWriter outputStream = new StreamWriter(new BufferedStream(socket.GetStream()));
if (inputStream.CanRead)
{
string data = ReadStream(inputStream);
if (data.Contains("/pac/"))
{
if (_responderMethod != null)
{
string address = ((IPEndPoint)socket.Client.LocalEndPoint).Address.ToString();
Utils.SaveLog("WebserverB Request " + address);
string pac = _responderMethod(address);
if (inputStream.CanWrite)
{
WriteStream(outputStream, pac);
}
}
}
}
outputStream.BaseStream.Flush();
inputStream = null;
outputStream = null;
socket.Close();
}
catch (Exception ex)
{
Utils.SaveLog(ex.Message, ex);
}
}
private string ReadStream(Stream inputStream)
{
int nextchar;
string data = "";
while (true)
{
nextchar = inputStream.ReadByte();
if (nextchar == '\n')
{
break;
}
if (nextchar == '\r')
{
continue;
}
if (nextchar == -1)
{
Thread.Sleep(1);
continue;
};
data += Convert.ToChar(nextchar);
}
return data;
}
private void WriteStream(StreamWriter outputStream, string pac)
{
string content_type = "application/x-ns-proxy-autoconfig";
outputStream.WriteLine("HTTP/1.1 200 OK");
outputStream.WriteLine(String.Format("Content-Type:{0}", content_type));
outputStream.WriteLine("Connection: close");
outputStream.WriteLine("");
outputStream.WriteLine(pac);
outputStream.Flush();
}
}
}

View File

@ -63,22 +63,17 @@
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.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();
this.menuKeepPAC = new System.Windows.Forms.ToolStripMenuItem();
this.menuKeepNothing = new System.Windows.Forms.ToolStripMenuItem();
this.menuKeepPACNothing = new System.Windows.Forms.ToolStripMenuItem();
this.menuGlobal = new System.Windows.Forms.ToolStripMenuItem();
this.menuKeepClear = new System.Windows.Forms.ToolStripMenuItem();
this.menuServers = new System.Windows.Forms.ToolStripMenuItem();
this.menuAddServers2 = new System.Windows.Forms.ToolStripMenuItem();
this.menuScanScreen2 = new System.Windows.Forms.ToolStripMenuItem();
this.menuCopyPACUrl = new System.Windows.Forms.ToolStripMenuItem();
this.menuUpdateSubscriptions = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
this.menuExit = new System.Windows.Forms.ToolStripMenuItem();
@ -93,8 +88,6 @@
this.toolSslHttpPortLab = new System.Windows.Forms.ToolStripStatusLabel();
this.toolSslHttpPort = new System.Windows.Forms.ToolStripStatusLabel();
this.toolSslBlank2 = new System.Windows.Forms.ToolStripStatusLabel();
this.toolSslPacPortLab = new System.Windows.Forms.ToolStripStatusLabel();
this.toolSslPacPort = new System.Windows.Forms.ToolStripStatusLabel();
this.toolSslBlank3 = new System.Windows.Forms.ToolStripStatusLabel();
this.toolSslServerSpeed = new System.Windows.Forms.ToolStripStatusLabel();
this.toolSslBlank4 = new System.Windows.Forms.ToolStripStatusLabel();
@ -106,16 +99,16 @@
this.tsbSubUpdate = new System.Windows.Forms.ToolStripMenuItem();
this.tsbQRCodeSwitch = new System.Windows.Forms.ToolStripButton();
this.toolStripSeparator8 = new System.Windows.Forms.ToolStripSeparator();
this.tsbOptionSetting = new System.Windows.Forms.ToolStripButton();
this.tsbSetting = new System.Windows.Forms.ToolStripDropDownButton();
this.tsbOptionSetting = new System.Windows.Forms.ToolStripMenuItem();
this.tsbRoutingSetting = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator();
this.tsbReload = new System.Windows.Forms.ToolStripButton();
this.toolStripSeparator7 = new System.Windows.Forms.ToolStripSeparator();
this.tsbCheckUpdate = new System.Windows.Forms.ToolStripDropDownButton();
this.tsbCheckUpdateN = new System.Windows.Forms.ToolStripMenuItem();
this.tsbCheckUpdateCore = new System.Windows.Forms.ToolStripMenuItem();
this.tsbCheckUpdatePACList = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator13 = new System.Windows.Forms.ToolStripSeparator();
this.tsbCheckClearPACList = new System.Windows.Forms.ToolStripMenuItem();
this.tsbCheckUpdateXrayCore = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator10 = new System.Windows.Forms.ToolStripSeparator();
this.tsbHelp = new System.Windows.Forms.ToolStripDropDownButton();
this.tsbAbout = new System.Windows.Forms.ToolStripMenuItem();
@ -211,6 +204,7 @@
this.menuExport2ShareUrl,
this.menuExport2SubContent});
this.cmsLv.Name = "cmsLv";
this.cmsLv.OwnerItem = this.tsbServer;
//
// menuAddVmessServer
//
@ -388,11 +382,6 @@
this.menuExport2SubContent.Name = "menuExport2SubContent";
this.menuExport2SubContent.Click += new System.EventHandler(this.menuExport2SubContent_Click);
//
// qrCodeControl
//
resources.ApplyResources(this.qrCodeControl, "qrCodeControl");
this.qrCodeControl.Name = "qrCodeControl";
//
// tsbServer
//
resources.ApplyResources(this.tsbServer, "tsbServer");
@ -400,6 +389,11 @@
this.tsbServer.Image = global::v2rayN.Properties.Resources.server;
this.tsbServer.Name = "tsbServer";
//
// qrCodeControl
//
resources.ApplyResources(this.qrCodeControl, "qrCodeControl");
this.qrCodeControl.Name = "qrCodeControl";
//
// notifyMain
//
resources.ApplyResources(this.notifyMain, "notifyMain");
@ -415,7 +409,6 @@
this.menuServers,
this.menuAddServers2,
this.menuScanScreen2,
this.menuCopyPACUrl,
this.menuUpdateSubscriptions,
this.toolStripSeparator2,
this.menuExit});
@ -428,56 +421,28 @@
//
resources.ApplyResources(this.menuSysAgentMode, "menuSysAgentMode");
this.menuSysAgentMode.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.menuNotEnabledHttp,
this.menuGlobal,
this.menuGlobalPAC,
this.menuKeep,
this.menuKeepPAC,
this.menuKeepNothing,
this.menuKeepPACNothing});
this.menuGlobal,
this.menuKeepClear});
this.menuSysAgentMode.Name = "menuSysAgentMode";
//
// menuNotEnabledHttp
//
resources.ApplyResources(this.menuNotEnabledHttp, "menuNotEnabledHttp");
this.menuNotEnabledHttp.Name = "menuNotEnabledHttp";
this.menuNotEnabledHttp.Click += new System.EventHandler(this.menuNotEnabledHttp_Click);
//
// menuGlobal
//
resources.ApplyResources(this.menuGlobal, "menuGlobal");
this.menuGlobal.Name = "menuGlobal";
this.menuGlobal.Click += new System.EventHandler(this.menuGlobal_Click);
//
// menuGlobalPAC
//
resources.ApplyResources(this.menuGlobalPAC, "menuGlobalPAC");
this.menuGlobalPAC.Name = "menuGlobalPAC";
this.menuGlobalPAC.Click += new System.EventHandler(this.menuGlobalPAC_Click);
//
// menuKeep
//
resources.ApplyResources(this.menuKeep, "menuKeep");
this.menuKeep.Name = "menuKeep";
this.menuKeep.Click += new System.EventHandler(this.menuKeep_Click);
//
// menuKeepPAC
//
resources.ApplyResources(this.menuKeepPAC, "menuKeepPAC");
this.menuKeepPAC.Name = "menuKeepPAC";
this.menuKeepPAC.Click += new System.EventHandler(this.menuKeepPAC_Click);
//
// menuKeepNothing
//
resources.ApplyResources(this.menuKeepNothing, "menuKeepNothing");
this.menuKeepNothing.Name = "menuKeepNothing";
this.menuKeepNothing.Click += new System.EventHandler(this.menuKeepNothing_Click);
//
// menuKeepPACNothing
// menuGlobal
//
resources.ApplyResources(this.menuKeepPACNothing, "menuKeepPACNothing");
this.menuKeepPACNothing.Name = "menuKeepPACNothing";
this.menuKeepPACNothing.Click += new System.EventHandler(this.menuKeepPACNothing_Click);
resources.ApplyResources(this.menuGlobal, "menuGlobal");
this.menuGlobal.Name = "menuGlobal";
this.menuGlobal.Click += new System.EventHandler(this.menuGlobal_Click);
//
// menuKeepClear
//
resources.ApplyResources(this.menuKeepClear, "menuKeepClear");
this.menuKeepClear.Name = "menuKeepClear";
this.menuKeepClear.Click += new System.EventHandler(this.menuKeepClear_Click);
//
// menuServers
//
@ -496,12 +461,6 @@
this.menuScanScreen2.Name = "menuScanScreen2";
this.menuScanScreen2.Click += new System.EventHandler(this.menuScanScreen_Click);
//
// menuCopyPACUrl
//
resources.ApplyResources(this.menuCopyPACUrl, "menuCopyPACUrl");
this.menuCopyPACUrl.Name = "menuCopyPACUrl";
this.menuCopyPACUrl.Click += new System.EventHandler(this.menuCopyPACUrl_Click);
//
// menuUpdateSubscriptions
//
resources.ApplyResources(this.menuUpdateSubscriptions, "menuUpdateSubscriptions");
@ -559,8 +518,6 @@
this.toolSslHttpPortLab,
this.toolSslHttpPort,
this.toolSslBlank2,
this.toolSslPacPortLab,
this.toolSslPacPort,
this.toolSslBlank3,
this.toolSslServerSpeed,
this.toolSslBlank4});
@ -599,16 +556,6 @@
this.toolSslBlank2.Name = "toolSslBlank2";
this.toolSslBlank2.Spring = true;
//
// toolSslPacPortLab
//
resources.ApplyResources(this.toolSslPacPortLab, "toolSslPacPortLab");
this.toolSslPacPortLab.Name = "toolSslPacPortLab";
//
// toolSslPacPort
//
resources.ApplyResources(this.toolSslPacPort, "toolSslPacPort");
this.toolSslPacPort.Name = "toolSslPacPort";
//
// toolSslBlank3
//
resources.ApplyResources(this.toolSslBlank3, "toolSslBlank3");
@ -641,7 +588,7 @@
this.tsbSub,
this.tsbQRCodeSwitch,
this.toolStripSeparator8,
this.tsbOptionSetting,
this.tsbSetting,
this.toolStripSeparator5,
this.tsbReload,
this.toolStripSeparator7,
@ -694,13 +641,27 @@
resources.ApplyResources(this.toolStripSeparator8, "toolStripSeparator8");
this.toolStripSeparator8.Name = "toolStripSeparator8";
//
// tsbSetting
//
resources.ApplyResources(this.tsbSetting, "tsbSetting");
this.tsbSetting.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.tsbOptionSetting,
this.tsbRoutingSetting});
this.tsbSetting.Image = global::v2rayN.Properties.Resources.option;
this.tsbSetting.Name = "tsbSetting";
//
// tsbOptionSetting
//
resources.ApplyResources(this.tsbOptionSetting, "tsbOptionSetting");
this.tsbOptionSetting.Image = global::v2rayN.Properties.Resources.option;
this.tsbOptionSetting.Name = "tsbOptionSetting";
this.tsbOptionSetting.Click += new System.EventHandler(this.tsbOptionSetting_Click);
//
// tsbRoutingSetting
//
resources.ApplyResources(this.tsbRoutingSetting, "tsbRoutingSetting");
this.tsbRoutingSetting.Name = "tsbRoutingSetting";
this.tsbRoutingSetting.Click += new System.EventHandler(this.tsbRoutingSetting_Click);
//
// toolStripSeparator5
//
resources.ApplyResources(this.toolStripSeparator5, "toolStripSeparator5");
@ -723,9 +684,7 @@
this.tsbCheckUpdate.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.tsbCheckUpdateN,
this.tsbCheckUpdateCore,
this.tsbCheckUpdatePACList,
this.toolStripSeparator13,
this.tsbCheckClearPACList});
this.tsbCheckUpdateXrayCore});
this.tsbCheckUpdate.Image = global::v2rayN.Properties.Resources.checkupdate;
this.tsbCheckUpdate.Name = "tsbCheckUpdate";
//
@ -741,22 +700,11 @@
this.tsbCheckUpdateCore.Name = "tsbCheckUpdateCore";
this.tsbCheckUpdateCore.Click += new System.EventHandler(this.tsbCheckUpdateCore_Click);
//
// tsbCheckUpdatePACList
// tsbCheckUpdateXrayCore
//
resources.ApplyResources(this.tsbCheckUpdatePACList, "tsbCheckUpdatePACList");
this.tsbCheckUpdatePACList.Name = "tsbCheckUpdatePACList";
this.tsbCheckUpdatePACList.Click += new System.EventHandler(this.tsbCheckUpdatePACList_Click);
//
// toolStripSeparator13
//
resources.ApplyResources(this.toolStripSeparator13, "toolStripSeparator13");
this.toolStripSeparator13.Name = "toolStripSeparator13";
//
// tsbCheckClearPACList
//
resources.ApplyResources(this.tsbCheckClearPACList, "tsbCheckClearPACList");
this.tsbCheckClearPACList.Name = "tsbCheckClearPACList";
this.tsbCheckClearPACList.Click += new System.EventHandler(this.tsbCheckClearPACList_Click);
resources.ApplyResources(this.tsbCheckUpdateXrayCore, "tsbCheckUpdateXrayCore");
this.tsbCheckUpdateXrayCore.Name = "tsbCheckUpdateXrayCore";
this.tsbCheckUpdateXrayCore.Click += new System.EventHandler(this.tsbCheckUpdateXrayCore_Click);
//
// toolStripSeparator10
//
@ -880,7 +828,6 @@
private System.Windows.Forms.ToolStripMenuItem menuExport2ServerConfig;
private System.Windows.Forms.ToolStrip tsMain;
private System.Windows.Forms.ToolStripDropDownButton tsbServer;
private System.Windows.Forms.ToolStripButton tsbOptionSetting;
private System.Windows.Forms.ToolStripButton tsbClose;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator4;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator5;
@ -893,9 +840,7 @@
private System.Windows.Forms.ToolStripSeparator toolStripSeparator9;
private System.Windows.Forms.ToolStripMenuItem menuSysAgentMode;
private System.Windows.Forms.ToolStripMenuItem menuGlobal;
private System.Windows.Forms.ToolStripMenuItem menuGlobalPAC;
private System.Windows.Forms.ToolStripMenuItem menuKeep;
private System.Windows.Forms.ToolStripMenuItem menuCopyPACUrl;
private System.Windows.Forms.ToolStripMenuItem menuKeepClear;
private System.Windows.Forms.ToolStripMenuItem menuAddCustomServer;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
private System.Windows.Forms.ToolStripMenuItem menuAddShadowsocksServer;
@ -905,7 +850,6 @@
private System.Windows.Forms.ToolStripDropDownButton tsbCheckUpdate;
private System.Windows.Forms.ToolStripMenuItem tsbCheckUpdateN;
private System.Windows.Forms.ToolStripMenuItem tsbCheckUpdateCore;
private System.Windows.Forms.ToolStripMenuItem tsbCheckUpdatePACList;
private System.Windows.Forms.ToolStripMenuItem menuAddServers;
private System.Windows.Forms.ToolStripMenuItem menuExport2ShareUrl;
private System.Windows.Forms.ToolStripMenuItem menuSpeedServer;
@ -920,8 +864,6 @@
private System.Windows.Forms.ToolStripSeparator toolStripSeparator8;
private System.Windows.Forms.ToolStripMenuItem tsbSubSetting;
private System.Windows.Forms.ToolStripMenuItem tsbSubUpdate;
private System.Windows.Forms.ToolStripMenuItem tsbCheckClearPACList;
private System.Windows.Forms.ToolStripMenuItem menuKeepPAC;
private System.Windows.Forms.ToolStripMenuItem menuSelectAll;
private System.Windows.Forms.ToolStripMenuItem menuExport2SubContent;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator12;
@ -934,27 +876,26 @@
private System.Windows.Forms.ToolStripStatusLabel toolSslHttpPort;
private System.Windows.Forms.ToolStripStatusLabel toolSslBlank2;
private System.Windows.Forms.ToolStripStatusLabel toolSslBlank1;
private System.Windows.Forms.ToolStripStatusLabel toolSslPacPort;
private System.Windows.Forms.ToolStripStatusLabel toolSslBlank3;
private System.Windows.Forms.ToolStripStatusLabel toolSslSocksPortLab;
private System.Windows.Forms.ToolStripStatusLabel toolSslHttpPortLab;
private System.Windows.Forms.ToolStripStatusLabel toolSslPacPortLab;
private System.Windows.Forms.ToolStripStatusLabel toolSslServerSpeed;
private System.Windows.Forms.ToolStripStatusLabel toolSslBlank4;
private System.Windows.Forms.ToolStripMenuItem menuRemoveDuplicateServer;
private System.Windows.Forms.ToolStripMenuItem menuTcpingServer;
private System.Windows.Forms.ToolStripMenuItem menuRealPingServer;
private System.Windows.Forms.ToolStripMenuItem menuNotEnabledHttp;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator13;
private System.Windows.Forms.ToolStripMenuItem menuUpdateSubscriptions;
private System.Windows.Forms.ToolStripMenuItem tsbV2rayWebsite;
private System.Windows.Forms.ToolStripMenuItem menuKeepNothing;
private System.Windows.Forms.ToolStripMenuItem menuKeepPACNothing;
private System.Windows.Forms.ToolStripMenuItem tsbTestMe;
private System.Windows.Forms.ToolStripButton tsbReload;
private System.Windows.Forms.ToolStripButton tsbQRCodeSwitch;
private System.Windows.Forms.ToolStripMenuItem menuAddVlessServer;
private System.Windows.Forms.ToolStripMenuItem menuAddTrojanServer;
private System.Windows.Forms.ToolStripDropDownButton tsbSetting;
private System.Windows.Forms.ToolStripMenuItem tsbOptionSetting;
private System.Windows.Forms.ToolStripMenuItem tsbRoutingSetting;
private System.Windows.Forms.ToolStripMenuItem tsbCheckUpdateXrayCore;
}
}

View File

@ -35,8 +35,8 @@ namespace v2rayN.Forms
{
v2rayHandler.V2rayStop();
HttpProxyHandle.CloseHttpAgent(config);
PACServerHandle.Stop();
//HttpProxyHandle.CloseHttpAgent(config);
HttpProxyHandle.UpdateSysProxy(config, true);
ConfigHandler.SaveConfig(ref config);
statistics?.SaveToFile();
@ -205,6 +205,8 @@ namespace v2rayN.Forms
/// </summary>
private void RefreshServersView()
{
int index = lvServers.SelectedIndices.Count > 0 ? lvServers.SelectedIndices[0] : -1;
lvServers.BeginUpdate();
lvServers.Items.Clear();
@ -270,15 +272,11 @@ namespace v2rayN.Forms
}
lvServers.EndUpdate();
//if (lvServers.Items.Count > 0)
//{
// if (lvServers.Items.Count <= testConfigIndex)
// {
// testConfigIndex = lvServers.Items.Count - 1;
// }
// lvServers.Items[testConfigIndex].Selected = true;
// lvServers.Select();
//}
if (index >= 0 && index < lvServers.Items.Count && lvServers.Items.Count > 0)
{
lvServers.Items[index].Selected = true;
lvServers.EnsureVisible(index); // workaround
}
}
/// <summary>
@ -343,29 +341,8 @@ namespace v2rayN.Forms
private void DisplayToolStatus()
{
toolSslSocksPort.Text =
toolSslHttpPort.Text =
toolSslPacPort.Text = "OFF";
toolSslSocksPort.Text = $"{Global.Loopback}:{config.inbound[0].localPort}";
if (config.listenerType != (int)ListenerType.noHttpProxy)
{
toolSslHttpPort.Text = $"{Global.Loopback}:{Global.httpPort}";
if (config.listenerType == ListenerType.GlobalPac ||
config.listenerType == ListenerType.PacOpenAndClear ||
config.listenerType == ListenerType.PacOpenOnly)
{
if (PACServerHandle.IsRunning)
{
toolSslPacPort.Text = $"{HttpProxyHandle.GetPacUrl()}";
}
else
{
toolSslPacPort.Text = UIRes.I18N("StartPacFailed");
}
}
}
toolSslHttpPort.Text = $"{Global.Loopback}:{Global.httpPort}";
notifyMain.Icon = MainFormHandler.Instance.GetNotifyIcon(config, this.Icon);
}
@ -426,7 +403,7 @@ namespace v2rayN.Forms
ConfigHandler.SaveConfig(ref config, false);
statistics?.SaveToFile();
ChangePACButtonStatus(config.listenerType);
ChangePACButtonStatus(config.sysProxyType);
tsbReload.Enabled = true;
}
@ -576,7 +553,7 @@ namespace v2rayN.Forms
private void menuAddVlessServer_Click(object sender, EventArgs e)
{
ShowServerForm((int)EConfigType.VLESS, -1);
ShowServerForm((int)EConfigType.VLESS, -1);
}
private void menuRemoveServer_Click(object sender, EventArgs e)
@ -758,7 +735,17 @@ namespace v2rayN.Forms
//刷新
RefreshServers();
LoadV2ray();
HttpProxyHandle.RestartHttpAgent(config, true);
}
}
private void tsbRoutingSetting_Click(object sender, EventArgs e)
{
RoutingSettingForm fm = new RoutingSettingForm();
if (fm.ShowDialog() == DialogResult.OK)
{
//刷新
RefreshServers();
LoadV2ray();
}
}
@ -858,13 +845,13 @@ namespace v2rayN.Forms
private void menuAddShadowsocksServer_Click(object sender, EventArgs e)
{
ShowServerForm((int)EConfigType.Shadowsocks, -1);
ShowServerForm((int)EConfigType.Shadowsocks, -1);
ShowForm();
}
private void menuAddSocksServer_Click(object sender, EventArgs e)
{
ShowServerForm((int)EConfigType.Socks, -1);
ShowServerForm((int)EConfigType.Socks, -1);
ShowForm();
}
@ -1020,10 +1007,11 @@ namespace v2rayN.Forms
this.ShowInTaskbar = true;
//this.notifyIcon1.Visible = false;
this.txtMsgBox.ScrollToCaret();
if (config.index >= 0 && config.index < lvServers.Items.Count)
{
lvServers.EnsureVisible(config.index); // workaround
}
//if (config.index >= 0 && config.index < lvServers.Items.Count)
//{
// lvServers.Items[config.index].Selected = true;
// lvServers.EnsureVisible(config.index); // workaround
//}
SetVisibleCore(true);
}
@ -1151,55 +1139,37 @@ namespace v2rayN.Forms
#region 系统代理相关
private void menuCopyPACUrl_Click(object sender, EventArgs e)
{
Utils.SetClipboardData(HttpProxyHandle.GetPacUrl());
}
private void menuNotEnabledHttp_Click(object sender, EventArgs e)
{
SetListenerType(ListenerType.noHttpProxy);
}
private void menuGlobal_Click(object sender, EventArgs e)
{
SetListenerType(ListenerType.GlobalHttp);
SetListenerType(ESysProxyType.ForcedChange);
}
private void menuGlobalPAC_Click(object sender, EventArgs e)
private void menuKeepClear_Click(object sender, EventArgs e)
{
SetListenerType(ListenerType.GlobalPac);
}
private void menuKeep_Click(object sender, EventArgs e)
{
SetListenerType(ListenerType.HttpOpenAndClear);
}
private void menuKeepPAC_Click(object sender, EventArgs e)
{
SetListenerType(ListenerType.PacOpenAndClear);
SetListenerType(ESysProxyType.ForcedClear);
}
private void menuKeepNothing_Click(object sender, EventArgs e)
{
SetListenerType(ListenerType.HttpOpenOnly);
SetListenerType(ESysProxyType.Unchanged);
}
private void menuKeepPACNothing_Click(object sender, EventArgs e)
private void SetListenerType(ESysProxyType type)
{
SetListenerType(ListenerType.PacOpenOnly);
}
private void SetListenerType(ListenerType type)
{
config.listenerType = type;
config.sysProxyType = type;
ChangePACButtonStatus(type);
}
private void ChangePACButtonStatus(ListenerType type)
private void ChangePACButtonStatus(ESysProxyType type)
{
if (type != ListenerType.noHttpProxy)
{
HttpProxyHandle.RestartHttpAgent(config, false);
}
else
{
HttpProxyHandle.CloseHttpAgent(config);
}
HttpProxyHandle.UpdateSysProxy(config, false);
//if (type != ListenerType.noHttpProxy)
//{
// HttpProxyHandle.RestartHttpAgent(config, false);
//}
//else
//{
// HttpProxyHandle.CloseHttpAgent(config);
//}
for (int k = 0; k < menuSysAgentMode.DropDownItems.Count; k++)
{
@ -1301,6 +1271,16 @@ namespace v2rayN.Forms
}
private void tsbCheckUpdateCore_Click(object sender, EventArgs e)
{
CheckUpdateCore("v2fly");
}
private void tsbCheckUpdateXrayCore_Click(object sender, EventArgs e)
{
CheckUpdateCore("xray");
}
private void CheckUpdateCore(string type)
{
DownloadHandle downloadHandle = null;
if (downloadHandle == null)
@ -1362,53 +1342,7 @@ namespace v2rayN.Forms
}
AppendText(false, string.Format(UIRes.I18N("MsgStartUpdating"), "v2rayCore"));
downloadHandle.CheckUpdateAsync("Core");
}
private void tsbCheckUpdatePACList_Click(object sender, EventArgs e)
{
DownloadHandle pacListHandle = null;
if (pacListHandle == null)
{
pacListHandle = new DownloadHandle();
pacListHandle.UpdateCompleted += (sender2, args) =>
{
if (args.Success)
{
string result = args.Msg;
if (Utils.IsNullOrEmpty(result))
{
return;
}
pacListHandle.GenPacFile(result);
AppendText(false, UIRes.I18N("MsgPACUpdateSuccessfully"));
}
else
{
AppendText(false, UIRes.I18N("MsgPACUpdateFailed"));
}
};
pacListHandle.Error += (sender2, args) =>
{
AppendText(true, args.GetException().Message);
};
}
AppendText(false, UIRes.I18N("MsgStartUpdatingPAC"));
pacListHandle.WebDownloadString(config.urlGFWList);
}
private void tsbCheckClearPACList_Click(object sender, EventArgs e)
{
try
{
File.WriteAllText(Utils.GetPath(Global.pacFILE), Utils.GetEmbedText(Global.BlankPacFileName), Encoding.UTF8);
AppendText(false, UIRes.I18N("MsgSimplifyPAC"));
}
catch (Exception ex)
{
Utils.SaveLog(ex.Message, ex);
}
downloadHandle.CheckUpdateAsync(type);
}
#endregion
@ -1570,8 +1504,8 @@ namespace v2rayN.Forms
#endregion
}
}

File diff suppressed because it is too large Load Diff

View File

@ -286,6 +286,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>301, 600</value>
</data>
@ -306,62 +312,29 @@
ZW0uRHJhd2luZy5HcmFwaGljc1VuaXQBAAAAB3ZhbHVlX18ACAMAAAADAAAACw==
</value>
</data>
<data name="tsbServer.Size" type="System.Drawing.Size, System.Drawing">
<value>73, 53</value>
<data name="menuKeepNothing.Size" type="System.Drawing.Size, System.Drawing">
<value>228, 22</value>
</data>
<data name="tsbServer.Text" xml:space="preserve">
<value> 服务器 </value>
<data name="menuKeepNothing.Text" xml:space="preserve">
<value>不改变系统代理</value>
</data>
<data name="cmsMain.Size" type="System.Drawing.Size, System.Drawing">
<value>196, 164</value>
<data name="menuGlobal.Size" type="System.Drawing.Size, System.Drawing">
<value>228, 22</value>
</data>
<data name="menuGlobal.Text" xml:space="preserve">
<value>自动配置系统代理(全局模式)</value>
</data>
<data name="menuKeepClear.Size" type="System.Drawing.Size, System.Drawing">
<value>228, 22</value>
</data>
<data name="menuKeepClear.Text" xml:space="preserve">
<value>清除系统代理</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="menuNotEnabledHttp.Size" type="System.Drawing.Size, System.Drawing">
<value>316, 22</value>
</data>
<data name="menuNotEnabledHttp.Text" xml:space="preserve">
<value>关闭Http代理</value>
</data>
<data name="menuGlobal.Size" type="System.Drawing.Size, System.Drawing">
<value>316, 22</value>
</data>
<data name="menuGlobal.Text" xml:space="preserve">
<value>开启Http代理,并自动配置系统代理(全局模式)</value>
</data>
<data name="menuGlobalPAC.Size" type="System.Drawing.Size, System.Drawing">
<value>316, 22</value>
</data>
<data name="menuGlobalPAC.Text" xml:space="preserve">
<value>开启PAC,并自动配置系统代理(PAC模式)</value>
</data>
<data name="menuKeep.Size" type="System.Drawing.Size, System.Drawing">
<value>316, 22</value>
</data>
<data name="menuKeep.Text" xml:space="preserve">
<value>仅开启Http代理,并清除系统代理</value>
</data>
<data name="menuKeepPAC.Size" type="System.Drawing.Size, System.Drawing">
<value>316, 22</value>
</data>
<data name="menuKeepPAC.Text" xml:space="preserve">
<value>仅开启PAC,并清除系统代理</value>
</data>
<data name="menuKeepNothing.Size" type="System.Drawing.Size, System.Drawing">
<value>316, 22</value>
</data>
<data name="menuKeepNothing.Text" xml:space="preserve">
<value>仅开启Http代理,不改变系统代理</value>
</data>
<data name="menuKeepPACNothing.Size" type="System.Drawing.Size, System.Drawing">
<value>316, 22</value>
</data>
<data name="menuKeepPACNothing.Text" xml:space="preserve">
<value>仅开启PAC,不改变系统代理</value>
<value>系统代理</value>
</data>
<data name="menuServers.Size" type="System.Drawing.Size, System.Drawing">
<value>195, 22</value>
@ -381,12 +354,6 @@
<data name="menuScanScreen2.Text" xml:space="preserve">
<value>扫描屏幕上的二维码</value>
</data>
<data name="menuCopyPACUrl.Size" type="System.Drawing.Size, System.Drawing">
<value>195, 22</value>
</data>
<data name="menuCopyPACUrl.Text" xml:space="preserve">
<value>复制本地PAC网址</value>
</data>
<data name="menuUpdateSubscriptions.Size" type="System.Drawing.Size, System.Drawing">
<value>195, 22</value>
</data>
@ -402,20 +369,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>
@ -429,6 +393,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="tsbQRCodeSwitch.Size" type="System.Drawing.Size, System.Drawing">
<value>52, 53</value>
</data>
@ -436,10 +406,22 @@
<value> 分享 </value>
</data>
<data name="tsbOptionSetting.Size" type="System.Drawing.Size, System.Drawing">
<value>76, 53</value>
<value>124, 22</value>
</data>
<data name="tsbOptionSetting.Text" xml:space="preserve">
<value> 参数设置 </value>
<value>参数设置</value>
</data>
<data name="tsbRoutingSetting.Size" type="System.Drawing.Size, System.Drawing">
<value>124, 22</value>
</data>
<data name="tsbRoutingSetting.Text" xml:space="preserve">
<value>路由设置</value>
</data>
<data name="tsbSetting.Size" type="System.Drawing.Size, System.Drawing">
<value>61, 53</value>
</data>
<data name="tsbSetting.Text" xml:space="preserve">
<value> 设置 </value>
</data>
<data name="tsbReload.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
@ -458,38 +440,35 @@
<data name="tsbReload.Text" xml:space="preserve">
<value> 重启服务 </value>
</data>
<data name="tsbCheckUpdateN.Size" type="System.Drawing.Size, System.Drawing">
<value>180, 22</value>
</data>
<data name="tsbCheckUpdateN.Text" xml:space="preserve">
<value>v2rayN</value>
</data>
<data name="tsbCheckUpdateCore.Size" type="System.Drawing.Size, System.Drawing">
<value>180, 22</value>
</data>
<data name="tsbCheckUpdateCore.Text" xml:space="preserve">
<value>v2fly-Core</value>
</data>
<data name="tsbCheckUpdateXrayCore.Size" type="System.Drawing.Size, System.Drawing">
<value>180, 22</value>
</data>
<data name="tsbCheckUpdateXrayCore.Text" xml:space="preserve">
<value>xray-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="tsbCheckUpdateN.Size" type="System.Drawing.Size, System.Drawing">
<value>223, 22</value>
<data name="tsbAbout.Text" xml:space="preserve">
<value>v2rayN 项目</value>
</data>
<data name="tsbCheckUpdateN.Text" xml:space="preserve">
<value>v2rayN</value>
</data>
<data name="tsbCheckUpdateCore.Size" type="System.Drawing.Size, System.Drawing">
<value>223, 22</value>
</data>
<data name="tsbCheckUpdateCore.Text" xml:space="preserve">
<value>v2rayCore</value>
</data>
<data name="tsbCheckUpdatePACList.Size" type="System.Drawing.Size, System.Drawing">
<value>223, 22</value>
</data>
<data name="tsbCheckUpdatePACList.Text" xml:space="preserve">
<value>PAC</value>
</data>
<data name="toolStripSeparator13.Size" type="System.Drawing.Size, System.Drawing">
<value>220, 6</value>
</data>
<data name="tsbCheckClearPACList.Size" type="System.Drawing.Size, System.Drawing">
<value>223, 22</value>
</data>
<data name="tsbCheckClearPACList.Text" xml:space="preserve">
<value>简化PAC (请设置Core路由)</value>
<data name="tsbV2rayWebsite.Text" xml:space="preserve">
<value>V2Ray 官网</value>
</data>
<data name="tsbHelp.Size" type="System.Drawing.Size, System.Drawing">
<value>69, 53</value>
@ -497,12 +476,6 @@
<data name="tsbHelp.Text" xml:space="preserve">
<value> 帮助 </value>
</data>
<data name="tsbAbout.Text" xml:space="preserve">
<value>v2rayN 项目</value>
</data>
<data name="tsbV2rayWebsite.Text" xml:space="preserve">
<value>V2Ray 官网</value>
</data>
<data name="tsbPromotion.Size" type="System.Drawing.Size, System.Drawing">
<value>68, 53</value>
</data>

View File

@ -34,12 +34,8 @@
this.tabPage1 = new System.Windows.Forms.TabPage();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.chkdefAllowInsecure = new System.Windows.Forms.CheckBox();
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();
this.label14 = new System.Windows.Forms.Label();
this.chkmuxEnabled = new System.Windows.Forms.CheckBox();
this.chkAllowIn2 = new System.Windows.Forms.CheckBox();
this.chkudpEnabled2 = new System.Windows.Forms.CheckBox();
@ -55,21 +51,9 @@
this.txtlocalPort = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.tabControl2 = new System.Windows.Forms.TabControl();
this.tabPage3 = new System.Windows.Forms.TabPage();
this.txtUseragent = new System.Windows.Forms.TextBox();
this.tabPage4 = new System.Windows.Forms.TabPage();
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.linkLabelRoutingDoc = new System.Windows.Forms.LinkLabel();
this.btnSetDefRountingRule = new System.Windows.Forms.Button();
this.labRoutingTips = new System.Windows.Forms.Label();
this.cmbdomainStrategy = new System.Windows.Forms.ComboBox();
this.linkDnsObjectDoc = new System.Windows.Forms.LinkLabel();
this.txtremoteDNS = new System.Windows.Forms.TextBox();
this.label14 = new System.Windows.Forms.Label();
this.tabPage6 = new System.Windows.Forms.TabPage();
this.chkKcpcongestion = new System.Windows.Forms.CheckBox();
this.txtKcpwriteBufferSize = new System.Windows.Forms.TextBox();
@ -90,13 +74,7 @@
this.lbFreshrate = new System.Windows.Forms.Label();
this.chkEnableStatistics = new System.Windows.Forms.CheckBox();
this.chkAllowLANConn = new System.Windows.Forms.CheckBox();
this.txturlGFWList = new System.Windows.Forms.TextBox();
this.label13 = new System.Windows.Forms.Label();
this.chkAutoRun = new System.Windows.Forms.CheckBox();
this.tabPage9 = new System.Windows.Forms.TabPage();
this.txtuserPacRule = new System.Windows.Forms.TextBox();
this.panel4 = new System.Windows.Forms.Panel();
this.label4 = new System.Windows.Forms.Label();
this.panel2 = new System.Windows.Forms.Panel();
this.btnOK = new System.Windows.Forms.Button();
this.panel1 = new System.Windows.Forms.Panel();
@ -104,56 +82,41 @@
this.tabPage1.SuspendLayout();
this.groupBox1.SuspendLayout();
this.tabPage2.SuspendLayout();
this.groupBox2.SuspendLayout();
this.tabControl2.SuspendLayout();
this.tabPage3.SuspendLayout();
this.tabPage4.SuspendLayout();
this.tabPage5.SuspendLayout();
this.tabPage8.SuspendLayout();
this.panel3.SuspendLayout();
this.tabPage6.SuspendLayout();
this.tabPage7.SuspendLayout();
this.tabPage9.SuspendLayout();
this.panel4.SuspendLayout();
this.panel2.SuspendLayout();
this.SuspendLayout();
//
// btnClose
//
resources.ApplyResources(this.btnClose, "btnClose");
this.btnClose.DialogResult = System.Windows.Forms.DialogResult.Cancel;
resources.ApplyResources(this.btnClose, "btnClose");
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);
this.tabControl1.Controls.Add(this.tabPage9);
resources.ApplyResources(this.tabControl1, "tabControl1");
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
//
// tabPage1
//
resources.ApplyResources(this.tabPage1, "tabPage1");
this.tabPage1.Controls.Add(this.groupBox1);
resources.ApplyResources(this.tabPage1, "tabPage1");
this.tabPage1.Name = "tabPage1";
this.tabPage1.UseVisualStyleBackColor = true;
//
// groupBox1
//
resources.ApplyResources(this.groupBox1, "groupBox1");
this.groupBox1.Controls.Add(this.chkdefAllowInsecure);
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);
this.groupBox1.Controls.Add(this.label14);
this.groupBox1.Controls.Add(this.chkmuxEnabled);
this.groupBox1.Controls.Add(this.chkAllowIn2);
this.groupBox1.Controls.Add(this.chkudpEnabled2);
@ -168,6 +131,7 @@
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;
//
@ -177,26 +141,6 @@
this.chkdefAllowInsecure.Name = "chkdefAllowInsecure";
this.chkdefAllowInsecure.UseVisualStyleBackColor = true;
//
// 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"),
resources.GetString("cmblistenerType.Items5"),
resources.GetString("cmblistenerType.Items6")});
this.cmblistenerType.Name = "cmblistenerType";
//
// chksniffingEnabled2
//
resources.ApplyResources(this.chksniffingEnabled2, "chksniffingEnabled2");
@ -209,16 +153,6 @@
this.chksniffingEnabled.Name = "chksniffingEnabled";
this.chksniffingEnabled.UseVisualStyleBackColor = true;
//
// txtremoteDNS
//
resources.ApplyResources(this.txtremoteDNS, "txtremoteDNS");
this.txtremoteDNS.Name = "txtremoteDNS";
//
// label14
//
resources.ApplyResources(this.label14, "label14");
this.label14.Name = "label14";
//
// chkmuxEnabled
//
resources.ApplyResources(this.chkmuxEnabled, "chkmuxEnabled");
@ -240,12 +174,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
@ -260,8 +194,8 @@
//
// cmbprotocol
//
resources.ApplyResources(this.cmbprotocol, "cmbprotocol");
this.cmbprotocol.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
resources.ApplyResources(this.cmbprotocol, "cmbprotocol");
this.cmbprotocol.FormattingEnabled = true;
this.cmbprotocol.Items.AddRange(new object[] {
resources.GetString("cmbprotocol.Items"),
@ -287,7 +221,6 @@
//
// cmbloglevel
//
resources.ApplyResources(this.cmbloglevel, "cmbloglevel");
this.cmbloglevel.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbloglevel.FormattingEnabled = true;
this.cmbloglevel.Items.AddRange(new object[] {
@ -296,6 +229,7 @@
resources.GetString("cmbloglevel.Items2"),
resources.GetString("cmbloglevel.Items3"),
resources.GetString("cmbloglevel.Items4")});
resources.ApplyResources(this.cmbloglevel, "cmbloglevel");
this.cmbloglevel.Name = "cmbloglevel";
//
// label5
@ -315,127 +249,31 @@
//
// tabPage2
//
this.tabPage2.Controls.Add(this.linkDnsObjectDoc);
this.tabPage2.Controls.Add(this.txtremoteDNS);
this.tabPage2.Controls.Add(this.label14);
resources.ApplyResources(this.tabPage2, "tabPage2");
this.tabPage2.Controls.Add(this.groupBox2);
this.tabPage2.Name = "tabPage2";
this.tabPage2.UseVisualStyleBackColor = true;
//
// groupBox2
// linkDnsObjectDoc
//
resources.ApplyResources(this.groupBox2, "groupBox2");
this.groupBox2.Controls.Add(this.tabControl2);
this.groupBox2.Controls.Add(this.panel3);
this.groupBox2.Name = "groupBox2";
this.groupBox2.TabStop = false;
resources.ApplyResources(this.linkDnsObjectDoc, "linkDnsObjectDoc");
this.linkDnsObjectDoc.Name = "linkDnsObjectDoc";
this.linkDnsObjectDoc.TabStop = true;
//
// tabControl2
// txtremoteDNS
//
resources.ApplyResources(this.tabControl2, "tabControl2");
this.tabControl2.Controls.Add(this.tabPage3);
this.tabControl2.Controls.Add(this.tabPage4);
this.tabControl2.Controls.Add(this.tabPage5);
this.tabControl2.Controls.Add(this.tabPage8);
this.tabControl2.Name = "tabControl2";
this.tabControl2.SelectedIndex = 0;
resources.ApplyResources(this.txtremoteDNS, "txtremoteDNS");
this.txtremoteDNS.Name = "txtremoteDNS";
//
// tabPage3
// label14
//
resources.ApplyResources(this.tabPage3, "tabPage3");
this.tabPage3.Controls.Add(this.txtUseragent);
this.tabPage3.Name = "tabPage3";
this.tabPage3.UseVisualStyleBackColor = true;
//
// txtUseragent
//
resources.ApplyResources(this.txtUseragent, "txtUseragent");
this.txtUseragent.Name = "txtUseragent";
//
// tabPage4
//
resources.ApplyResources(this.tabPage4, "tabPage4");
this.tabPage4.Controls.Add(this.txtUserdirect);
this.tabPage4.Name = "tabPage4";
this.tabPage4.UseVisualStyleBackColor = true;
//
// txtUserdirect
//
resources.ApplyResources(this.txtUserdirect, "txtUserdirect");
this.txtUserdirect.Name = "txtUserdirect";
//
// tabPage5
//
resources.ApplyResources(this.tabPage5, "tabPage5");
this.tabPage5.Controls.Add(this.txtUserblock);
this.tabPage5.Name = "tabPage5";
this.tabPage5.UseVisualStyleBackColor = true;
//
// txtUserblock
//
resources.ApplyResources(this.txtUserblock, "txtUserblock");
this.txtUserblock.Name = "txtUserblock";
//
// tabPage8
//
resources.ApplyResources(this.tabPage8, "tabPage8");
this.tabPage8.Controls.Add(this.cmbroutingMode);
this.tabPage8.Name = "tabPage8";
this.tabPage8.UseVisualStyleBackColor = true;
//
// cmbroutingMode
//
resources.ApplyResources(this.cmbroutingMode, "cmbroutingMode");
this.cmbroutingMode.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbroutingMode.FormattingEnabled = true;
this.cmbroutingMode.Items.AddRange(new object[] {
resources.GetString("cmbroutingMode.Items"),
resources.GetString("cmbroutingMode.Items1"),
resources.GetString("cmbroutingMode.Items2"),
resources.GetString("cmbroutingMode.Items3")});
this.cmbroutingMode.Name = "cmbroutingMode";
//
// panel3
//
resources.ApplyResources(this.panel3, "panel3");
this.panel3.Controls.Add(this.linkLabelRoutingDoc);
this.panel3.Controls.Add(this.btnSetDefRountingRule);
this.panel3.Controls.Add(this.labRoutingTips);
this.panel3.Controls.Add(this.cmbdomainStrategy);
this.panel3.Name = "panel3";
//
// linkLabelRoutingDoc
//
resources.ApplyResources(this.linkLabelRoutingDoc, "linkLabelRoutingDoc");
this.linkLabelRoutingDoc.Name = "linkLabelRoutingDoc";
this.linkLabelRoutingDoc.TabStop = true;
this.linkLabelRoutingDoc.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabelRoutingDoc_LinkClicked);
//
// btnSetDefRountingRule
//
resources.ApplyResources(this.btnSetDefRountingRule, "btnSetDefRountingRule");
this.btnSetDefRountingRule.Name = "btnSetDefRountingRule";
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")});
this.cmbdomainStrategy.Name = "cmbdomainStrategy";
resources.ApplyResources(this.label14, "label14");
this.label14.Name = "label14";
//
// tabPage6
//
resources.ApplyResources(this.tabPage6, "tabPage6");
this.tabPage6.Controls.Add(this.chkKcpcongestion);
this.tabPage6.Controls.Add(this.txtKcpwriteBufferSize);
this.tabPage6.Controls.Add(this.label10);
@ -449,6 +287,7 @@
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;
//
@ -520,15 +359,13 @@
//
// tabPage7
//
resources.ApplyResources(this.tabPage7, "tabPage7");
this.tabPage7.Controls.Add(this.chkKeepOlderDedupl);
this.tabPage7.Controls.Add(this.cbFreshrate);
this.tabPage7.Controls.Add(this.lbFreshrate);
this.tabPage7.Controls.Add(this.chkEnableStatistics);
this.tabPage7.Controls.Add(this.chkAllowLANConn);
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;
//
@ -540,9 +377,9 @@
//
// 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";
//
// lbFreshrate
@ -562,52 +399,17 @@
this.chkAllowLANConn.Name = "chkAllowLANConn";
this.chkAllowLANConn.UseVisualStyleBackColor = true;
//
// txturlGFWList
//
resources.ApplyResources(this.txturlGFWList, "txturlGFWList");
this.txturlGFWList.Name = "txturlGFWList";
//
// label13
//
resources.ApplyResources(this.label13, "label13");
this.label13.Name = "label13";
//
// chkAutoRun
//
resources.ApplyResources(this.chkAutoRun, "chkAutoRun");
this.chkAutoRun.Name = "chkAutoRun";
this.chkAutoRun.UseVisualStyleBackColor = true;
//
// tabPage9
//
resources.ApplyResources(this.tabPage9, "tabPage9");
this.tabPage9.Controls.Add(this.txtuserPacRule);
this.tabPage9.Controls.Add(this.panel4);
this.tabPage9.Name = "tabPage9";
this.tabPage9.UseVisualStyleBackColor = true;
//
// txtuserPacRule
//
resources.ApplyResources(this.txtuserPacRule, "txtuserPacRule");
this.txtuserPacRule.Name = "txtuserPacRule";
//
// panel4
//
resources.ApplyResources(this.panel4, "panel4");
this.panel4.Controls.Add(this.label4);
this.panel4.Name = "panel4";
//
// label4
//
resources.ApplyResources(this.label4, "label4");
this.label4.ForeColor = System.Drawing.Color.Brown;
this.label4.Name = "label4";
//
// 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
@ -638,24 +440,11 @@
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.tabPage2.ResumeLayout(false);
this.groupBox2.ResumeLayout(false);
this.tabControl2.ResumeLayout(false);
this.tabPage3.ResumeLayout(false);
this.tabPage3.PerformLayout();
this.tabPage4.ResumeLayout(false);
this.tabPage4.PerformLayout();
this.tabPage5.ResumeLayout(false);
this.tabPage5.PerformLayout();
this.tabPage8.ResumeLayout(false);
this.panel3.ResumeLayout(false);
this.panel3.PerformLayout();
this.tabPage2.PerformLayout();
this.tabPage6.ResumeLayout(false);
this.tabPage6.PerformLayout();
this.tabPage7.ResumeLayout(false);
this.tabPage7.PerformLayout();
this.tabPage9.ResumeLayout(false);
this.tabPage9.PerformLayout();
this.panel4.ResumeLayout(false);
this.panel2.ResumeLayout(false);
this.ResumeLayout(false);
@ -675,9 +464,7 @@
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.TabControl tabControl1;
private System.Windows.Forms.TabPage tabPage1;
private System.Windows.Forms.TabPage tabPage2;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.ComboBox cmbprotocol;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.ComboBox cmbprotocol2;
@ -686,14 +473,6 @@
private System.Windows.Forms.CheckBox chkudpEnabled2;
private System.Windows.Forms.CheckBox chkAllowIn2;
private System.Windows.Forms.CheckBox chkmuxEnabled;
private System.Windows.Forms.TabControl tabControl2;
private System.Windows.Forms.TabPage tabPage3;
private System.Windows.Forms.TabPage tabPage4;
private System.Windows.Forms.Label labRoutingTips;
private System.Windows.Forms.TextBox txtUseragent;
private System.Windows.Forms.TabPage tabPage5;
private System.Windows.Forms.TextBox txtUserdirect;
private System.Windows.Forms.TextBox txtUserblock;
private System.Windows.Forms.TabPage tabPage6;
private System.Windows.Forms.TextBox txtKcpmtu;
private System.Windows.Forms.Label label6;
@ -710,29 +489,17 @@
private System.Windows.Forms.CheckBox chkKcpcongestion;
private System.Windows.Forms.TabPage tabPage7;
private System.Windows.Forms.CheckBox chkAutoRun;
private System.Windows.Forms.Label label13;
private System.Windows.Forms.TextBox txturlGFWList;
private System.Windows.Forms.CheckBox chkAllowLANConn;
private System.Windows.Forms.TextBox txtremoteDNS;
private System.Windows.Forms.Label label14;
private System.Windows.Forms.Panel panel3;
private System.Windows.Forms.ComboBox cmbdomainStrategy;
private System.Windows.Forms.ComboBox cmbroutingMode;
private System.Windows.Forms.CheckBox chksniffingEnabled;
private System.Windows.Forms.CheckBox chksniffingEnabled2;
private System.Windows.Forms.Button btnSetDefRountingRule;
private System.Windows.Forms.CheckBox chkEnableStatistics;
private System.Windows.Forms.ComboBox cbFreshrate;
private System.Windows.Forms.Label lbFreshrate;
private System.Windows.Forms.Label label16;
private System.Windows.Forms.ComboBox cmblistenerType;
private System.Windows.Forms.TabPage tabPage8;
private System.Windows.Forms.TabPage tabPage9;
private System.Windows.Forms.TextBox txtuserPacRule;
private System.Windows.Forms.Panel panel4;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.CheckBox chkKeepOlderDedupl;
private System.Windows.Forms.LinkLabel linkLabelRoutingDoc;
private System.Windows.Forms.CheckBox chkdefAllowInsecure;
private System.Windows.Forms.TabPage tabPage2;
private System.Windows.Forms.LinkLabel linkDnsObjectDoc;
private System.Windows.Forms.TextBox txtremoteDNS;
private System.Windows.Forms.Label label14;
}
}

View File

@ -4,6 +4,7 @@ using System.Windows.Forms;
using v2rayN.Handler;
using v2rayN.Base;
using v2rayN.HttpProxyHandler;
using v2rayN.Mode;
namespace v2rayN.Forms
{
@ -18,13 +19,9 @@ namespace v2rayN.Forms
{
InitBase();
InitRouting();
InitKCP();
InitGUI();
InitUserPAC();
}
/// <summary>
@ -68,25 +65,10 @@ namespace v2rayN.Forms
//remoteDNS
txtremoteDNS.Text = config.remoteDNS;
cmblistenerType.SelectedIndex = (int)config.listenerType;
chkdefAllowInsecure.Checked = config.defAllowInsecure;
}
/// <summary>
/// 初始化路由设置
/// </summary>
private void InitRouting()
{
//路由
cmbdomainStrategy.Text = config.domainStrategy;
int.TryParse(config.routingMode, out int routingMode);
cmbroutingMode.SelectedIndex = routingMode;
txtUseragent.Text = Utils.List2String(config.useragent, true);
txtUserdirect.Text = Utils.List2String(config.userdirect, true);
txtUserblock.Text = Utils.List2String(config.userblock, true);
}
/// <summary>
/// 初始化KCP设置
@ -110,16 +92,10 @@ namespace v2rayN.Forms
//开机自动启动
chkAutoRun.Checked = Utils.IsAutoRun();
//自定义GFWList
txturlGFWList.Text = config.urlGFWList;
chkAllowLANConn.Checked = config.allowLANConn;
chkEnableStatistics.Checked = config.enableStatistics;
chkKeepOlderDedupl.Checked = config.keepOlderDedupl;
ComboItem[] cbSource = new ComboItem[]
{
new ComboItem{ID = (int)Global.StatisticsFreshRate.quick, Text = UIRes.I18N("QuickFresh")},
@ -145,12 +121,6 @@ namespace v2rayN.Forms
}
}
private void InitUserPAC()
{
txtuserPacRule.Text = Utils.List2String(config.userPacRule, true);
}
private void btnOK_Click(object sender, EventArgs e)
{
if (SaveBase() != 0)
@ -158,10 +128,6 @@ namespace v2rayN.Forms
return;
}
if (SaveRouting() != 0)
{
return;
}
if (SaveKCP() != 0)
{
@ -173,11 +139,6 @@ namespace v2rayN.Forms
return;
}
if (SaveUserPAC() != 0)
{
return;
}
if (ConfigHandler.SaveConfig(ref config) == 0)
{
this.DialogResult = DialogResult.OK;
@ -265,36 +226,12 @@ namespace v2rayN.Forms
//remoteDNS
config.remoteDNS = txtremoteDNS.Text.TrimEx();
config.listenerType = (ListenerType)Enum.ToObject(typeof(ListenerType), cmblistenerType.SelectedIndex);
config.defAllowInsecure = chkdefAllowInsecure.Checked;
return 0;
}
/// <summary>
/// 保存路由设置
/// </summary>
/// <returns></returns>
private int SaveRouting()
{
//路由
string domainStrategy = cmbdomainStrategy.Text;
string routingMode = cmbroutingMode.SelectedIndex.ToString();
string useragent = txtUseragent.Text.TrimEx();
string userdirect = txtUserdirect.Text.TrimEx();
string userblock = txtUserblock.Text.TrimEx();
config.domainStrategy = domainStrategy;
config.routingMode = routingMode;
config.useragent = Utils.String2List(useragent);
config.userdirect = Utils.String2List(userdirect);
config.userblock = Utils.String2List(userblock);
return 0;
}
/// <summary>
/// 保存KCP设置
@ -340,9 +277,6 @@ namespace v2rayN.Forms
//开机自动启动
Utils.SetAutoRun(chkAutoRun.Checked);
//自定义GFWList
config.urlGFWList = txturlGFWList.Text.TrimEx();
config.allowLANConn = chkAllowLANConn.Checked;
bool lastEnableStatistics = config.enableStatistics;
@ -350,27 +284,10 @@ namespace v2rayN.Forms
config.statisticsFreshRate = (int)cbFreshrate.SelectedValue;
config.keepOlderDedupl = chkKeepOlderDedupl.Checked;
//if(lastEnableStatistics != config.enableStatistics)
//{
// /// https://stackoverflow.com/questions/779405/how-do-i-restart-my-c-sharp-winform-application
// // Shut down the current app instance.
// Application.Exit();
// // Restart the app passing "/restart [processId]" as cmd line args
// Process.Start(Application.ExecutablePath, "/restart " + Process.GetCurrentProcess().Id);
//}
return 0;
}
private int SaveUserPAC()
{
string userPacRule = txtuserPacRule.Text.TrimEx();
userPacRule = userPacRule.Replace("\"", "");
config.userPacRule = Utils.String2List(userPacRule);
return 0;
}
private void btnClose_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.Cancel;
@ -388,75 +305,9 @@ namespace v2rayN.Forms
chkudpEnabled2.Enabled = blAllow2;
}
private void btnSetDefRountingRule_Click(object sender, EventArgs e)
private void linkDnsObjectDoc_LinkClicked(object sender, LinkLabelLinkClickedEventArgs 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;
List<string> lstUrl = new List<string>
{
Global.CustomRoutingListUrl + Global.agentTag,
Global.CustomRoutingListUrl + Global.directTag,
Global.CustomRoutingListUrl + Global.blockTag
};
List<TextBox> lstTxt = new List<TextBox>
{
txtUseragent,
txtUserdirect,
txtUserblock
};
for (int k = 0; k < lstUrl.Count; k++)
{
TextBox txt = lstTxt[k];
DownloadHandle downloadHandle = new DownloadHandle();
downloadHandle.UpdateCompleted += (sender2, args) =>
{
if (args.Success)
{
string result = args.Msg;
if (Utils.IsNullOrEmpty(result))
{
return;
}
txt.Text = result;
}
else
{
AppendText(false, args.Msg);
}
};
downloadHandle.Error += (sender2, args) =>
{
AppendText(true, args.GetException().Message);
};
downloadHandle.WebDownloadString(lstUrl[k]);
}
}
void AppendText(bool notify, string text)
{
labRoutingTips.Text = text;
}
private void linkLabelRoutingDoc_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
System.Diagnostics.Process.Start("https://www.v2fly.org/config/routing.html");
}
}
class ComboItem
{
public int ID
{
get; set;
}
public string Text
{
get; set;
System.Diagnostics.Process.Start("https://www.v2fly.org/config/dns.html#dnsobject");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -120,43 +120,19 @@
<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="linkDnsObjectDoc.Size" type="System.Drawing.Size, System.Drawing">
<value>161, 12</value>
</data>
<data name="linkDnsObjectDoc.Text" xml:space="preserve">
<value>支持填写DnsObject,JSON格式</value>
</data>
<data name="chkdefAllowInsecure.Size" type="System.Drawing.Size, System.Drawing">
<value>222, 16</value>
<value>336, 16</value>
</data>
<data name="chkdefAllowInsecure.Text" xml:space="preserve">
<value>底层传输安全选tls时默认跳过证书验证(allowInsecure)</value>
</data>
<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模式)</value>
</data>
<data name="cmblistenerType.Items3" xml:space="preserve">
<value>仅开启Http代理,并清除系统代理</value>
</data>
<data name="cmblistenerType.Items4" xml:space="preserve">
<value>仅开启PAC,并清除系统代理</value>
</data>
<data name="cmblistenerType.Items5" xml:space="preserve">
<value>仅开启Http代理,不改变系统代理</value>
</data>
<data name="cmblistenerType.Items6" xml:space="preserve">
<value>仅开启PAC,不改变系统代理</value>
</data>
<data name="chksniffingEnabled2.Size" type="System.Drawing.Size, System.Drawing">
<value>96, 16</value>
</data>
@ -226,107 +202,27 @@
<data name="label2.Text" xml:space="preserve">
<value>本地监听端口</value>
</data>
<data name="groupBox1.Size" type="System.Drawing.Size, System.Drawing">
<value>648, 437</value>
</data>
<data name="tabPage1.Size" type="System.Drawing.Size, System.Drawing">
<value>654, 443</value>
</data>
<data name="tabPage1.Text" xml:space="preserve">
<value> Core:基础设置 </value>
</data>
<data name="tabPage2.Size" type="System.Drawing.Size, System.Drawing">
<value>654, 443</value>
</data>
<data name="tabPage2.Text" xml:space="preserve">
<value> Core:路由设置 </value>
<value> Core:DNS设置 </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> 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> 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> 3.阻止的Domain或IP </value>
</data>
<data name="txtUserblock.Size" type="System.Drawing.Size, System.Drawing">
<value>628, 449</value>
</data>
<data name="tabPage8.Size" type="System.Drawing.Size, System.Drawing">
<value>634, 455</value>
</data>
<data name="tabPage8.Text" xml:space="preserve">
<value> 4.预定义规则 </value>
</data>
<data name="cmbroutingMode.Items" xml:space="preserve">
<value>全局</value>
</data>
<data name="cmbroutingMode.Items1" xml:space="preserve">
<value>绕过局域网地址</value>
</data>
<data name="cmbroutingMode.Items2" xml:space="preserve">
<value>绕过大陆地址</value>
</data>
<data name="cmbroutingMode.Items3" xml:space="preserve">
<value>绕过局域网及大陆地址</value>
</data>
<data name="cmbroutingMode.Location" type="System.Drawing.Point, System.Drawing">
<value>19, 26</value>
</data>
<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>
<data name="linkLabelRoutingDoc.Size" type="System.Drawing.Size, System.Drawing">
<value>77, 12</value>
</data>
<data name="linkLabelRoutingDoc.Text" xml:space="preserve">
<value>域名解析策略</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 name="tabPage6.Size" type="System.Drawing.Size, System.Drawing">
<value>654, 443</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="chkKeepOlderDedupl.Size" type="System.Drawing.Size, System.Drawing">
<value>156, 16</value>
</data>
@ -351,27 +247,30 @@
<data name="chkAllowLANConn.Text" xml:space="preserve">
<value>允许来自局域网的连接</value>
</data>
<data name="label13.Size" type="System.Drawing.Size, System.Drawing">
<value>227, 12</value>
</data>
<data name="label13.Text" xml:space="preserve">
<value>自定义GFWList地址(不需自定义请填空白)</value>
</data>
<data name="chkAutoRun.Size" type="System.Drawing.Size, System.Drawing">
<value>180, 16</value>
</data>
<data name="chkAutoRun.Text" xml:space="preserve">
<value>开机自动启动(可能会不成功)</value>
</data>
<data name="tabPage9.Text" xml:space="preserve">
<value> 用户PAC设置 </value>
<data name="tabPage7.Size" type="System.Drawing.Size, System.Drawing">
<value>654, 443</value>
</data>
<data name="label4.Text" xml:space="preserve">
<value>*设置用户PAC规则用逗号(,)隔开</value>
<data name="tabPage7.Text" xml:space="preserve">
<value> v2rayN设置 </value>
</data>
<data name="tabControl1.Size" type="System.Drawing.Size, System.Drawing">
<value>662, 469</value>
</data>
<data name="btnOK.Text" xml:space="preserve">
<value>确定(&amp;O)</value>
</data>
<data name="panel2.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 479</value>
</data>
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
<value>662, 539</value>
</data>
<data name="$this.Text" xml:space="preserve">
<value>参数设置</value>
</data>

View File

@ -0,0 +1,159 @@
namespace v2rayN.Forms
{
partial class RoutingSettingControl
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region 组件设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(RoutingSettingControl));
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.btnExpand = new System.Windows.Forms.Button();
this.label4 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.cmbroutingMode = new System.Windows.Forms.ComboBox();
this.cmbOutboundTag = new System.Windows.Forms.ComboBox();
this.btnRemove = new System.Windows.Forms.Button();
this.txtUserRule = new System.Windows.Forms.TextBox();
this.txtRemarks = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.groupBox2.SuspendLayout();
this.SuspendLayout();
//
// groupBox2
//
resources.ApplyResources(this.groupBox2, "groupBox2");
this.groupBox2.Controls.Add(this.btnExpand);
this.groupBox2.Controls.Add(this.label4);
this.groupBox2.Controls.Add(this.label1);
this.groupBox2.Controls.Add(this.cmbroutingMode);
this.groupBox2.Controls.Add(this.cmbOutboundTag);
this.groupBox2.Controls.Add(this.btnRemove);
this.groupBox2.Controls.Add(this.txtUserRule);
this.groupBox2.Controls.Add(this.txtRemarks);
this.groupBox2.Controls.Add(this.label2);
this.groupBox2.Controls.Add(this.label3);
this.groupBox2.Name = "groupBox2";
this.groupBox2.TabStop = false;
//
// btnExpand
//
resources.ApplyResources(this.btnExpand, "btnExpand");
this.btnExpand.Name = "btnExpand";
this.btnExpand.UseVisualStyleBackColor = true;
this.btnExpand.Click += new System.EventHandler(this.btnExpand_Click);
//
// label4
//
resources.ApplyResources(this.label4, "label4");
this.label4.Name = "label4";
//
// label1
//
resources.ApplyResources(this.label1, "label1");
this.label1.Name = "label1";
//
// 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"),
resources.GetString("cmbroutingMode.Items4")});
this.cmbroutingMode.Name = "cmbroutingMode";
//
// cmbOutboundTag
//
resources.ApplyResources(this.cmbOutboundTag, "cmbOutboundTag");
this.cmbOutboundTag.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbOutboundTag.FormattingEnabled = true;
this.cmbOutboundTag.Items.AddRange(new object[] {
resources.GetString("cmbOutboundTag.Items"),
resources.GetString("cmbOutboundTag.Items1"),
resources.GetString("cmbOutboundTag.Items2")});
this.cmbOutboundTag.Name = "cmbOutboundTag";
//
// btnRemove
//
resources.ApplyResources(this.btnRemove, "btnRemove");
this.btnRemove.Name = "btnRemove";
this.btnRemove.UseVisualStyleBackColor = true;
this.btnRemove.Click += new System.EventHandler(this.btnRemove_Click);
//
// txtUserRule
//
resources.ApplyResources(this.txtUserRule, "txtUserRule");
this.txtUserRule.Name = "txtUserRule";
this.txtUserRule.Leave += new System.EventHandler(this.txtRemarks_Leave);
//
// txtRemarks
//
resources.ApplyResources(this.txtRemarks, "txtRemarks");
this.txtRemarks.Name = "txtRemarks";
this.txtRemarks.Leave += new System.EventHandler(this.txtRemarks_Leave);
//
// label2
//
resources.ApplyResources(this.label2, "label2");
this.label2.Name = "label2";
//
// label3
//
resources.ApplyResources(this.label3, "label3");
this.label3.Name = "label3";
//
// RoutingSettingControl
//
resources.ApplyResources(this, "$this");
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.groupBox2);
this.Name = "RoutingSettingControl";
this.Load += new System.EventHandler(this.RoutingSettingControl_Load);
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.TextBox txtUserRule;
private System.Windows.Forms.TextBox txtRemarks;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Button btnRemove;
private System.Windows.Forms.ComboBox cmbOutboundTag;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.ComboBox cmbroutingMode;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Button btnExpand;
}
}

View File

@ -0,0 +1,76 @@
using System;
using System.Windows.Forms;
using v2rayN.Base;
using v2rayN.Mode;
namespace v2rayN.Forms
{
public partial class RoutingSettingControl : UserControl
{
public event ChangeEventHandler OnButtonClicked;
public RoutingItem routingItem
{
get; set;
}
public RoutingSettingControl()
{
InitializeComponent();
}
private void RoutingSettingControl_Load(object sender, EventArgs e)
{
BindingSub();
}
private void BindingSub()
{
if (routingItem != null)
{
txtRemarks.Text = routingItem.remarks.ToString();
cmbOutboundTag.Text = routingItem.outboundTag;
int.TryParse(routingItem.routingMode, out int routingMode);
cmbroutingMode.SelectedIndex = routingMode;
txtUserRule.Text = Utils.List2String(routingItem.userRules, true);
}
}
private void EndBindingSub()
{
if (routingItem != null)
{
routingItem.remarks = txtRemarks.Text.TrimEx();
routingItem.outboundTag = cmbOutboundTag.Text;
routingItem.routingMode = cmbroutingMode.SelectedIndex.ToString();
routingItem.userRules = Utils.String2List(txtUserRule.Text);
}
}
private void txtRemarks_Leave(object sender, EventArgs e)
{
EndBindingSub();
}
private void btnRemove_Click(object sender, EventArgs e)
{
if (routingItem != null)
{
routingItem.remarks = string.Empty;
}
OnButtonClicked?.Invoke(sender, e);
}
private void btnExpand_Click(object sender, EventArgs e)
{
if (this.Height > 200)
{
this.Height = 160;
}
else
{
this.Height = 500;
}
}
}
}

View File

@ -0,0 +1,456 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="label1.Text" xml:space="preserve">
<value>Pre-defined</value>
</data>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="label2.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Size" type="System.Drawing.Size, System.Drawing">
<value>733, 164</value>
</data>
<data name="cmbOutboundTag.Size" type="System.Drawing.Size, System.Drawing">
<value>119, 20</value>
</data>
<data name="&gt;&gt;txtUserRule.Type" xml:space="preserve">
<value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;label3.Parent" xml:space="preserve">
<value>groupBox2</value>
</data>
<data name="&gt;&gt;label3.ZOrder" xml:space="preserve">
<value>9</value>
</data>
<data name="cmbroutingMode.Location" type="System.Drawing.Point, System.Drawing">
<value>127, 53</value>
</data>
<data name="btnRemove.Size" type="System.Drawing.Size, System.Drawing">
<value>75, 23</value>
</data>
<data name="txtUserRule.Location" type="System.Drawing.Point, System.Drawing">
<value>127, 87</value>
</data>
<data name="btnRemove.Text" xml:space="preserve">
<value>Remove</value>
</data>
<data name="&gt;&gt;txtRemarks.Name" xml:space="preserve">
<value>txtRemarks</value>
</data>
<assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="btnRemove.TabIndex" type="System.Int32, mscorlib">
<value>24</value>
</data>
<data name="txtUserRule.TabIndex" type="System.Int32, mscorlib">
<value>23</value>
</data>
<data name="&gt;&gt;$this.Name" xml:space="preserve">
<value>RoutingSettingControl</value>
</data>
<data name="txtRemarks.Size" type="System.Drawing.Size, System.Drawing">
<value>162, 21</value>
</data>
<data name="&gt;&gt;label1.Name" xml:space="preserve">
<value>label1</value>
</data>
<data name="&gt;&gt;txtRemarks.Type" xml:space="preserve">
<value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;txtRemarks.Parent" xml:space="preserve">
<value>groupBox2</value>
</data>
<data name="label4.TabIndex" type="System.Int32, mscorlib">
<value>28</value>
</data>
<data name="&gt;&gt;txtRemarks.ZOrder" xml:space="preserve">
<value>7</value>
</data>
<data name="cmbOutboundTag.Items" xml:space="preserve">
<value>proxy</value>
</data>
<data name="label3.Size" type="System.Drawing.Size, System.Drawing">
<value>77, 12</value>
</data>
<data name="cmbOutboundTag.Location" type="System.Drawing.Point, System.Drawing">
<value>362, 21</value>
</data>
<data name="&gt;&gt;cmbroutingMode.Type" xml:space="preserve">
<value>System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
<value>6, 12</value>
</data>
<data name="&gt;&gt;label3.Name" xml:space="preserve">
<value>label3</value>
</data>
<data name="txtRemarks.Location" type="System.Drawing.Point, System.Drawing">
<value>127, 21</value>
</data>
<data name="label3.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="&gt;&gt;btnExpand.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="&gt;&gt;btnExpand.Name" xml:space="preserve">
<value>btnExpand</value>
</data>
<data name="&gt;&gt;label1.Parent" xml:space="preserve">
<value>groupBox2</value>
</data>
<data name="label3.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 87</value>
</data>
<data name="&gt;&gt;label1.ZOrder" xml:space="preserve">
<value>2</value>
</data>
<data name="&gt;&gt;cmbroutingMode.Name" xml:space="preserve">
<value>cmbroutingMode</value>
</data>
<data name="cmbroutingMode.Size" type="System.Drawing.Size, System.Drawing">
<value>255, 20</value>
</data>
<data name="&gt;&gt;label4.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="cmbroutingMode.Items1" xml:space="preserve">
<value>Global</value>
</data>
<data name="label1.Size" type="System.Drawing.Size, System.Drawing">
<value>71, 12</value>
</data>
<data name="cmbroutingMode.Items3" xml:space="preserve">
<value>Bypass mainland address</value>
</data>
<data name="cmbroutingMode.Items2" xml:space="preserve">
<value>Bypassing the LAN address</value>
</data>
<data name="&gt;&gt;cmbOutboundTag.ZOrder" xml:space="preserve">
<value>4</value>
</data>
<data name="btnRemove.Location" type="System.Drawing.Point, System.Drawing">
<value>640, 21</value>
</data>
<data name="groupBox2.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Fill</value>
</data>
<data name="btnExpand.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="&gt;&gt;label2.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="cmbOutboundTag.TabIndex" type="System.Int32, mscorlib">
<value>25</value>
</data>
<data name="&gt;&gt;cmbOutboundTag.Parent" xml:space="preserve">
<value>groupBox2</value>
</data>
<data name="label4.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="label2.Size" type="System.Drawing.Size, System.Drawing">
<value>47, 12</value>
</data>
<data name="txtUserRule.Multiline" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="&gt;&gt;btnRemove.Name" xml:space="preserve">
<value>btnRemove</value>
</data>
<data name="groupBox2.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 0</value>
</data>
<data name="btnExpand.TabIndex" type="System.Int32, mscorlib">
<value>29</value>
</data>
<data name="&gt;&gt;label4.Name" xml:space="preserve">
<value>label4</value>
</data>
<data name="btnRemove.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="label4.Text" xml:space="preserve">
<value>Out Tag</value>
</data>
<data name="label1.TabIndex" type="System.Int32, mscorlib">
<value>27</value>
</data>
<data name="cmbOutboundTag.Items2" xml:space="preserve">
<value>block</value>
</data>
<data name="cmbOutboundTag.Items1" xml:space="preserve">
<value>direct</value>
</data>
<data name="btnExpand.Size" type="System.Drawing.Size, System.Drawing">
<value>75, 23</value>
</data>
<data name="label1.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="cmbroutingMode.TabIndex" type="System.Int32, mscorlib">
<value>26</value>
</data>
<data name="&gt;&gt;btnRemove.ZOrder" xml:space="preserve">
<value>5</value>
</data>
<data name="&gt;&gt;btnExpand.Parent" xml:space="preserve">
<value>groupBox2</value>
</data>
<data name="&gt;&gt;txtUserRule.ZOrder" xml:space="preserve">
<value>6</value>
</data>
<data name="btnExpand.Text" xml:space="preserve">
<value>Expand</value>
</data>
<data name="&gt;&gt;label4.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<data name="&gt;&gt;label2.Parent" xml:space="preserve">
<value>groupBox2</value>
</data>
<data name="&gt;&gt;btnRemove.Parent" xml:space="preserve">
<value>groupBox2</value>
</data>
<data name="txtUserRule.Size" type="System.Drawing.Size, System.Drawing">
<value>588, 68</value>
</data>
<data name="label2.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="&gt;&gt;btnExpand.Type" xml:space="preserve">
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;txtUserRule.Parent" xml:space="preserve">
<value>groupBox2</value>
</data>
<data name="label1.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="cmbroutingMode.Items4" xml:space="preserve">
<value>Bypassing LAN and mainland address</value>
</data>
<data name="label3.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="&gt;&gt;label2.Name" xml:space="preserve">
<value>label2</value>
</data>
<data name="&gt;&gt;groupBox2.Type" xml:space="preserve">
<value>System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;cmbOutboundTag.Type" xml:space="preserve">
<value>System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;cmbroutingMode.Parent" xml:space="preserve">
<value>groupBox2</value>
</data>
<data name="groupBox2.Size" type="System.Drawing.Size, System.Drawing">
<value>733, 164</value>
</data>
<data name="&gt;&gt;label2.ZOrder" xml:space="preserve">
<value>8</value>
</data>
<data name="txtUserRule.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Top, Bottom, Left, Right</value>
</data>
<data name="label1.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 57</value>
</data>
<data name="&gt;&gt;cmbOutboundTag.Name" xml:space="preserve">
<value>cmbOutboundTag</value>
</data>
<data name="txtRemarks.TabIndex" type="System.Int32, mscorlib">
<value>11</value>
</data>
<data name="label2.Text" xml:space="preserve">
<value>Remarks</value>
</data>
<data name="&gt;&gt;label4.Parent" xml:space="preserve">
<value>groupBox2</value>
</data>
<data name="&gt;&gt;cmbroutingMode.ZOrder" xml:space="preserve">
<value>3</value>
</data>
<data name="label4.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="label2.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 25</value>
</data>
<data name="&gt;&gt;groupBox2.Name" xml:space="preserve">
<value>groupBox2</value>
</data>
<data name="label4.Location" type="System.Drawing.Point, System.Drawing">
<value>301, 26</value>
</data>
<data name="label4.Size" type="System.Drawing.Size, System.Drawing">
<value>47, 12</value>
</data>
<data name="groupBox2.Text" xml:space="preserve">
<value>Rule</value>
</data>
<data name="groupBox2.TabIndex" type="System.Int32, mscorlib">
<value>10</value>
</data>
<data name="label3.Text" xml:space="preserve">
<value>Domain or IP</value>
</data>
<data name="&gt;&gt;btnRemove.Type" xml:space="preserve">
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;txtUserRule.Name" xml:space="preserve">
<value>txtUserRule</value>
</data>
<data name="label3.TabIndex" type="System.Int32, mscorlib">
<value>0</value>
</data>
<data name="&gt;&gt;$this.Type" xml:space="preserve">
<value>System.Windows.Forms.UserControl, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;groupBox2.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="&gt;&gt;groupBox2.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="cmbroutingMode.Items" xml:space="preserve">
<value>Use custom Domain or IP</value>
</data>
<data name="&gt;&gt;label1.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="btnExpand.Location" type="System.Drawing.Point, System.Drawing">
<value>640, 46</value>
</data>
<data name="&gt;&gt;label3.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="label2.TabIndex" type="System.Int32, mscorlib">
<value>10</value>
</data>
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="$this.Language" type="System.Globalization.CultureInfo, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>zh-Hans</value>
</metadata>
</root>

View File

@ -0,0 +1,184 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="btnExpand.Location" type="System.Drawing.Point, System.Drawing">
<value>619, 46</value>
</data>
<data name="btnExpand.Text" xml:space="preserve">
<value>扩大</value>
</data>
<data name="label4.Size" type="System.Drawing.Size, System.Drawing">
<value>53, 12</value>
</data>
<data name="label4.Text" xml:space="preserve">
<value>出口标签</value>
</data>
<data name="label1.Size" type="System.Drawing.Size, System.Drawing">
<value>65, 12</value>
</data>
<data name="label1.Text" xml:space="preserve">
<value>预定义规则</value>
</data>
<data name="cmbroutingMode.Items" xml:space="preserve">
<value>使用自定义域名或IP</value>
</data>
<data name="cmbroutingMode.Items1" xml:space="preserve">
<value>全局</value>
</data>
<data name="cmbroutingMode.Items2" xml:space="preserve">
<value>绕过局域网</value>
</data>
<data name="cmbroutingMode.Items3" xml:space="preserve">
<value>绕过大陆地址</value>
</data>
<data name="cmbroutingMode.Items4" xml:space="preserve">
<value>绕过局域网及大陆地址</value>
</data>
<data name="btnRemove.Location" type="System.Drawing.Point, System.Drawing">
<value>619, 20</value>
</data>
<data name="btnRemove.Text" xml:space="preserve">
<value>移除</value>
</data>
<data name="txtUserRule.Size" type="System.Drawing.Size, System.Drawing">
<value>567, 64</value>
</data>
<data name="label2.Size" type="System.Drawing.Size, System.Drawing">
<value>29, 12</value>
</data>
<data name="label2.Text" xml:space="preserve">
<value>备注</value>
</data>
<data name="label3.Size" type="System.Drawing.Size, System.Drawing">
<value>53, 12</value>
</data>
<data name="label3.Text" xml:space="preserve">
<value>域名或IP</value>
</data>
<data name="groupBox2.Size" type="System.Drawing.Size, System.Drawing">
<value>709, 160</value>
</data>
<data name="groupBox2.Text" xml:space="preserve">
<value>规则</value>
</data>
<data name="$this.Size" type="System.Drawing.Size, System.Drawing">
<value>709, 160</value>
</data>
</root>

View File

@ -0,0 +1,151 @@
namespace v2rayN.Forms
{
partial class RoutingSettingForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(RoutingSettingForm));
this.btnClose = new System.Windows.Forms.Button();
this.panCon = new System.Windows.Forms.Panel();
this.panel2 = new System.Windows.Forms.Panel();
this.btnAdd = new System.Windows.Forms.Button();
this.btnOK = new System.Windows.Forms.Button();
this.btnSetDefRountingRule = new System.Windows.Forms.Button();
this.panel1 = new System.Windows.Forms.Panel();
this.labRoutingTips = new System.Windows.Forms.Label();
this.linkLabelRoutingDoc = new System.Windows.Forms.LinkLabel();
this.cmbdomainStrategy = new System.Windows.Forms.ComboBox();
this.panel2.SuspendLayout();
this.panel1.SuspendLayout();
this.SuspendLayout();
//
// btnClose
//
this.btnClose.DialogResult = System.Windows.Forms.DialogResult.Cancel;
resources.ApplyResources(this.btnClose, "btnClose");
this.btnClose.Name = "btnClose";
this.btnClose.UseVisualStyleBackColor = true;
this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
//
// panCon
//
resources.ApplyResources(this.panCon, "panCon");
this.panCon.Name = "panCon";
//
// panel2
//
this.panel2.Controls.Add(this.btnAdd);
this.panel2.Controls.Add(this.btnClose);
this.panel2.Controls.Add(this.btnOK);
resources.ApplyResources(this.panel2, "panel2");
this.panel2.Name = "panel2";
//
// btnAdd
//
resources.ApplyResources(this.btnAdd, "btnAdd");
this.btnAdd.Name = "btnAdd";
this.btnAdd.UseVisualStyleBackColor = true;
this.btnAdd.Click += new System.EventHandler(this.btnAdd_Click);
//
// btnOK
//
resources.ApplyResources(this.btnOK, "btnOK");
this.btnOK.Name = "btnOK";
this.btnOK.UseVisualStyleBackColor = true;
this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
//
// btnSetDefRountingRule
//
resources.ApplyResources(this.btnSetDefRountingRule, "btnSetDefRountingRule");
this.btnSetDefRountingRule.Name = "btnSetDefRountingRule";
this.btnSetDefRountingRule.UseVisualStyleBackColor = true;
this.btnSetDefRountingRule.Click += new System.EventHandler(this.btnSetDefRountingRule_Click);
//
// panel1
//
this.panel1.Controls.Add(this.btnSetDefRountingRule);
this.panel1.Controls.Add(this.labRoutingTips);
this.panel1.Controls.Add(this.linkLabelRoutingDoc);
this.panel1.Controls.Add(this.cmbdomainStrategy);
resources.ApplyResources(this.panel1, "panel1");
this.panel1.Name = "panel1";
//
// labRoutingTips
//
this.labRoutingTips.ForeColor = System.Drawing.Color.Brown;
resources.ApplyResources(this.labRoutingTips, "labRoutingTips");
this.labRoutingTips.Name = "labRoutingTips";
//
// linkLabelRoutingDoc
//
resources.ApplyResources(this.linkLabelRoutingDoc, "linkLabelRoutingDoc");
this.linkLabelRoutingDoc.Name = "linkLabelRoutingDoc";
this.linkLabelRoutingDoc.TabStop = true;
this.linkLabelRoutingDoc.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabelRoutingDoc_LinkClicked);
//
// 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";
//
// RoutingSettingForm
//
resources.ApplyResources(this, "$this");
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.btnClose;
this.Controls.Add(this.panCon);
this.Controls.Add(this.panel1);
this.Controls.Add(this.panel2);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Name = "RoutingSettingForm";
this.Load += new System.EventHandler(this.RoutingSettingForm_Load);
this.panel2.ResumeLayout(false);
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Button btnClose;
private System.Windows.Forms.Button btnOK;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.Button btnAdd;
private System.Windows.Forms.Panel panCon;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Label labRoutingTips;
private System.Windows.Forms.LinkLabel linkLabelRoutingDoc;
private System.Windows.Forms.ComboBox cmbdomainStrategy;
private System.Windows.Forms.Button btnSetDefRountingRule;
}
}

View File

@ -0,0 +1,143 @@
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using v2rayN.Handler;
using v2rayN.Mode;
namespace v2rayN.Forms
{
public partial class RoutingSettingForm : BaseForm
{
List<RoutingSettingControl> lstControls = new List<RoutingSettingControl>();
public RoutingSettingForm()
{
InitializeComponent();
}
private void RoutingSettingForm_Load(object sender, EventArgs e)
{
cmbdomainStrategy.Text = config.domainStrategy;
if (config.routingItem == null)
{
config.routingItem = new List<RoutingItem>();
}
RefreshSubsView();
}
/// <summary>
/// 刷新列表
/// </summary>
private void RefreshSubsView()
{
panCon.Controls.Clear();
lstControls.Clear();
for (int k = config.routingItem.Count - 1; k >= 0; k--)
{
RoutingItem item = config.routingItem[k];
if (Utils.IsNullOrEmpty(item.remarks))
{
config.routingItem.RemoveAt(k);
}
}
foreach (RoutingItem item in config.routingItem)
{
RoutingSettingControl control = new RoutingSettingControl();
control.OnButtonClicked += Control_OnButtonClicked;
control.routingItem = item;
control.Dock = DockStyle.Top;
panCon.Controls.Add(control);
panCon.Controls.SetChildIndex(control, 0);
lstControls.Add(control);
}
}
private void Control_OnButtonClicked(object sender, EventArgs e)
{
RefreshSubsView();
}
private void btnOK_Click(object sender, EventArgs e)
{
if (config.routingItem.Count <= 0)
{
AddSub("proxy", "");
}
if (ConfigHandler.SaveRoutingItem(ref config) == 0)
{
this.DialogResult = DialogResult.OK;
}
else
{
UI.ShowWarning(UIRes.I18N("OperationFailed"));
}
}
private void btnClose_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.Cancel;
}
private void btnAdd_Click(object sender, EventArgs e)
{
AddSub("proxy", "");
RefreshSubsView();
}
private void AddSub(string outboundTag, string userRule, string routingMode = "0")
{
RoutingItem RoutingItem = new RoutingItem
{
remarks = outboundTag,
routingMode = routingMode,
outboundTag = outboundTag,
userRules = Utils.String2List(userRule)
};
config.routingItem.Add(RoutingItem);
}
private void btnSetDefRountingRule_Click(object sender, EventArgs e)
{
config.routingItem.Clear();
List<string> lstTag = new List<string>
{
Global.agentTag,
Global.directTag,
Global.blockTag
};
for (int k = 0; k < lstTag.Count; k++)
{
DownloadHandle downloadHandle = new DownloadHandle();
string result = downloadHandle.WebDownloadStringSync(Global.CustomRoutingListUrl + lstTag[k]);
if (Utils.IsNullOrEmpty(result))
{
result = Utils.GetEmbedText(Global.CustomRoutingFileName + lstTag[k]);
}
AddSub(lstTag[k], result);
}
AddSub(Global.directTag, "", "4");
AddSub(Global.agentTag, "", "0");
RefreshSubsView();
}
private void linkLabelRoutingDoc_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
System.Diagnostics.Process.Start("https://www.v2fly.org/config/routing.html");
}
}
}

View File

@ -0,0 +1,420 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="btnClose.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="btnClose.Location" type="System.Drawing.Point, System.Drawing">
<value>568, 17</value>
</data>
<data name="btnClose.Size" type="System.Drawing.Size, System.Drawing">
<value>75, 23</value>
</data>
<assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="btnClose.TabIndex" type="System.Int32, mscorlib">
<value>4</value>
</data>
<data name="btnClose.Text" xml:space="preserve">
<value>&amp;Cancel</value>
</data>
<data name="&gt;&gt;btnClose.Name" xml:space="preserve">
<value>btnClose</value>
</data>
<data name="&gt;&gt;btnClose.Type" xml:space="preserve">
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;btnClose.Parent" xml:space="preserve">
<value>panel2</value>
</data>
<data name="&gt;&gt;btnClose.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<data name="panCon.AutoScroll" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="panCon.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Fill</value>
</data>
<data name="panCon.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 68</value>
</data>
<data name="panCon.Size" type="System.Drawing.Size, System.Drawing">
<value>765, 545</value>
</data>
<data name="panCon.TabIndex" type="System.Int32, mscorlib">
<value>10</value>
</data>
<data name="&gt;&gt;panCon.Name" xml:space="preserve">
<value>panCon</value>
</data>
<data name="&gt;&gt;panCon.Type" xml:space="preserve">
<value>System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;panCon.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;panCon.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="btnAdd.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="btnAdd.Location" type="System.Drawing.Point, System.Drawing">
<value>47, 17</value>
</data>
<data name="btnAdd.Size" type="System.Drawing.Size, System.Drawing">
<value>75, 23</value>
</data>
<data name="btnAdd.TabIndex" type="System.Int32, mscorlib">
<value>6</value>
</data>
<data name="btnAdd.Text" xml:space="preserve">
<value>&amp;Add</value>
</data>
<data name="&gt;&gt;btnAdd.Name" xml:space="preserve">
<value>btnAdd</value>
</data>
<data name="&gt;&gt;btnAdd.Type" xml:space="preserve">
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;btnAdd.Parent" xml:space="preserve">
<value>panel2</value>
</data>
<data name="&gt;&gt;btnAdd.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="btnOK.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="btnOK.Location" type="System.Drawing.Point, System.Drawing">
<value>475, 17</value>
</data>
<data name="btnOK.Size" type="System.Drawing.Size, System.Drawing">
<value>75, 23</value>
</data>
<data name="btnOK.TabIndex" type="System.Int32, mscorlib">
<value>5</value>
</data>
<data name="btnOK.Text" xml:space="preserve">
<value>&amp;OK</value>
</data>
<data name="&gt;&gt;btnOK.Name" xml:space="preserve">
<value>btnOK</value>
</data>
<data name="&gt;&gt;btnOK.Type" xml:space="preserve">
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;btnOK.Parent" xml:space="preserve">
<value>panel2</value>
</data>
<data name="&gt;&gt;btnOK.ZOrder" xml:space="preserve">
<value>2</value>
</data>
<data name="panel2.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Bottom</value>
</data>
<data name="panel2.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 613</value>
</data>
<data name="panel2.Size" type="System.Drawing.Size, System.Drawing">
<value>765, 60</value>
</data>
<data name="panel2.TabIndex" type="System.Int32, mscorlib">
<value>7</value>
</data>
<data name="&gt;&gt;panel2.Name" xml:space="preserve">
<value>panel2</value>
</data>
<data name="&gt;&gt;panel2.Type" xml:space="preserve">
<value>System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;panel2.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;panel2.ZOrder" xml:space="preserve">
<value>2</value>
</data>
<data name="btnSetDefRountingRule.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Top, Right</value>
</data>
<data name="btnSetDefRountingRule.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<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>319, 17</value>
</data>
<data name="btnSetDefRountingRule.Size" type="System.Drawing.Size, System.Drawing">
<value>229, 23</value>
</data>
<data name="btnSetDefRountingRule.TabIndex" type="System.Int32, mscorlib">
<value>19</value>
</data>
<data name="btnSetDefRountingRule.Text" xml:space="preserve">
<value>Set default custom routing rules</value>
</data>
<data name="&gt;&gt;btnSetDefRountingRule.Name" xml:space="preserve">
<value>btnSetDefRountingRule</value>
</data>
<data name="&gt;&gt;btnSetDefRountingRule.Type" xml:space="preserve">
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;btnSetDefRountingRule.Parent" xml:space="preserve">
<value>panel1</value>
</data>
<data name="&gt;&gt;btnSetDefRountingRule.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="labRoutingTips.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="labRoutingTips.Location" type="System.Drawing.Point, System.Drawing">
<value>10, 42</value>
</data>
<data name="labRoutingTips.Size" type="System.Drawing.Size, System.Drawing">
<value>598, 16</value>
</data>
<data name="labRoutingTips.TabIndex" type="System.Int32, mscorlib">
<value>13</value>
</data>
<data name="labRoutingTips.Text" xml:space="preserve">
<value>*Set the rules, separated by commas (,); support Domain (pure string / regular / subdomain) and IP</value>
</data>
<data name="&gt;&gt;labRoutingTips.Name" xml:space="preserve">
<value>labRoutingTips</value>
</data>
<data name="&gt;&gt;labRoutingTips.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;labRoutingTips.Parent" xml:space="preserve">
<value>panel1</value>
</data>
<data name="&gt;&gt;labRoutingTips.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<data name="linkLabelRoutingDoc.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="linkLabelRoutingDoc.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="linkLabelRoutingDoc.Location" type="System.Drawing.Point, System.Drawing">
<value>6, 21</value>
</data>
<data name="linkLabelRoutingDoc.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>0, 0, 0, 0</value>
</data>
<data name="linkLabelRoutingDoc.Size" type="System.Drawing.Size, System.Drawing">
<value>95, 12</value>
</data>
<data name="linkLabelRoutingDoc.TabIndex" type="System.Int32, mscorlib">
<value>19</value>
</data>
<data name="linkLabelRoutingDoc.Text" xml:space="preserve">
<value>Domain strategy</value>
</data>
<data name="&gt;&gt;linkLabelRoutingDoc.Name" xml:space="preserve">
<value>linkLabelRoutingDoc</value>
</data>
<data name="&gt;&gt;linkLabelRoutingDoc.Type" xml:space="preserve">
<value>System.Windows.Forms.LinkLabel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;linkLabelRoutingDoc.Parent" xml:space="preserve">
<value>panel1</value>
</data>
<data name="&gt;&gt;linkLabelRoutingDoc.ZOrder" xml:space="preserve">
<value>2</value>
</data>
<data name="cmbdomainStrategy.Items" xml:space="preserve">
<value>AsIs</value>
</data>
<data name="cmbdomainStrategy.Items1" xml:space="preserve">
<value>IPIfNonMatch</value>
</data>
<data name="cmbdomainStrategy.Items2" xml:space="preserve">
<value>IPOnDemand</value>
</data>
<data name="cmbdomainStrategy.Location" type="System.Drawing.Point, System.Drawing">
<value>116, 17</value>
</data>
<data name="cmbdomainStrategy.Size" type="System.Drawing.Size, System.Drawing">
<value>165, 20</value>
</data>
<data name="cmbdomainStrategy.TabIndex" type="System.Int32, mscorlib">
<value>16</value>
</data>
<data name="&gt;&gt;cmbdomainStrategy.Name" xml:space="preserve">
<value>cmbdomainStrategy</value>
</data>
<data name="&gt;&gt;cmbdomainStrategy.Type" xml:space="preserve">
<value>System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;cmbdomainStrategy.Parent" xml:space="preserve">
<value>panel1</value>
</data>
<data name="&gt;&gt;cmbdomainStrategy.ZOrder" xml:space="preserve">
<value>3</value>
</data>
<data name="panel1.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Top</value>
</data>
<data name="panel1.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 0</value>
</data>
<data name="panel1.Size" type="System.Drawing.Size, System.Drawing">
<value>765, 68</value>
</data>
<data name="panel1.TabIndex" type="System.Int32, mscorlib">
<value>11</value>
</data>
<data name="&gt;&gt;panel1.Name" xml:space="preserve">
<value>panel1</value>
</data>
<data name="&gt;&gt;panel1.Type" xml:space="preserve">
<value>System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;panel1.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;panel1.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
<value>6, 12</value>
</data>
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
<value>765, 673</value>
</data>
<data name="$this.Text" xml:space="preserve">
<value>Routing Settings</value>
</data>
<data name="&gt;&gt;$this.Name" xml:space="preserve">
<value>RoutingSettingForm</value>
</data>
<data name="&gt;&gt;$this.Type" xml:space="preserve">
<value>v2rayN.Forms.BaseForm, v2rayN, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</value>
</data>
</root>

View File

@ -0,0 +1,145 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="btnClose.Text" xml:space="preserve">
<value>取消(&amp;C)</value>
</data>
<data name="btnAdd.Text" xml:space="preserve">
<value>添加(&amp;A)</value>
</data>
<data name="btnOK.Text" xml:space="preserve">
<value>确定(&amp;O)</value>
</data>
<data name="btnSetDefRountingRule.Text" xml:space="preserve">
<value>一键设置默认自定义路由规则</value>
</data>
<data name="labRoutingTips.Text" xml:space="preserve">
<value>*设置的规则,用逗号(,)隔开;支持Domain(纯字符串/正则/子域名)和IP</value>
</data>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="linkLabelRoutingDoc.Size" type="System.Drawing.Size, System.Drawing">
<value>77, 12</value>
</data>
<data name="linkLabelRoutingDoc.Text" xml:space="preserve">
<value>域名解析策略</value>
</data>
<data name="$this.Text" xml:space="preserve">
<value>路由设置</value>
</data>
</root>

View File

@ -29,27 +29,38 @@
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SubSettingControl));
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.grbMain = new System.Windows.Forms.GroupBox();
this.btnShare = new System.Windows.Forms.Button();
this.chkEnabled = new System.Windows.Forms.CheckBox();
this.btnRemove = new System.Windows.Forms.Button();
this.txtUrl = new System.Windows.Forms.TextBox();
this.txtRemarks = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.groupBox2.SuspendLayout();
this.picQRCode = new System.Windows.Forms.PictureBox();
this.grbMain.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.picQRCode)).BeginInit();
this.SuspendLayout();
//
// groupBox2
// grbMain
//
resources.ApplyResources(this.groupBox2, "groupBox2");
this.groupBox2.Controls.Add(this.chkEnabled);
this.groupBox2.Controls.Add(this.btnRemove);
this.groupBox2.Controls.Add(this.txtUrl);
this.groupBox2.Controls.Add(this.txtRemarks);
this.groupBox2.Controls.Add(this.label2);
this.groupBox2.Controls.Add(this.label3);
this.groupBox2.Name = "groupBox2";
this.groupBox2.TabStop = false;
resources.ApplyResources(this.grbMain, "grbMain");
this.grbMain.Controls.Add(this.btnShare);
this.grbMain.Controls.Add(this.chkEnabled);
this.grbMain.Controls.Add(this.btnRemove);
this.grbMain.Controls.Add(this.txtUrl);
this.grbMain.Controls.Add(this.txtRemarks);
this.grbMain.Controls.Add(this.label2);
this.grbMain.Controls.Add(this.label3);
this.grbMain.Name = "grbMain";
this.grbMain.TabStop = false;
//
// btnShare
//
resources.ApplyResources(this.btnShare, "btnShare");
this.btnShare.Name = "btnShare";
this.btnShare.UseVisualStyleBackColor = true;
this.btnShare.Click += new System.EventHandler(this.btnShare_Click);
//
// chkEnabled
//
@ -87,27 +98,37 @@
resources.ApplyResources(this.label3, "label3");
this.label3.Name = "label3";
//
// picQRCode
//
resources.ApplyResources(this.picQRCode, "picQRCode");
this.picQRCode.Name = "picQRCode";
this.picQRCode.TabStop = false;
//
// SubSettingControl
//
resources.ApplyResources(this, "$this");
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.picQRCode);
this.Controls.Add(this.grbMain);
this.Name = "SubSettingControl";
this.Load += new System.EventHandler(this.SubSettingControl_Load);
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.grbMain.ResumeLayout(false);
this.grbMain.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.picQRCode)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.GroupBox grbMain;
private System.Windows.Forms.TextBox txtUrl;
private System.Windows.Forms.TextBox txtRemarks;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Button btnRemove;
private System.Windows.Forms.CheckBox chkEnabled;
private System.Windows.Forms.Button btnShare;
private System.Windows.Forms.PictureBox picQRCode;
}
}

View File

@ -1,6 +1,7 @@
using System;
using System.Windows.Forms;
using v2rayN.Base;
using v2rayN.Handler;
using v2rayN.Mode;
namespace v2rayN.Forms
@ -11,7 +12,10 @@ namespace v2rayN.Forms
public event ChangeEventHandler OnButtonClicked;
public SubItem subItem { get; set; }
public SubItem subItem
{
get; set;
}
public SubSettingControl()
{
@ -20,6 +24,7 @@ namespace v2rayN.Forms
private void SubSettingControl_Load(object sender, EventArgs e)
{
this.Height = grbMain.Height;
BindingSub();
}
@ -56,5 +61,23 @@ namespace v2rayN.Forms
OnButtonClicked?.Invoke(sender, e);
}
private void btnShare_Click(object sender, EventArgs e)
{
if (this.Height <= grbMain.Height)
{
if (Utils.IsNullOrEmpty(subItem.url))
{
picQRCode.Image = null;
return;
}
picQRCode.Image = QRCodeHelper.GetQRCode(subItem.url);
this.Height = grbMain.Height + 200;
}
else
{
this.Height = grbMain.Height;
}
}
}
}

View File

@ -118,123 +118,270 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
<value>6, 12</value>
</data>
<data name="$this.Language" type="System.Globalization.CultureInfo, mscorlib">
<value>zh-Hans</value>
</data>
<data name="$this.Localizable" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="$this.Size" type="System.Drawing.Size, System.Drawing">
<value>584, 119</value>
</data>
<data name="btnRemove.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="btnRemove.Location" type="System.Drawing.Point, System.Drawing">
<value>484, 21</value>
</data>
<data name="btnRemove.Size" type="System.Drawing.Size, System.Drawing">
<value>75, 23</value>
</data>
<data name="btnRemove.TabIndex" type="System.Int32, mscorlib">
<value>24</value>
</data>
<data name="btnRemove.Text" xml:space="preserve">
<value>&amp;Remove</value>
</data>
<data name="chkEnabled.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="chkEnabled.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="chkEnabled.Location" type="System.Drawing.Point, System.Drawing">
<value>406, 23</value>
</data>
<data name="chkEnabled.Size" type="System.Drawing.Size, System.Drawing">
<value>60, 16</value>
</data>
<data name="chkEnabled.TabIndex" type="System.Int32, mscorlib">
<value>25</value>
</data>
<data name="chkEnabled.Text" xml:space="preserve">
<value>Enable</value>
</data>
<data name="groupBox2.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Bottom</value>
</data>
<data name="groupBox2.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 9</value>
</data>
<data name="groupBox2.Size" type="System.Drawing.Size, System.Drawing">
<value>584, 110</value>
</data>
<data name="groupBox2.TabIndex" type="System.Int32, mscorlib">
<value>10</value>
</data>
<data name="groupBox2.Text" xml:space="preserve">
<value>Subscription details</value>
</data>
<data name="label2.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="label2.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="label2.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 25</value>
<data name="&gt;&gt;txtUrl.Parent" xml:space="preserve">
<value>grbMain</value>
</data>
<data name="label2.Size" type="System.Drawing.Size, System.Drawing">
<value>47, 12</value>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="chkEnabled.Size" type="System.Drawing.Size, System.Drawing">
<value>60, 16</value>
</data>
<data name="label2.TabIndex" type="System.Int32, mscorlib">
<value>10</value>
<data name="&gt;&gt;txtUrl.Name" xml:space="preserve">
<value>txtUrl</value>
</data>
<data name="label2.Text" xml:space="preserve">
<value>Remarks</value>
<data name="&gt;&gt;label3.ZOrder" xml:space="preserve">
<value>6</value>
</data>
<data name="label3.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
<data name="&gt;&gt;picQRCode.Name" xml:space="preserve">
<value>picQRCode</value>
</data>
<data name="label3.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
<data name="&gt;&gt;btnShare.Type" xml:space="preserve">
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="label3.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 55</value>
<data name="btnRemove.Text" xml:space="preserve">
<value>Remove</value>
</data>
<data name="label3.Size" type="System.Drawing.Size, System.Drawing">
<value>83, 12</value>
<data name="&gt;&gt;txtRemarks.Name" xml:space="preserve">
<value>txtRemarks</value>
</data>
<data name="label3.TabIndex" type="System.Int32, mscorlib">
<value>0</value>
<assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="btnRemove.TabIndex" type="System.Int32, mscorlib">
<value>24</value>
</data>
<data name="label3.Text" xml:space="preserve">
<value>Address (url)</value>
<data name="&gt;&gt;grbMain.Name" xml:space="preserve">
<value>grbMain</value>
</data>
<data name="txtRemarks.Location" type="System.Drawing.Point, System.Drawing">
<value>127, 21</value>
<data name="&gt;&gt;$this.Name" xml:space="preserve">
<value>SubSettingControl</value>
</data>
<data name="txtRemarks.Size" type="System.Drawing.Size, System.Drawing">
<value>265, 21</value>
<data name="picQRCode.SizeMode" type="System.Windows.Forms.PictureBoxSizeMode, System.Windows.Forms">
<value>Zoom</value>
</data>
<data name="txtRemarks.TabIndex" type="System.Int32, mscorlib">
<value>11</value>
<data name="grbMain.Text" xml:space="preserve">
<value>Subscription details</value>
</data>
<data name="txtUrl.Location" type="System.Drawing.Point, System.Drawing">
<value>127, 55</value>
<data name="btnShare.TabIndex" type="System.Int32, mscorlib">
<value>26</value>
</data>
<data name="&gt;&gt;txtRemarks.Type" xml:space="preserve">
<value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="txtUrl.Multiline" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="txtUrl.Size" type="System.Drawing.Size, System.Drawing">
<value>432, 46</value>
<data name="&gt;&gt;txtRemarks.Parent" xml:space="preserve">
<value>grbMain</value>
</data>
<data name="btnShare.Location" type="System.Drawing.Point, System.Drawing">
<value>434, 21</value>
</data>
<data name="label3.Size" type="System.Drawing.Size, System.Drawing">
<value>83, 12</value>
</data>
<data name="txtRemarks.Size" type="System.Drawing.Size, System.Drawing">
<value>232, 21</value>
</data>
<data name="grbMain.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Top</value>
</data>
<data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
<value>6, 12</value>
</data>
<data name="&gt;&gt;label3.Name" xml:space="preserve">
<value>label3</value>
</data>
<data name="txtRemarks.Location" type="System.Drawing.Point, System.Drawing">
<value>127, 21</value>
</data>
<data name="label3.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="btnShare.Text" xml:space="preserve">
<value>Share</value>
</data>
<data name="picQRCode.Size" type="System.Drawing.Size, System.Drawing">
<value>619, 200</value>
</data>
<data name="&gt;&gt;chkEnabled.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<data name="label3.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 55</value>
</data>
<data name="btnShare.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="picQRCode.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Fill</value>
</data>
<data name="&gt;&gt;grbMain.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="picQRCode.TabIndex" type="System.Int32, mscorlib">
<value>25</value>
</data>
<data name="txtUrl.Location" type="System.Drawing.Point, System.Drawing">
<value>127, 55</value>
</data>
<data name="&gt;&gt;label2.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;txtUrl.ZOrder" xml:space="preserve">
<value>3</value>
</data>
<data name="&gt;&gt;chkEnabled.Parent" xml:space="preserve">
<value>grbMain</value>
</data>
<data name="&gt;&gt;label2.ZOrder" xml:space="preserve">
<value>5</value>
</data>
<data name="label2.Size" type="System.Drawing.Size, System.Drawing">
<value>47, 12</value>
</data>
<data name="&gt;&gt;btnRemove.Name" xml:space="preserve">
<value>btnRemove</value>
</data>
<data name="&gt;&gt;txtUrl.Type" xml:space="preserve">
<value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="chkEnabled.Text" xml:space="preserve">
<value>Enable</value>
</data>
<data name="&gt;&gt;chkEnabled.Name" xml:space="preserve">
<value>chkEnabled</value>
</data>
<data name="&gt;&gt;txtRemarks.ZOrder" xml:space="preserve">
<value>4</value>
</data>
<data name="btnRemove.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="picQRCode.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 110</value>
</data>
<data name="btnShare.Size" type="System.Drawing.Size, System.Drawing">
<value>75, 23</value>
</data>
<data name="&gt;&gt;btnRemove.ZOrder" xml:space="preserve">
<value>2</value>
</data>
<data name="&gt;&gt;btnShare.Parent" xml:space="preserve">
<value>grbMain</value>
</data>
<data name="chkEnabled.TabIndex" type="System.Int32, mscorlib">
<value>25</value>
</data>
<data name="grbMain.TabIndex" type="System.Int32, mscorlib">
<value>10</value>
</data>
<data name="txtUrl.TabIndex" type="System.Int32, mscorlib">
<value>23</value>
</data>
<data name="&gt;&gt;label2.Parent" xml:space="preserve">
<value>grbMain</value>
</data>
<data name="&gt;&gt;btnRemove.Parent" xml:space="preserve">
<value>grbMain</value>
</data>
<data name="chkEnabled.Location" type="System.Drawing.Point, System.Drawing">
<value>368, 23</value>
</data>
<data name="label2.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="chkEnabled.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="grbMain.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 0</value>
</data>
<data name="&gt;&gt;picQRCode.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;picQRCode.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="label3.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="&gt;&gt;label2.Name" xml:space="preserve">
<value>label2</value>
</data>
<data name="grbMain.Size" type="System.Drawing.Size, System.Drawing">
<value>619, 110</value>
</data>
<data name="&gt;&gt;btnShare.Name" xml:space="preserve">
<value>btnShare</value>
</data>
<data name="&gt;&gt;btnShare.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="chkEnabled.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="$this.Size" type="System.Drawing.Size, System.Drawing">
<value>619, 310</value>
</data>
<data name="txtRemarks.TabIndex" type="System.Int32, mscorlib">
<value>11</value>
</data>
<data name="label2.Text" xml:space="preserve">
<value>Remarks</value>
</data>
<data name="label3.TabIndex" type="System.Int32, mscorlib">
<value>0</value>
</data>
<data name="picQRCode.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="txtUrl.Size" type="System.Drawing.Size, System.Drawing">
<value>473, 46</value>
</data>
<data name="label2.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 25</value>
</data>
<data name="btnRemove.Size" type="System.Drawing.Size, System.Drawing">
<value>75, 23</value>
</data>
<data name="&gt;&gt;label3.Parent" xml:space="preserve">
<value>grbMain</value>
</data>
<data name="&gt;&gt;grbMain.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<data name="label3.Text" xml:space="preserve">
<value>Address (url)</value>
</data>
<data name="&gt;&gt;btnRemove.Type" xml:space="preserve">
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;$this.Type" xml:space="preserve">
<value>System.Windows.Forms.UserControl, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;picQRCode.Type" xml:space="preserve">
<value>System.Windows.Forms.PictureBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="btnRemove.Location" type="System.Drawing.Point, System.Drawing">
<value>525, 21</value>
</data>
<data name="&gt;&gt;grbMain.Type" xml:space="preserve">
<value>System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;chkEnabled.Type" xml:space="preserve">
<value>System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;label3.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="label2.TabIndex" type="System.Int32, mscorlib">
<value>10</value>
</data>
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="$this.Language" type="System.Globalization.CultureInfo, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>zh-Hans</value>
</metadata>
</root>

View File

@ -117,18 +117,18 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="btnRemove.Text" xml:space="preserve">
<value>移除</value>
<data name="btnShare.Text" xml:space="preserve">
<value>分享</value>
</data>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="chkEnabled.Size" type="System.Drawing.Size, System.Drawing">
<value>48, 16</value>
</data>
<data name="chkEnabled.Text" xml:space="preserve">
<value>启用</value>
</data>
<data name="groupBox2.Text" xml:space="preserve">
<value>订阅详情</value>
<data name="btnRemove.Text" xml:space="preserve">
<value>移除</value>
</data>
<data name="label2.Size" type="System.Drawing.Size, System.Drawing">
<value>29, 12</value>
@ -142,4 +142,7 @@
<data name="label3.Text" xml:space="preserve">
<value>地址 (url)</value>
</data>
<data name="grbMain.Text" xml:space="preserve">
<value>订阅详情</value>
</data>
</root>

View File

@ -118,19 +118,61 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="btnClose.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="btnClose.Location" type="System.Drawing.Point, System.Drawing">
<value>448, 17</value>
</data>
<data name="btnClose.Size" type="System.Drawing.Size, System.Drawing">
<value>75, 23</value>
</data>
<assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
<value>6, 12</value>
<data name="btnClose.TabIndex" type="System.Int32, mscorlib">
<value>4</value>
</data>
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
<value>581, 629</value>
<data name="btnClose.Text" xml:space="preserve">
<value>&amp;Cancel</value>
</data>
<data name="$this.Localizable" type="System.Boolean, mscorlib">
<data name="&gt;&gt;btnClose.Name" xml:space="preserve">
<value>btnClose</value>
</data>
<data name="&gt;&gt;btnClose.Type" xml:space="preserve">
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;btnClose.Parent" xml:space="preserve">
<value>panel2</value>
</data>
<data name="&gt;&gt;btnClose.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<data name="panCon.AutoScroll" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="$this.Text" xml:space="preserve">
<value>Subscription settings</value>
<data name="panCon.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Fill</value>
</data>
<data name="panCon.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 0</value>
</data>
<data name="panCon.Size" type="System.Drawing.Size, System.Drawing">
<value>614, 569</value>
</data>
<data name="panCon.TabIndex" type="System.Int32, mscorlib">
<value>10</value>
</data>
<data name="&gt;&gt;panCon.Name" xml:space="preserve">
<value>panCon</value>
</data>
<data name="&gt;&gt;panCon.Type" xml:space="preserve">
<value>System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;panCon.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;panCon.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="btnAdd.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
@ -147,20 +189,17 @@
<data name="btnAdd.Text" xml:space="preserve">
<value>&amp;Add</value>
</data>
<data name="btnClose.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
<data name="&gt;&gt;btnAdd.Name" xml:space="preserve">
<value>btnAdd</value>
</data>
<data name="btnClose.Location" type="System.Drawing.Point, System.Drawing">
<value>448, 17</value>
<data name="&gt;&gt;btnAdd.Type" xml:space="preserve">
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="btnClose.Size" type="System.Drawing.Size, System.Drawing">
<value>75, 23</value>
<data name="&gt;&gt;btnAdd.Parent" xml:space="preserve">
<value>panel2</value>
</data>
<data name="btnClose.TabIndex" type="System.Int32, mscorlib">
<value>4</value>
</data>
<data name="btnClose.Text" xml:space="preserve">
<value>&amp;Cancel</value>
<data name="&gt;&gt;btnAdd.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="btnOK.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
@ -177,20 +216,17 @@
<data name="btnOK.Text" xml:space="preserve">
<value>&amp;OK</value>
</data>
<data name="panCon.AutoScroll" type="System.Boolean, mscorlib">
<value>True</value>
<data name="&gt;&gt;btnOK.Name" xml:space="preserve">
<value>btnOK</value>
</data>
<data name="panCon.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Fill</value>
<data name="&gt;&gt;btnOK.Type" xml:space="preserve">
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="panCon.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 0</value>
<data name="&gt;&gt;btnOK.Parent" xml:space="preserve">
<value>panel2</value>
</data>
<data name="panCon.Size" type="System.Drawing.Size, System.Drawing">
<value>581, 569</value>
</data>
<data name="panCon.TabIndex" type="System.Int32, mscorlib">
<value>10</value>
<data name="&gt;&gt;btnOK.ZOrder" xml:space="preserve">
<value>2</value>
</data>
<data name="panel2.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Bottom</value>
@ -199,9 +235,39 @@
<value>0, 569</value>
</data>
<data name="panel2.Size" type="System.Drawing.Size, System.Drawing">
<value>581, 60</value>
<value>614, 60</value>
</data>
<data name="panel2.TabIndex" type="System.Int32, mscorlib">
<value>7</value>
</data>
<data name="&gt;&gt;panel2.Name" xml:space="preserve">
<value>panel2</value>
</data>
<data name="&gt;&gt;panel2.Type" xml:space="preserve">
<value>System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;panel2.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;panel2.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
<value>6, 12</value>
</data>
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
<value>614, 629</value>
</data>
<data name="$this.Text" xml:space="preserve">
<value>Subscription settings</value>
</data>
<data name="&gt;&gt;$this.Name" xml:space="preserve">
<value>SubSettingForm</value>
</data>
<data name="&gt;&gt;$this.Type" xml:space="preserve">
<value>v2rayN.Forms.BaseForm, v2rayN, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</value>
</data>
</root>

View File

@ -23,7 +23,6 @@ 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
@ -56,10 +55,7 @@ namespace v2rayN
/// v2ray配置Httpresponse文件名
/// </summary>
public const string v2raySampleHttpresponseFileName = "v2rayN.Sample.SampleHttpresponse.txt";
/// <summary>
/// 空白的pac文件
/// </summary>
public const string BlankPacFileName = "v2rayN.Sample.BlankPac.txt";
public const string CustomRoutingFileName = "v2rayN.Sample.custom_routing_";
@ -97,7 +93,7 @@ namespace v2rayN
/// <summary>
/// 阻止 tag值
/// </summary>
public const string blockTag = "block";
public const string blockTag = "block";
/// <summary>
///
@ -161,11 +157,6 @@ namespace v2rayN
/// </summary>
public const string trojanProtocolLite = "trojan";
/// <summary>
/// pac
/// </summary>
public const string pacFILE = "pac.txt";
/// <summary>
/// email
/// </summary>
@ -231,13 +222,6 @@ namespace v2rayN
get; set;
}
/// <summary>
/// PAC端口
/// </summary>
public static int pacPort
{
get; set;
}
/// <summary>
///

View File

@ -86,22 +86,10 @@ namespace v2rayN.Handler
if (Utils.IsNullOrEmpty(config.domainStrategy))
{
config.domainStrategy = "IPIfNonMatch";
}
if (Utils.IsNullOrEmpty(config.routingMode))
}
if (config.routingItem == null)
{
config.routingMode = "0";
}
if (config.useragent == null)
{
config.useragent = new List<string>();
}
if (config.userdirect == null)
{
config.userdirect = new List<string>();
}
if (config.userblock == null)
{
config.userblock = new List<string>();
config.routingItem = new List<RoutingItem>();
}
//kcp
if (config.kcpItem == null)
@ -139,10 +127,6 @@ namespace v2rayN.Handler
{
config.speedPingTestUrl = Global.SpeedPingTestUrl;
}
if (Utils.IsNullOrEmpty(config.urlGFWList))
{
config.urlGFWList = Global.GFWLIST_URL;
}
//if (Utils.IsNullOrEmpty(config.remoteDNS))
//{
// config.remoteDNS = "1.1.1.1";
@ -152,10 +136,6 @@ namespace v2rayN.Handler
{
config.subItem = new List<SubItem>();
}
if (config.userPacRule == null)
{
config.userPacRule = new List<string>();
}
if (config == null
|| config.index < 0
@ -299,7 +279,8 @@ namespace v2rayN.Handler
path = config.vmess[index].path,
streamSecurity = config.vmess[index].streamSecurity,
allowInsecure = config.vmess[index].allowInsecure,
configType = config.vmess[index].configType
configType = config.vmess[index].configType,
flow = config.vmess[index].flow
};
config.vmess.Insert(index + 1, vmessItem); // 插入到下一项
@ -1080,5 +1061,28 @@ namespace v2rayN.Handler
return 0;
}
/// <summary>
/// SaveRoutingItem
/// </summary>
/// <param name="config"></param>
/// <returns></returns>
public static int SaveRoutingItem(ref Config config)
{
if (config.routingItem == null || config.routingItem.Count <= 0)
{
return -1;
}
foreach (RoutingItem sub in config.routingItem)
{
}
Global.reloadV2ray = true;
ToJsonFile(config);
return 0;
}
}
}

View File

@ -54,8 +54,10 @@ namespace v2rayN.Handler
private readonly string nLatestUrl = "https://github.com/2dust/v2rayN/releases/latest";
private const string nUrl = "https://github.com/2dust/v2rayN/releases/download/{0}/v2rayN.zip";
private readonly string coreLatestUrl = "https://github.com/v2fly/v2ray-core/releases/latest";
private const string coreUrl = "https://github.com/v2fly/v2ray-core/releases/download/{0}/v2ray-windows-{1}.zip";
private readonly string v2flyCoreLatestUrl = "https://github.com/v2fly/v2ray-core/releases/latest";
private const string v2flyCoreUrl = "https://github.com/v2fly/v2ray-core/releases/download/{0}/v2ray-windows-{1}.zip";
private readonly string xrayCoreLatestUrl = "https://github.com/xtls/xray-core/releases/latest";
private const string xrayCoreUrl = "https://github.com/xtls/xray-core/releases/download/{0}/xray-windows-{1}.zip";
public async void CheckUpdateAsync(string type)
{
@ -67,9 +69,13 @@ namespace v2rayN.Handler
HttpClient httpClient = new HttpClient(webRequestHandler);
string url;
if (type == "Core")
if (type == "v2fly")
{
url = coreLatestUrl;
url = v2flyCoreLatestUrl;
}
else if (type == "xray")
{
url = xrayCoreLatestUrl;
}
else if (type == "v2rayN")
{
@ -94,11 +100,23 @@ namespace v2rayN.Handler
/// <summary>
/// 获取V2RayCore版本
/// </summary>
public string getV2rayVersion()
public string getCoreVersion(string type)
{
try
{
string filePath = Utils.GetPath("V2ray.exe");
var core = string.Empty;
var match = string.Empty;
if (type == "v2fly")
{
core = "v2ray.exe";
match = "V2Ray";
}
else if (type == "xray")
{
core = "xray.exe";
match = "Xray";
}
string filePath = Utils.GetPath(core);
if (!File.Exists(filePath))
{
string msg = string.Format(UIRes.I18N("NotFoundCore"), @"https://github.com/v2fly/v2ray-core/releases");
@ -117,10 +135,9 @@ namespace v2rayN.Handler
p.Start();
p.WaitForExit(5000);
string echo = p.StandardOutput.ReadToEnd();
string version = Regex.Match(echo, "V2Ray ([0-9.]+) \\(").Groups[1].Value;
string version = Regex.Match(echo, $"{match} ([0-9.]+) \\(").Groups[1].Value;
return version;
}
catch (Exception ex)
{
Utils.SaveLog(ex.Message, ex);
@ -136,12 +153,19 @@ namespace v2rayN.Handler
string curVersion;
string message;
string url;
if (type == "Core")
if (type == "v2fly")
{
curVersion = "v" + getV2rayVersion();
curVersion = "v" + getCoreVersion(type);
message = string.Format(UIRes.I18N("IsLatestCore"), curVersion);
string osBit = Environment.Is64BitProcess ? "64" : "32";
url = string.Format(coreUrl, version, osBit);
url = string.Format(v2flyCoreUrl, version, osBit);
}
else if (type == "xray")
{
curVersion = "v" + getCoreVersion(type);
message = string.Format(UIRes.I18N("IsLatestCore"), curVersion);
string osBit = Environment.Is64BitProcess ? "64" : "32";
url = string.Format(xrayCoreUrl, version, osBit);
}
else if (type == "v2rayN")
{
@ -313,47 +337,24 @@ namespace v2rayN.Handler
}
}
#endregion
#region PAC
public string GenPacFile(string result)
public string WebDownloadStringSync(string url)
{
string source = string.Empty;
try
{
File.WriteAllText(Utils.GetTempPath("gfwlist.txt"), result, Encoding.UTF8);
List<string> lines = ParsePacResult(result);
string abpContent = Utils.UnGzip(Resources.abp_js);
abpContent = abpContent.Replace("__RULES__", JsonConvert.SerializeObject(lines, Formatting.Indented));
File.WriteAllText(Utils.GetPath(Global.pacFILE), abpContent, Encoding.UTF8);
Utils.SetSecurityProtocol();
WebClientEx ws = new WebClientEx();
return ws.DownloadString(new Uri(url));
}
catch (Exception ex)
{
Utils.SaveLog(ex.Message, ex);
return ex.Message;
return string.Empty;
}
return string.Empty;
}
private List<string> ParsePacResult(string response)
{
IEnumerable<char> IgnoredLineBegins = new[] { '!', '[' };
byte[] bytes = Convert.FromBase64String(response);
string content = Encoding.UTF8.GetString(bytes);
List<string> valid_lines = new List<string>();
using (StringReader sr = new StringReader(content))
{
foreach (string line in sr.NonWhiteSpaceLines())
{
if (line.BeginWithAny(IgnoredLineBegins))
continue;
valid_lines.Add(line);
}
}
return valid_lines;
}
#endregion
}
}

View File

@ -32,7 +32,7 @@ namespace v2rayN.Handler
try
{
Color color = ColorTranslator.FromHtml("#3399CC");
int index = (int)config.listenerType;
int index = (int)config.sysProxyType;
if (index > 0)
{
color = (new Color[] { Color.Red, Color.Purple, Color.DarkGreen, Color.Orange, Color.DarkSlateBlue, Color.RoyalBlue })[index - 1];

View File

@ -166,6 +166,13 @@ namespace v2rayN.Handler
//开启udp
inbound.settings.udp = config.inbound[0].udpEnabled;
inbound.sniffing.enabled = config.inbound[0].sniffingEnabled;
//http
Inbounds inbound2 = v2rayConfig.inbounds[1];
inbound2.port = config.GetLocalPort(Global.InboundHttp);
inbound2.protocol = Global.InboundHttp;
inbound2.listen = inbound.listen;
inbound2.settings.allowTransparent = false;
}
catch
{
@ -188,31 +195,31 @@ namespace v2rayN.Handler
{
v2rayConfig.routing.domainStrategy = config.domainStrategy;
//自定义
//需代理
routingUserRule(config.useragent, Global.agentTag, ref v2rayConfig);
//直连
routingUserRule(config.userdirect, Global.directTag, ref v2rayConfig);
//阻止
routingUserRule(config.userblock, Global.blockTag, ref v2rayConfig);
switch (config.routingMode)
foreach (var item in config.routingItem)
{
case "0":
break;
case "1":
routingGeo("ip", "private", Global.directTag, ref v2rayConfig);
break;
case "2":
routingGeo("", "cn", Global.directTag, ref v2rayConfig);
break;
case "3":
routingGeo("ip", "private", Global.directTag, ref v2rayConfig);
routingGeo("", "cn", Global.directTag, ref v2rayConfig);
break;
if (item.routingMode != "0")
{
switch (item.routingMode)
{
case "1":
break;
case "2":
routingGeo("ip", "private", Global.directTag, ref v2rayConfig);
break;
case "3":
routingGeo("", "cn", Global.directTag, ref v2rayConfig);
break;
case "4":
routingGeo("ip", "private", Global.directTag, ref v2rayConfig);
routingGeo("", "cn", Global.directTag, ref v2rayConfig);
break;
}
}
else
{
routingUserRule(item.userRules, item.outboundTag, ref v2rayConfig);
}
}
}
}
catch
@ -224,8 +231,19 @@ namespace v2rayN.Handler
{
try
{
if (userRule != null
&& userRule.Count > 0)
if (userRule == null)
{
}
else if (userRule.Count == 0)
{
v2rayConfig.routing.rules.Add(new RulesItem
{
type = "field",
outboundTag = tag,
port = "0-65535"
});
}
else if (userRule.Count > 0)
{
//Domain
RulesItem rulesDomain = new RulesItem
@ -470,7 +488,7 @@ namespace v2rayN.Handler
usersItem.flow = string.Empty;
usersItem.email = Global.userEMail;
usersItem.encryption = config.security();
//Mux
outbound.mux.enabled = config.muxEnabled;
outbound.mux.concurrency = config.muxEnabled ? 8 : -1;
@ -490,7 +508,7 @@ namespace v2rayN.Handler
{
usersItem.flow = config.flow();
}
outbound.mux.enabled = false;
outbound.mux.concurrency = -1;
}
@ -624,7 +642,7 @@ namespace v2rayN.Handler
//ws
case "ws":
WsSettings wsSettings = new WsSettings
{
{
};
string path = config.path();
@ -744,21 +762,30 @@ namespace v2rayN.Handler
{
return 0;
}
List<string> servers = new List<string>();
string[] arrDNS = config.remoteDNS.Split(',');
foreach (string str in arrDNS)
var obj = Utils.ParseJson(config.remoteDNS);
if (obj != null && obj.ContainsKey("servers"))
{
//if (Utils.IsIP(str))
//{
servers.Add(str);
//}
v2rayConfig.dns = obj;
}
//servers.Add("localhost");
v2rayConfig.dns = new Mode.Dns
else
{
servers = servers
};
List<string> servers = new List<string>();
string[] arrDNS = config.remoteDNS.Split(',');
foreach (string str in arrDNS)
{
//if (Utils.IsIP(str))
//{
servers.Add(str);
//}
}
//servers.Add("localhost");
v2rayConfig.dns = new Mode.Dns
{
servers = servers
};
}
}
catch
{
@ -783,8 +810,8 @@ namespace v2rayN.Handler
apiObj.services = services.ToList();
v2rayConfig.api = apiObj;
policySystemSetting.statsInboundDownlink = true;
policySystemSetting.statsInboundUplink = true;
policySystemSetting.statsOutboundDownlink = true;
policySystemSetting.statsOutboundUplink = true;
policyObj.system = policySystemSetting;
v2rayConfig.policy = policyObj;
@ -1450,7 +1477,7 @@ namespace v2rayN.Handler
else
{
vmessItem.remarks = WebUtility.UrlDecode(remarks);
}
}
}
else
{
@ -1743,7 +1770,7 @@ namespace v2rayN.Handler
//routing(config, ref v2rayConfig);
dns(configCopy, ref v2rayConfig);
v2rayConfig.inbounds.RemoveAt(0); // Remove "proxy" service for speedtest, avoiding port conflicts.
v2rayConfig.inbounds.Clear(); // Remove "proxy" service for speedtest, avoiding port conflicts.
int httpPort = configCopy.GetLocalPort("speedtest");
foreach (int index in selecteds)

View File

@ -10,23 +10,20 @@ namespace v2rayN.HttpProxyHandler
{
noHttpProxy = 0,
GlobalHttp = 1,
GlobalPac = 2,
HttpOpenAndClear = 3,
PacOpenAndClear = 4,
HttpOpenOnly = 5,
PacOpenOnly = 6
HttpOpenAndClear = 2,
HttpOpenOnly = 3,
}
/// <summary>
/// 系统代理(http)总处理
/// 启动privoxy提供http协议
/// 设置IE系统代理或者PAC模式
/// 设置IE系统代理
/// </summary>
class HttpProxyHandle
{
private static bool Update(Config config, bool forceDisable)
{
ListenerType type = config.listenerType;
// ListenerType type = config.listenerType;
var type = ListenerType.noHttpProxy;
if (forceDisable)
{
type = ListenerType.noHttpProxy;
@ -43,47 +40,21 @@ namespace v2rayN.HttpProxyHandler
}
if (type == ListenerType.GlobalHttp)
{
//PACServerHandle.Stop();
//ProxySetting.SetProxy($"{Global.Loopback}:{port}", Global.IEProxyExceptions, 2);
SysProxyHandle.SetIEProxy(true, true, $"{Global.Loopback}:{port}");
}
else if (type == ListenerType.GlobalPac)
{
string pacUrl = GetPacUrl();
//ProxySetting.SetProxy(pacUrl, "", 4);
SysProxyHandle.SetIEProxy(true, false, pacUrl);
//PACServerHandle.Stop();
PACServerHandle.Init(config);
}
else if (type == ListenerType.HttpOpenAndClear)
{
//PACServerHandle.Stop();
SysProxyHandle.ResetIEProxy();
}
else if (type == ListenerType.PacOpenAndClear)
{
string pacUrl = GetPacUrl();
SysProxyHandle.ResetIEProxy();
//PACServerHandle.Stop();
PACServerHandle.Init(config);
}
else if (type == ListenerType.HttpOpenOnly)
{
//PACServerHandle.Stop();
//SysProxyHandle.ResetIEProxy();
}
else if (type == ListenerType.PacOpenOnly)
{
string pacUrl = GetPacUrl();
//SysProxyHandle.ResetIEProxy();
//PACServerHandle.Stop();
PACServerHandle.Init(config);
}
}
else
{
SysProxyHandle.ResetIEProxy();
//PACServerHandle.Stop();
}
}
catch (Exception ex)
@ -110,7 +81,6 @@ namespace v2rayN.HttpProxyHandler
Global.sysAgent = true;
Global.socksPort = localPort;
Global.httpPort = PrivoxyHandler.Instance.RunningPort;
Global.pacPort = config.GetLocalPort("pac");
}
}
}
@ -127,10 +97,10 @@ namespace v2rayN.HttpProxyHandler
{
try
{
if (config.listenerType != ListenerType.HttpOpenOnly && config.listenerType != ListenerType.PacOpenOnly)
{
Update(config, true);
}
//if (config.listenerType != ListenerType.HttpOpenOnly)
//{
// Update(config, true);
//}
PrivoxyHandler.Instance.Stop();
@ -151,11 +121,11 @@ namespace v2rayN.HttpProxyHandler
public static void RestartHttpAgent(Config config, bool forced)
{
bool isRestart = false;
if (config.listenerType == ListenerType.noHttpProxy)
{
// 关闭http proxy时直接返回
return;
}
//if (config.listenerType == ListenerType.noHttpProxy)
//{
// // 关闭http proxy时直接返回
// return;
//}
//强制重启或者socks端口变化
if (forced)
{
@ -177,10 +147,40 @@ namespace v2rayN.HttpProxyHandler
Update(config, false);
}
public static string GetPacUrl()
public static bool UpdateSysProxy(Config config, bool forceDisable)
{
string pacUrl = $"http://{Global.Loopback}:{Global.pacPort}/pac/?t={ DateTime.Now.ToString("HHmmss")}";
return pacUrl;
var type = config.sysProxyType;
if (forceDisable)
{
type = ESysProxyType.ForcedClear;
}
try
{
Global.httpPort = config.GetLocalPort(Global.InboundHttp);
int port = Global.httpPort;
if (port <= 0)
{
return false;
}
if (type == ESysProxyType.ForcedChange)
{
SysProxyHandle.SetIEProxy(true, true, $"{Global.Loopback}:{port}");
}
else if (type == ESysProxyType.ForcedClear)
{
SysProxyHandle.ResetIEProxy();
}
else if (type == ESysProxyType.Unchanged)
{
}
}
catch (Exception ex)
{
Utils.SaveLog(ex.Message, ex);
}
return true;
}
}
}

View File

@ -1,209 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using v2rayN.Mode;
using v2rayN.Properties;
using v2rayN.Tool;
using v2rayN.Base;
namespace v2rayN.HttpProxyHandler
{
/// <summary>
/// 提供PAC功能支持
/// </summary>
class PACServerHandle
{
private static int pacPort = 0;
private static HttpWebServer server;
private static HttpWebServerB serverB;
private static Config _config;
public static bool IsRunning
{
get
{
return (pacPort > 0);
}
}
public static void Init(Config config)
{
_config = config;
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;
}
else
{
Utils.SaveLog("Webserver init failed ");
pacPort = 0;
}
}
private static bool InitServer(string address)
{
try
{
if (pacPort != Global.pacPort)
{
if (server != null)
{
server.Stop();
server = null;
}
if (server == null)
{
string prefixes = string.Format("http://{0}:{1}/pac/", address, Global.pacPort);
Utils.SaveLog("Webserver prefixes " + prefixes);
server = new HttpWebServer(SendResponse, prefixes);
server.Run();
}
}
Utils.SaveLog("Webserver at " + address);
}
catch (Exception ex)
{
Utils.SaveLog("Webserver InitServer " + ex.Message);
return false;
}
return true;
}
public static bool InitServerB(string address)
{
try
{
if (pacPort != Global.pacPort)
{
if (serverB != null)
{
serverB.Stop();
serverB = null;
}
if (serverB == null)
{
serverB = new HttpWebServerB(Global.pacPort, SendResponse);
}
}
Utils.SaveLog("WebserverB at " + address);
}
catch (Exception ex)
{
Utils.SaveLog("WebserverB InitServer " + ex.Message);
return false;
}
return true;
}
public static string SendResponse(string address)
{
try
{
string pac = GetPacList(address);
return pac;
}
catch (Exception ex)
{
Utils.SaveLog("Webserver SendResponse " + ex.Message);
return ex.Message;
}
}
public static void Stop()
{
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
//{
// if (httpWebServer == null)
// {
// return;
// }
// foreach (var key in httpWebServer.Keys)
// {
// Utils.SaveLog("Webserver Stop " + key.ToString());
// ((HttpWebServer)httpWebServer[key]).Stop();
// }
// httpWebServer.Clear();
//}
//catch (Exception ex)
//{
// Utils.SaveLog("Webserver Stop " + ex.Message);
//}
}
private static string GetPacList(string address)
{
int port = Global.httpPort;
if (port <= 0)
{
return "No port";
}
try
{
List<string> lstProxy = new List<string>
{
string.Format("PROXY {0}:{1};", address, port)
};
string proxy = string.Join("", lstProxy.ToArray());
string strPacfile = Utils.GetPath(Global.pacFILE);
if (!File.Exists(strPacfile))
{
FileManager.UncompressFile(strPacfile, Resources.pac_txt);
}
string pac = File.ReadAllText(strPacfile, Encoding.UTF8);
pac = pac.Replace("__PROXY__", proxy);
if (_config.userPacRule.Count > 0)
{
string keyWords = "var rules = [";
if (pac.IndexOf(keyWords) >= 0)
{
string userPac = string.Join($"\",{Environment.NewLine}\"", _config.userPacRule.ToArray());
userPac = string.Format("\"{0}\",", userPac);
pac = pac.Replace(keyWords, keyWords + userPac);
}
}
return pac;
}
catch
{
}
return "No pac content";
}
}
}

View File

@ -0,0 +1,14 @@
namespace v2rayN.Mode
{
class ComboItem
{
public int ID
{
get; set;
}
public string Text
{
get; set;
}
}
}

View File

@ -67,39 +67,6 @@ namespace v2rayN.Mode
{
get; set;
}
/// <summary>
/// 路由模式
/// </summary>
public string routingMode
{
get; set;
}
/// <summary>
/// 用户自定义需代理的网址或ip
/// </summary>
public List<string> useragent
{
get; set;
}
/// <summary>
/// 用户自定义直连的网址或ip
/// </summary>
public List<string> userdirect
{
get; set;
}
/// <summary>
/// 用户自定义阻止的网址或ip
/// </summary>
public List<string> userblock
{
get; set;
}
/// <summary>
/// KcpItem
/// </summary>
@ -109,9 +76,9 @@ namespace v2rayN.Mode
}
/// <summary>
/// 监听状态
///
/// </summary>
public ListenerType listenerType
public ESysProxyType sysProxyType
{
get; set;
}
@ -129,14 +96,7 @@ namespace v2rayN.Mode
public string speedPingTestUrl
{
get; set;
}
/// <summary>
/// 自定义GFWList url
/// </summary>
public string urlGFWList
{
get; set;
}
}
/// <summary>
/// 允许来自局域网的连接
@ -201,8 +161,7 @@ namespace v2rayN.Mode
{
get; set;
}
public List<string> userPacRule
public List<RoutingItem> routingItem
{
get; set;
}
@ -317,10 +276,7 @@ namespace v2rayN.Mode
{
return GetLocalPort(Global.InboundSocks) + 1;
}
else if (protocol == "pac")
{
return GetLocalPort(Global.InboundSocks) + 2;
}
else if (protocol == "speedtest")
{
return GetLocalPort(Global.InboundSocks) + 103;
@ -737,4 +693,40 @@ namespace v2rayN.Mode
get; set;
}
}
[Serializable]
public class RoutingItem
{
/// <summary>
///
/// </summary>
public string remarks
{
get; set;
}
/// <summary>
/// 路由模式
/// </summary>
public string routingMode
{
get; set;
}
/// <summary>
///
/// </summary>
public string outboundTag
{
get; set;
}
/// <summary>
///
/// </summary>
public List<string> userRules
{
get; set;
}
}
}

View File

@ -0,0 +1,11 @@

namespace v2rayN.Mode
{
public enum ERoutingSort
{
UserProxy = 1,
UserDirect = 2,
UserBlock = 3,
UserPredefined = 4
}
}

View File

@ -0,0 +1,10 @@

namespace v2rayN.Mode
{
public enum ESysProxyType
{
Unchanged = 0,
ForcedChange = 1,
ForcedClear = 2
}
}

View File

@ -35,7 +35,7 @@ namespace v2rayN.Mode
/// <summary>
/// DNS 配置
/// </summary>
public Dns dns { get; set; }
public object dns { get; set; }
/// <summary>
/// 路由配置
/// </summary>
@ -57,8 +57,8 @@ namespace v2rayN.Mode
public class SystemPolicy
{
public bool statsInboundUplink;
public bool statsInboundDownlink;
public bool statsOutboundUplink;
public bool statsOutboundDownlink;
}
public class Log
@ -138,7 +138,9 @@ namespace v2rayN.Mode
/// VLESS
/// </summary>
public string decryption { get; set; }
public bool allowTransparent { get; set; }
}
public class UsersItem

View File

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

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", "15.0.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
@ -70,16 +70,6 @@ namespace v2rayN.Properties {
}
}
/// <summary>
/// 查找 System.Byte[] 类型的本地化资源。
/// </summary>
internal static byte[] abp_js {
get {
object obj = ResourceManager.GetObject("abp_js", resourceCulture);
return ((byte[])(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
@ -130,16 +120,6 @@ namespace v2rayN.Properties {
}
}
/// <summary>
/// 查找 System.Byte[] 类型的本地化资源。
/// </summary>
internal static byte[] pac_txt {
get {
object obj = ResourceManager.GetObject("pac_txt", resourceCulture);
return ((byte[])(obj));
}
}
/// <summary>
/// 查找类似 listen-address __PRIVOXY_BIND_IP__:__PRIVOXY_BIND_PORT__
///toggle 0

View File

@ -157,15 +157,9 @@
<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>
<data name="pac_txt" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\pac.txt.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="abp_js" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\abp.js.gz;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="share" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\resources\share.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.

View File

@ -1,5 +0,0 @@
var proxy = "__PROXY__";
function FindProxyForURL(url, host) {
return proxy;
}

View File

@ -1,17 +1,11 @@
{
"log": {
"access": "",
"error": "",
"loglevel": "error"
},
{
"log": {
"access": "Vaccess.log",
"error": "Verror.log",
"loglevel": "warning"
},
"inbounds": [
{
"tag": "proxy",
"inbounds": [{
"tag": "tag1",
"port": 10808,
"protocol": "socks",
"listen": "127.0.0.1",
@ -26,6 +20,22 @@
"tls"
]
}
},
{
"tag": "tag2",
"port": 10809,
"protocol": "socks",
"listen": "127.0.0.1",
"settings": {
"allowTransparent": false
},
"sniffing": {
"enabled": true,
"destOverride": [
"http",
"tls"
]
}
}
],
"outbounds": [{

View File

@ -19,6 +19,7 @@ using ZXing.Common;
using ZXing.QrCode;
using System.Security.Principal;
using v2rayN.Base;
using Newtonsoft.Json.Linq;
namespace v2rayN
{
@ -146,6 +147,19 @@ namespace v2rayN
}
return result;
}
public static JObject ParseJson(string strJson)
{
try
{
JObject obj = JObject.Parse(strJson);
return obj;
}
catch
{
return null;
}
}
#endregion
#region 转换函数

View File

@ -125,12 +125,25 @@
<Compile Include="Forms\BaseServerForm.Designer.cs">
<DependentUpon>BaseServerForm.cs</DependentUpon>
</Compile>
<Compile Include="Mode\ComboItem.cs" />
<Compile Include="Forms\MainForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\MainForm.Designer.cs">
<DependentUpon>MainForm.cs</DependentUpon>
</Compile>
<Compile Include="Forms\RoutingSettingForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\RoutingSettingForm.Designer.cs">
<DependentUpon>RoutingSettingForm.cs</DependentUpon>
</Compile>
<Compile Include="Forms\RoutingSettingControl.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Forms\RoutingSettingControl.Designer.cs">
<DependentUpon>RoutingSettingControl.cs</DependentUpon>
</Compile>
<Compile Include="Forms\SubSettingForm.cs">
<SubType>Form</SubType>
</Compile>
@ -165,16 +178,16 @@
<Compile Include="Handler\SpeedtestHandler.cs" />
<Compile Include="Handler\StatisticsHandler.cs" />
<Compile Include="Handler\DownloadHandle.cs" />
<Compile Include="Base\HttpWebServer.cs" />
<Compile Include="Base\HttpWebServerB.cs" />
<Compile Include="HttpProxyHandler\PrivoxyHandler.cs" />
<Compile Include="HttpProxyHandler\PACServerHandle.cs" />
<Compile Include="HttpProxyHandler\ProxySetting.cs" />
<Compile Include="HttpProxyHandler\HttpProxyHandle.cs" />
<Compile Include="Base\WebClientEx.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="HttpProxyHandler\SysProxyHandle.cs" />
<Compile Include="Mode\ECoreType.cs" />
<Compile Include="Mode\ESysProxyType.cs" />
<Compile Include="Mode\ERoutingSort.cs" />
<Compile Include="Mode\EMove.cs" />
<Compile Include="Mode\EServerColName.cs" />
<Compile Include="Mode\ServerStatistics.cs" />
@ -287,6 +300,13 @@
<DependentUpon>QRCodeControl.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Forms\RoutingSettingControl.resx">
<DependentUpon>RoutingSettingControl.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Forms\RoutingSettingControl.zh-Hans.resx">
<DependentUpon>RoutingSettingControl.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\SubSettingControl.resx">
<DependentUpon>SubSettingControl.cs</DependentUpon>
<SubType>Designer</SubType>
@ -294,6 +314,13 @@
<EmbeddedResource Include="Forms\SubSettingControl.zh-Hans.resx">
<DependentUpon>SubSettingControl.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\RoutingSettingForm.resx">
<DependentUpon>RoutingSettingForm.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Forms\RoutingSettingForm.zh-Hans.resx">
<DependentUpon>RoutingSettingForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\SubSettingForm.resx">
<DependentUpon>SubSettingForm.cs</DependentUpon>
<SubType>Designer</SubType>
@ -347,8 +374,6 @@
<None Include="Resources\sysproxy.exe.gz" />
<None Include="Resources\sysproxy64.exe.gz" />
<Protobuf Include="Protos\Statistics.proto" />
<None Include="Resources\abp.js.gz" />
<None Include="Resources\pac.txt.gz" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Resx\ResUI.zh-Hans.resx">
@ -411,7 +436,6 @@
<ItemGroup>
<None Include="Resources\share.png" />
<None Include="Resources\promotion.png" />
<EmbeddedResource Include="Sample\BlankPac.txt" />
<None Include="Resources\sub.png" />
<None Include="Resources\checkupdate.png" />
<None Include="Resources\about.png" />