Browse Source

add socks user

pull/31/head
2dust 5 years ago
parent
commit
5ec275a7e0
  1. 44
      v2rayN/v2rayN/Forms/AddServer4Form.Designer.cs
  2. 10
      v2rayN/v2rayN/Forms/AddServer4Form.cs
  3. 549
      v2rayN/v2rayN/Forms/AddServer4Form.resx
  4. 26
      v2rayN/v2rayN/Forms/AddServer4Form.zh-Hans.resx
  5. 4
      v2rayN/v2rayN/Handler/ConfigHandler.cs
  6. 84
      v2rayN/v2rayN/Handler/V2rayConfigHandler.cs
  7. 22
      v2rayN/v2rayN/Mode/V2rayConfig.cs

44
v2rayN/v2rayN/Forms/AddServer4Form.Designer.cs generated

@ -31,6 +31,10 @@
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AddServer4Form));
this.btnClose = new System.Windows.Forms.Button();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.txtSecurity = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.txtId = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.label13 = new System.Windows.Forms.Label();
this.txtRemarks = new System.Windows.Forms.TextBox();
this.label6 = new System.Windows.Forms.Label();
@ -51,15 +55,18 @@
//
// btnClose
//
resources.ApplyResources(this.btnClose, "btnClose");
this.btnClose.DialogResult = System.Windows.Forms.DialogResult.Cancel;
resources.ApplyResources(this.btnClose, "btnClose");
this.btnClose.Name = "btnClose";
this.btnClose.UseVisualStyleBackColor = true;
this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
//
// groupBox1
//
resources.ApplyResources(this.groupBox1, "groupBox1");
this.groupBox1.Controls.Add(this.txtSecurity);
this.groupBox1.Controls.Add(this.label4);
this.groupBox1.Controls.Add(this.txtId);
this.groupBox1.Controls.Add(this.label3);
this.groupBox1.Controls.Add(this.label13);
this.groupBox1.Controls.Add(this.txtRemarks);
this.groupBox1.Controls.Add(this.label6);
@ -67,9 +74,30 @@
this.groupBox1.Controls.Add(this.label2);
this.groupBox1.Controls.Add(this.txtAddress);
this.groupBox1.Controls.Add(this.label1);
resources.ApplyResources(this.groupBox1, "groupBox1");
this.groupBox1.Name = "groupBox1";
this.groupBox1.TabStop = false;
//
// txtSecurity
//
resources.ApplyResources(this.txtSecurity, "txtSecurity");
this.txtSecurity.Name = "txtSecurity";
//
// label4
//
resources.ApplyResources(this.label4, "label4");
this.label4.Name = "label4";
//
// txtId
//
resources.ApplyResources(this.txtId, "txtId");
this.txtId.Name = "txtId";
//
// label3
//
resources.ApplyResources(this.label3, "label3");
this.label3.Name = "label3";
//
// label13
//
resources.ApplyResources(this.label13, "label13");
@ -107,9 +135,9 @@
//
// panel2
//
resources.ApplyResources(this.panel2, "panel2");
this.panel2.Controls.Add(this.btnClose);
this.panel2.Controls.Add(this.btnOK);
resources.ApplyResources(this.panel2, "panel2");
this.panel2.Name = "panel2";
//
// btnOK
@ -126,22 +154,22 @@
//
// menuServer
//
resources.ApplyResources(this.menuServer, "menuServer");
this.menuServer.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.MenuItem1});
resources.ApplyResources(this.menuServer, "menuServer");
this.menuServer.Name = "menuServer";
//
// MenuItem1
//
resources.ApplyResources(this.MenuItem1, "MenuItem1");
this.MenuItem1.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.menuItemImportClipboard});
this.MenuItem1.Name = "MenuItem1";
resources.ApplyResources(this.MenuItem1, "MenuItem1");
//
// menuItemImportClipboard
//
resources.ApplyResources(this.menuItemImportClipboard, "menuItemImportClipboard");
this.menuItemImportClipboard.Name = "menuItemImportClipboard";
resources.ApplyResources(this.menuItemImportClipboard, "menuItemImportClipboard");
this.menuItemImportClipboard.Click += new System.EventHandler(this.menuItemImportClipboard_Click);
//
// AddServer4Form
@ -184,5 +212,9 @@
private System.Windows.Forms.MenuStrip menuServer;
private System.Windows.Forms.ToolStripMenuItem MenuItem1;
private System.Windows.Forms.ToolStripMenuItem menuItemImportClipboard;
private System.Windows.Forms.TextBox txtId;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox txtSecurity;
private System.Windows.Forms.Label label4;
}
}

10
v2rayN/v2rayN/Forms/AddServer4Form.cs

