mirror of
https://github.com/2dust/v2rayN.git
synced 2025-08-29 06:16:22 +00:00
增加一个设置,允许开启一个out为proxy的socks端口
This commit is contained in:
parent
b3292729b0
commit
ab12e3f531
11 changed files with 906 additions and 1464 deletions
|
@ -106,6 +106,12 @@ namespace v2rayN.Forms
|
|||
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());
|
||||
}
|
||||
|
||||
|
|
23
v2rayN/v2rayN/Forms/OptionSettingForm.Designer.cs
generated
23
v2rayN/v2rayN/Forms/OptionSettingForm.Designer.cs
generated
|
@ -33,6 +33,7 @@
|
|||
this.tabControl1 = new System.Windows.Forms.TabControl();
|
||||
this.tabPage1 = new System.Windows.Forms.TabPage();
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.chkaddGlobalProxyPort = new System.Windows.Forms.CheckBox();
|
||||
this.label16 = new System.Windows.Forms.Label();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.txtpass = new System.Windows.Forms.TextBox();
|
||||
|
@ -70,6 +71,7 @@
|
|||
this.txtKcpmtu = new System.Windows.Forms.TextBox();
|
||||
this.label6 = new System.Windows.Forms.Label();
|
||||
this.tabPage7 = new System.Windows.Forms.TabPage();
|
||||
this.chkEnableCheckPreReleaseUpdate = new System.Windows.Forms.CheckBox();
|
||||
this.numStatisticsFreshRate = new System.Windows.Forms.NumericUpDown();
|
||||
this.txttrayMenuServersLimit = new System.Windows.Forms.TextBox();
|
||||
this.label17 = new System.Windows.Forms.Label();
|
||||
|
@ -108,7 +110,6 @@
|
|||
this.panel2 = new System.Windows.Forms.Panel();
|
||||
this.btnOK = new System.Windows.Forms.Button();
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.chkEnableCheckPreReleaseUpdate = new System.Windows.Forms.CheckBox();
|
||||
this.tabControl1.SuspendLayout();
|
||||
this.tabPage1.SuspendLayout();
|
||||
this.groupBox1.SuspendLayout();
|
||||
|
@ -151,6 +152,7 @@
|
|||
//
|
||||
// groupBox1
|
||||
//
|
||||
this.groupBox1.Controls.Add(this.chkaddGlobalProxyPort);
|
||||
this.groupBox1.Controls.Add(this.label16);
|
||||
this.groupBox1.Controls.Add(this.label4);
|
||||
this.groupBox1.Controls.Add(this.txtpass);
|
||||
|
@ -171,6 +173,12 @@
|
|||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.TabStop = false;
|
||||
//
|
||||
// chkaddGlobalProxyPort
|
||||
//
|
||||
resources.ApplyResources(this.chkaddGlobalProxyPort, "chkaddGlobalProxyPort");
|
||||
this.chkaddGlobalProxyPort.Name = "chkaddGlobalProxyPort";
|
||||
this.chkaddGlobalProxyPort.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// label16
|
||||
//
|
||||
resources.ApplyResources(this.label16, "label16");
|
||||
|
@ -422,6 +430,12 @@
|
|||
this.tabPage7.Name = "tabPage7";
|
||||
this.tabPage7.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// chkEnableCheckPreReleaseUpdate
|
||||
//
|
||||
resources.ApplyResources(this.chkEnableCheckPreReleaseUpdate, "chkEnableCheckPreReleaseUpdate");
|
||||
this.chkEnableCheckPreReleaseUpdate.Name = "chkEnableCheckPreReleaseUpdate";
|
||||
this.chkEnableCheckPreReleaseUpdate.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// numStatisticsFreshRate
|
||||
//
|
||||
resources.ApplyResources(this.numStatisticsFreshRate, "numStatisticsFreshRate");
|
||||
|
@ -658,12 +672,6 @@
|
|||
resources.ApplyResources(this.panel1, "panel1");
|
||||
this.panel1.Name = "panel1";
|
||||
//
|
||||
// chkEnableCheckPreReleaseUpdate
|
||||
//
|
||||
resources.ApplyResources(this.chkEnableCheckPreReleaseUpdate, "chkEnableCheckPreReleaseUpdate");
|
||||
this.chkEnableCheckPreReleaseUpdate.Name = "chkEnableCheckPreReleaseUpdate";
|
||||
this.chkEnableCheckPreReleaseUpdate.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// OptionSettingForm
|
||||
//
|
||||
resources.ApplyResources(this, "$this");
|
||||
|
@ -778,5 +786,6 @@
|
|||
private System.Windows.Forms.ComboBox cmbdomainStrategy4Freedom;
|
||||
private System.Windows.Forms.Label label19;
|
||||
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;
|
||||
chksniffingEnabled.Checked = config.inbound[0].sniffingEnabled;
|
||||
chkAllowLANConn.Checked = config.inbound[0].allowLANConn;
|
||||
chkaddGlobalProxyPort.Checked = config.inbound[0].addGlobalProxyPort;
|
||||
txtuser.Text = config.inbound[0].user;
|
||||
txtpass.Text = config.inbound[0].pass;
|
||||
|
||||
|
@ -183,6 +184,8 @@ namespace v2rayN.Forms
|
|||
bool udpEnabled = chkudpEnabled.Checked;
|
||||
bool sniffingEnabled = chksniffingEnabled.Checked;
|
||||
bool allowLANConn = chkAllowLANConn.Checked;
|
||||
bool addGlobalProxyPort = chkaddGlobalProxyPort.Checked;
|
||||
|
||||
if (Utils.IsNullOrEmpty(localPort) || !Utils.IsNumberic(localPort))
|
||||
{
|
||||
UI.Show(ResUI.FillLocalListeningPort);
|
||||
|
@ -213,6 +216,7 @@ namespace v2rayN.Forms
|
|||
config.inbound[0].udpEnabled = udpEnabled;
|
||||
config.inbound[0].sniffingEnabled = sniffingEnabled;
|
||||
config.inbound[0].allowLANConn = allowLANConn;
|
||||
config.inbound[0].addGlobalProxyPort = addGlobalProxyPort;
|
||||
config.inbound[0].user = txtuser.Text;
|
||||
config.inbound[0].pass = txtpass.Text;
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -163,6 +163,12 @@
|
|||
<data name="chkAllowLANConn.Text" xml:space="preserve">
|
||||
<value>允许来自局域网的连接</value>
|
||||
</data>
|
||||
<data name="chkaddGlobalProxyPort.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>204, 16</value>
|
||||
</data>
|
||||
<data name="chkaddGlobalProxyPort.Text" xml:space="preserve">
|
||||
<value>增加一个本地全局socks端口</value>
|
||||
</data>
|
||||
<data name="chksniffingEnabled.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>96, 16</value>
|
||||
</data>
|
||||
|
|
|
@ -120,6 +120,7 @@ namespace v2rayN
|
|||
public const string InboundHttp = "http";
|
||||
public const string InboundSocks2 = "socks2";
|
||||
public const string InboundHttp2 = "http2";
|
||||
public const string InboundSocksG = "socksG";
|
||||
public const string Loopback = "127.0.0.1";
|
||||
public const string InboundAPITagName = "api";
|
||||
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 } };
|
||||
}
|
||||
}
|
||||
|
||||
if (config.inbound[0].addGlobalProxyPort)
|
||||
{
|
||||
Inbounds inbound5 = GetInbound(config.inbound[0], Global.InboundSocksG, 4, true);
|
||||
v2rayConfig.inbounds.Add(inbound5);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -202,6 +208,17 @@ namespace v2rayN.Handler
|
|||
v2rayConfig.routing.domainStrategy = config.domainStrategy;
|
||||
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.routings != null && config.routingIndex < config.routings.Count)
|
||||
|
|
|
@ -238,6 +238,10 @@ namespace v2rayN.Mode
|
|||
{
|
||||
return localPort + 3;
|
||||
}
|
||||
else if (protocol == Global.InboundSocksG)
|
||||
{
|
||||
return localPort + 4;
|
||||
}
|
||||
else if (protocol == "speedtest")
|
||||
{
|
||||
return localPort + 103;
|
||||
|
@ -611,6 +615,8 @@ namespace v2rayN.Mode
|
|||
|
||||
public bool allowLANConn { get; set; }
|
||||
|
||||
public bool addGlobalProxyPort { get; set; }
|
||||
|
||||
public string user { get; set; }
|
||||
|
||||
public string pass { get; set; }
|
||||
|
|
13
v2rayN/v2rayN/Resx/ResUI.Designer.cs
generated
13
v2rayN/v2rayN/Resx/ResUI.Designer.cs
generated
|
@ -338,7 +338,18 @@ namespace v2rayN.Resx {
|
|||
return ResourceManager.GetString("LabLocal", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 Local 的本地化字符串。
|
||||
/// </summary>
|
||||
internal static string LabLocalGlobal
|
||||
{
|
||||
get
|
||||
{
|
||||
return ResourceManager.GetString("LabLocalGlobal", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 Address 的本地化字符串。
|
||||
/// </summary>
|
||||
|
|
|
@ -475,4 +475,7 @@
|
|||
<data name="NetFrameworkRequirementsTip" xml:space="preserve">
|
||||
<value>Normal use of this version requires .NET Framework 4.8</value>
|
||||
</data>
|
||||
<data name="LabLocalGlobal" xml:space="preserve">
|
||||
<value>Global</value>
|
||||
</data>
|
||||
</root>
|
|
@ -475,4 +475,7 @@
|
|||
<data name="NetFrameworkRequirementsTip" xml:space="preserve">
|
||||
<value>正常使用此版本需要.NET Framework 4.8,请更新后重启</value>
|
||||
</data>
|
||||
<data name="LabLocalGlobal" xml:space="preserve">
|
||||
<value>全局</value>
|
||||
</data>
|
||||
</root>
|
Loading…
Reference in a new issue