add mixed-port

This commit is contained in:
2dust
2022-05-03 18:30:31 +08:00
parent c539790f51
commit 9b474505ee
8 changed files with 808 additions and 336 deletions

View File

@@ -77,6 +77,8 @@ namespace clashN.Forms
{
StringBuilder sb = new StringBuilder();
sb.Append($"mixed {Global.Loopback}:{config.mixedPort}");
sb.Append(" | ");
sb.Append($"{Global.InboundSocks} {Global.Loopback}:{config.socksPort}");
sb.Append(" | ");
sb.Append($"{ Global.InboundHttp} { Global.Loopback}:{config.httpPort}");

View File

@@ -64,6 +64,8 @@
this.btnOK = new System.Windows.Forms.Button();
this.panel1 = new System.Windows.Forms.Panel();
this.fontDialog1 = new System.Windows.Forms.FontDialog();
this.txtmixedPort = new System.Windows.Forms.TextBox();
this.label6 = new System.Windows.Forms.Label();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
this.groupBox1.SuspendLayout();
@@ -99,6 +101,8 @@
//
// groupBox1
//
this.groupBox1.Controls.Add(this.txtmixedPort);
this.groupBox1.Controls.Add(this.label6);
this.groupBox1.Controls.Add(this.txtAPIPort);
this.groupBox1.Controls.Add(this.label3);
this.groupBox1.Controls.Add(this.chkAllowLANConn);
@@ -305,6 +309,16 @@
resources.ApplyResources(this.panel1, "panel1");
this.panel1.Name = "panel1";
//
// txtmixedPort
//
resources.ApplyResources(this.txtmixedPort, "txtmixedPort");
this.txtmixedPort.Name = "txtmixedPort";
//
// label6
//
resources.ApplyResources(this.label6, "label6");
this.label6.Name = "label6";
//
// OptionSettingForm
//
resources.ApplyResources(this, "$this");
@@ -367,5 +381,7 @@
private System.Windows.Forms.TextBox txtautoUpdateSubInterval;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Button btnFontReset;
private System.Windows.Forms.TextBox txtmixedPort;
private System.Windows.Forms.Label label6;
}
}

View File

@@ -33,6 +33,7 @@ namespace clashN.Forms
cmbloglevel.Text = config.logLevel;
//本地监听
txtmixedPort.Text = config.mixedPort.ToString();
txthttpPort.Text = config.httpPort.ToString();
txtsocksPort.Text = config.socksPort.ToString();
txtAPIPort.Text = config.APIPort.ToString();
@@ -90,9 +91,15 @@ namespace clashN.Forms
string loglevel = cmbloglevel.Text.TrimEx();
//本地监听
string mixedPort = txtmixedPort.Text.TrimEx();
string httpPort = txthttpPort.Text.TrimEx();
string socksPort = txtsocksPort.Text.TrimEx();
string APIPort = txtAPIPort.Text.TrimEx();
if (Utils.IsNullOrEmpty(mixedPort) || !Utils.IsNumberic(mixedPort))
{
UI.Show(ResUI.FillLocalListeningPort);
return -1;
}
if (Utils.IsNullOrEmpty(httpPort) || !Utils.IsNumberic(httpPort))
{
UI.Show(ResUI.FillLocalListeningPort);
@@ -109,6 +116,7 @@ namespace clashN.Forms
return -1;
}
config.mixedPort = Utils.ToInt(mixedPort);
config.httpPort = Utils.ToInt(httpPort);
config.socksPort = Utils.ToInt(socksPort);
config.APIPort = Utils.ToInt(APIPort);

File diff suppressed because it is too large Load Diff

View File

@@ -262,4 +262,7 @@
<data name="btnFontReset.Text" xml:space="preserve">
<value>字体重置</value>
</data>
<data name="label6.Text" xml:space="preserve">
<value>本地混合监听端口</value>
</data>
</root>

View File

@@ -58,6 +58,10 @@ namespace clashN.Handler
}
//本地监听
if (config.mixedPort == 0)
{
config.mixedPort = 7888;
}
if (config.httpPort == 0)
{
config.httpPort = 7890;

View File

@@ -81,6 +81,8 @@ namespace clashN.Handler
msg = ResUI.FailedConversionConfiguration;
return -1;
}
//mixed-port
ModifyContent(fileContent, "mixed-port", config.mixedPort);
//port
ModifyContent(fileContent, "port", config.httpPort);
//socks-port

View File

@@ -14,9 +14,11 @@ namespace clashN.Mode
public class Config
{
#region property
public int mixedPort { get; set; }
public int httpPort { get; set; }
public int socksPort { get; set; }
public int socksPort { get; set; }
public int APIPort { get; set; }