Compare commits

...

15 Commits
1.4.4 ... 1.4.5

Author SHA1 Message Date
Connection Refused
b2b19be32b Dump version to 1.4.5 2020-05-08 16:10:16 +08:00
Connection Refused
ffc6b7adc9 Update zh-CN 2020-05-08 16:05:09 +08:00
Connection Refused
9ecde61b52 Update README.md 2020-05-08 16:02:18 +08:00
Connection Refused
083364ae9d Update README.md 2020-05-08 16:01:36 +08:00
Connection Refused
96f8b9944d Update zh-CN 2020-05-08 15:59:11 +08:00
Connection Refused
8d7a5613fa Support edit Trojan server 2020-05-08 15:58:04 +08:00
Connection Refused
d8133bcc35 Update submodule for support trojan 2020-05-08 15:54:13 +08:00
Connection Refused
9149f23986 Add Trojan Support 2020-05-08 15:53:19 +08:00
Connection Refused
92d1cfdb50 Update README.md 2020-05-07 21:28:47 +08:00
Connection Refused
53e847ce1d CLEAN.BAT → CLEAN.ps1 2020-05-07 21:26:33 +08:00
Connection Refused
08524f08f3 Fix CI 2020-05-07 21:20:03 +08:00
Connection Refused
222ddfe434 Fix CI 2020-05-07 21:11:20 +08:00
Connection Refused
6872ca94e7 Update submodule 2020-05-07 21:09:18 +08:00
Connection Refused
152f49c161 Update build scripts 2020-05-07 21:00:34 +08:00
Connection Refused
0b46f8d8af Lowercase SHA256 2020-05-07 20:52:50 +08:00
21 changed files with 5576 additions and 57 deletions

View File