@ -36,6 +36,8 @@ namespace v2rayN.Forms
{
txtAddress.Text = vmessItem.address;
txtPort.Text = vmessItem.port.ToString();
txtId.Text = vmessItem.id;
txtSecurity.Text = vmessItem.security;
txtRemarks.Text = vmessItem.remarks;
}
@ -47,6 +49,8 @@ namespace v2rayN.Forms
{
txtAddress.Text = "";
txtPort.Text = "";
txtId.Text = "";
txtSecurity.Text = "";
txtRemarks.Text = "";
}
@ -54,6 +58,8 @@ namespace v2rayN.Forms
{
string address = txtAddress.Text;
string port = txtPort.Text;
string id = txtId.Text;
string security = txtSecurity.Text;
string remarks = txtRemarks.Text;
if (Utils.IsNullOrEmpty(address))
@ -69,6 +75,8 @@ namespace v2rayN.Forms
vmessItem.address = address;
vmessItem.port = Utils.ToInt(port);
vmessItem.id = id;
vmessItem.security = security;
vmessItem.remarks = remarks;
if (ConfigHandler.AddSocksServer(ref config, vmessItem, EditIndex) == 0)
@ -112,6 +120,8 @@ namespace v2rayN.Forms
txtAddress.Text = vmessItem.address;
txtPort.Text = vmessItem.port.ToString();
txtSecurity.Text = vmessItem.security;
txtId.Text = vmessItem.id;
txtRemarks.Text = vmessItem.remarks;
}

549
v2rayN/v2rayN/Forms/AddServer4Form.resx

