Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e256ec5401 | ||
|
|
3defba6290 | ||
|
|
c201d986c5 | ||
|
|
36aad4424e | ||
|
|
b29fb1e2a3 | ||
|
|
d5aa307efb | ||
|
|
48928613bf | ||
|
|
52b8f480f6 | ||
|
|
bcda8bd602 | ||
|
|
2a11fe11e8 | ||
|
|
7ec0607fec | ||
|
|
aa41a8675e | ||
|
|
19f9bff6fe |
@@ -56,7 +56,7 @@ namespace v2rayN.Base
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
public async Task<string> GetAsync(HttpClient client, string url)
|
public async Task<string> GetAsync(HttpClient client, string url, CancellationToken token)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(url))
|
if (string.IsNullOrEmpty(url))
|
||||||
{
|
{
|
||||||
@@ -64,10 +64,7 @@ namespace v2rayN.Base
|
|||||||
}
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var cts = new CancellationTokenSource();
|
HttpResponseMessage response = await client.GetAsync(url, token);
|
||||||
cts.CancelAfter(5000);
|
|
||||||
|
|
||||||
HttpResponseMessage response = await client.GetAsync(url, cts.Token);
|
|
||||||
return await response.Content.ReadAsStringAsync();
|
return await response.Content.ReadAsStringAsync();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|||||||
@@ -123,7 +123,10 @@ namespace v2rayN.Forms
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
v2rayHandler.V2rayStop();
|
Utils.SaveLog("MyAppExit Begin");
|
||||||
|
|
||||||
|
StorageUI();
|
||||||
|
ConfigHandler.SaveConfig(ref config);
|
||||||
|
|
||||||
//HttpProxyHandle.CloseHttpAgent(config);
|
//HttpProxyHandle.CloseHttpAgent(config);
|
||||||
if (blWindowsShutDown)
|
if (blWindowsShutDown)
|
||||||
@@ -135,10 +138,11 @@ namespace v2rayN.Forms
|
|||||||
SysProxyHandle.UpdateSysProxy(config, true);
|
SysProxyHandle.UpdateSysProxy(config, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
StorageUI();
|
|
||||||
ConfigHandler.SaveConfig(ref config);
|
|
||||||
statistics?.SaveToFile();
|
statistics?.SaveToFile();
|
||||||
statistics?.Close();
|
statistics?.Close();
|
||||||
|
|
||||||
|
v2rayHandler.V2rayStop();
|
||||||
|
Utils.SaveLog("MyAppExit End");
|
||||||
}
|
}
|
||||||
catch { }
|
catch { }
|
||||||
}
|
}
|
||||||
@@ -1273,7 +1277,10 @@ namespace v2rayN.Forms
|
|||||||
|
|
||||||
mainMsgControl.DisplayToolStatus(config);
|
mainMsgControl.DisplayToolStatus(config);
|
||||||
|
|
||||||
|
this.BeginInvoke(new Action(() =>
|
||||||
|
{
|
||||||
notifyMain.Icon = this.Icon = MainFormHandler.Instance.GetNotifyIcon(config, this.Icon);
|
notifyMain.Icon = this.Icon = MainFormHandler.Instance.GetNotifyIcon(config, this.Icon);
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
26
v2rayN/v2rayN/Forms/OptionSettingForm.Designer.cs
generated
26
v2rayN/v2rayN/Forms/OptionSettingForm.Designer.cs
generated
@@ -98,13 +98,14 @@
|
|||||||
this.labCoreType1 = new System.Windows.Forms.Label();
|
this.labCoreType1 = new System.Windows.Forms.Label();
|
||||||
this.tabPage3 = new System.Windows.Forms.TabPage();
|
this.tabPage3 = new System.Windows.Forms.TabPage();
|
||||||
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
||||||
|
this.label18 = new System.Windows.Forms.Label();
|
||||||
|
this.cmbSystemProxyAdvancedProtocol = new System.Windows.Forms.ComboBox();
|
||||||
this.label13 = new System.Windows.Forms.Label();
|
this.label13 = new System.Windows.Forms.Label();
|
||||||
this.label12 = new System.Windows.Forms.Label();
|
this.label12 = new System.Windows.Forms.Label();
|
||||||
this.txtsystemProxyExceptions = new System.Windows.Forms.TextBox();
|
this.txtsystemProxyExceptions = new System.Windows.Forms.TextBox();
|
||||||
this.panel2 = new System.Windows.Forms.Panel();
|
this.panel2 = new System.Windows.Forms.Panel();
|
||||||
this.btnOK = new System.Windows.Forms.Button();
|
this.btnOK = new System.Windows.Forms.Button();
|
||||||
this.panel1 = new System.Windows.Forms.Panel();
|
this.panel1 = new System.Windows.Forms.Panel();
|
||||||
this.chkEnableSystemProxyAdvanced = new System.Windows.Forms.CheckBox();
|
|
||||||
this.tabControl1.SuspendLayout();
|
this.tabControl1.SuspendLayout();
|
||||||
this.tabPage1.SuspendLayout();
|
this.tabPage1.SuspendLayout();
|
||||||
this.groupBox1.SuspendLayout();
|
this.groupBox1.SuspendLayout();
|
||||||
@@ -581,7 +582,8 @@
|
|||||||
//
|
//
|
||||||
// groupBox2
|
// groupBox2
|
||||||
//
|
//
|
||||||
this.groupBox2.Controls.Add(this.chkEnableSystemProxyAdvanced);
|
this.groupBox2.Controls.Add(this.label18);
|
||||||
|
this.groupBox2.Controls.Add(this.cmbSystemProxyAdvancedProtocol);
|
||||||
this.groupBox2.Controls.Add(this.label13);
|
this.groupBox2.Controls.Add(this.label13);
|
||||||
this.groupBox2.Controls.Add(this.label12);
|
this.groupBox2.Controls.Add(this.label12);
|
||||||
this.groupBox2.Controls.Add(this.txtsystemProxyExceptions);
|
this.groupBox2.Controls.Add(this.txtsystemProxyExceptions);
|
||||||
@@ -589,6 +591,17 @@
|
|||||||
this.groupBox2.Name = "groupBox2";
|
this.groupBox2.Name = "groupBox2";
|
||||||
this.groupBox2.TabStop = false;
|
this.groupBox2.TabStop = false;
|
||||||
//
|
//
|
||||||
|
// label18
|
||||||
|
//
|
||||||
|
resources.ApplyResources(this.label18, "label18");
|
||||||
|
this.label18.Name = "label18";
|
||||||
|
//
|
||||||
|
// cmbSystemProxyAdvancedProtocol
|
||||||
|
//
|
||||||
|
this.cmbSystemProxyAdvancedProtocol.FormattingEnabled = true;
|
||||||
|
resources.ApplyResources(this.cmbSystemProxyAdvancedProtocol, "cmbSystemProxyAdvancedProtocol");
|
||||||
|
this.cmbSystemProxyAdvancedProtocol.Name = "cmbSystemProxyAdvancedProtocol";
|
||||||
|
//
|
||||||
// label13
|
// label13
|
||||||
//
|
//
|
||||||
resources.ApplyResources(this.label13, "label13");
|
resources.ApplyResources(this.label13, "label13");
|
||||||
@@ -623,12 +636,6 @@
|
|||||||
resources.ApplyResources(this.panel1, "panel1");
|
resources.ApplyResources(this.panel1, "panel1");
|
||||||
this.panel1.Name = "panel1";
|
this.panel1.Name = "panel1";
|
||||||
//
|
//
|
||||||
// chkEnableSystemProxyAdvanced
|
|
||||||
//
|
|
||||||
resources.ApplyResources(this.chkEnableSystemProxyAdvanced, "chkEnableSystemProxyAdvanced");
|
|
||||||
this.chkEnableSystemProxyAdvanced.Name = "chkEnableSystemProxyAdvanced";
|
|
||||||
this.chkEnableSystemProxyAdvanced.UseVisualStyleBackColor = true;
|
|
||||||
//
|
|
||||||
// OptionSettingForm
|
// OptionSettingForm
|
||||||
//
|
//
|
||||||
resources.ApplyResources(this, "$this");
|
resources.ApplyResources(this, "$this");
|
||||||
@@ -737,6 +744,7 @@
|
|||||||
private System.Windows.Forms.Label label3;
|
private System.Windows.Forms.Label label3;
|
||||||
private System.Windows.Forms.TextBox txttrayMenuServersLimit;
|
private System.Windows.Forms.TextBox txttrayMenuServersLimit;
|
||||||
private System.Windows.Forms.Label label17;
|
private System.Windows.Forms.Label label17;
|
||||||
private System.Windows.Forms.CheckBox chkEnableSystemProxyAdvanced;
|
private System.Windows.Forms.ComboBox cmbSystemProxyAdvancedProtocol;
|
||||||
|
private System.Windows.Forms.Label label18;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -18,6 +18,8 @@ namespace v2rayN.Forms
|
|||||||
|
|
||||||
private void OptionSettingForm_Load(object sender, EventArgs e)
|
private void OptionSettingForm_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
cmbSystemProxyAdvancedProtocol.Items.AddRange(Global.IEProxyProtocols.ToArray());
|
||||||
|
|
||||||
InitBase();
|
InitBase();
|
||||||
|
|
||||||
InitKCP();
|
InitKCP();
|
||||||
@@ -59,7 +61,7 @@ namespace v2rayN.Forms
|
|||||||
|
|
||||||
txtsystemProxyExceptions.Text = config.systemProxyExceptions;
|
txtsystemProxyExceptions.Text = config.systemProxyExceptions;
|
||||||
|
|
||||||
chkEnableSystemProxyAdvanced.Checked = config.enableSystemProxyAdvanced;
|
cmbSystemProxyAdvancedProtocol.Text = config.systemProxyAdvancedProtocol;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -255,7 +257,7 @@ namespace v2rayN.Forms
|
|||||||
|
|
||||||
config.systemProxyExceptions = txtsystemProxyExceptions.Text.TrimEx();
|
config.systemProxyExceptions = txtsystemProxyExceptions.Text.TrimEx();
|
||||||
|
|
||||||
config.enableSystemProxyAdvanced = chkEnableSystemProxyAdvanced.Checked;
|
config.systemProxyAdvancedProtocol = cmbSystemProxyAdvancedProtocol.Text.TrimEx();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1851,33 +1851,57 @@
|
|||||||
<data name=">>tabPageCoreType.ZOrder" xml:space="preserve">
|
<data name=">>tabPageCoreType.ZOrder" xml:space="preserve">
|
||||||
<value>4</value>
|
<value>4</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="chkEnableSystemProxyAdvanced.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
<data name="label18.AutoSize" type="System.Boolean, mscorlib">
|
||||||
|
<value>True</value>
|
||||||
|
</data>
|
||||||
|
<data name="label18.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||||
<value>NoControl</value>
|
<value>NoControl</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="chkEnableSystemProxyAdvanced.Location" type="System.Drawing.Point, System.Drawing">
|
<data name="label18.Location" type="System.Drawing.Point, System.Drawing">
|
||||||
<value>8, 328</value>
|
<value>8, 346</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="chkEnableSystemProxyAdvanced.Size" type="System.Drawing.Size, System.Drawing">
|
<data name="label18.Size" type="System.Drawing.Size, System.Drawing">
|
||||||
<value>502, 16</value>
|
<value>329, 12</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="chkEnableSystemProxyAdvanced.TabIndex" type="System.Int32, mscorlib">
|
<data name="label18.TabIndex" type="System.Int32, mscorlib">
|
||||||
<value>43</value>
|
<value>45</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="chkEnableSystemProxyAdvanced.Text" xml:space="preserve">
|
<data name="label18.Text" xml:space="preserve">
|
||||||
<value>Enable system proxy advanced settings, use socks protocol</value>
|
<value>Advanced proxy settings, protocol selection (optional)</value>
|
||||||
</data>
|
</data>
|
||||||
<data name=">>chkEnableSystemProxyAdvanced.Name" xml:space="preserve">
|
<data name=">>label18.Name" xml:space="preserve">
|
||||||
<value>chkEnableSystemProxyAdvanced</value>
|
<value>label18</value>
|
||||||
</data>
|
</data>
|
||||||
<data name=">>chkEnableSystemProxyAdvanced.Type" xml:space="preserve">
|
<data name=">>label18.Type" xml:space="preserve">
|
||||||
<value>System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</data>
|
</data>
|
||||||
<data name=">>chkEnableSystemProxyAdvanced.Parent" xml:space="preserve">
|
<data name=">>label18.Parent" xml:space="preserve">
|
||||||
<value>groupBox2</value>
|
<value>groupBox2</value>
|
||||||
</data>
|
</data>
|
||||||
<data name=">>chkEnableSystemProxyAdvanced.ZOrder" xml:space="preserve">
|
<data name=">>label18.ZOrder" xml:space="preserve">
|
||||||
<value>0</value>
|
<value>0</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="cmbSystemProxyAdvancedProtocol.Location" type="System.Drawing.Point, System.Drawing">
|
||||||
|
<value>8, 371</value>
|
||||||
|
</data>
|
||||||
|
<data name="cmbSystemProxyAdvancedProtocol.Size" type="System.Drawing.Size, System.Drawing">
|
||||||
|
<value>638, 20</value>
|
||||||
|
</data>
|
||||||
|
<data name="cmbSystemProxyAdvancedProtocol.TabIndex" type="System.Int32, mscorlib">
|
||||||
|
<value>44</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>cmbSystemProxyAdvancedProtocol.Name" xml:space="preserve">
|
||||||
|
<value>cmbSystemProxyAdvancedProtocol</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>cmbSystemProxyAdvancedProtocol.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=">>cmbSystemProxyAdvancedProtocol.Parent" xml:space="preserve">
|
||||||
|
<value>groupBox2</value>
|
||||||
|
</data>
|
||||||
|
<data name=">>cmbSystemProxyAdvancedProtocol.ZOrder" xml:space="preserve">
|
||||||
|
<value>1</value>
|
||||||
|
</data>
|
||||||
<data name="label13.AutoSize" type="System.Boolean, mscorlib">
|
<data name="label13.AutoSize" type="System.Boolean, mscorlib">
|
||||||
<value>True</value>
|
<value>True</value>
|
||||||
</data>
|
</data>
|
||||||
@@ -1906,7 +1930,7 @@
|
|||||||
<value>groupBox2</value>
|
<value>groupBox2</value>
|
||||||
</data>
|
</data>
|
||||||
<data name=">>label13.ZOrder" xml:space="preserve">
|
<data name=">>label13.ZOrder" xml:space="preserve">
|
||||||
<value>1</value>
|
<value>2</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="label12.AutoSize" type="System.Boolean, mscorlib">
|
<data name="label12.AutoSize" type="System.Boolean, mscorlib">
|
||||||
<value>True</value>
|
<value>True</value>
|
||||||
@@ -1936,7 +1960,7 @@
|
|||||||
<value>groupBox2</value>
|
<value>groupBox2</value>
|
||||||
</data>
|
</data>
|
||||||
<data name=">>label12.ZOrder" xml:space="preserve">
|
<data name=">>label12.ZOrder" xml:space="preserve">
|
||||||
<value>2</value>
|
<value>3</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="txtsystemProxyExceptions.Location" type="System.Drawing.Point, System.Drawing">
|
<data name="txtsystemProxyExceptions.Location" type="System.Drawing.Point, System.Drawing">
|
||||||
<value>8, 52</value>
|
<value>8, 52</value>
|
||||||
@@ -1963,7 +1987,7 @@
|
|||||||
<value>groupBox2</value>
|
<value>groupBox2</value>
|
||||||
</data>
|
</data>
|
||||||
<data name=">>txtsystemProxyExceptions.ZOrder" xml:space="preserve">
|
<data name=">>txtsystemProxyExceptions.ZOrder" xml:space="preserve">
|
||||||
<value>3</value>
|
<value>4</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="groupBox2.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
|
<data name="groupBox2.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
|
||||||
<value>Fill</value>
|
<value>Fill</value>
|
||||||
|
|||||||
@@ -373,7 +373,7 @@
|
|||||||
<data name="$this.Text" xml:space="preserve">
|
<data name="$this.Text" xml:space="preserve">
|
||||||
<value>参数设置</value>
|
<value>参数设置</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="chkEnableSystemProxyAdvanced.Text" xml:space="preserve">
|
<data name="label18.Text" xml:space="preserve">
|
||||||
<value>开启系统代理高级设置, 使用socks协议</value>
|
<value>高级代理设置, 协议选择(可选)</value>
|
||||||
</data>
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -199,6 +199,13 @@ namespace v2rayN
|
|||||||
public const string StatisticLogOverall = "StatisticLogOverall.json";
|
public const string StatisticLogOverall = "StatisticLogOverall.json";
|
||||||
|
|
||||||
public const string IEProxyExceptions = "localhost;127.*;10.*;172.16.*;172.17.*;172.18.*;172.19.*;172.20.*;172.21.*;172.22.*;172.23.*;172.24.*;172.25.*;172.26.*;172.27.*;172.28.*;172.29.*;172.30.*;172.31.*;192.168.*";
|
public const string IEProxyExceptions = "localhost;127.*;10.*;172.16.*;172.17.*;172.18.*;172.19.*;172.20.*;172.21.*;172.22.*;172.23.*;172.24.*;172.25.*;172.26.*;172.27.*;172.28.*;172.29.*;172.30.*;172.31.*;192.168.*";
|
||||||
|
public static readonly List<string> IEProxyProtocols = new List<string> {
|
||||||
|
"{ip}:{http_port}",
|
||||||
|
"socks={ip}:{socks_port}",
|
||||||
|
"http={ip}:{http_port};https={ip}:{http_port};ftp={ip}:{http_port};socks={ip}:{socks_port}",
|
||||||
|
"http=http://{ip}:{http_port};https=http://{ip}:{http_port}",
|
||||||
|
""
|
||||||
|
};
|
||||||
|
|
||||||
public const string RoutingRuleComma = "<COMMA>";
|
public const string RoutingRuleComma = "<COMMA>";
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using v2rayN.Mode;
|
|||||||
using v2rayN.Base;
|
using v2rayN.Base;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using v2rayN.Tool;
|
using v2rayN.Tool;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace v2rayN.Handler
|
namespace v2rayN.Handler
|
||||||
{
|
{
|
||||||
@@ -207,7 +208,28 @@ namespace v2rayN.Handler
|
|||||||
{
|
{
|
||||||
lock (objLock)
|
lock (objLock)
|
||||||
{
|
{
|
||||||
Utils.ToJsonFile(config, Utils.GetPath(configRes));
|
try
|
||||||
|
{
|
||||||
|
|
||||||
|
//save temp file
|
||||||
|
var resPath = Utils.GetPath(configRes);
|
||||||
|
var tempPath = $"{resPath}_temp";
|
||||||
|
if (Utils.ToJsonFile(config, tempPath) != 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (File.Exists(resPath))
|
||||||
|
{
|
||||||
|
File.Delete(resPath);
|
||||||
|
}
|
||||||
|
//rename
|
||||||
|
File.Move(tempPath, resPath);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Utils.SaveLog("ToJsonFile", ex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -950,14 +972,39 @@ namespace v2rayN.Handler
|
|||||||
vmessItem.address = fileName;
|
vmessItem.address = fileName;
|
||||||
vmessItem.remarks = "clash_custom";
|
vmessItem.remarks = "clash_custom";
|
||||||
}
|
}
|
||||||
|
//Is hysteria configuration
|
||||||
|
else if (clipboardData.IndexOf("server") >= 0
|
||||||
|
&& clipboardData.IndexOf("up") >= 0
|
||||||
|
&& clipboardData.IndexOf("down") >= 0
|
||||||
|
&& clipboardData.IndexOf("listen") >= 0)
|
||||||
|
{
|
||||||
|
var fileName = Utils.GetTempPath($"{Utils.GetGUID(false)}.json");
|
||||||
|
File.WriteAllText(fileName, clipboardData);
|
||||||
|
|
||||||
|
vmessItem.coreType = ECoreType.hysteria;
|
||||||
|
vmessItem.address = fileName;
|
||||||
|
vmessItem.remarks = "hysteria_custom";
|
||||||
|
}
|
||||||
|
//Is naiveproxy configuration
|
||||||
|
else if (clipboardData.IndexOf("listen") >= 0
|
||||||
|
&& clipboardData.IndexOf("proxy") >= 0)
|
||||||
|
{
|
||||||
|
var fileName = Utils.GetTempPath($"{Utils.GetGUID(false)}.json");
|
||||||
|
File.WriteAllText(fileName, clipboardData);
|
||||||
|
|
||||||
|
vmessItem.coreType = ECoreType.naiveproxy;
|
||||||
|
vmessItem.address = fileName;
|
||||||
|
vmessItem.remarks = "naiveproxy_custom";
|
||||||
|
}
|
||||||
//Is Other configuration
|
//Is Other configuration
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var fileName = Utils.GetTempPath($"{Utils.GetGUID(false)}.txt");
|
return -1;
|
||||||
File.WriteAllText(fileName, clipboardData);
|
//var fileName = Utils.GetTempPath($"{Utils.GetGUID(false)}.txt");
|
||||||
|
//File.WriteAllText(fileName, clipboardData);
|
||||||
|
|
||||||
vmessItem.address = fileName;
|
//vmessItem.address = fileName;
|
||||||
vmessItem.remarks = "other_custom";
|
//vmessItem.remarks = "other_custom";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Utils.IsNullOrEmpty(subid))
|
if (!Utils.IsNullOrEmpty(subid))
|
||||||
@@ -987,6 +1034,56 @@ namespace v2rayN.Handler
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static int AddBatchServers4SsSIP008(ref Config config, string clipboardData, string subid, List<VmessItem> lstOriSub, string groupId)
|
||||||
|
{
|
||||||
|
if (Utils.IsNullOrEmpty(clipboardData))
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Utils.IsNullOrEmpty(subid))
|
||||||
|
{
|
||||||
|
RemoveServerViaSubid(ref config, subid);
|
||||||
|
}
|
||||||
|
|
||||||
|
//SsSIP008
|
||||||
|
var lstSsServer = Utils.FromJson<List<SsServer>>(clipboardData);
|
||||||
|
if (lstSsServer == null || lstSsServer.Count <= 0)
|
||||||
|
{
|
||||||
|
var ssSIP008 = Utils.FromJson<SsSIP008>(clipboardData);
|
||||||
|
if (ssSIP008 != null && ssSIP008.servers != null && ssSIP008.servers.Count > 0)
|
||||||
|
{
|
||||||
|
lstSsServer = ssSIP008.servers;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lstSsServer != null && lstSsServer.Count > 0)
|
||||||
|
{
|
||||||
|
int counter = 0;
|
||||||
|
foreach (var it in lstSsServer)
|
||||||
|
{
|
||||||
|
var ssItem = new VmessItem()
|
||||||
|
{
|
||||||
|
subid = subid,
|
||||||
|
groupId = groupId,
|
||||||
|
remarks = it.remarks,
|
||||||
|
security = it.method,
|
||||||
|
id = it.password,
|
||||||
|
address = it.server,
|
||||||
|
port = Utils.ToInt(it.server_port)
|
||||||
|
};
|
||||||
|
if (AddShadowsocksServer(ref config, ssItem, false) == 0)
|
||||||
|
{
|
||||||
|
counter++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ToJsonFile(config);
|
||||||
|
return counter;
|
||||||
|
}
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
public static int AddBatchServers(ref Config config, string clipboardData, string subid, string groupId)
|
public static int AddBatchServers(ref Config config, string clipboardData, string subid, string groupId)
|
||||||
{
|
{
|
||||||
List<VmessItem> lstOriSub = null;
|
List<VmessItem> lstOriSub = null;
|
||||||
@@ -1001,6 +1098,11 @@ namespace v2rayN.Handler
|
|||||||
counter = AddBatchServers(ref config, Utils.Base64Decode(clipboardData), subid, lstOriSub, groupId);
|
counter = AddBatchServers(ref config, Utils.Base64Decode(clipboardData), subid, lstOriSub, groupId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (counter < 1)
|
||||||
|
{
|
||||||
|
counter = AddBatchServers4SsSIP008(ref config, clipboardData, subid, lstOriSub, groupId);
|
||||||
|
}
|
||||||
|
|
||||||
//maybe other sub
|
//maybe other sub
|
||||||
if (counter < 1)
|
if (counter < 1)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -156,7 +156,11 @@ namespace v2rayN.Handler
|
|||||||
{
|
{
|
||||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", Utils.Base64Encode(uri.UserInfo));
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", Utils.Base64Encode(uri.UserInfo));
|
||||||
}
|
}
|
||||||
var result = await HttpClientHelper.GetInstance().GetAsync(client, url);
|
|
||||||
|
var cts = new CancellationTokenSource();
|
||||||
|
cts.CancelAfter(1000 * 30);
|
||||||
|
|
||||||
|
var result = await HttpClientHelper.GetInstance().GetAsync(client, url, cts.Token);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|||||||
@@ -70,13 +70,16 @@ namespace v2rayN.Handler
|
|||||||
var strExceptions = $"{config.constItem.defIEProxyExceptions};{config.systemProxyExceptions}";
|
var strExceptions = $"{config.constItem.defIEProxyExceptions};{config.systemProxyExceptions}";
|
||||||
|
|
||||||
var strProxy = string.Empty;
|
var strProxy = string.Empty;
|
||||||
if (config.enableSystemProxyAdvanced)
|
if (Utils.IsNullOrEmpty(config.systemProxyAdvancedProtocol))
|
||||||
{
|
{
|
||||||
strProxy = $"socks={Global.Loopback}:{portSocks}";
|
strProxy = $"{Global.Loopback}:{port}";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
strProxy = $"{Global.Loopback}:{port}";
|
strProxy = config.systemProxyAdvancedProtocol
|
||||||
|
.Replace("{ip}", Global.Loopback)
|
||||||
|
.Replace("{http_port}", port.ToString())
|
||||||
|
.Replace("{socks_port}", portSocks.ToString());
|
||||||
}
|
}
|
||||||
SetIEProxy(true, strProxy, strExceptions);
|
SetIEProxy(true, strProxy, strExceptions);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ namespace v2rayN.Mode
|
|||||||
{
|
{
|
||||||
get; set;
|
get; set;
|
||||||
}
|
}
|
||||||
public bool enableSystemProxyAdvanced { get; set; }
|
public string systemProxyAdvancedProtocol { get; set; }
|
||||||
|
|
||||||
public int autoUpdateInterval { get; set; } = 0;
|
public int autoUpdateInterval { get; set; } = 0;
|
||||||
|
|
||||||
|
|||||||
22
v2rayN/v2rayN/Mode/SsSIP008.cs
Normal file
22
v2rayN/v2rayN/Mode/SsSIP008.cs
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace v2rayN.Mode
|
||||||
|
{
|
||||||
|
public class SsSIP008
|
||||||
|
{
|
||||||
|
public List<SsServer> servers { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
[Serializable]
|
||||||
|
public class SsServer
|
||||||
|
{
|
||||||
|
public string remarks { get; set; }
|
||||||
|
public string server { get; set; }
|
||||||
|
public string server_port { get; set; }
|
||||||
|
public string method { get; set; }
|
||||||
|
public string password { get; set; }
|
||||||
|
public string plugin { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -32,4 +32,4 @@ using System.Runtime.InteropServices;
|
|||||||
// 方法是按如下所示使用“*”:
|
// 方法是按如下所示使用“*”:
|
||||||
//[assembly: AssemblyVersion("1.0.*")]
|
//[assembly: AssemblyVersion("1.0.*")]
|
||||||
//[assembly: AssemblyVersion("1.0.0")]
|
//[assembly: AssemblyVersion("1.0.0")]
|
||||||
[assembly: AssemblyFileVersion("5.20")]
|
[assembly: AssemblyFileVersion("5.23")]
|
||||||
|
|||||||
@@ -216,6 +216,7 @@
|
|||||||
<Compile Include="Mode\SysproxyConfig.cs" />
|
<Compile Include="Mode\SysproxyConfig.cs" />
|
||||||
<Compile Include="Mode\EConfigType.cs" />
|
<Compile Include="Mode\EConfigType.cs" />
|
||||||
<Compile Include="Mode\ServerTestItem.cs" />
|
<Compile Include="Mode\ServerTestItem.cs" />
|
||||||
|
<Compile Include="Mode\SsSIP008.cs" />
|
||||||
<Compile Include="Properties\Resources.Designer.cs">
|
<Compile Include="Properties\Resources.Designer.cs">
|
||||||
<AutoGen>True</AutoGen>
|
<AutoGen>True</AutoGen>
|
||||||
<DesignTime>True</DesignTime>
|
<DesignTime>True</DesignTime>
|
||||||
|
|||||||
Reference in New Issue
Block a user