@@ -1,44 +1,44 @@
name: GitHub Actions & Netch CI name: Netch CI
on: [push] on: [push]
jobs: jobs:
build: build:
name: Build name: Build
runs-on: windows-latest runs-on: windows-latest
steps:
steps: - name: NuGet
- uses: actions/checkout@v2 uses: nuget/setup-nuget@v1
- name: Get tag name
uses: olegtarasov/get-tag@v1
- name: submodules-init - name: MSBuild
uses: snickerbockers/submodules-init@v4
- uses: nuget/setup-nuget@v1
- run: nuget restore Netch.sln
- name: Setup MSBuild.exe
uses: microsoft/setup-msbuild@v1.0.0 uses: microsoft/setup-msbuild@v1.0.0
- name: Build .NET 4.8 Netch - name: Checkout
uses: actions/checkout@v2
- name: Update submodules
uses: snickerbockers/submodules-init@v4
- name: Restore NuGet Package
run: nuget restore Netch.sln
- name: Build .NET 4.8
shell: pwsh shell: pwsh
run: | run: |
.\build.ps1 .\BUILD.ps1
New-Item -ItemType Directory -Path C:\builtfiles -Force > $null New-Item -ItemType Directory -Path C:\builtfiles -Force > $null
Compress-Archive -Path Netch\bin\x64\Release\win-x64\* -DestinationPath C:\builtfiles\Netch-${{ env.GITHUB_TAG_NAME }}.zip Compress-Archive -Path Netch\bin\x64\Release\win-x64\* -DestinationPath C:\builtfiles\Netch-${{ env.GITHUB_TAG_NAME }}.zip
echo "::set-env name=Netch_SHA256::$(.\getSHA256.ps1 C:\builtfiles\Netch-${{ env.GITHUB_TAG_NAME }}.zip)" echo "::set-env name=Netch_SHA256::$(.\GetSHA256.ps1 C:\builtfiles\Netch-${{ env.GITHUB_TAG_NAME }}.zip)"
- name: Upload Netch - name: Upload
uses: actions/upload-artifact@v1 uses: actions/upload-artifact@v1
with: with:
name: Netch name: Netch
path: Netch\bin\x64\Release\win-x64 path: Netch\bin\x64\Release\win-x64
# Create a new release: create a tag, then 'git push origin <tagname>', wait for it to build - name: Release
- name: Create a new GitHub release if a new tag is pushed
uses: softprops/action-gh-release@v1 uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
if: startsWith(github.ref, 'refs/tags/')
with: with:
name: ${{ env.GITHUB_TAG_NAME }} name: ${{ env.GITHUB_TAG_NAME }}
prerelease: true prerelease: true
@@ -50,12 +50,9 @@ jobs:
[![](https://img.shields.io/badge/Telegram-Channel-blue)](https://t.me/Netch) [![](https://img.shields.io/badge/Telegram-Group-green)](https://t.me/Netch_Discuss_Group) [![](https://img.shields.io/badge/Telegram-Channel-blue)](https://t.me/Netch) [![](https://img.shields.io/badge/Telegram-Group-green)](https://t.me/Netch_Discuss_Group)
## 更新日志: ## 更新日志:
* 这是 GitHub Action 自动化部署,更新日志应该很快会手动更新:D * 这是 GitHub Action 自动化部署,更新日志应该很快会手动更新
## 文件校验 ## 校验
| 文件名 | SHA256 | | 文件名 | SHA256 |
| :- | :- | | :- | :- |
| <sub>Netch-${{ env.GITHUB_TAG_NAME }}.zip</sub> | <sub>${{ env.Netch_SHA256 }}</sub> | | Netch-${{ env.GITHUB_TAG_NAME }}.zip | ${{ env.Netch_SHA256 }} |
if: startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

View File

@@ -1,3 +0,0 @@
@ECHO OFF
RD /S /Q Netch\bin > NUL 2>&1
RD /S /Q Netch\obj > NUL 2>&1

21
CLEAN.ps1 Normal file
View File

@@ -0,0 +1,21 @@
if (Test-Path Netch\bin)
{
Remove-Item -Recurse -Force Netch\bin
}
if (Test-Path Netch\obj)
{
Remove-Item -Recurse -Force Netch\obj
}
if (Test-Path NetchLib\bin)
{
Remove-Item -Recurse -Force NetchLib\bin
}
if (Test-Path NetchLib\obj)
{
Remove-Item -Recurse -Force NetchLib\obj
}
exit 0

View File

@@ -1,5 +1,5 @@
param([string]$file) param([string]$file)
$hash = [Security.Cryptography.HashAlgorithm]::Create( "SHA256" ) $hash = [Security.Cryptography.HashAlgorithm]::Create( "SHA256" )
$stream = ([IO.StreamReader]$file).BaseStream $stream = ([IO.StreamReader]$file).BaseStream
-join ($hash.ComputeHash($stream) | ForEach { "{0:X2}" -f $_ }) -join ($hash.ComputeHash($stream) | ForEach { "{0:x2}" -f $_ })
$stream.Close() $stream.Close()

View File

@@ -40,6 +40,11 @@ namespace Netch.Controllers
/// </summary> /// </summary>
public VMessController pVMessController; public VMessController pVMessController;
/// <summary>
/// Trojan 控制器
/// </summary>
public TrojanController pTrojanController;
/// <summary> /// <summary>
/// NF 控制器 /// NF 控制器
/// </summary> /// </summary>
@@ -108,6 +113,14 @@ namespace Netch.Controllers
} }
result = pVMessController.Start(server, mode); result = pVMessController.Start(server, mode);
break; break;
case "Trojan":
KillProcess("Trojan");
if (pTrojanController == null)
{
pTrojanController = new TrojanController();
}
result = pTrojanController.Start(server, mode);
break;
} }
if (result) if (result)

View File