@ -117,367 +117,472 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="&gt;&gt;txtAddress.Name" xml:space="preserve">
<value>txtAddress</value>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="btnClose.Location" type="System.Drawing.Point, System.Drawing">
<value>396, 17</value>
</data>
<data name="label1.Text" xml:space="preserve">
<value>Server address</value>
<data name="btnClose.Size" type="System.Drawing.Size, System.Drawing">
<value>75, 23</value>
</data>
<assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="txtPort.TabIndex" type="System.Int32, mscorlib">
<value>3</value>
<data name="btnClose.TabIndex" type="System.Int32, mscorlib">
<value>4</value>
</data>
<data name="&gt;&gt;label6.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<data name="btnClose.Text" xml:space="preserve">
<value>&amp;Cancel</value>
</data>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="panel2.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Bottom</value>
<data name="&gt;&gt;btnClose.Name" xml:space="preserve">
<value>btnClose</value>
</data>
<data name="&gt;&gt;txtPort.Parent" xml:space="preserve">
<value>groupBox1</value>
<data name="&gt;&gt;btnClose.Type" xml:space="preserve">
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="label13.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
<data name="&gt;&gt;btnClose.Parent" xml:space="preserve">
<value>panel2</value>
</data>
<data name="&gt;&gt;menuServer.Name" xml:space="preserve">
<value>menuServer</value>
<data name="&gt;&gt;btnClose.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="&gt;&gt;btnOK.Type" xml:space="preserve">
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<data name="txtSecurity.Location" type="System.Drawing.Point, System.Drawing">
<value>127, 84</value>
</data>
<data name="&gt;&gt;btnOK.Name" xml:space="preserve">
<value>btnOK</value>
<data name="txtSecurity.Size" type="System.Drawing.Size, System.Drawing">
<value>278, 21</value>
</data>
<data name="&gt;&gt;txtRemarks.Name" xml:space="preserve">
<value>txtRemarks</value>
<data name="txtSecurity.TabIndex" type="System.Int32, mscorlib">
<value>26</value>
</data>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="txtPort.Size" type="System.Drawing.Size, System.Drawing">
<value>194, 21</value>
<data name="&gt;&gt;txtSecurity.Name" xml:space="preserve">
<value>txtSecurity</value>
</data>
<data name="&gt;&gt;panel2.Type" xml:space="preserve">
<value>System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<data name="&gt;&gt;txtSecurity.Type" xml:space="preserve">
<value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;$this.Name" xml:space="preserve">
<value>AddServer4Form</value>
<data name="&gt;&gt;txtSecurity.Parent" xml:space="preserve">
<value>groupBox1</value>
</data>
<data name="label1.Size" type="System.Drawing.Size, System.Drawing">
<data name="&gt;&gt;txtSecurity.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="label4.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="label4.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="label4.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 88</value>
</data>
<data name="label4.Size" type="System.Drawing.Size, System.Drawing">
<value>89, 12</value>
</data>
<data name="&gt;&gt;label1.Name" xml:space="preserve">
<value>label1</value>
<data name="label4.TabIndex" type="System.Int32, mscorlib">
<value>25</value>
</data>
<data name="&gt;&gt;txtRemarks.Type" xml:space="preserve">
<value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<data name="label4.Text" xml:space="preserve">
<value>User(Optional)</value>
</data>
<data name="&gt;&gt;txtRemarks.Parent" xml:space="preserve">
<data name="&gt;&gt;label4.Name" xml:space="preserve">
<value>label4</value>
</data>
<data name="&gt;&gt;label4.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;label4.Parent" xml:space="preserve">
<value>groupBox1</value>
</data>
<data name="&gt;&gt;btnClose.Parent" xml:space="preserve">
<value>panel2</value>
<data name="&gt;&gt;label4.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<data name="label6.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 158</value>
<data name="txtId.Location" type="System.Drawing.Point, System.Drawing">
<value>127, 117</value>
</data>
<data name="&gt;&gt;txtPort.Type" xml:space="preserve">
<value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<data name="txtId.PasswordChar" type="System.Char, mscorlib" xml:space="preserve">
<value>*</value>
</data>
<data name="groupBox1.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Fill</value>
<data name="txtId.Size" type="System.Drawing.Size, System.Drawing">
<value>278, 21</value>
</data>
<data name="txtRemarks.Size" type="System.Drawing.Size, System.Drawing">
<value>194, 21</value>
<data name="txtId.TabIndex" type="System.Int32, mscorlib">
<value>24</value>
</data>
<data name="&gt;&gt;label13.Parent" xml:space="preserve">
<value>groupBox1</value>
<data name="&gt;&gt;txtId.Name" xml:space="preserve">
<value>txtId</value>
</data>
<data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
<value>6, 12</value>
<data name="&gt;&gt;txtId.Type" xml:space="preserve">
<value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="menuServer.Size" type="System.Drawing.Size, System.Drawing">
<value>547, 25</value>
<data name="&gt;&gt;txtId.Parent" xml:space="preserve">
<value>groupBox1</value>
</data>
<data name="label6.AutoSize" type="System.Boolean, mscorlib">
<data name="&gt;&gt;txtId.ZOrder" xml:space="preserve">
<value>2</value>
</data>
<data name="label3.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="label6.Text" xml:space="preserve">
<value>Alias (remarks)</value>
<data name="label3.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="txtRemarks.Location" type="System.Drawing.Point, System.Drawing">
<value>127, 154</value>
<data name="label3.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 121</value>
</data>
<data name="&gt;&gt;label2.Parent" xml:space="preserve">
<value>groupBox1</value>
<data name="label3.Size" type="System.Drawing.Size, System.Drawing">
<value>113, 12</value>
</data>
<data name="panel1.TabIndex" type="System.Int32, mscorlib">
<value>6</value>
<data name="label3.TabIndex" type="System.Int32, mscorlib">
<value>23</value>
</data>
<data name="panel2.TabIndex" type="System.Int32, mscorlib">
<value>7</value>
<data name="label3.Text" xml:space="preserve">
<value>Password(Optional)</value>
</data>
<data name="&gt;&gt;label1.Parent" xml:space="preserve">
<data name="&gt;&gt;label3.Name" xml:space="preserve">
<value>label3</value>
</data>
<data name="&gt;&gt;label3.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;label3.Parent" xml:space="preserve">
<value>groupBox1</value>
</data>
<data name="&gt;&gt;label3.ZOrder" xml:space="preserve">
<value>3</value>
</data>
<data name="label13.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="label13.Location" type="System.Drawing.Point, System.Drawing">
<value>337, 158</value>
</data>
<data name="label13.Size" type="System.Drawing.Size, System.Drawing">
<value>113, 12</value>
</data>
<data name="&gt;&gt;MenuItem1.Name" xml:space="preserve">
<value>MenuItem1</value>
<data name="label13.TabIndex" type="System.Int32, mscorlib">
<value>22</value>
</data>
<data name="groupBox1.Text" xml:space="preserve">
<value>Server</value>
<data name="label13.Text" xml:space="preserve">
<value>* Fill in manually</value>
</data>
<data name="MenuItem1.Size" type="System.Drawing.Size, System.Drawing">
<value>162, 21</value>
<data name="&gt;&gt;label13.Name" xml:space="preserve">
<value>label13</value>
</data>
<data name="&gt;&gt;btnClose.Type" xml:space="preserve">
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<data name="&gt;&gt;label13.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="label1.TabIndex" type="System.Int32, mscorlib">
<value>0</value>
<data name="&gt;&gt;label13.Parent" xml:space="preserve">
<value>groupBox1</value>
</data>
<data name="label2.TabIndex" type="System.Int32, mscorlib">
<value>2</value>
<data name="&gt;&gt;label13.ZOrder" xml:space="preserve">
<value>4</value>
</data>
<data name="panel2.Size" type="System.Drawing.Size, System.Drawing">
<value>547, 60</value>
<data name="txtRemarks.Location" type="System.Drawing.Point, System.Drawing">
<value>127, 154</value>
</data>
<data name="&gt;&gt;txtAddress.Type" xml:space="preserve">
<value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<data name="txtRemarks.Size" type="System.Drawing.Size, System.Drawing">
<value>194, 21</value>
</data>
<data name="$this.Text" xml:space="preserve">
<value>Edit or add a [Socks] server</value>
<data name="txtRemarks.TabIndex" type="System.Int32, mscorlib">
<value>11</value>
</data>
<data name="txtAddress.Size" type="System.Drawing.Size, System.Drawing">
<value>359, 21</value>
<data name="&gt;&gt;txtRemarks.Name" xml:space="preserve">
<value>txtRemarks</value>
</data>
<data name="&gt;&gt;label2.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<data name="&gt;&gt;txtRemarks.Type" xml:space="preserve">
<value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="panel1.Size" type="System.Drawing.Size, System.Drawing">
<value>547, 10</value>
<data name="&gt;&gt;txtRemarks.Parent" xml:space="preserve">
<value>groupBox1</value>
</data>
<data name="label13.Text" xml:space="preserve">
<value>* Fill in manually</value>
<data name="&gt;&gt;txtRemarks.ZOrder" xml:space="preserve">
<value>5</value>
</data>
<data name="&gt;&gt;label2.ZOrder" xml:space="preserve">
<value>4</value>
<data name="label6.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="label6.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 158</value>
</data>
<data name="label6.Size" type="System.Drawing.Size, System.Drawing">
<value>95, 12</value>
</data>
<data name="label6.TabIndex" type="System.Int32, mscorlib">
<value>10</value>
</data>
<data name="label2.Size" type="System.Drawing.Size, System.Drawing">
<value>71, 12</value>
<data name="label6.Text" xml:space="preserve">
<value>Alias (remarks)</value>
</data>
<data name="&gt;&gt;label13.ZOrder" xml:space="preserve">
<value>0</value>
<data name="&gt;&gt;label6.Name" xml:space="preserve">
<value>label6</value>
</data>
<data name="&gt;&gt;panel1.Name" xml:space="preserve">
<value>panel1</value>
<data name="&gt;&gt;label6.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="btnClose.Size" type="System.Drawing.Size, System.Drawing">
<value>75, 23</value>
<data name="&gt;&gt;label6.Parent" xml:space="preserve">
<value>groupBox1</value>
</data>
<data name="&gt;&gt;label6.ZOrder" xml:space="preserve">
<value>6</value>
</data>
<data name="txtPort.Location" type="System.Drawing.Point, System.Drawing">
<value>127, 56</value>
</data>
<data name="txtPort.Size" type="System.Drawing.Size, System.Drawing">
<value>194, 21</value>
</data>
<data name="txtPort.TabIndex" type="System.Int32, mscorlib">
<value>3</value>
</data>
<data name="&gt;&gt;txtPort.Name" xml:space="preserve">
<value>txtPort</value>
</data>
<data name="&gt;&gt;txtPort.Type" xml:space="preserve">
<value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;txtPort.Parent" xml:space="preserve">
<value>groupBox1</value>
</data>
<data name="&gt;&gt;txtPort.ZOrder" xml:space="preserve">
<value>7</value>
</data>
<data name="label2.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="label2.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 60</value>
</data>
<data name="&gt;&gt;txtRemarks.ZOrder" xml:space="preserve">
<value>1</value>
<data name="label2.Size" type="System.Drawing.Size, System.Drawing">
<value>71, 12</value>
</data>
<data name="&gt;&gt;panel1.Parent" xml:space="preserve">
<value>$this</value>
<data name="label2.TabIndex" type="System.Int32, mscorlib">
<value>2</value>
</data>
<data name="&gt;&gt;btnClose.Name" xml:space="preserve">
<value>btnClose</value>
<data name="label2.Text" xml:space="preserve">
<value>Server port</value>
</data>
<data name="&gt;&gt;label6.Name" xml:space="preserve">
<value>label6</value>
<data name="&gt;&gt;label2.Name" xml:space="preserve">
<value>label2</value>
</data>
<data name="menuServer.TabIndex" type="System.Int32, mscorlib">
<value>8</value>
<data name="&gt;&gt;label2.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="btnOK.Location" type="System.Drawing.Point, System.Drawing">
<value>303, 17</value>
<data name="&gt;&gt;label2.Parent" xml:space="preserve">
<value>groupBox1</value>
</data>
<data name="&gt;&gt;label2.ZOrder" xml:space="preserve">
<value>8</value>
</data>
<data name="txtAddress.Location" type="System.Drawing.Point, System.Drawing">
<value>127, 27</value>
</data>
<data name="btnOK.Size" type="System.Drawing.Size, System.Drawing">
<value>75, 23</value>
<data name="txtAddress.Size" type="System.Drawing.Size, System.Drawing">
<value>359, 21</value>
</data>
<data name="&gt;&gt;label13.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<data name="txtAddress.TabIndex" type="System.Int32, mscorlib">
<value>1</value>
</data>
<data name="&gt;&gt;groupBox1.Parent" xml:space="preserve">
<value>$this</value>
<data name="&gt;&gt;txtAddress.Name" xml:space="preserve">
<value>txtAddress</value>
</data>
<data name="panel1.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Top</value>
<data name="&gt;&gt;txtAddress.Type" xml:space="preserve">
<value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="groupBox1.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 35</value>
<data name="&gt;&gt;txtAddress.Parent" xml:space="preserve">
<value>groupBox1</value>
</data>
<data name="&gt;&gt;label6.ZOrder" xml:space="preserve">
<value>2</value>
<data name="&gt;&gt;txtAddress.ZOrder" xml:space="preserve">
<value>9</value>
</data>
<data name="&gt;&gt;menuServer.Parent" xml:space="preserve">
<value>$this</value>
<data name="label1.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="&gt;&gt;btnOK.Parent" xml:space="preserve">
<value>panel2</value>
<data name="label1.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 31</value>
</data>
<data name="groupBox1.Size" type="System.Drawing.Size, System.Drawing">
<value>547, 196</value>
<data name="label1.Size" type="System.Drawing.Size, System.Drawing">
<value>89, 12</value>
</data>
<data name="&gt;&gt;panel1.ZOrder" xml:space="preserve">
<value>2</value>
<data name="label1.TabIndex" type="System.Int32, mscorlib">
<value>0</value>
</data>
<data name="&gt;&gt;label1.ZOrder" xml:space="preserve">
<value>6</value>
<data name="label1.Text" xml:space="preserve">
<value>Server address</value>
</data>
<data name="menuItemImportClipboard.Size" type="System.Drawing.Size, System.Drawing">
<value>235, 22</value>
<data name="&gt;&gt;label1.Name" xml:space="preserve">
<value>label1</value>
</data>
<data name="btnClose.TabIndex" type="System.Int32, mscorlib">
<value>4</value>
<data name="&gt;&gt;label1.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="groupBox1.TabIndex" type="System.Int32, mscorlib">
<value>3</value>
<data name="&gt;&gt;label1.Parent" xml:space="preserve">
<value>groupBox1</value>
</data>
<data name="label2.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
<data name="&gt;&gt;label1.ZOrder" xml:space="preserve">
<value>10</value>
</data>
<data name="btnOK.TabIndex" type="System.Int32, mscorlib">
<value>5</value>
<data name="groupBox1.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Fill</value>
</data>
<data name="&gt;&gt;txtAddress.Parent" xml:space="preserve">
<value>groupBox1</value>
<data name="groupBox1.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 35</value>
</data>
<data name="&gt;&gt;txtPort.Name" xml:space="preserve">
<value>txtPort</value>
<data name="groupBox1.Size" type="System.Drawing.Size, System.Drawing">
<value>547, 196</value>
</data>
<data name="txtPort.Location" type="System.Drawing.Point, System.Drawing">
<value>127, 56</value>
<data name="groupBox1.TabIndex" type="System.Int32, mscorlib">
<value>3</value>
</data>
<data name="label6.Size" type="System.Drawing.Size, System.Drawing">
<value>95, 12</value>
<data name="groupBox1.Text" xml:space="preserve">
<value>Server</value>
</data>
<data name="&gt;&gt;groupBox1.Name" xml:space="preserve">
<value>groupBox1</value>
</data>
<data name="&gt;&gt;groupBox1.Type" xml:space="preserve">
<value>System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="label1.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
<data name="&gt;&gt;groupBox1.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="menuItemImportClipboard.Text" xml:space="preserve">
<value>Import URL from clipboard</value>
<data name="&gt;&gt;groupBox1.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="&gt;&gt;menuItemImportClipboard.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<data name="btnOK.Location" type="System.Drawing.Point, System.Drawing">
<value>303, 17</value>
</data>
<data name="btnClose.Text" xml:space="preserve">
<value>&amp;Cancel</value>
<data name="btnOK.Size" type="System.Drawing.Size, System.Drawing">
<value>75, 23</value>
</data>
<data name="label1.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 31</value>
<data name="btnOK.TabIndex" type="System.Int32, mscorlib">
<value>5</value>
</data>
<data name="btnOK.Text" xml:space="preserve">
<value>&amp;OK</value>
</data>
<data name="txtRemarks.TabIndex" type="System.Int32, mscorlib">
<value>11</value>
<data name="&gt;&gt;btnOK.Name" xml:space="preserve">
<value>btnOK</value>
</data>
<data name="&gt;&gt;btnClose.ZOrder" xml:space="preserve">
<value>0</value>
<data name="&gt;&gt;btnOK.Type" xml:space="preserve">
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="label2.Text" xml:space="preserve">
<value>Server port</value>
<data name="&gt;&gt;btnOK.Parent" xml:space="preserve">
<value>panel2</value>
</data>
<data name="label13.Location" type="System.Drawing.Point, System.Drawing">
<value>337, 158</value>
<data name="&gt;&gt;btnOK.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<data name="&gt;&gt;label6.Parent" xml:space="preserve">
<value>groupBox1</value>
<data name="panel2.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Bottom</value>
</data>
<data name="MenuItem1.Text" xml:space="preserve">
<value>Import configuration file</value>
<data name="panel2.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 231</value>
</data>
<data name="menuServer.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 0</value>
<data name="panel2.Size" type="System.Drawing.Size, System.Drawing">
<value>547, 60</value>
</data>
<data name="&gt;&gt;MenuItem1.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<data name="panel2.TabIndex" type="System.Int32, mscorlib">
<value>7</value>
</data>
<data name="&gt;&gt;txtAddress.ZOrder" xml:space="preserve">
<value>5</value>
<data name="&gt;&gt;panel2.Name" xml:space="preserve">
<value>panel2</value>
</data>
<data name="&gt;&gt;menuServer.Type" xml:space="preserve">
<value>System.Windows.Forms.MenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<data name="&gt;&gt;panel2.Type" xml:space="preserve">
<value>System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;menuServer.ZOrder" xml:space="preserve">
<value>3</value>
<data name="&gt;&gt;panel2.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;btnOK.ZOrder" xml:space="preserve">
<data name="&gt;&gt;panel2.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<data name="panel1.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Top</value>
</data>
<data name="panel1.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 25</value>
</data>
<data name="txtAddress.TabIndex" type="System.Int32, mscorlib">
<value>1</value>
<data name="panel1.Size" type="System.Drawing.Size, System.Drawing">
<value>547, 10</value>
</data>
<data name="&gt;&gt;label13.Name" xml:space="preserve">
<value>label13</value>
<data name="panel1.TabIndex" type="System.Int32, mscorlib">
<value>6</value>
</data>
<data name="&gt;&gt;txtPort.ZOrder" xml:space="preserve">
<value>3</value>
<data name="&gt;&gt;panel1.Name" xml:space="preserve">
<value>panel1</value>
</data>
<data name="&gt;&gt;label2.Name" xml:space="preserve">
<value>label2</value>
<data name="&gt;&gt;panel1.Type" xml:space="preserve">
<value>System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;groupBox1.Name" xml:space="preserve">
<value>groupBox1</value>
<data name="&gt;&gt;panel1.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;panel2.Name" xml:space="preserve">
<value>panel2</value>
<data name="&gt;&gt;panel1.ZOrder" xml:space="preserve">
<value>2</value>
</data>
<data name="panel2.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 231</value>
<metadata name="menuServer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<data name="menuItemImportClipboard.Size" type="System.Drawing.Size, System.Drawing">
<value>235, 22</value>
</data>
<data name="label13.TabIndex" type="System.Int32, mscorlib">
<value>22</value>
<data name="menuItemImportClipboard.Text" xml:space="preserve">
<value>Import URL from clipboard</value>
</data>
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
<value>547, 291</value>
<data name="MenuItem1.Size" type="System.Drawing.Size, System.Drawing">
<value>162, 21</value>
</data>
<data name="&gt;&gt;groupBox1.ZOrder" xml:space="preserve">
<value>0</value>
<data name="MenuItem1.Text" xml:space="preserve">
<value>Import configuration file</value>
</data>
<data name="&gt;&gt;$this.Type" xml:space="preserve">
<value>v2rayN.Forms.BaseForm, v2rayN, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</value>
<data name="menuServer.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 0</value>
</data>
<data name="&gt;&gt;menuItemImportClipboard.Name" xml:space="preserve">
<value>menuItemImportClipboard</value>
<data name="menuServer.Size" type="System.Drawing.Size, System.Drawing">
<value>547, 25</value>
</data>
<data name="&gt;&gt;panel2.Parent" xml:space="preserve">
<value>$this</value>
<data name="menuServer.TabIndex" type="System.Int32, mscorlib">
<value>8</value>
</data>
<data name="btnClose.Location" type="System.Drawing.Point, System.Drawing">
<value>396, 17</value>
<data name="&gt;&gt;menuServer.Name" xml:space="preserve">
<value>menuServer</value>
</data>
<data name="&gt;&gt;label1.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<data name="&gt;&gt;menuServer.Type" xml:space="preserve">
<value>System.Windows.Forms.MenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;panel2.ZOrder" xml:space="preserve">
<value>1</value>
<data name="&gt;&gt;menuServer.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;panel1.Type" xml:space="preserve">
<value>System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<data name="&gt;&gt;menuServer.ZOrder" xml:space="preserve">
<value>3</value>
</data>
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="menuServer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
<value>6, 12</value>
</data>
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
<value>547, 291</value>
</data>
<data name="$this.Text" xml:space="preserve">
<value>Edit or add a [Socks] server</value>
</data>
<data name="&gt;&gt;MenuItem1.Name" xml:space="preserve">
<value>MenuItem1</value>
</data>
<data name="&gt;&gt;MenuItem1.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;menuItemImportClipboard.Name" xml:space="preserve">
<value>menuItemImportClipboard</value>
</data>
<data name="&gt;&gt;menuItemImportClipboard.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;$this.Name" xml:space="preserve">
<value>AddServer4Form</value>
</data>
<data name="&gt;&gt;$this.Type" xml:space="preserve">
<value>v2rayN.Forms.BaseForm, v2rayN, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</value>
</data>
</root>

