mirror of
https://github.com/2dust/v2rayN.git
synced 2025-08-29 14:26:20 +00:00
增加一个全局生效的socks端口
This commit is contained in:
parent
b3292729b0
commit
5f7feac85c
12 changed files with 1239 additions and 1156 deletions
|
@ -106,6 +106,12 @@ namespace v2rayN.Forms
|
||||||
sb.Append($"[{Global.InboundHttp}:{config.GetLocalPort(Global.InboundHttp2)}]");
|
sb.Append($"[{Global.InboundHttp}:{config.GetLocalPort(Global.InboundHttp2)}]");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (config.inbound[0].addGlobalProxyPort)
|
||||||
|
{
|
||||||
|
sb.Append($" {ResUI.LabLocalGlobal}:");
|
||||||
|
sb.Append($"[{Global.InboundSocks}:{config.GetLocalPort(Global.InboundSocksG)}]");
|
||||||
|
}
|
||||||
|
|
||||||
SetToolSslInfo("inbound", sb.ToString());
|
SetToolSslInfo("inbound", sb.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
19
v2rayN/v2rayN/Forms/OptionSettingForm.Designer.cs
generated
19
v2rayN/v2rayN/Forms/OptionSettingForm.Designer.cs
generated
|
@ -70,6 +70,7 @@
|
||||||
this.txtKcpmtu = new System.Windows.Forms.TextBox();
|
this.txtKcpmtu = new System.Windows.Forms.TextBox();
|
||||||
this.label6 = new System.Windows.Forms.Label();
|
this.label6 = new System.Windows.Forms.Label();
|
||||||
this.tabPage7 = new System.Windows.Forms.TabPage();
|
this.tabPage7 = new System.Windows.Forms.TabPage();
|
||||||
|
this.chkEnableCheckPreReleaseUpdate = new System.Windows.Forms.CheckBox();
|
||||||
this.numStatisticsFreshRate = new System.Windows.Forms.NumericUpDown();
|
this.numStatisticsFreshRate = new System.Windows.Forms.NumericUpDown();
|
||||||
this.txttrayMenuServersLimit = new System.Windows.Forms.TextBox();
|
this.txttrayMenuServersLimit = new System.Windows.Forms.TextBox();
|
||||||
this.label17 = new System.Windows.Forms.Label();
|
this.label17 = new System.Windows.Forms.Label();
|
||||||
|
@ -108,7 +109,7 @@
|
||||||
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.chkEnableCheckPreReleaseUpdate = new System.Windows.Forms.CheckBox();
|
this.chkaddGlobalProxyPort = new System.Windows.Forms.CheckBox();
|
||||||
this.tabControl1.SuspendLayout();
|
this.tabControl1.SuspendLayout();
|
||||||
this.tabPage1.SuspendLayout();
|
this.tabPage1.SuspendLayout();
|
||||||
this.groupBox1.SuspendLayout();
|
this.groupBox1.SuspendLayout();
|
||||||
|
@ -151,6 +152,7 @@
|
||||||
//
|
//
|
||||||
// groupBox1
|
// groupBox1
|
||||||
//
|
//
|
||||||
|
this.groupBox1.Controls.Add(this.chkaddGlobalProxyPort);
|
||||||
this.groupBox1.Controls.Add(this.label16);
|
this.groupBox1.Controls.Add(this.label16);
|
||||||
this.groupBox1.Controls.Add(this.label4);
|
this.groupBox1.Controls.Add(this.label4);
|
||||||
this.groupBox1.Controls.Add(this.txtpass);
|
this.groupBox1.Controls.Add(this.txtpass);
|
||||||
|
@ -422,6 +424,12 @@
|
||||||
this.tabPage7.Name = "tabPage7";
|
this.tabPage7.Name = "tabPage7";
|
||||||
this.tabPage7.UseVisualStyleBackColor = true;
|
this.tabPage7.UseVisualStyleBackColor = true;
|
||||||
//
|
//
|
||||||
|
// chkEnableCheckPreReleaseUpdate
|
||||||
|
//
|
||||||
|
resources.ApplyResources(this.chkEnableCheckPreReleaseUpdate, "chkEnableCheckPreReleaseUpdate");
|
||||||
|
this.chkEnableCheckPreReleaseUpdate.Name = "chkEnableCheckPreReleaseUpdate";
|
||||||
|
this.chkEnableCheckPreReleaseUpdate.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
// numStatisticsFreshRate
|
// numStatisticsFreshRate
|
||||||
//
|
//
|
||||||
resources.ApplyResources(this.numStatisticsFreshRate, "numStatisticsFreshRate");
|
resources.ApplyResources(this.numStatisticsFreshRate, "numStatisticsFreshRate");
|
||||||
|
@ -658,11 +666,11 @@
|
||||||
resources.ApplyResources(this.panel1, "panel1");
|
resources.ApplyResources(this.panel1, "panel1");
|
||||||
this.panel1.Name = "panel1";
|
this.panel1.Name = "panel1";
|
||||||
//
|
//
|
||||||
// chkEnableCheckPreReleaseUpdate
|
// chkaddGlobalProxyPort
|
||||||
//
|
//
|
||||||
resources.ApplyResources(this.chkEnableCheckPreReleaseUpdate, "chkEnableCheckPreReleaseUpdate");
|
resources.ApplyResources(this.chkaddGlobalProxyPort, "chkaddGlobalProxyPort");
|
||||||
this.chkEnableCheckPreReleaseUpdate.Name = "chkEnableCheckPreReleaseUpdate";
|
this.chkaddGlobalProxyPort.Name = "chkaddGlobalProxyPort";
|
||||||
this.chkEnableCheckPreReleaseUpdate.UseVisualStyleBackColor = true;
|
this.chkaddGlobalProxyPort.UseVisualStyleBackColor = true;
|
||||||
//
|
//
|
||||||
// OptionSettingForm
|
// OptionSettingForm
|
||||||
//
|
//
|
||||||
|
@ -778,5 +786,6 @@
|
||||||
private System.Windows.Forms.ComboBox cmbdomainStrategy4Freedom;
|
private System.Windows.Forms.ComboBox cmbdomainStrategy4Freedom;
|
||||||
private System.Windows.Forms.Label label19;
|
private System.Windows.Forms.Label label19;
|
||||||
private System.Windows.Forms.CheckBox chkEnableCheckPreReleaseUpdate;
|
private System.Windows.Forms.CheckBox chkEnableCheckPreReleaseUpdate;
|
||||||
|
private System.Windows.Forms.CheckBox chkaddGlobalProxyPort;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -49,6 +49,7 @@ namespace v2rayN.Forms
|
||||||
chkudpEnabled.Checked = config.inbound[0].udpEnabled;
|
chkudpEnabled.Checked = config.inbound[0].udpEnabled;
|
||||||
chksniffingEnabled.Checked = config.inbound[0].sniffingEnabled;
|
chksniffingEnabled.Checked = config.inbound[0].sniffingEnabled;
|
||||||
chkAllowLANConn.Checked = config.inbound[0].allowLANConn;
|
chkAllowLANConn.Checked = config.inbound[0].allowLANConn;
|
||||||
|
chkaddGlobalProxyPort.Checked = config.inbound[0].addGlobalProxyPort;
|
||||||
txtuser.Text = config.inbound[0].user;
|
txtuser.Text = config.inbound[0].user;
|
||||||
txtpass.Text = config.inbound[0].pass;
|
txtpass.Text = config.inbound[0].pass;
|
||||||
|
|
||||||
|
@ -183,6 +184,7 @@ namespace v2rayN.Forms
|
||||||
bool udpEnabled = chkudpEnabled.Checked;
|
bool udpEnabled = chkudpEnabled.Checked;
|
||||||
bool sniffingEnabled = chksniffingEnabled.Checked;
|
bool sniffingEnabled = chksniffingEnabled.Checked;
|
||||||
bool allowLANConn = chkAllowLANConn.Checked;
|
bool allowLANConn = chkAllowLANConn.Checked;
|
||||||
|
bool addGlobalProxyPort = chkaddGlobalProxyPort.Checked;
|
||||||
if (Utils.IsNullOrEmpty(localPort) || !Utils.IsNumberic(localPort))
|
if (Utils.IsNullOrEmpty(localPort) || !Utils.IsNumberic(localPort))
|
||||||
{
|
{
|
||||||
UI.Show(ResUI.FillLocalListeningPort);
|
UI.Show(ResUI.FillLocalListeningPort);
|
||||||
|
@ -213,6 +215,7 @@ namespace v2rayN.Forms
|
||||||
config.inbound[0].udpEnabled = udpEnabled;
|
config.inbound[0].udpEnabled = udpEnabled;
|
||||||
config.inbound[0].sniffingEnabled = sniffingEnabled;
|
config.inbound[0].sniffingEnabled = sniffingEnabled;
|
||||||
config.inbound[0].allowLANConn = allowLANConn;
|
config.inbound[0].allowLANConn = allowLANConn;
|
||||||
|
config.inbound[0].addGlobalProxyPort = addGlobalProxyPort;
|
||||||
config.inbound[0].user = txtuser.Text;
|
config.inbound[0].user = txtuser.Text;
|
||||||
config.inbound[0].pass = txtpass.Text;
|
config.inbound[0].pass = txtpass.Text;
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -163,8 +163,14 @@
|
||||||
<data name="chkAllowLANConn.Text" xml:space="preserve">
|
<data name="chkAllowLANConn.Text" xml:space="preserve">
|
||||||
<value>允许来自局域网的连接</value>
|
<value>允许来自局域网的连接</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="chksniffingEnabled.Size" type="System.Drawing.Size, System.Drawing">
|
<data name="chkAllowLANConn.Size" type="System.Drawing.Size, System.Drawing">
|
||||||
<value>96, 16</value>
|
<value>144, 16</value>
|
||||||
|
</data>
|
||||||
|
<data name="chkaddGlobalProxyPort.Text" xml:space="preserve">
|
||||||
|
<value>增加一个本地全局socks端口</value>
|
||||||
|
</data>
|
||||||
|
<data name="chkaddGlobalProxyPort.Size" type="System.Drawing.Size, System.Drawing">
|
||||||
|
<value>144, 16</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="chksniffingEnabled.Text" xml:space="preserve">
|
<data name="chksniffingEnabled.Text" xml:space="preserve">
|
||||||
<value>开启流量探测</value>
|
<value>开启流量探测</value>
|
||||||
|
|
|
@ -120,6 +120,7 @@ namespace v2rayN
|
||||||
public const string InboundHttp = "http";
|
public const string InboundHttp = "http";
|
||||||
public const string InboundSocks2 = "socks2";
|
public const string InboundSocks2 = "socks2";
|
||||||
public const string InboundHttp2 = "http2";
|
public const string InboundHttp2 = "http2";
|
||||||
|
public const string InboundSocksG = "socksG";
|
||||||
public const string Loopback = "127.0.0.1";
|
public const string Loopback = "127.0.0.1";
|
||||||
public const string InboundAPITagName = "api";
|
public const string InboundAPITagName = "api";
|
||||||
public const string InboundAPIProtocal = "dokodemo-door";
|
public const string InboundAPIProtocal = "dokodemo-door";
|
||||||
|
|
|
@ -156,6 +156,12 @@ namespace v2rayN.Handler
|
||||||
inbound4.settings.accounts = new List<AccountsItem> { new AccountsItem() { user = config.inbound[0].user, pass = config.inbound[0].pass } };
|
inbound4.settings.accounts = new List<AccountsItem> { new AccountsItem() { user = config.inbound[0].user, pass = config.inbound[0].pass } };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (config.inbound[0].addGlobalProxyPort)
|
||||||
|
{
|
||||||
|
Inbounds inbound5 = GetInbound(config.inbound[0], Global.InboundSocksG, 4, true);
|
||||||
|
v2rayConfig.inbounds.Add(inbound5);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -202,6 +208,17 @@ namespace v2rayN.Handler
|
||||||
v2rayConfig.routing.domainStrategy = config.domainStrategy;
|
v2rayConfig.routing.domainStrategy = config.domainStrategy;
|
||||||
v2rayConfig.routing.domainMatcher = Utils.IsNullOrEmpty(config.domainMatcher) ? null : config.domainMatcher;
|
v2rayConfig.routing.domainMatcher = Utils.IsNullOrEmpty(config.domainMatcher) ? null : config.domainMatcher;
|
||||||
|
|
||||||
|
if (config.inbound[0].addGlobalProxyPort)
|
||||||
|
{
|
||||||
|
var item = new RulesItem();
|
||||||
|
var inTag = new List<String>();
|
||||||
|
inTag.Add("socksG");
|
||||||
|
item.type = "field";
|
||||||
|
item.inboundTag = inTag;
|
||||||
|
item.outboundTag = "proxy";
|
||||||
|
v2rayConfig.routing.rules.Add(item);
|
||||||
|
}
|
||||||
|
|
||||||
if (config.enableRoutingAdvanced)
|
if (config.enableRoutingAdvanced)
|
||||||
{
|
{
|
||||||
if (config.routings != null && config.routingIndex < config.routings.Count)
|
if (config.routings != null && config.routingIndex < config.routings.Count)
|
||||||
|
|
|
@ -238,6 +238,10 @@ namespace v2rayN.Mode
|
||||||
{
|
{
|
||||||
return localPort + 3;
|
return localPort + 3;
|
||||||
}
|
}
|
||||||
|
else if (protocol == Global.InboundSocksG)
|
||||||
|
{
|
||||||
|
return localPort + 4;
|
||||||
|
}
|
||||||
else if (protocol == "speedtest")
|
else if (protocol == "speedtest")
|
||||||
{
|
{
|
||||||
return localPort + 103;
|
return localPort + 103;
|
||||||
|
@ -611,6 +615,8 @@ namespace v2rayN.Mode
|
||||||
|
|
||||||
public bool allowLANConn { get; set; }
|
public bool allowLANConn { get; set; }
|
||||||
|
|
||||||
|
public bool addGlobalProxyPort { get; set; }
|
||||||
|
|
||||||
public string user { get; set; }
|
public string user { get; set; }
|
||||||
|
|
||||||
public string pass { get; set; }
|
public string pass { get; set; }
|
||||||
|
|
2
v2rayN/v2rayN/Properties/Settings.Designer.cs
generated
2
v2rayN/v2rayN/Properties/Settings.Designer.cs
generated
|
@ -12,7 +12,7 @@ namespace v2rayN.Properties {
|
||||||
|
|
||||||
|
|
||||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.3.0.0")]
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.2.0.0")]
|
||||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||||
|
|
||||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||||
|
|
11
v2rayN/v2rayN/Resx/ResUI.Designer.cs
generated
11
v2rayN/v2rayN/Resx/ResUI.Designer.cs
generated
|
@ -339,6 +339,17 @@ namespace v2rayN.Resx {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 Local 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
internal static string LabLocalGlobal
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return ResourceManager.GetString("LabLocalGlobal", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找类似 Address 的本地化字符串。
|
/// 查找类似 Address 的本地化字符串。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -475,4 +475,7 @@
|
||||||
<data name="NetFrameworkRequirementsTip" xml:space="preserve">
|
<data name="NetFrameworkRequirementsTip" xml:space="preserve">
|
||||||
<value>Normal use of this version requires .NET Framework 4.8</value>
|
<value>Normal use of this version requires .NET Framework 4.8</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="LabLocalGlobal" xml:space="preserve">
|
||||||
|
<value>Global</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
|
@ -475,4 +475,7 @@
|
||||||
<data name="NetFrameworkRequirementsTip" xml:space="preserve">
|
<data name="NetFrameworkRequirementsTip" xml:space="preserve">
|
||||||
<value>正常使用此版本需要.NET Framework 4.8,请更新后重启</value>
|
<value>正常使用此版本需要.NET Framework 4.8,请更新后重启</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="LabLocalGlobal" xml:space="preserve">
|
||||||
|
<value>全局</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
Loading…
Reference in a new issue