@@ -0,0 +1,127 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace Netch.Controllers
{
public class TrojanController
{
/// <summary>
/// 进程实例
/// </summary>
public Process Instance;
/// <summary>
/// 当前状态
/// </summary>
public Models.State State = Models.State.Waiting;
/// <summary>
/// 启动
/// </summary>
/// <param name="server">服务器</param>
/// <param name="mode">模式</param>
/// <returns>是否启动成功</returns>
public bool Start(Models.Server server, Models.Mode mode)
{
Forms.MainForm.Instance.StatusText($"{Utils.i18N.Translate("Status")}{Utils.i18N.Translate(": ")}{Utils.i18N.Translate("Starting Trojan")}");
File.Delete("logging\\trojan.log");
if (!File.Exists("bin\\Trojan.exe"))
{
return false;
}
File.WriteAllText("data\\last.json", Newtonsoft.Json.JsonConvert.SerializeObject(new Models.Trojan()
{
local_addr = Global.Settings.LocalAddress,
local_port = Global.Settings.Socks5LocalPort,
remote_addr = server.Hostname,
remote_port = server.Port,
password = new List<string>()
{
server.Password
}
}));
Instance = MainController.GetProcess();
Instance.StartInfo.FileName = "bin\\Trojan.exe";
Instance.StartInfo.Arguments = "-c data\\last.json";
Instance.OutputDataReceived += OnOutputDataReceived;
Instance.ErrorDataReceived += OnOutputDataReceived;
State = Models.State.Starting;
Instance.Start();
Instance.BeginOutputReadLine();
Instance.BeginErrorReadLine();
for (var i = 0; i < 1000; i++)
{
Thread.Sleep(10);
if (State == Models.State.Started)
{
return true;
}
if (State == Models.State.Stopped)
{
Utils.Logging.Info("Trojan 进程启动失败");
Stop();
return false;
}
}
Utils.Logging.Info("Trojan 进程启动超时");
Stop();
return false;
}
/// <summary>
/// 停止
/// </summary>
public void Stop()
{
try
{
if (Instance != null && !Instance.HasExited)
{
Instance.Kill();
}
}
catch (Exception e)
{
Utils.Logging.Info(e.ToString());
}
}
public void OnOutputDataReceived(object sender, DataReceivedEventArgs e)
{
if (!string.IsNullOrWhiteSpace(e.Data))
{
File.AppendAllText("logging\\trojan.log", $"{e.Data}\r\n");
if (State == Models.State.Starting)
{
if (Instance.HasExited)
{
State = Models.State.Stopped;
}
else if (e.Data.Contains("started"))
{
State = Models.State.Started;
}
else if (e.Data.Contains("exiting"))
{
State = Models.State.Stopped;
}
}
}
}
}
}

View File

@@ -26,7 +26,7 @@ namespace Netch.Controllers
public const string Name = @"Netch"; public const string Name = @"Netch";
public const string Copyright = @"Copyright © 2019 - 2020"; public const string Copyright = @"Copyright © 2019 - 2020";
public const string Version = @"1.4.4"; public const string Version = @"1.4.5";
public async void Check(bool notifyNoFound, bool isPreRelease) public async void Check(bool notifyNoFound, bool isPreRelease)
{ {

View File

@@ -86,6 +86,7 @@ namespace Netch.Forms
this.SettingsButton = new System.Windows.Forms.Button(); this.SettingsButton = new System.Windows.Forms.Button();
this.ProfileGroupBox = new System.Windows.Forms.GroupBox(); this.ProfileGroupBox = new System.Windows.Forms.GroupBox();
this.ProfileTable = new System.Windows.Forms.TableLayoutPanel(); this.ProfileTable = new System.Windows.Forms.TableLayoutPanel();
this.AddTrojanServerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.MenuStrip.SuspendLayout(); this.MenuStrip.SuspendLayout();
this.ConfigurationGroupBox.SuspendLayout(); this.ConfigurationGroupBox.SuspendLayout();
this.configLayoutPanel.SuspendLayout(); this.configLayoutPanel.SuspendLayout();
@@ -127,7 +128,8 @@ namespace Netch.Forms
this.AddSocks5ServerToolStripMenuItem, this.AddSocks5ServerToolStripMenuItem,
this.AddShadowsocksServerToolStripMenuItem, this.AddShadowsocksServerToolStripMenuItem,
this.AddShadowsocksRServerToolStripMenuItem, this.AddShadowsocksRServerToolStripMenuItem,
this.AddVMessServerToolStripMenuItem}); this.AddVMessServerToolStripMenuItem,
this.AddTrojanServerToolStripMenuItem});
this.ServerToolStripMenuItem.Margin = new System.Windows.Forms.Padding(3, 0, 0, 1); this.ServerToolStripMenuItem.Margin = new System.Windows.Forms.Padding(3, 0, 0, 1);
this.ServerToolStripMenuItem.Name = "ServerToolStripMenuItem"; this.ServerToolStripMenuItem.Name = "ServerToolStripMenuItem";
this.ServerToolStripMenuItem.Size = new System.Drawing.Size(57, 21); this.ServerToolStripMenuItem.Size = new System.Drawing.Size(57, 21);
@@ -638,6 +640,13 @@ namespace Netch.Forms
this.ProfileTable.Size = new System.Drawing.Size(599, 43); this.ProfileTable.Size = new System.Drawing.Size(599, 43);
this.ProfileTable.TabIndex = 0; this.ProfileTable.TabIndex = 0;
// //
// AddTrojanServerToolStripMenuItem
//
this.AddTrojanServerToolStripMenuItem.Name = "AddTrojanServerToolStripMenuItem";
this.AddTrojanServerToolStripMenuItem.Size = new System.Drawing.Size(259, 22);
this.AddTrojanServerToolStripMenuItem.Text = "Add [Trojan] Server";
this.AddTrojanServerToolStripMenuItem.Click += new System.EventHandler(this.AddTrojanServerToolStripMenuItem_Click);
//
// MainForm // MainForm
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
@@ -738,5 +747,6 @@ namespace Netch.Forms
private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem updateACLWithProxyToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem updateACLWithProxyToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem reinstallTapDriverToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem reinstallTapDriverToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem AddTrojanServerToolStripMenuItem;
} }
} }