26
v2rayN/v2rayN/Forms/AddServer4Form.zh-Hans.resx

@ -123,10 +123,34 @@
<data name="groupBox1.Text" xml:space="preserve">
<value>服务器</value>
</data>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="txtSecurity.Location" type="System.Drawing.Point, System.Drawing">
<value>127, 85</value>
</data>
<data name="label4.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 89</value>
</data>
<data name="label4.Size" type="System.Drawing.Size, System.Drawing">
<value>77, 12</value>
</data>
<data name="label4.Text" xml:space="preserve">
<value>用户名(可选)</value>
</data>
<data name="txtId.Location" type="System.Drawing.Point, System.Drawing">
<value>127, 115</value>
</data>
<data name="label3.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 119</value>
</data>
<data name="label3.Size" type="System.Drawing.Size, System.Drawing">
<value>65, 12</value>
</data>
<data name="label3.Text" xml:space="preserve">
<value>密码(可选)</value>
</data>
<data name="label13.Text" xml:space="preserve">
<value>*手填,方便识别管理</value>
</data>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="label6.Size" type="System.Drawing.Size, System.Drawing">
<value>83, 12</value>
</data>

4
v2rayN/v2rayN/Handler/ConfigHandler.cs

@ -366,7 +366,9 @@ namespace v2rayN.Handler
{
remark = "#" + WebUtility.UrlEncode(vmessItem.remarks);
}
url = string.Format("{0}:{1}",
url = string.Format("{0}:{1}@{2}:{3}",
vmessItem.security,
vmessItem.id,
vmessItem.address,
vmessItem.port);
url = Utils.Base64Encode(url);

84
v2rayN/v2rayN/Handler/V2rayConfigHandler.cs

@ -400,6 +400,17 @@ namespace v2rayN.Handler
serversItem.address = config.address();
serversItem.port = config.port();
if (!string.IsNullOrEmpty(config.security())
&& !string.IsNullOrEmpty(config.id()))
{
var socksUsersItem = new SocksUsersItem();
socksUsersItem.user = config.security();
socksUsersItem.pass = config.id();
socksUsersItem.level = 1;
serversItem.users = new List<SocksUsersItem>() { socksUsersItem };
}
outbound.mux.enabled = false;
outbound.protocol = "socks";
@ -425,7 +436,21 @@ namespace v2rayN.Handler
{
//远程服务器底层传输配置
streamSettings.network = config.network();
streamSettings.security = config.streamSecurity();
var host = config.requestHost();
//if tls
if (config.streamSecurity() == "tls")
{
streamSettings.security = config.streamSecurity();
TlsSettings tlsSettings = new TlsSettings();
tlsSettings.allowInsecure = config.allowInsecure();
if (!string.IsNullOrWhiteSpace(host))
{
tlsSettings.serverName = host;
}
streamSettings.tlsSettings = tlsSettings;
}
//streamSettings
switch (config.network())
@ -463,12 +488,11 @@ namespace v2rayN.Handler
WsSettings wsSettings = new WsSettings();
wsSettings.connectionReuse = true;
string host2 = config.requestHost();
string path = config.path();
if (!string.IsNullOrWhiteSpace(host2))
if (!string.IsNullOrWhiteSpace(host))
{
wsSettings.headers = new Headers();
wsSettings.headers.Host = host2;
wsSettings.headers.Host = host;
}
if (!string.IsNullOrWhiteSpace(path))
{
@ -476,35 +500,34 @@ namespace v2rayN.Handler
}
streamSettings.wsSettings = wsSettings;
TlsSettings tlsSettings = new TlsSettings();
tlsSettings.allowInsecure = config.allowInsecure();
if (!string.IsNullOrWhiteSpace(host2))
{
tlsSettings.serverName = host2;
}
streamSettings.tlsSettings = tlsSettings;
//TlsSettings tlsSettings = new TlsSettings();
//tlsSettings.allowInsecure = config.allowInsecure();
//if (!string.IsNullOrWhiteSpace(host))
//{
// tlsSettings.serverName = host;
//}
//streamSettings.tlsSettings = tlsSettings;
break;
//h2
case "h2":
HttpSettings httpSettings = new HttpSettings();
string host3 = config.requestHost();
if (!string.IsNullOrWhiteSpace(host3))
if (!string.IsNullOrWhiteSpace(host))
{
httpSettings.host = Utils.String2List(host3);
httpSettings.host = Utils.String2List(host);
}
httpSettings.path = config.path();
streamSettings.httpSettings = httpSettings;
TlsSettings tlsSettings2 = new TlsSettings();
tlsSettings2.allowInsecure = config.allowInsecure();
streamSettings.tlsSettings = tlsSettings2;
//TlsSettings tlsSettings2 = new TlsSettings();
//tlsSettings2.allowInsecure = config.allowInsecure();
//streamSettings.tlsSettings = tlsSettings2;
break;
//quic
case "quic":
QuicSettings quicsettings = new QuicSettings();
quicsettings.security = config.requestHost();
quicsettings.security = host;
quicsettings.key = config.path();
quicsettings.header = new Header();
quicsettings.header.type = config.headerType();
@ -524,9 +547,9 @@ namespace v2rayN.Handler
{
//request填入自定义Host
string request = Utils.GetEmbedText(Global.v2raySampleHttprequestFileName);
string[] arrHost = config.requestHost().Split(',');
string host = string.Join("\",\"", arrHost);
request = request.Replace("$requestHost$", string.Format("\"{0}\"", host));
string[] arrHost = host.Split(',');
string host2 = string.Join("\",\"", arrHost);
request = request.Replace("$requestHost$", string.Format("\"{0}\"", host2));
//request = request.Replace("$requestHost$", string.Format("\"{0}\"", config.requestHost()));
//填入自定义Path
@ -1159,7 +1182,7 @@ namespace v2rayN.Handler
result = result.Substring(0, indexRemark);
}
//part decode
int indexS = result.IndexOf(":");
int indexS = result.IndexOf("@");
if (indexS > 0)
{
}
@ -1168,15 +1191,22 @@ namespace v2rayN.Handler
result = Utils.Base64Decode(result);
}
string[] arr21 = result.Split(':');
int indexPort = result.LastIndexOf(":");
string[] arr1 = result.Split('@');
if (arr1.Length != 2)
{
return null;
}
string[] arr21 = arr1[0].Split(':');
//string[] arr22 = arr1[1].Split(':');
int indexPort = arr1[1].LastIndexOf(":");
if (arr21.Length != 2 || indexPort < 0)
{
return null;
}
vmessItem.address = result.Substring(0, indexPort);
vmessItem.port = Utils.ToInt(result.Substring(indexPort + 1, result.Length - (indexPort + 1)));
vmessItem.address = arr1[1].Substring(0, indexPort);
vmessItem.port = Utils.ToInt(arr1[1].Substring(indexPort + 1, arr1[1].Length - (indexPort + 1)));
vmessItem.security = arr21[0];
vmessItem.id = arr21[1];
}
else
{

22
v2rayN/v2rayN/Mode/V2rayConfig.cs

@ -215,8 +215,30 @@ namespace v2rayN.Mode
///
/// </summary>
public int level { get; set; }
/// <summary>
///
/// </summary>
public List<SocksUsersItem> users { get; set; }
}
public class SocksUsersItem
{
/// <summary>
///
/// </summary>
public string user { get; set; }
/// <summary>
///
/// </summary>
public string pass { get; set; }
/// <summary>
///
/// </summary>
public int level { get; set; }
}
public class Mux
{
/// <summary>

Loading…
Cancel
Save