mirror of
https://github.com/2dust/v2rayN.git
synced 2025-07-01 20:42:10 +00:00
Refactor local listening port
This commit is contained in:
parent
e2f399eeb1
commit
a8bc9ce605
16 changed files with 1067 additions and 587 deletions
|
@ -435,13 +435,6 @@ namespace v2rayN.Forms
|
|||
//qrCodeControl.showQRCode(index, config);
|
||||
}
|
||||
|
||||
private void DisplayToolStatus()
|
||||
{
|
||||
toolSslInboundInfo.Text = $"{Global.InboundSocks} {Global.Loopback}:{config.inbound[0].localPort} | "
|
||||
+ $"{ Global.InboundHttp} { Global.Loopback}:{Global.httpPort}";
|
||||
|
||||
notifyMain.Icon = MainFormHandler.Instance.GetNotifyIcon(config, this.Icon);
|
||||
}
|
||||
private void ssMain_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
|
||||
{
|
||||
if (!Utils.IsNullOrEmpty(e.ClickedItem.Text))
|
||||
|
@ -1401,6 +1394,23 @@ namespace v2rayN.Forms
|
|||
DisplayToolStatus();
|
||||
}
|
||||
|
||||
private void DisplayToolStatus()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append($"{Global.InboundSocks} {Global.Loopback}:{config.GetLocalPort(Global.InboundSocks)}");
|
||||
sb.Append(" | ");
|
||||
sb.Append($"{Global.InboundHttp} {Global.Loopback}:{config.GetLocalPort(Global.InboundHttp)}");
|
||||
|
||||
if (config.sysProxyType == ESysProxyType.ForcedChange)
|
||||
{
|
||||
sb.Append(" | ");
|
||||
sb.Append($"{ResUI.SystemProxy} {Global.Loopback}:{config.GetLocalPort(Global.InboundHttp2)}");
|
||||
}
|
||||
|
||||
toolSslInboundInfo.Text = sb.ToString();
|
||||
|
||||
notifyMain.Icon = MainFormHandler.Instance.GetNotifyIcon(config, this.Icon);
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
|
|
101
v2rayN/v2rayN/Forms/OptionSettingForm.Designer.cs
generated
101
v2rayN/v2rayN/Forms/OptionSettingForm.Designer.cs
generated
|
@ -33,15 +33,14 @@
|
|||
this.tabControl1 = new System.Windows.Forms.TabControl();
|
||||
this.tabPage1 = new System.Windows.Forms.TabPage();
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.label16 = new System.Windows.Forms.Label();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.txtpass = new System.Windows.Forms.TextBox();
|
||||
this.txtuser = new System.Windows.Forms.TextBox();
|
||||
this.chkdefAllowInsecure = new System.Windows.Forms.CheckBox();
|
||||
this.chksniffingEnabled2 = new System.Windows.Forms.CheckBox();
|
||||
this.chkAllowLANConn = new System.Windows.Forms.CheckBox();
|
||||
this.chksniffingEnabled = new System.Windows.Forms.CheckBox();
|
||||
this.chkmuxEnabled = new System.Windows.Forms.CheckBox();
|
||||
this.chkAllowIn2 = new System.Windows.Forms.CheckBox();
|
||||
this.chkudpEnabled2 = new System.Windows.Forms.CheckBox();
|
||||
this.cmbprotocol2 = new System.Windows.Forms.ComboBox();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.txtlocalPort2 = new System.Windows.Forms.TextBox();
|
||||
this.cmbprotocol = new System.Windows.Forms.ComboBox();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.chkudpEnabled = new System.Windows.Forms.CheckBox();
|
||||
|
@ -79,7 +78,6 @@
|
|||
this.cbFreshrate = new System.Windows.Forms.ComboBox();
|
||||
this.lbFreshrate = new System.Windows.Forms.Label();
|
||||
this.chkEnableStatistics = new System.Windows.Forms.CheckBox();
|
||||
this.chkAllowLANConn = new System.Windows.Forms.CheckBox();
|
||||
this.chkAutoRun = new System.Windows.Forms.CheckBox();
|
||||
this.tabPageCoreType = new System.Windows.Forms.TabPage();
|
||||
this.cmbCoreType6 = new System.Windows.Forms.ComboBox();
|
||||
|
@ -143,15 +141,14 @@
|
|||
//
|
||||
// groupBox1
|
||||
//
|
||||
this.groupBox1.Controls.Add(this.label16);
|
||||
this.groupBox1.Controls.Add(this.label4);
|
||||
this.groupBox1.Controls.Add(this.txtpass);
|
||||
this.groupBox1.Controls.Add(this.txtuser);
|
||||
this.groupBox1.Controls.Add(this.chkdefAllowInsecure);
|
||||
this.groupBox1.Controls.Add(this.chksniffingEnabled2);
|
||||
this.groupBox1.Controls.Add(this.chkAllowLANConn);
|
||||
this.groupBox1.Controls.Add(this.chksniffingEnabled);
|
||||
this.groupBox1.Controls.Add(this.chkmuxEnabled);
|
||||
this.groupBox1.Controls.Add(this.chkAllowIn2);
|
||||
this.groupBox1.Controls.Add(this.chkudpEnabled2);
|
||||
this.groupBox1.Controls.Add(this.cmbprotocol2);
|
||||
this.groupBox1.Controls.Add(this.label3);
|
||||
this.groupBox1.Controls.Add(this.txtlocalPort2);
|
||||
this.groupBox1.Controls.Add(this.cmbprotocol);
|
||||
this.groupBox1.Controls.Add(this.label1);
|
||||
this.groupBox1.Controls.Add(this.chkudpEnabled);
|
||||
|
@ -164,17 +161,37 @@
|
|||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.TabStop = false;
|
||||
//
|
||||
// label16
|
||||
//
|
||||
resources.ApplyResources(this.label16, "label16");
|
||||
this.label16.Name = "label16";
|
||||
//
|
||||
// label4
|
||||
//
|
||||
resources.ApplyResources(this.label4, "label4");
|
||||
this.label4.Name = "label4";
|
||||
//
|
||||
// txtpass
|
||||
//
|
||||
resources.ApplyResources(this.txtpass, "txtpass");
|
||||
this.txtpass.Name = "txtpass";
|
||||
//
|
||||
// txtuser
|
||||
//
|
||||
resources.ApplyResources(this.txtuser, "txtuser");
|
||||
this.txtuser.Name = "txtuser";
|
||||
//
|
||||
// chkdefAllowInsecure
|
||||
//
|
||||
resources.ApplyResources(this.chkdefAllowInsecure, "chkdefAllowInsecure");
|
||||
this.chkdefAllowInsecure.Name = "chkdefAllowInsecure";
|
||||
this.chkdefAllowInsecure.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// chksniffingEnabled2
|
||||
// chkAllowLANConn
|
||||
//
|
||||
resources.ApplyResources(this.chksniffingEnabled2, "chksniffingEnabled2");
|
||||
this.chksniffingEnabled2.Name = "chksniffingEnabled2";
|
||||
this.chksniffingEnabled2.UseVisualStyleBackColor = true;
|
||||
resources.ApplyResources(this.chkAllowLANConn, "chkAllowLANConn");
|
||||
this.chkAllowLANConn.Name = "chkAllowLANConn";
|
||||
this.chkAllowLANConn.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// chksniffingEnabled
|
||||
//
|
||||
|
@ -188,39 +205,6 @@
|
|||
this.chkmuxEnabled.Name = "chkmuxEnabled";
|
||||
this.chkmuxEnabled.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// chkAllowIn2
|
||||
//
|
||||
resources.ApplyResources(this.chkAllowIn2, "chkAllowIn2");
|
||||
this.chkAllowIn2.Name = "chkAllowIn2";
|
||||
this.chkAllowIn2.UseVisualStyleBackColor = true;
|
||||
this.chkAllowIn2.CheckedChanged += new System.EventHandler(this.chkAllowIn2_CheckedChanged);
|
||||
//
|
||||
// chkudpEnabled2
|
||||
//
|
||||
resources.ApplyResources(this.chkudpEnabled2, "chkudpEnabled2");
|
||||
this.chkudpEnabled2.Name = "chkudpEnabled2";
|
||||
this.chkudpEnabled2.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// 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
|
||||
//
|
||||
resources.ApplyResources(this.label3, "label3");
|
||||
this.label3.Name = "label3";
|
||||
//
|
||||
// txtlocalPort2
|
||||
//
|
||||
resources.ApplyResources(this.txtlocalPort2, "txtlocalPort2");
|
||||
this.txtlocalPort2.Name = "txtlocalPort2";
|
||||
//
|
||||
// cmbprotocol
|
||||
//
|
||||
this.cmbprotocol.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
|
@ -399,7 +383,6 @@
|
|||
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.chkAutoRun);
|
||||
resources.ApplyResources(this.tabPage7, "tabPage7");
|
||||
this.tabPage7.Name = "tabPage7";
|
||||
|
@ -464,12 +447,6 @@
|
|||
this.chkEnableStatistics.Name = "chkEnableStatistics";
|
||||
this.chkEnableStatistics.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// chkAllowLANConn
|
||||
//
|
||||
resources.ApplyResources(this.chkAllowLANConn, "chkAllowLANConn");
|
||||
this.chkAllowLANConn.Name = "chkAllowLANConn";
|
||||
this.chkAllowLANConn.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// chkAutoRun
|
||||
//
|
||||
resources.ApplyResources(this.chkAutoRun, "chkAutoRun");
|
||||
|
@ -664,11 +641,6 @@
|
|||
private System.Windows.Forms.Panel panel2;
|
||||
private System.Windows.Forms.ComboBox cmbprotocol;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.ComboBox cmbprotocol2;
|
||||
private System.Windows.Forms.Label label3;
|
||||
private System.Windows.Forms.TextBox txtlocalPort2;
|
||||
private System.Windows.Forms.CheckBox chkudpEnabled2;
|
||||
private System.Windows.Forms.CheckBox chkAllowIn2;
|
||||
private System.Windows.Forms.CheckBox chkmuxEnabled;
|
||||
private System.Windows.Forms.TabPage tabPage6;
|
||||
private System.Windows.Forms.TextBox txtKcpmtu;
|
||||
|
@ -688,7 +660,6 @@
|
|||
private System.Windows.Forms.CheckBox chkAutoRun;
|
||||
private System.Windows.Forms.CheckBox chkAllowLANConn;
|
||||
private System.Windows.Forms.CheckBox chksniffingEnabled;
|
||||
private System.Windows.Forms.CheckBox chksniffingEnabled2;
|
||||
private System.Windows.Forms.CheckBox chkEnableStatistics;
|
||||
private System.Windows.Forms.ComboBox cbFreshrate;
|
||||
private System.Windows.Forms.Label lbFreshrate;
|
||||
|
@ -722,5 +693,9 @@
|
|||
private System.Windows.Forms.Label labCoreType3;
|
||||
private System.Windows.Forms.ComboBox cmbCoreType2;
|
||||
private System.Windows.Forms.Label labCoreType2;
|
||||
private System.Windows.Forms.Label label16;
|
||||
private System.Windows.Forms.Label label4;
|
||||
private System.Windows.Forms.TextBox txtpass;
|
||||
private System.Windows.Forms.TextBox txtuser;
|
||||
}
|
||||
}
|
|
@ -46,23 +46,10 @@ namespace v2rayN.Forms
|
|||
cmbprotocol.Text = config.inbound[0].protocol.ToString();
|
||||
chkudpEnabled.Checked = config.inbound[0].udpEnabled;
|
||||
chksniffingEnabled.Checked = config.inbound[0].sniffingEnabled;
|
||||
chkAllowLANConn.Checked = config.inbound[0].allowLANConn;
|
||||
txtuser.Text = config.inbound[0].user;
|
||||
txtpass.Text = config.inbound[0].pass;
|
||||
|
||||
txtlocalPort2.Text = $"{config.inbound[0].localPort + 1}";
|
||||
cmbprotocol2.Text = Global.InboundHttp;
|
||||
|
||||
if (config.inbound.Count > 1)
|
||||
{
|
||||
txtlocalPort2.Text = config.inbound[1].localPort.ToString();
|
||||
cmbprotocol2.Text = config.inbound[1].protocol.ToString();
|
||||
chkudpEnabled2.Checked = config.inbound[1].udpEnabled;
|
||||
chksniffingEnabled2.Checked = config.inbound[1].sniffingEnabled;
|
||||
chkAllowIn2.Checked = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
chkAllowIn2.Checked = false;
|
||||
}
|
||||
chkAllowIn2State();
|
||||
}
|
||||
|
||||
//remoteDNS
|
||||
|
@ -96,7 +83,6 @@ namespace v2rayN.Forms
|
|||
//开机自动启动
|
||||
chkAutoRun.Checked = Utils.IsAutoRun();
|
||||
|
||||
chkAllowLANConn.Checked = config.allowLANConn;
|
||||
chkEnableStatistics.Checked = config.enableStatistics;
|
||||
chkKeepOlderDedupl.Checked = config.keepOlderDedupl;
|
||||
|
||||
|
@ -210,6 +196,7 @@ namespace v2rayN.Forms
|
|||
string protocol = cmbprotocol.Text.TrimEx();
|
||||
bool udpEnabled = chkudpEnabled.Checked;
|
||||
bool sniffingEnabled = chksniffingEnabled.Checked;
|
||||
bool allowLANConn = chkAllowLANConn.Checked;
|
||||
if (Utils.IsNullOrEmpty(localPort) || !Utils.IsNumberic(localPort))
|
||||
{
|
||||
UI.Show(ResUI.FillLocalListeningPort);
|
||||
|
@ -239,41 +226,16 @@ namespace v2rayN.Forms
|
|||
config.inbound[0].protocol = protocol;
|
||||
config.inbound[0].udpEnabled = udpEnabled;
|
||||
config.inbound[0].sniffingEnabled = sniffingEnabled;
|
||||
config.inbound[0].allowLANConn = allowLANConn;
|
||||
config.inbound[0].user = txtuser.Text;
|
||||
config.inbound[0].pass = txtpass.Text;
|
||||
|
||||
//本地监听2
|
||||
string localPort2 = txtlocalPort2.Text.TrimEx();
|
||||
string protocol2 = cmbprotocol2.Text.TrimEx();
|
||||
bool udpEnabled2 = chkudpEnabled2.Checked;
|
||||
bool sniffingEnabled2 = chksniffingEnabled2.Checked;
|
||||
if (chkAllowIn2.Checked)
|
||||
if (config.inbound.Count > 1)
|
||||
{
|
||||
if (Utils.IsNullOrEmpty(localPort2) || !Utils.IsNumberic(localPort2))
|
||||
{
|
||||
UI.Show(ResUI.FillLocalListeningPort);
|
||||
return -1;
|
||||
}
|
||||
if (Utils.IsNullOrEmpty(protocol2))
|
||||
{
|
||||
UI.Show(ResUI.PleaseSelectProtocol);
|
||||
return -1;
|
||||
}
|
||||
if (config.inbound.Count < 2)
|
||||
{
|
||||
config.inbound.Add(new Mode.InItem());
|
||||
}
|
||||
config.inbound[1].localPort = Utils.ToInt(localPort2);
|
||||
config.inbound[1].protocol = protocol2;
|
||||
config.inbound[1].udpEnabled = udpEnabled2;
|
||||
config.inbound[1].sniffingEnabled = sniffingEnabled2;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (config.inbound.Count > 1)
|
||||
{
|
||||
config.inbound.RemoveAt(1);
|
||||
}
|
||||
config.inbound.RemoveAt(1);
|
||||
}
|
||||
|
||||
|
||||
//日志
|
||||
config.logEnabled = logEnabled;
|
||||
config.loglevel = loglevel;
|
||||
|
@ -336,8 +298,6 @@ namespace v2rayN.Forms
|
|||
//开机自动启动
|
||||
Utils.SetAutoRun(chkAutoRun.Checked);
|
||||
|
||||
config.allowLANConn = chkAllowLANConn.Checked;
|
||||
|
||||
bool lastEnableStatistics = config.enableStatistics;
|
||||
config.enableStatistics = chkEnableStatistics.Checked;
|
||||
config.statisticsFreshRate = (int)cbFreshrate.SelectedValue;
|
||||
|
@ -367,17 +327,6 @@ namespace v2rayN.Forms
|
|||
this.DialogResult = DialogResult.Cancel;
|
||||
}
|
||||
|
||||
private void chkAllowIn2_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
chkAllowIn2State();
|
||||
}
|
||||
private void chkAllowIn2State()
|
||||
{
|
||||
bool blAllow2 = chkAllowIn2.Checked;
|
||||
txtlocalPort2.Enabled =
|
||||
cmbprotocol2.Enabled =
|
||||
chkudpEnabled2.Enabled = blAllow2;
|
||||
}
|
||||
|
||||
private void linkDnsObjectDoc_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
|
||||
{
|
||||
|
@ -388,5 +337,6 @@ namespace v2rayN.Forms
|
|||
{
|
||||
Process.Start(Utils.GetPath("EnableLoopback.exe"));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -121,48 +121,96 @@
|
|||
<value>取消(&C)</value>
|
||||
</data>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="label16.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>53, 12</value>
|
||||
</data>
|
||||
<data name="label16.Text" xml:space="preserve">
|
||||
<value>认证密码</value>
|
||||
</data>
|
||||
<data name="label4.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>219, 65</value>
|
||||
</data>
|
||||
<data name="label4.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>65, 12</value>
|
||||
</data>
|
||||
<data name="label4.Text" xml:space="preserve">
|
||||
<value>认证用户名</value>
|
||||
</data>
|
||||
<data name="chkdefAllowInsecure.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>15, 208</value>
|
||||
</data>
|
||||
<data name="chkdefAllowInsecure.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>324, 16</value>
|
||||
</data>
|
||||
<data name="chkdefAllowInsecure.Text" xml:space="preserve">
|
||||
<value>传输层安全选tls时,默认跳过证书验证(allowInsecure)</value>
|
||||
</data>
|
||||
<data name="chksniffingEnabled2.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>468, 117</value>
|
||||
</data>
|
||||
<data name="chksniffingEnabled2.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>96, 16</value>
|
||||
</data>
|
||||
<data name="chksniffingEnabled2.Text" xml:space="preserve">
|
||||
<value>开启流量探测</value>
|
||||
</data>
|
||||
<data name="chkAllowLANConn.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>144, 16</value>
|
||||
</data>
|
||||
<data name="chkAllowLANConn.Text" xml:space="preserve">
|
||||
<value>允许来自局域网的连接</value>
|
||||
</data>
|
||||
<data name="chksniffingEnabled.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>96, 16</value>
|
||||
</data>
|
||||
<data name="chksniffingEnabled.Text" xml:space="preserve">
|
||||
<value>开启流量探测</value>
|
||||
</data>
|
||||
<data name="chkmuxEnabled.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>15, 145</value>
|
||||
</data>
|
||||
<data name="chkmuxEnabled.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>114, 16</value>
|
||||
</data>
|
||||
<data name="chkmuxEnabled.Text" xml:space="preserve">
|
||||
<value>开启Mux多路复用</value>
|
||||
</data>
|
||||
<data name="chkAllowIn2.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>15, 120</value>
|
||||
</data>
|
||||
<data name="chkAllowIn2.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>102, 16</value>
|
||||
</data>
|
||||
<data name="chkAllowIn2.Text" xml:space="preserve">
|
||||
<value>本地监听端口2</value>
|
||||
</data>
|
||||
<data name="chkudpEnabled2.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>369, 119</value>
|
||||
</data>
|
||||
<data name="chkudpEnabled2.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>66, 16</value>
|
||||
</data>
|
||||
<data name="chkudpEnabled2.Text" xml:space="preserve">
|
||||
<value>开启UDP</value>
|
||||
</data>
|
||||
<data name="cmbprotocol2.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>257, 117</value>
|
||||
</data>
|
||||
<data name="label3.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>206, 121</value>
|
||||
</data>
|
||||
<data name="label3.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>29, 12</value>
|
||||
</data>
|
||||
<data name="label3.Text" xml:space="preserve">
|
||||
<value>协议</value>
|
||||
</data>
|
||||
<data name="txtlocalPort2.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>124, 117</value>
|
||||
</data>
|
||||
<data name="label1.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>219, 29</value>
|
||||
</data>
|
||||
<data name="label1.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>29, 12</value>
|
||||
</data>
|
||||
|
@ -175,12 +223,21 @@
|
|||
<data name="chkudpEnabled.Text" xml:space="preserve">
|
||||
<value>开启UDP</value>
|
||||
</data>
|
||||
<data name="chklogEnabled.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>15, 176</value>
|
||||
</data>
|
||||
<data name="chklogEnabled.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>156, 16</value>
|
||||
</data>
|
||||
<data name="chklogEnabled.Text" xml:space="preserve">
|
||||
<value>记录本地日志(默认关闭)</value>
|
||||
</data>
|
||||
<data name="cmbloglevel.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>257, 174</value>
|
||||
</data>
|
||||
<data name="label5.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>193, 178</value>
|
||||
</data>
|
||||
<data name="label5.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>53, 12</value>
|
||||
</data>
|
||||
|
@ -253,12 +310,6 @@
|
|||
<data name="chkIgnoreGeoUpdateCore.Text" xml:space="preserve">
|
||||
<value>更新Core时忽略Geo文件</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>Core类型</value>
|
||||
</data>
|
||||
<data name="chkKeepOlderDedupl.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>156, 16</value>
|
||||
</data>
|
||||
|
@ -277,12 +328,6 @@
|
|||
<data name="chkEnableStatistics.Text" xml:space="preserve">
|
||||
<value>启用统计(实时网速显示和使用流量显示,需要重启v2rayN客户端)</value>
|
||||
</data>
|
||||
<data name="chkAllowLANConn.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>144, 16</value>
|
||||
</data>
|
||||
<data name="chkAllowLANConn.Text" xml:space="preserve">
|
||||
<value>允许来自局域网的连接</value>
|
||||
</data>
|
||||
<data name="chkAutoRun.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>180, 16</value>
|
||||
</data>
|
||||
|
@ -295,6 +340,12 @@
|
|||
<data name="tabPage7.Text" xml:space="preserve">
|
||||
<value> v2rayN设置 </value>
|
||||
</data>
|
||||
<data name="tabPageCoreType.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>654, 443</value>
|
||||
</data>
|
||||
<data name="tabPageCoreType.Text" xml:space="preserve">
|
||||
<value> Core类型设置 </value>
|
||||
</data>
|
||||
<data name="label13.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>95, 12</value>
|
||||
</data>
|
||||
|
@ -328,13 +379,16 @@
|
|||
<data name="panel2.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>0, 479</value>
|
||||
</data>
|
||||
<data name="panel2.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>662, 60</value>
|
||||
</data>
|
||||
<data name="panel1.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>662, 10</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>
|
||||
<data name="tabPageCoreType.Text" xml:space="preserve">
|
||||
<value> Core类型设置 </value>
|
||||
</data>
|
||||
</root>
|
|
@ -111,6 +111,7 @@ namespace v2rayN
|
|||
|
||||
public const string InboundSocks = "socks";
|
||||
public const string InboundHttp = "http";
|
||||
public const string InboundHttp2 = "http2";
|
||||
public const string Loopback = "127.0.0.1";
|
||||
public const string InboundAPITagName = "api";
|
||||
public const string InboundAPIProtocal = "dokodemo-door";
|
||||
|
@ -219,31 +220,6 @@ namespace v2rayN
|
|||
get; set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否开启全局代理(http)
|
||||
/// </summary>
|
||||
public static bool sysAgent
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// socks端口
|
||||
/// </summary>
|
||||
public static int socksPort
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// http端口
|
||||
/// </summary>
|
||||
public static int httpPort
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
|
|
|
@ -169,7 +169,7 @@ namespace v2rayN.Handler
|
|||
{
|
||||
try
|
||||
{
|
||||
int httpPort = _config.GetLocalPort(Global.InboundHttp);
|
||||
int httpPort = _config.GetLocalPort(Global.InboundHttp2);
|
||||
|
||||
Task<int> t = Task.Run(() =>
|
||||
{
|
||||
|
|
|
@ -59,8 +59,7 @@ namespace v2rayN.Handler
|
|||
|
||||
try
|
||||
{
|
||||
Global.httpPort = config.GetLocalPort(Global.InboundHttp);
|
||||
int port = Global.httpPort;
|
||||
int port = config.GetLocalPort(Global.InboundHttp2);
|
||||
if (port <= 0)
|
||||
{
|
||||
return false;
|
||||
|
|
|
@ -232,7 +232,7 @@ namespace v2rayN.Handler
|
|||
_updateFunc(false, args.GetException().Message);
|
||||
};
|
||||
|
||||
WebProxy webProxy = blProxy ? new WebProxy(Global.Loopback, _config.GetLocalPort(Global.InboundHttp)) : null;
|
||||
WebProxy webProxy = blProxy ? new WebProxy(Global.Loopback, _config.GetLocalPort(Global.InboundHttp2)) : null;
|
||||
downloadHandle3.WebDownloadString(url, webProxy, userAgent);
|
||||
|
||||
_updateFunc(false, $"{hashCode}{ResUI.MsgStartGettingSubscriptions}");
|
||||
|
@ -304,7 +304,7 @@ namespace v2rayN.Handler
|
|||
};
|
||||
if (httpProxyTest() > 0)
|
||||
{
|
||||
int httpPort = _config.GetLocalPort(Global.InboundHttp);
|
||||
int httpPort = _config.GetLocalPort(Global.InboundHttp2);
|
||||
WebProxy webProxy = new WebProxy(Global.Loopback, httpPort);
|
||||
webRequestHandler.Proxy = webProxy;
|
||||
}
|
||||
|
@ -460,7 +460,7 @@ namespace v2rayN.Handler
|
|||
{
|
||||
if (httpProxyTest() > 0)
|
||||
{
|
||||
int httpPort = _config.GetLocalPort(Global.InboundHttp);
|
||||
int httpPort = _config.GetLocalPort(Global.InboundHttp2);
|
||||
WebProxy webProxy = new WebProxy(Global.Loopback, httpPort);
|
||||
downloadHandle.DownloadFileAsync(url, webProxy, 600);
|
||||
}
|
||||
|
|
|
@ -150,7 +150,7 @@ namespace v2rayN.Handler
|
|||
inbound.tag = Global.InboundSocks;
|
||||
inbound.port = config.inbound[0].localPort;
|
||||
inbound.protocol = config.inbound[0].protocol;
|
||||
if (config.allowLANConn)
|
||||
if (config.inbound[0].allowLANConn)
|
||||
{
|
||||
inbound.listen = "0.0.0.0";
|
||||
}
|
||||
|
@ -170,6 +170,24 @@ namespace v2rayN.Handler
|
|||
inbound2.listen = inbound.listen;
|
||||
inbound2.settings.allowTransparent = false;
|
||||
inbound2.sniffing.enabled = inbound.sniffing.enabled;
|
||||
|
||||
//auth
|
||||
if (!Utils.IsNullOrEmpty(config.inbound[0].user) && !Utils.IsNullOrEmpty(config.inbound[0].pass))
|
||||
{
|
||||
inbound.settings.auth = "password";
|
||||
inbound.settings.accounts = new List<AccountsItem> { new AccountsItem() { user = config.inbound[0].user, pass = config.inbound[0].pass } };
|
||||
inbound2.settings.auth = "password";
|
||||
inbound2.settings.accounts = new List<AccountsItem> { new AccountsItem() { user = config.inbound[0].user, pass = config.inbound[0].pass } };
|
||||
}
|
||||
|
||||
//http Loopback
|
||||
Inbounds inbound3 = v2rayConfig.inbounds[2];
|
||||
inbound3.tag = Global.InboundHttp2;
|
||||
inbound3.port = config.GetLocalPort(Global.InboundHttp2);
|
||||
inbound3.protocol = Global.InboundHttp;
|
||||
inbound3.listen = Global.Loopback;
|
||||
inbound3.settings.allowTransparent = false;
|
||||
inbound3.sniffing.enabled = inbound.sniffing.enabled;
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
|
|
@ -52,14 +52,6 @@ namespace v2rayN.Mode
|
|||
get; set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 允许来自局域网的连接
|
||||
/// </summary>
|
||||
public bool allowLANConn
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 启用实时网速和流量统计
|
||||
/// </summary>
|
||||
|
@ -220,7 +212,10 @@ namespace v2rayN.Mode
|
|||
{
|
||||
return GetLocalPort(Global.InboundSocks) + 1;
|
||||
}
|
||||
|
||||
else if (protocol == Global.InboundHttp2)
|
||||
{
|
||||
return GetLocalPort(Global.InboundSocks) + 2;
|
||||
}
|
||||
else if (protocol == "speedtest")
|
||||
{
|
||||
return GetLocalPort(Global.InboundSocks) + 103;
|
||||
|
@ -581,6 +576,13 @@ namespace v2rayN.Mode
|
|||
/// 开启流量探测
|
||||
/// </summary>
|
||||
public bool sniffingEnabled { get; set; } = true;
|
||||
|
||||
public bool allowLANConn { get; set; }
|
||||
|
||||
public string user { get; set; }
|
||||
|
||||
public string pass { get; set; }
|
||||
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
|
|
|
@ -141,6 +141,7 @@ namespace v2rayN.Mode
|
|||
|
||||
public bool allowTransparent { get; set; }
|
||||
|
||||
public List<AccountsItem> accounts { get; set; }
|
||||
}
|
||||
|
||||
public class UsersItem
|
||||
|
@ -540,4 +541,15 @@ namespace v2rayN.Mode
|
|||
public bool multiMode { get; set; }
|
||||
}
|
||||
|
||||
public class AccountsItem
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string user { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string pass { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
9
v2rayN/v2rayN/Resx/ResUI.Designer.cs
generated
9
v2rayN/v2rayN/Resx/ResUI.Designer.cs
generated
|
@ -934,6 +934,15 @@ namespace v2rayN.Resx {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 System proxy 的本地化字符串。
|
||||
/// </summary>
|
||||
internal static string SystemProxy {
|
||||
get {
|
||||
return ResourceManager.GetString("SystemProxy", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 The ping of current service: {0} 的本地化字符串。
|
||||
/// </summary>
|
||||
|
|
|
@ -454,4 +454,7 @@
|
|||
<data name="FillServerAddressCustom" xml:space="preserve">
|
||||
<value>Please browse to import server configuration</value>
|
||||
</data>
|
||||
<data name="SystemProxy" xml:space="preserve">
|
||||
<value>System proxy</value>
|
||||
</data>
|
||||
</root>
|
|
@ -454,4 +454,7 @@
|
|||
<data name="FillServerAddressCustom" xml:space="preserve">
|
||||
<value>请浏览导入服务器配置</value>
|
||||
</data>
|
||||
<data name="SystemProxy" xml:space="preserve">
|
||||
<value>系统代理</value>
|
||||
</data>
|
||||
</root>
|
|
@ -24,7 +24,23 @@
|
|||
{
|
||||
"tag": "tag2",
|
||||
"port": 10809,
|
||||
"protocol": "socks",
|
||||
"protocol": "http",
|
||||
"listen": "127.0.0.1",
|
||||
"settings": {
|
||||
"allowTransparent": false
|
||||
},
|
||||
"sniffing": {
|
||||
"enabled": true,
|
||||
"destOverride": [
|
||||
"http",
|
||||
"tls"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"tag": "tag3",
|
||||
"port": 10809,
|
||||
"protocol": "http",
|
||||
"listen": "127.0.0.1",
|
||||
"settings": {
|
||||
"allowTransparent": false
|
||||
|
|
Loading…
Reference in a new issue