View File

@@ -493,6 +493,12 @@ namespace Netch.Forms
Hide(); Hide();
} }
private void AddTrojanServerToolStripMenuItem_Click(object sender, EventArgs e)
{
new Server.Trojan().Show();
Hide();
}
private void CreateProcessModeToolStripButton_Click(object sender, EventArgs e) private void CreateProcessModeToolStripButton_Click(object sender, EventArgs e)
{ {
new Mode.Process().Show(); new Mode.Process().Show();
@@ -764,6 +770,9 @@ namespace Netch.Forms
case "VMess": case "VMess":
new Server.VMess(ServerComboBox.SelectedIndex).Show(); new Server.VMess(ServerComboBox.SelectedIndex).Show();
break; break;
case "Trojan":
new Server.Trojan(ServerComboBox.SelectedIndex).Show();
break;
default: default:
return; return;
} }

176
Netch/Forms/Server/Trojan.Designer.cs generated Normal file
View File

@@ -0,0 +1,176 @@
namespace Netch.Forms.Server
{
partial class Trojan
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Trojan));
this.ConfigurationGroupBox = new System.Windows.Forms.GroupBox();
this.PasswordTextBox = new System.Windows.Forms.TextBox();
this.PasswordLabel = new System.Windows.Forms.Label();
this.AddressLabel = new System.Windows.Forms.Label();
this.PortTextBox = new System.Windows.Forms.TextBox();
this.AddressTextBox = new System.Windows.Forms.TextBox();
this.RemarkTextBox = new System.Windows.Forms.TextBox();
this.RemarkLabel = new System.Windows.Forms.Label();
this.PortLabel = new System.Windows.Forms.Label();
this.ControlButton = new System.Windows.Forms.Button();
this.ConfigurationGroupBox.SuspendLayout();
this.SuspendLayout();
//
// ConfigurationGroupBox
//
this.ConfigurationGroupBox.Controls.Add(this.PasswordTextBox);
this.ConfigurationGroupBox.Controls.Add(this.PasswordLabel);
this.ConfigurationGroupBox.Controls.Add(this.AddressLabel);
this.ConfigurationGroupBox.Controls.Add(this.PortTextBox);
this.ConfigurationGroupBox.Controls.Add(this.AddressTextBox);
this.ConfigurationGroupBox.Controls.Add(this.RemarkTextBox);
this.ConfigurationGroupBox.Controls.Add(this.RemarkLabel);
this.ConfigurationGroupBox.Controls.Add(this.PortLabel);
this.ConfigurationGroupBox.Location = new System.Drawing.Point(12, 12);
this.ConfigurationGroupBox.Name = "ConfigurationGroupBox";
this.ConfigurationGroupBox.Size = new System.Drawing.Size(420, 109);
this.ConfigurationGroupBox.TabIndex = 0;
this.ConfigurationGroupBox.TabStop = false;
this.ConfigurationGroupBox.Text = "Configuration";
//
// PasswordTextBox
//
this.PasswordTextBox.Location = new System.Drawing.Point(120, 77);
this.PasswordTextBox.Name = "PasswordTextBox";
this.PasswordTextBox.Size = new System.Drawing.Size(294, 23);
this.PasswordTextBox.TabIndex = 7;
this.PasswordTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// PasswordLabel
//
this.PasswordLabel.AutoSize = true;
this.PasswordLabel.Location = new System.Drawing.Point(10, 80);
this.PasswordLabel.Name = "PasswordLabel";
this.PasswordLabel.Size = new System.Drawing.Size(64, 17);
this.PasswordLabel.TabIndex = 6;
this.PasswordLabel.Text = "Password";
//
// AddressLabel
//
this.AddressLabel.AutoSize = true;
this.AddressLabel.Location = new System.Drawing.Point(10, 51);
this.AddressLabel.Name = "AddressLabel";
this.AddressLabel.Size = new System.Drawing.Size(56, 17);
this.AddressLabel.TabIndex = 2;
this.AddressLabel.Text = "Address";
//
// PortTextBox
//
this.PortTextBox.Location = new System.Drawing.Point(358, 48);
this.PortTextBox.Name = "PortTextBox";
this.PortTextBox.Size = new System.Drawing.Size(56, 23);
this.PortTextBox.TabIndex = 5;
this.PortTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// AddressTextBox
//
this.AddressTextBox.Location = new System.Drawing.Point(120, 48);
this.AddressTextBox.Name = "AddressTextBox";
this.AddressTextBox.Size = new System.Drawing.Size(232, 23);
this.AddressTextBox.TabIndex = 3;
this.AddressTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// RemarkTextBox
//
this.RemarkTextBox.Location = new System.Drawing.Point(120, 19);
this.RemarkTextBox.Name = "RemarkTextBox";
this.RemarkTextBox.Size = new System.Drawing.Size(294, 23);
this.RemarkTextBox.TabIndex = 1;
this.RemarkTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// RemarkLabel
//
this.RemarkLabel.AutoSize = true;
this.RemarkLabel.Location = new System.Drawing.Point(10, 22);
this.RemarkLabel.Name = "RemarkLabel";
this.RemarkLabel.Size = new System.Drawing.Size(53, 17);
this.RemarkLabel.TabIndex = 0;
this.RemarkLabel.Text = "Remark";
//
// PortLabel
//
this.PortLabel.AutoSize = true;
this.PortLabel.Location = new System.Drawing.Point(351, 51);
this.PortLabel.Name = "PortLabel";
this.PortLabel.Size = new System.Drawing.Size(11, 17);
this.PortLabel.TabIndex = 4;
this.PortLabel.Text = ":";
//
// ControlButton
//
this.ControlButton.Location = new System.Drawing.Point(357, 127);
this.ControlButton.Name = "ControlButton";
this.ControlButton.Size = new System.Drawing.Size(75, 23);
this.ControlButton.TabIndex = 1;
this.ControlButton.Text = "Save";
this.ControlButton.UseVisualStyleBackColor = true;
this.ControlButton.Click += new System.EventHandler(this.ControlButton_Click);
//
// Trojan
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.ClientSize = new System.Drawing.Size(444, 161);
this.Controls.Add(this.ControlButton);
this.Controls.Add(this.ConfigurationGroupBox);
this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.MaximizeBox = false;
this.Name = "Trojan";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Trojan";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Trojan_FormClosing);
this.Load += new System.EventHandler(this.Trojan_Load);
this.ConfigurationGroupBox.ResumeLayout(false);
this.ConfigurationGroupBox.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.GroupBox ConfigurationGroupBox;
private System.Windows.Forms.Button ControlButton;
private System.Windows.Forms.Label RemarkLabel;
private System.Windows.Forms.TextBox RemarkTextBox;
private System.Windows.Forms.Label PortLabel;
private System.Windows.Forms.TextBox AddressTextBox;
private System.Windows.Forms.TextBox PortTextBox;
private System.Windows.Forms.Label AddressLabel;
private System.Windows.Forms.TextBox PasswordTextBox;
private System.Windows.Forms.Label PasswordLabel;
}
}

View File

@@ -0,0 +1,106 @@
using System;
using System.Drawing;
using System.Text.RegularExpressions;
using System.Windows.Forms;
namespace Netch.Forms.Server
{
public partial class Trojan : Form
{
public int Index;
/// <summary>
/// 初始化
/// </summary>
/// <param name="index">需要编辑的索引</param>
public Trojan(int index = -1)
{
InitializeComponent();
Index = index;
}
private void Trojan_Load(object sender, EventArgs e)
{
ConfigurationGroupBox.Text = Utils.i18N.Translate(ConfigurationGroupBox.Text);
RemarkLabel.Text = Utils.i18N.Translate(RemarkLabel.Text);
AddressLabel.Text = Utils.i18N.Translate(AddressLabel.Text);
PasswordLabel.Text = Utils.i18N.Translate(PasswordLabel.Text);
ControlButton.Text = Utils.i18N.Translate(ControlButton.Text);
if (Index != -1)
{
RemarkTextBox.Text = Global.Settings.Server[Index].Remark;
AddressTextBox.Text = Global.Settings.Server[Index].Hostname;
PortTextBox.Text = Global.Settings.Server[Index].Port.ToString();
PasswordTextBox.Text = Global.Settings.Server[Index].Password;
}
}
private void Trojan_FormClosing(object sender, FormClosingEventArgs e)
{
Global.MainForm.Show();
}
private void ComboBox_DrawItem(object sender, DrawItemEventArgs e)
{
var cbx = sender as ComboBox;
if (cbx != null)
{
e.DrawBackground();
if (e.Index >= 0)
{
var sf = new StringFormat();
sf.LineAlignment = StringAlignment.Center;
sf.Alignment = StringAlignment.Center;
var brush = new SolidBrush(cbx.ForeColor);
if ((e.State & DrawItemState.Selected) == DrawItemState.Selected)
{
brush = SystemBrushes.HighlightText as SolidBrush;
}
e.Graphics.DrawString(cbx.Items[e.Index].ToString(), cbx.Font, brush, e.Bounds, sf);
}
}
}
private void ControlButton_Click(object sender, EventArgs e)
{
if (!Regex.Match(PortTextBox.Text, "^[0-9]+$").Success)
{
return;
}
if (Index == -1)
{
Global.Settings.Server.Add(new Models.Server
{
Remark = RemarkTextBox.Text,
Type = "Trojan",
Hostname = AddressTextBox.Text,
Port = int.Parse(PortTextBox.Text),
Password = PasswordTextBox.Text
});
}
else
{
Global.Settings.Server[Index] = new Models.Server
{
Remark = RemarkTextBox.Text,
Group = Global.Settings.Server[Index].Group,
Type = "Trojan",
Hostname = AddressTextBox.Text,
Port = int.Parse(PortTextBox.Text),
Password = PasswordTextBox.Text
};
}
Utils.Configuration.Save();
MessageBox.Show(Utils.i18N.Translate("Saved"), Utils.i18N.Translate("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
Global.MainForm.InitServer();
Close();
}
}
}

File diff suppressed because it is too large Load Diff

76
Netch/Models/Trojan.cs Normal file
View File

@@ -0,0 +1,76 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Netch.Models
{
public class Trojan
{
/// <summary>
/// 启动类型
/// </summary>
public string run_type = "client";
/// <summary>
/// 监听地址
/// </summary>
public string local_addr = "127.0.0.1";
/// <summary>
/// 监听端口
/// </summary>
public int local_port = 2801;
/// <summary>
/// 远端地址
/// </summary>
public string remote_addr;
/// <summary>
/// 远端端口
/// </summary>
public int remote_port;
/// <summary>
/// 密码
/// </summary>
public List<string> password;
/// <summary>
/// 日志级别
/// </summary>
public int log_level = 1;
public TrojanSSL ssl = new TrojanSSL();
public TrojanTCP tcp = new TrojanTCP();
}
public class TrojanSSL
{
public bool verify = false;
public bool verify_hostname = false;
public string cert;
public string cipher = "ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA:AES128-SHA:AES256-SHA:DES-CBC3-SHA";
public string cipher_tls13 = "TLS_AES_128_GCM_SHA256:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_256_GCM_SHA384";
public string sni;
public List<string> alpn = new List<string>()
{
"h2",
"http/1.1"
};
public bool reuse_session = true;
public bool session_ticket = true;
public string curves = "";
}
public class TrojanTCP
{
public bool no_delay = false;
public bool keep_alive = true;
public bool reuse_port = false;
public bool fast_open = true;
public int fast_open_qlen = 20;
}
}

View File

@@ -66,6 +66,9 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Update="Forms\Server\Trojan.cs">
<SubType>Form</SubType>
</Compile>
<Compile Update="Properties\Resources.Designer.cs"> <Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime> <DesignTime>True</DesignTime>
<AutoGen>True</AutoGen> <AutoGen>True</AutoGen>

View File

@@ -19,6 +19,7 @@
"Starting Shadowsocks": "正在启动 Shadowsocks", "Starting Shadowsocks": "正在启动 Shadowsocks",
"Starting ShadowsocksR": "正在启动 ShadowsocksR", "Starting ShadowsocksR": "正在启动 ShadowsocksR",
"Starting V2ray": "正在启动 V2Ray", "Starting V2ray": "正在启动 V2Ray",
"Starting Trojan": "正在启动 Trojan",
"Starting Tap": "正在启动 TUN/TAP", "Starting Tap": "正在启动 TUN/TAP",
"Starting NatTester": "正在启动 NAT 测试", "Starting NatTester": "正在启动 NAT 测试",
"Starting LocalDns service": "正在启动本地 DNS 服务", "Starting LocalDns service": "正在启动本地 DNS 服务",
@@ -40,6 +41,7 @@
"Add [Shadowsocks] Server": "添加 [Shadowsocks] 服务器", "Add [Shadowsocks] Server": "添加 [Shadowsocks] 服务器",
"Add [ShadowsocksR] Server": "添加 [ShadowsocksR] 服务器", "Add [ShadowsocksR] Server": "添加 [ShadowsocksR] 服务器",
"Add [VMess] Server": "添加 [VMess] 服务器", "Add [VMess] Server": "添加 [VMess] 服务器",
"Add [Trojan] Server": "添加 [Trojan] 服务器",
"VMess is currently not supported. For more information, please see our Github releases\n\nPress OK will redirect": "当前不支持 VMess 服务器。需要更多信息请查看我们的 Github 发布页\n\n点击 OK 将会跳转", "VMess is currently not supported. For more information, please see our Github releases\n\nPress OK will redirect": "当前不支持 VMess 服务器。需要更多信息请查看我们的 Github 发布页\n\n点击 OK 将会跳转",
"Netch is now minimized to the notification bar, double click this icon to restore.": "Netch 已最小化至通知栏,双击此图标恢复窗口。", "Netch is now minimized to the notification bar, double click this icon to restore.": "Netch 已最小化至通知栏,双击此图标恢复窗口。",
"New version available": "发现新版本", "New version available": "发现新版本",

View File

@@ -1,5 +1,5 @@
# Netch # Netch
[![](https://img.shields.io/badge/Telegram-Channel-blue)](https://t.me/Netch) [![](https://img.shields.io/badge/Telegram-Group-green)](https://t.me/Netch_Discuss_Group) ![GitHub Actions & Netch CI](https://github.com/NetchX/Netch/workflows/GitHub%20Actions%20&%20Netch%20CI/badge.svg) [![](https://img.shields.io/badge/Telegram-Channel-blue)](https://t.me/Netch) [![](https://img.shields.io/badge/Telegram-Group-green)](https://t.me/Netch_Discuss_Group) ![Netch CI](https://github.com/NetchX/Netch/workflows/Netch%20CI/badge.svg)
Game accelerator Game accelerator
@@ -34,6 +34,7 @@ As well, Netch avoid the restricted NAT problem caused by SSTap. You can use an
- [shadowsocks-libev](https://github.com/shadowsocks/shadowsocks-libev) - [shadowsocks-libev](https://github.com/shadowsocks/shadowsocks-libev)
- [shadowsocksr-libev](https://github.com/shadowsocksrr/shadowsocksr-libev) - [shadowsocksr-libev](https://github.com/shadowsocksrr/shadowsocksr-libev)
- [v2ray-core](https://github.com/v2ray/v2ray-core) - [v2ray-core](https://github.com/v2ray/v2ray-core)
- [trojan](https://github.com/trojan-gfw/trojan)
- [ACL4SSR](https://github.com/ACL4SSR/ACL4SSR) - [ACL4SSR](https://github.com/ACL4SSR/ACL4SSR)
- [dnsmasq-china-list](https://github.com/felixonmars/dnsmasq-china-list) - [dnsmasq-china-list](https://github.com/felixonmars/dnsmasq-china-list)
- [unbound](https://github.com/NLnetLabs/unbound) - [unbound](https://github.com/NLnetLabs/unbound)

View File

@@ -1,7 +1,6 @@
# REM The reason we don't use dotnet build is that dotnet build doesn't support COM references yet https://github.com/microsoft/msbuild/issues/3986
param([string]$buildtfm = 'all') param([string]$buildtfm = 'all')
Write-Host 'dotnet SDK version' Write-Host 'DotNet SDK Version'
dotnet --version dotnet --version
$exe = 'Netch.exe' $exe = 'Netch.exe'
@@ -14,28 +13,23 @@ Write-Host $net_baseoutput
function Build-NetFrameworkx64 function Build-NetFrameworkx64
{ {
Write-Host 'Building .NET Framework x64' Write-Host 'Building .NET Framework x64'
$outdir = "$net_baseoutput\x64" $outdir = "$net_baseoutput\x64"
msbuild -v:m -m -t:Build /p:Configuration="Release" /p:Platform="x64" /p:TargetFramework=net48 /p:Runtimeidentifier=win-x64 /restore msbuild -v:m -m -t:Build /p:Configuration="Release" /p:Platform="x64" /p:TargetFramework=net48 /p:Runtimeidentifier=win-x64 /restore
if ($LASTEXITCODE) { cd $mainDir ; exit $LASTEXITCODE } if ($LASTEXITCODE) { cd $mainDir ; exit $LASTEXITCODE }
Write-Host 'Build x64 Complete ,Started Copy bin,mode,i18n file' Write-Host 'Build x64 Completed, start copy bin, mode, i18n file'
Remove-Item -Recurse -Force "$net_baseoutput\x64\Release\win-x64\bin\tap-driver"
Copy-Item "$mainDir\translations\i18n\*" "$net_baseoutput\x64\Release\win-x64\i18n" -recurse Copy-Item -Recurse "$mainDir\binaries\*" "$net_baseoutput\x64\Release\win-x64\bin"
Copy-Item -Recurse "$mainDir\modes\mode\*" "$net_baseoutput\x64\Release\win-x64\mode"
Copy-Item "$mainDir\modes\mode\*" "$net_baseoutput\x64\Release\win-x64\mode" -recurse Copy-Item -Recurse "$mainDir\translations\i18n\*" "$net_baseoutput\x64\Release\win-x64\i18n"
Remove-Item -path "$net_baseoutput\x64\Release\win-x64\bin\tap-driver"
Copy-Item "$mainDir\binaries\*" -destination "$net_baseoutput\x64\Release\win-x64\bin" -recurse
Write-Host 'Netch Build ALL DONE'
Write-Host 'Build done'
} }
cd $mainDir\Netch cd $mainDir\Netch
Build-NetFrameworkx64 Build-NetFrameworkx64
cd $mainDir cd $mainDir
exit 0

View File

@@ -1,5 +1,5 @@
# Netch # Netch
[![](https://img.shields.io/badge/Telegram-频道-blue)](https://t.me/Netch) [![](https://img.shields.io/badge/Telegram-讨论组-green)](https://t.me/Netch_Discuss_Group) ![GitHub Actions & Netch CI](https://github.com/NetchX/Netch/workflows/GitHub%20Actions%20&%20Netch%20CI/badge.svg) [![](https://img.shields.io/badge/Telegram-频道-blue)](https://t.me/Netch) [![](https://img.shields.io/badge/Telegram-讨论组-green)](https://t.me/Netch_Discuss_Group) ![Netch CI](https://github.com/NetchX/Netch/workflows/Netch%20CI/badge.svg)
游戏加速工具 游戏加速工具
@@ -8,7 +8,7 @@
- [TOC](#TOC) - [TOC](#TOC)
- [简介](#简介) - [简介](#简介)
- [捐赠](#捐赠) - [捐赠](#捐赠)
- [新手入门](Basic-usage.md) - [新手入门](Quickstart.zh-CN.md)
- [进阶用法](https://github.com/NormanBB/NetchMode/blob/master/docs/README.zh-CN.md) - [进阶用法](https://github.com/NormanBB/NetchMode/blob/master/docs/README.zh-CN.md)
- [依赖](#依赖) - [依赖](#依赖)
- [语言支持](#语言支持) - [语言支持](#语言支持)
@@ -39,6 +39,7 @@ Netch 支持多种语言,在启动时会根据系统语言选择自身语言
- [shadowsocks-libev](https://github.com/shadowsocks/shadowsocks-libev) - [shadowsocks-libev](https://github.com/shadowsocks/shadowsocks-libev)
- [shadowsocksr-libev](https://github.com/shadowsocksrr/shadowsocksr-libev) - [shadowsocksr-libev](https://github.com/shadowsocksrr/shadowsocksr-libev)
- [v2ray-core](https://github.com/v2ray/v2ray-core) - [v2ray-core](https://github.com/v2ray/v2ray-core)
- [trojan](https://github.com/trojan-gfw/trojan)
- [ACL4SSR](https://github.com/ACL4SSR/ACL4SSR) - [ACL4SSR](https://github.com/ACL4SSR/ACL4SSR)
- [dnsmasq-china-list](https://github.com/felixonmars/dnsmasq-china-list) - [dnsmasq-china-list](https://github.com/felixonmars/dnsmasq-china-list)
- [unbound](https://github.com/NLnetLabs/unbound) - [unbound](https://github.com/NLnetLabs/unbound)

2
modes

Submodule modes updated: 314f2d14b4...ed69e875fa