Compare commits
52 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d09700b54a | ||
|
|
427e1bba80 | ||
|
|
01d0ffcdc9 | ||
|
|
ae095ba99a | ||
|
|
3e3c41e7f9 | ||
|
|
edae4bd9d5 | ||
|
|
415baea580 | ||
|
|
bc98a9cd42 | ||
|
|
2d22608d48 | ||
|
|
5df2b77ec0 | ||
|
|
1bc7ea95eb | ||
|
|
f240dc9da8 | ||
|
|
338170f10b | ||
|
|
f02c9151de | ||
|
|
a711ee4f3f | ||
|
|
1c628492e8 | ||
|
|
045eb9e751 | ||
|
|
445013af99 | ||
|
|
156686bc98 | ||
|
|
47b611d350 | ||
|
|
b615119dcd | ||
|
|
fea60efa45 | ||
|
|
2da11beb7a | ||
|
|
9aafefad37 | ||
|
|
e8879379c9 | ||
|
|
2585c3967f | ||
|
|
2914a2d9dc | ||
|
|
f62bf91857 | ||
|
|
d34a43a790 | ||
|
|
c9c023aad8 | ||
|
|
8e202e6800 | ||
|
|
9fe2541f18 | ||
|
|
b83f6d6c3d | ||
|
|
2bcd942675 | ||
|
|
8c05ba2289 | ||
|
|
95f26332a6 | ||
|
|
e946b01b6f | ||
|
|
b2b19be32b | ||
|
|
ffc6b7adc9 | ||
|
|
9ecde61b52 | ||
|
|
083364ae9d | ||
|
|
96f8b9944d | ||
|
|
8d7a5613fa | ||
|
|
d8133bcc35 | ||
|
|
9149f23986 | ||
|
|
92d1cfdb50 | ||
|
|
53e847ce1d | ||
|
|
08524f08f3 | ||
|
|
222ddfe434 | ||
|
|
6872ca94e7 | ||
|
|
152f49c161 | ||
|
|
0b46f8d8af |
60
.github/workflows/build.yml
vendored
@@ -1,61 +1,57 @@
|
|||||||
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.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.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
|
||||||
draft: false
|
draft: false
|
||||||
files: |
|
files: |
|
||||||
C:\builtfiles\Netch-${{ env.GITHUB_TAG_NAME }}.zip
|
C:\builtfiles\Netch.zip
|
||||||
body: |
|
body: |
|
||||||
|
|
||||||
[](https://t.me/Netch) [](https://t.me/Netch_Discuss_Group)
|
[](https://t.me/Netch) [](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.zip | ${{ env.Netch_SHA256 }} |
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
|
||||||
|
|||||||
35
BUILD.ps1
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
param([string]$buildtfm = 'all')
|
||||||
|
|
||||||
|
Write-Host 'DotNet SDK Version'
|
||||||
|
dotnet --version
|
||||||
|
|
||||||
|
$exe = 'Netch.exe'
|
||||||
|
$mainDir = (Get-Item -Path ".\").FullName
|
||||||
|
$net_baseoutput = "$mainDir\Netch\bin\$configuration"
|
||||||
|
|
||||||
|
Write-Host $mainDir
|
||||||
|
Write-Host $net_baseoutput
|
||||||
|
|
||||||
|
function Build-NetFrameworkx64
|
||||||
|
{
|
||||||
|
Write-Host 'Building .NET Framework 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
|
||||||
|
if ($LASTEXITCODE) { cd $mainDir ; exit $LASTEXITCODE }
|
||||||
|
|
||||||
|
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 -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 -Recurse "$mainDir\translations\i18n\*" "$net_baseoutput\x64\Release\win-x64\i18n"
|
||||||
|
|
||||||
|
Write-Host 'Build done'
|
||||||
|
}
|
||||||
|
|
||||||
|
cd $mainDir\Netch
|
||||||
|
Build-NetFrameworkx64
|
||||||
|
cd $mainDir
|
||||||
|
|
||||||
|
exit 0
|
||||||
@@ -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
@@ -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
|
||||||
@@ -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()
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ namespace Netch.Controllers
|
|||||||
if (Instance != null && !Instance.HasExited)
|
if (Instance != null && !Instance.HasExited)
|
||||||
{
|
{
|
||||||
Instance.Kill();
|
Instance.Kill();
|
||||||
|
Instance.WaitForExit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
|||||||
@@ -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)
|
||||||
@@ -126,17 +139,15 @@ namespace Netch.Controllers
|
|||||||
result = pNFController.Start(server, mode, false);
|
result = pNFController.Start(server, mode, false);
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
MainForm.Instance.StatusText($"{Utils.i18N.Translate("Status")}{Utils.i18N.Translate(": ")}{Utils.i18N.Translate("ReStarting Redirector")}");
|
MainForm.Instance.StatusText($"{Utils.i18N.Translate("Status")}{Utils.i18N.Translate(": ")}{Utils.i18N.Translate("Restarting Redirector")}");
|
||||||
Utils.Logging.Info("正常启动失败后尝试停止驱动服务再重新启动");
|
Utils.Logging.Info("正常启动失败后尝试停止驱动服务再重新启动");
|
||||||
//正常启动失败后尝试停止驱动服务再重新启动
|
//正常启动失败后尝试停止驱动服务再重新启动
|
||||||
result = pNFController.Start(server, mode, true);
|
result = pNFController.Start(server, mode, true);
|
||||||
}
|
}
|
||||||
if (result)
|
else
|
||||||
Task.Run(() =>
|
{
|
||||||
{
|
Task.Run(() => pNTTController.Start());
|
||||||
pNTTController.Start();
|
}
|
||||||
});
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (mode.Type == 1)
|
else if (mode.Type == 1)
|
||||||
{
|
{
|
||||||
@@ -151,10 +162,9 @@ namespace Netch.Controllers
|
|||||||
// TUN/TAP 黑名单代理模式,启动 TUN/TAP 控制器
|
// TUN/TAP 黑名单代理模式,启动 TUN/TAP 控制器
|
||||||
result = pTUNTAPController.Start(server, mode);
|
result = pTUNTAPController.Start(server, mode);
|
||||||
if (result)
|
if (result)
|
||||||
Task.Run(() =>
|
{
|
||||||
{
|
Task.Run(() => pNTTController.Start());
|
||||||
pNTTController.Start();
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
else if (mode.Type == 2)
|
else if (mode.Type == 2)
|
||||||
{
|
{
|
||||||
@@ -169,10 +179,9 @@ namespace Netch.Controllers
|
|||||||
// TUN/TAP 白名单代理模式,启动 TUN/TAP 控制器
|
// TUN/TAP 白名单代理模式,启动 TUN/TAP 控制器
|
||||||
result = pTUNTAPController.Start(server, mode);
|
result = pTUNTAPController.Start(server, mode);
|
||||||
if (result)
|
if (result)
|
||||||
Task.Run(() =>
|
{
|
||||||
{
|
Task.Run(() => pNTTController.Start());
|
||||||
pNTTController.Start();
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
else if (mode.Type == 3 || mode.Type == 5)
|
else if (mode.Type == 3 || mode.Type == 5)
|
||||||
{
|
{
|
||||||
@@ -218,6 +227,10 @@ namespace Netch.Controllers
|
|||||||
{
|
{
|
||||||
pVMessController.Stop();
|
pVMessController.Stop();
|
||||||
}
|
}
|
||||||
|
else if (pTrojanController != null)
|
||||||
|
{
|
||||||
|
pTrojanController.Stop();
|
||||||
|
}
|
||||||
|
|
||||||
if (pNFController != null)
|
if (pNFController != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -47,6 +47,11 @@ namespace Netch.Controllers
|
|||||||
if (!StopServiceAndRestart)
|
if (!StopServiceAndRestart)
|
||||||
MainForm.Instance.StatusText($"{Utils.i18N.Translate("Status")}{Utils.i18N.Translate(": ")}{Utils.i18N.Translate("Starting Redirector")}");
|
MainForm.Instance.StatusText($"{Utils.i18N.Translate("Status")}{Utils.i18N.Translate(": ")}{Utils.i18N.Translate("Starting Redirector")}");
|
||||||
|
|
||||||
|
if (!File.Exists("bin\\Redirector.exe"))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// 检查驱动是否存在
|
// 检查驱动是否存在
|
||||||
if (File.Exists(driverPath))
|
if (File.Exists(driverPath))
|
||||||
{
|
{
|
||||||
@@ -72,14 +77,14 @@ namespace Netch.Controllers
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//检查驱动版本号
|
// 检查驱动版本号
|
||||||
FileVersionInfo SystemfileVerInfo = System.Diagnostics.FileVersionInfo.GetVersionInfo(driverPath);
|
FileVersionInfo SystemfileVerInfo = System.Diagnostics.FileVersionInfo.GetVersionInfo(driverPath);
|
||||||
FileVersionInfo BinFileVerInfo = System.Diagnostics.FileVersionInfo.GetVersionInfo(string.Format("bin\\{0}", driverName));
|
FileVersionInfo BinFileVerInfo = System.Diagnostics.FileVersionInfo.GetVersionInfo(string.Format("bin\\{0}", driverName));
|
||||||
|
|
||||||
if (!SystemfileVerInfo.FileVersion.Equals(BinFileVerInfo.FileVersion))
|
if (!SystemfileVerInfo.FileVersion.Equals(BinFileVerInfo.FileVersion))
|
||||||
{
|
{
|
||||||
Utils.Logging.Info("开始更新驱动");
|
Utils.Logging.Info("开始更新驱动");
|
||||||
//需要更新驱动
|
// 需要更新驱动
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var service = new ServiceController("netfilter2");
|
var service = new ServiceController("netfilter2");
|
||||||
@@ -108,16 +113,18 @@ namespace Netch.Controllers
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!InstallDriver())
|
if (!InstallDriver())
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
//启动驱动服务
|
// 启动驱动服务
|
||||||
var service = new ServiceController("netfilter2");
|
var service = new ServiceController("netfilter2");
|
||||||
if (service.Status == ServiceControllerStatus.Running && StopServiceAndRestart)
|
if (service.Status == ServiceControllerStatus.Running && StopServiceAndRestart)
|
||||||
{
|
{
|
||||||
//防止其他程序占用 重置NF百万ID限制
|
// 防止其他程序占用 重置 NF 百万连接数限制
|
||||||
service.Stop();
|
service.Stop();
|
||||||
service.WaitForStatus(ServiceControllerStatus.Stopped);
|
service.WaitForStatus(ServiceControllerStatus.Stopped);
|
||||||
MainForm.Instance.StatusText($"{Utils.i18N.Translate("Status")}{Utils.i18N.Translate(": ")}{Utils.i18N.Translate("Starting netfilter2 Service")}");
|
MainForm.Instance.StatusText($"{Utils.i18N.Translate("Status")}{Utils.i18N.Translate(": ")}{Utils.i18N.Translate("Starting netfilter2 Service")}");
|
||||||
@@ -142,105 +149,43 @@ namespace Netch.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
var processes = "";
|
var processes = "";
|
||||||
|
|
||||||
//开启进程白名单模式
|
|
||||||
if (!Global.Settings.ProcessBypassMode)
|
|
||||||
{
|
|
||||||
processes += "NTT.exe,";
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var proc in mode.Rule)
|
foreach (var proc in mode.Rule)
|
||||||
{
|
{
|
||||||
processes += proc;
|
processes += proc;
|
||||||
processes += ",";
|
processes += ",";
|
||||||
}
|
}
|
||||||
processes = processes.Substring(0, processes.Length - 1);
|
processes += "NTT.exe";
|
||||||
|
|
||||||
Instance = MainController.GetProcess();
|
Instance = MainController.GetProcess();
|
||||||
var fallback = "";
|
Instance.StartInfo.FileName = "bin\\Redirector.exe";
|
||||||
|
Instance.StartInfo.Arguments = "";
|
||||||
|
|
||||||
if (Global.Settings.UseRedirector2)
|
if (server.Type != "Socks5")
|
||||||
{
|
{
|
||||||
if (!File.Exists("bin\\Redirector2.exe"))
|
Instance.StartInfo.Arguments += $"-r 127.0.0.1:{Global.Settings.Socks5LocalPort} -p \"{processes}\"";
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
Instance.StartInfo.FileName = "bin\\Redirector2.exe";
|
|
||||||
|
|
||||||
|
|
||||||
if (server.Type != "Socks5")
|
|
||||||
{
|
|
||||||
fallback += $" 127.0.0.1:{Global.Settings.Socks5LocalPort}";
|
|
||||||
fallback += $" \"{processes}\"";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var result = Utils.DNS.Lookup(server.Hostname);
|
|
||||||
if (result == null)
|
|
||||||
{
|
|
||||||
Utils.Logging.Info("无法解析服务器 IP 地址");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
fallback += $" {result}:{server.Port}";
|
|
||||||
fallback += $" \"{processes}\"";
|
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(server.Username) && !string.IsNullOrWhiteSpace(server.Password))
|
|
||||||
{
|
|
||||||
fallback += $" \"{server.Username}\"";
|
|
||||||
fallback += $" \"{server.Password}\"";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!File.Exists("bin\\Redirector.exe"))
|
var result = Utils.DNS.Lookup(server.Hostname);
|
||||||
|
if (result == null)
|
||||||
{
|
{
|
||||||
|
Utils.Logging.Info("无法解析服务器 IP 地址");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Instance.StartInfo.FileName = "bin\\Redirector.exe";
|
|
||||||
|
|
||||||
//开启进程白名单模式
|
Instance.StartInfo.Arguments += $"-r {result}:{server.Port} -p \"{processes}\"";
|
||||||
if (Global.Settings.ProcessBypassMode)
|
if (!string.IsNullOrWhiteSpace(server.Username) && !string.IsNullOrWhiteSpace(server.Password))
|
||||||
{
|
{
|
||||||
processes += ",Shadowsocks.exe";
|
Instance.StartInfo.Arguments += $" -username \"{server.Username}\" -password \"{server.Password}\"";
|
||||||
processes += ",ShadowsocksR.exe";
|
|
||||||
processes += ",Privoxy.exe";
|
|
||||||
processes += ",simple-obfs.exe";
|
|
||||||
processes += ",v2ray.exe,v2ctl.exe,v2ray-plugin.exe";
|
|
||||||
fallback += " -bypass true ";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
fallback += " -bypass false ";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (server.Type != "Socks5")
|
|
||||||
{
|
|
||||||
fallback += $"-r 127.0.0.1:{Global.Settings.Socks5LocalPort} -p \"{processes}\"";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var result = Utils.DNS.Lookup(server.Hostname);
|
|
||||||
if (result == null)
|
|
||||||
{
|
|
||||||
Utils.Logging.Info("无法解析服务器 IP 地址");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
fallback += $"-r {result}:{server.Port} -p \"{processes}\"";
|
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(server.Username) && !string.IsNullOrWhiteSpace(server.Password))
|
|
||||||
{
|
|
||||||
fallback += $" -username \"{server.Username}\" -password \"{server.Password}\"";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (File.Exists("logging\\redirector.log"))
|
if (File.Exists("logging\\redirector.log"))
|
||||||
File.Delete("logging\\redirector.log");
|
{
|
||||||
|
File.Delete("logging\\redirector.log");
|
||||||
|
}
|
||||||
|
|
||||||
Instance.StartInfo.Arguments = fallback + $" -tcport {Global.Settings.RedirectorTCPPort}";
|
Instance.StartInfo.Arguments += $" -t {Global.Settings.RedirectorTCPPort}";
|
||||||
Utils.Logging.Info(Instance.StartInfo.Arguments);
|
Utils.Logging.Info(Instance.StartInfo.Arguments);
|
||||||
Instance.OutputDataReceived += OnOutputDataReceived;
|
Instance.OutputDataReceived += OnOutputDataReceived;
|
||||||
Instance.ErrorDataReceived += OnOutputDataReceived;
|
Instance.ErrorDataReceived += OnOutputDataReceived;
|
||||||
@@ -255,13 +200,8 @@ namespace Netch.Controllers
|
|||||||
|
|
||||||
if (State == Models.State.Started)
|
if (State == Models.State.Started)
|
||||||
{
|
{
|
||||||
Utils.Logging.Info($"成功启动Redirector耗时:{i + 1}秒");
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
Utils.Logging.Info($"Redirector启动中,已耗时:{i + 1}秒");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils.Logging.Info("NF 进程启动超时");
|
Utils.Logging.Info("NF 进程启动超时");
|
||||||
@@ -347,7 +287,7 @@ namespace Netch.Controllers
|
|||||||
{
|
{
|
||||||
State = Models.State.Stopped;
|
State = Models.State.Stopped;
|
||||||
}
|
}
|
||||||
else if (e.Data.Contains("Start") || e.Data.Contains("Redirect to"))
|
else if (e.Data.Contains("Started"))
|
||||||
{
|
{
|
||||||
State = Models.State.Started;
|
State = Models.State.Started;
|
||||||
}
|
}
|
||||||
@@ -358,9 +298,9 @@ namespace Netch.Controllers
|
|||||||
}
|
}
|
||||||
else if (State == Models.State.Started)
|
else if (State == Models.State.Started)
|
||||||
{
|
{
|
||||||
if (e.Data.StartsWith("[Application][Bandwidth]"))
|
if (e.Data.StartsWith("[APP][Bandwidth]"))
|
||||||
{
|
{
|
||||||
var splited = e.Data.Replace("[Application][Bandwidth]", "").Trim().Split(',');
|
var splited = e.Data.Replace("[APP][Bandwidth]", "").Trim().Split(',');
|
||||||
if (splited.Length == 2)
|
if (splited.Length == 2)
|
||||||
{
|
{
|
||||||
var uploadSplited = splited[0].Split(':');
|
var uploadSplited = splited[0].Split(':');
|
||||||
|
|||||||
@@ -73,6 +73,7 @@ namespace Netch.Controllers
|
|||||||
if (Instance != null && !Instance.HasExited)
|
if (Instance != null && !Instance.HasExited)
|
||||||
{
|
{
|
||||||
Instance.Kill();
|
Instance.Kill();
|
||||||
|
Instance.WaitForExit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
@@ -89,6 +90,7 @@ namespace Netch.Controllers
|
|||||||
{
|
{
|
||||||
File.Delete("logging\\NTT.log");
|
File.Delete("logging\\NTT.log");
|
||||||
}
|
}
|
||||||
|
|
||||||
File.AppendAllText("logging\\NTT.log", $"{e.Data}\r\n");
|
File.AppendAllText("logging\\NTT.log", $"{e.Data}\r\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -73,6 +73,7 @@ namespace Netch.Controllers
|
|||||||
if (Instance != null && !Instance.HasExited)
|
if (Instance != null && !Instance.HasExited)
|
||||||
{
|
{
|
||||||
Instance.Kill();
|
Instance.Kill();
|
||||||
|
Instance.WaitForExit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
|
|||||||
@@ -117,12 +117,17 @@ namespace Netch.Controllers
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
if (Global.Settings.BootShadowsocksFromDLL)
|
||||||
|
{
|
||||||
|
NativeMethods.Shadowsocks.Stop();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (Instance != null && !Instance.HasExited)
|
if (Instance != null && !Instance.HasExited)
|
||||||
{
|
{
|
||||||
Instance.Kill();
|
Instance.Kill();
|
||||||
|
Instance.WaitForExit();
|
||||||
}
|
}
|
||||||
if (Global.Settings.BootShadowsocksFromDLL)
|
|
||||||
NativeMethods.Shadowsocks.Stop();
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -106,6 +106,7 @@ namespace Netch.Controllers
|
|||||||
if (Instance != null && !Instance.HasExited)
|
if (Instance != null && !Instance.HasExited)
|
||||||
{
|
{
|
||||||
Instance.Kill();
|
Instance.Kill();
|
||||||
|
Instance.WaitForExit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ namespace Netch.Controllers
|
|||||||
public bool SetupBypass()
|
public bool SetupBypass()
|
||||||
{
|
{
|
||||||
MainForm.Instance.StatusText($"{Utils.i18N.Translate("Status")}{Utils.i18N.Translate(": ")}{Utils.i18N.Translate("SetupBypass")}");
|
MainForm.Instance.StatusText($"{Utils.i18N.Translate("Status")}{Utils.i18N.Translate(": ")}{Utils.i18N.Translate("SetupBypass")}");
|
||||||
Logging.Info("设置绕行规则->设置让服务器 IP 走直连");
|
Logging.Info("设置绕行规则 → 设置让服务器 IP 走直连");
|
||||||
// 让服务器 IP 走直连
|
// 让服务器 IP 走直连
|
||||||
foreach (var address in ServerAddresses)
|
foreach (var address in ServerAddresses)
|
||||||
{
|
{
|
||||||
@@ -81,7 +81,7 @@ namespace Netch.Controllers
|
|||||||
// 处理模式的绕过中国
|
// 处理模式的绕过中国
|
||||||
if (SavedMode.BypassChina)
|
if (SavedMode.BypassChina)
|
||||||
{
|
{
|
||||||
Logging.Info("设置绕行规则->处理模式的绕过中国");
|
Logging.Info("设置绕行规则 → 处理模式的绕过中国");
|
||||||
using (var sr = new StringReader(Encoding.UTF8.GetString(Properties.Resources.CNIP)))
|
using (var sr = new StringReader(Encoding.UTF8.GetString(Properties.Resources.CNIP)))
|
||||||
{
|
{
|
||||||
string text;
|
string text;
|
||||||
@@ -95,7 +95,7 @@ namespace Netch.Controllers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Logging.Info("设置绕行规则->处理全局绕过 IP");
|
Logging.Info("设置绕行规则 → 处理全局绕过 IP");
|
||||||
// 处理全局绕过 IP
|
// 处理全局绕过 IP
|
||||||
foreach (var ip in Global.Settings.BypassIPs)
|
foreach (var ip in Global.Settings.BypassIPs)
|
||||||
{
|
{
|
||||||
@@ -108,7 +108,7 @@ namespace Netch.Controllers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Logging.Info("设置绕行规则->处理绕过局域网 IP");
|
Logging.Info("设置绕行规则 → 处理绕过局域网 IP");
|
||||||
// 处理绕过局域网 IP
|
// 处理绕过局域网 IP
|
||||||
foreach (var ip in BypassLanIPs)
|
foreach (var ip in BypassLanIPs)
|
||||||
{
|
{
|
||||||
@@ -123,7 +123,7 @@ namespace Netch.Controllers
|
|||||||
|
|
||||||
if (SavedMode.Type == 2) // 处理仅规则内走直连
|
if (SavedMode.Type == 2) // 处理仅规则内走直连
|
||||||
{
|
{
|
||||||
Logging.Info("设置绕行规则->处理仅规则内走直连");
|
Logging.Info("设置绕行规则 → 处理仅规则内走直连");
|
||||||
// 将 TUN/TAP 网卡权重放到最高
|
// 将 TUN/TAP 网卡权重放到最高
|
||||||
var instance = new Process
|
var instance = new Process
|
||||||
{
|
{
|
||||||
@@ -138,7 +138,7 @@ namespace Netch.Controllers
|
|||||||
};
|
};
|
||||||
instance.Start();
|
instance.Start();
|
||||||
|
|
||||||
Logging.Info("设置绕行规则->创建默认路由");
|
Logging.Info("设置绕行规则 → 创建默认路由");
|
||||||
// 创建默认路由
|
// 创建默认路由
|
||||||
if (!NativeMethods.CreateRoute("0.0.0.0", 0, Global.Settings.TUNTAP.Gateway, Global.TUNTAP.Index, 10))
|
if (!NativeMethods.CreateRoute("0.0.0.0", 0, Global.Settings.TUNTAP.Gateway, Global.TUNTAP.Index, 10))
|
||||||
{
|
{
|
||||||
@@ -152,7 +152,7 @@ namespace Netch.Controllers
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Logging.Info("设置绕行规则->创建规则路由");
|
Logging.Info("设置绕行规则 → 创建规则路由");
|
||||||
// 创建规则路由
|
// 创建规则路由
|
||||||
foreach (var ip in SavedMode.Rule)
|
foreach (var ip in SavedMode.Rule)
|
||||||
{
|
{
|
||||||
@@ -182,7 +182,7 @@ namespace Netch.Controllers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//处理NAT类型检测,由于协议的原因,无法仅通过域名确定需要代理的IP,自己记录解析了返回的IP,仅支持默认检测服务器
|
//处理 NAT 类型检测,由于协议的原因,无法仅通过域名确定需要代理的 IP,自己记录解析了返回的 IP,仅支持默认检测服务器
|
||||||
if (Global.Settings.STUN_Server == "stun.stunprotocol.org")
|
if (Global.Settings.STUN_Server == "stun.stunprotocol.org")
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -200,13 +200,13 @@ namespace Netch.Controllers
|
|||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
Logging.Info("NAT类型测试域名解析失败,将不会被添加到代理列表。");
|
Logging.Info("NAT 类型测试域名解析失败,将不会被添加到代理列表");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//处理DNS代理
|
//处理DNS代理
|
||||||
if (Global.Settings.TUNTAP.ProxyDNS)
|
if (Global.Settings.TUNTAP.ProxyDNS)
|
||||||
{
|
{
|
||||||
Logging.Info("设置绕行规则->处理自定义DNS代理");
|
Logging.Info("设置绕行规则 → 处理自定义 DNS 代理");
|
||||||
if (Global.Settings.TUNTAP.UseCustomDNS)
|
if (Global.Settings.TUNTAP.UseCustomDNS)
|
||||||
{
|
{
|
||||||
string dns = "";
|
string dns = "";
|
||||||
|
|||||||
128
Netch/Controllers/TrojanController.cs
Normal file
@@ -0,0 +1,128 @@
|
|||||||
|
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();
|
||||||
|
Instance.WaitForExit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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.7";
|
||||||
|
|
||||||
public async void Check(bool notifyNoFound, bool isPreRelease)
|
public async void Check(bool notifyNoFound, bool isPreRelease)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -216,6 +216,7 @@ namespace Netch.Controllers
|
|||||||
if (Instance != null && !Instance.HasExited)
|
if (Instance != null && !Instance.HasExited)
|
||||||
{
|
{
|
||||||
Instance.Kill();
|
Instance.Kill();
|
||||||
|
Instance.WaitForExit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
|||||||
2
Netch/Forms/AboutForm.Designer.cs
generated
@@ -51,7 +51,7 @@
|
|||||||
// SponsorPictureBox
|
// SponsorPictureBox
|
||||||
//
|
//
|
||||||
this.SponsorPictureBox.Cursor = System.Windows.Forms.Cursors.Hand;
|
this.SponsorPictureBox.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||||
this.SponsorPictureBox.Image = global::Netch.Properties.Resources.N3RO;
|
this.SponsorPictureBox.Image = global::Netch.Properties.Resources.Sponsor;
|
||||||
this.SponsorPictureBox.Location = new System.Drawing.Point(6, 22);
|
this.SponsorPictureBox.Location = new System.Drawing.Point(6, 22);
|
||||||
this.SponsorPictureBox.Name = "SponsorPictureBox";
|
this.SponsorPictureBox.Name = "SponsorPictureBox";
|
||||||
this.SponsorPictureBox.Size = new System.Drawing.Size(300, 200);
|
this.SponsorPictureBox.Size = new System.Drawing.Size(300, 200);
|
||||||
|
|||||||
14
Netch/Forms/MainForm.Designer.cs
generated
@@ -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);
|
||||||
@@ -277,7 +279,7 @@ namespace Netch.Forms
|
|||||||
//
|
//
|
||||||
this.reinstallTapDriverToolStripMenuItem.Name = "reinstallTapDriverToolStripMenuItem";
|
this.reinstallTapDriverToolStripMenuItem.Name = "reinstallTapDriverToolStripMenuItem";
|
||||||
this.reinstallTapDriverToolStripMenuItem.Size = new System.Drawing.Size(209, 22);
|
this.reinstallTapDriverToolStripMenuItem.Size = new System.Drawing.Size(209, 22);
|
||||||
this.reinstallTapDriverToolStripMenuItem.Text = "Reinstall Tap driver";
|
this.reinstallTapDriverToolStripMenuItem.Text = "Reinstall TUN/TAP driver";
|
||||||
this.reinstallTapDriverToolStripMenuItem.Click += new System.EventHandler(this.reinstallTapDriverToolStripMenuItem_Click);
|
this.reinstallTapDriverToolStripMenuItem.Click += new System.EventHandler(this.reinstallTapDriverToolStripMenuItem_Click);
|
||||||
//
|
//
|
||||||
// AboutToolStripButton
|
// AboutToolStripButton
|
||||||
@@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -352,6 +352,7 @@ namespace Netch.Forms
|
|||||||
AddShadowsocksServerToolStripMenuItem.Text = Utils.i18N.Translate(AddShadowsocksServerToolStripMenuItem.Text);
|
AddShadowsocksServerToolStripMenuItem.Text = Utils.i18N.Translate(AddShadowsocksServerToolStripMenuItem.Text);
|
||||||
AddShadowsocksRServerToolStripMenuItem.Text = Utils.i18N.Translate(AddShadowsocksRServerToolStripMenuItem.Text);
|
AddShadowsocksRServerToolStripMenuItem.Text = Utils.i18N.Translate(AddShadowsocksRServerToolStripMenuItem.Text);
|
||||||
AddVMessServerToolStripMenuItem.Text = Utils.i18N.Translate(AddVMessServerToolStripMenuItem.Text);
|
AddVMessServerToolStripMenuItem.Text = Utils.i18N.Translate(AddVMessServerToolStripMenuItem.Text);
|
||||||
|
AddTrojanServerToolStripMenuItem.Text = Utils.i18N.Translate(AddTrojanServerToolStripMenuItem.Text);
|
||||||
ModeToolStripMenuItem.Text = Utils.i18N.Translate(ModeToolStripMenuItem.Text);
|
ModeToolStripMenuItem.Text = Utils.i18N.Translate(ModeToolStripMenuItem.Text);
|
||||||
CreateProcessModeToolStripMenuItem.Text = Utils.i18N.Translate(CreateProcessModeToolStripMenuItem.Text);
|
CreateProcessModeToolStripMenuItem.Text = Utils.i18N.Translate(CreateProcessModeToolStripMenuItem.Text);
|
||||||
ManageProcessModeToolStripMenuItem.Text = Utils.i18N.Translate(ManageProcessModeToolStripMenuItem.Text);
|
ManageProcessModeToolStripMenuItem.Text = Utils.i18N.Translate(ManageProcessModeToolStripMenuItem.Text);
|
||||||
@@ -493,6 +494,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();
|
||||||
@@ -583,7 +590,6 @@ namespace Netch.Forms
|
|||||||
foreach (var x in result)
|
foreach (var x in result)
|
||||||
{
|
{
|
||||||
x.Group = item.Remark;
|
x.Group = item.Remark;
|
||||||
x.Remark = "[" + item.Remark + "] " + x.Remark;
|
|
||||||
}
|
}
|
||||||
Global.Settings.Server.AddRange(result);
|
Global.Settings.Server.AddRange(result);
|
||||||
NotifyIcon.ShowBalloonTip(5,
|
NotifyIcon.ShowBalloonTip(5,
|
||||||
@@ -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;
|
||||||
}
|
}
|
||||||
@@ -1416,15 +1425,10 @@ namespace Netch.Forms
|
|||||||
NotifyIcon.ShowBalloonTip(5,
|
NotifyIcon.ShowBalloonTip(5,
|
||||||
UpdateChecker.Name, Utils.i18N.Translate("ACL updated successfully"),
|
UpdateChecker.Name, Utils.i18N.Translate("ACL updated successfully"),
|
||||||
ToolTipIcon.Info);
|
ToolTipIcon.Info);
|
||||||
//MessageBox.Show(Utils.i18N.Translate("ACL updated successfully"));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Utils.Logging.Info("ACL更新失败!" + args.Error);
|
Utils.Logging.Info("ACL 更新失败!" + args.Error);
|
||||||
/*NotifyIcon.ShowBalloonTip(5,
|
|
||||||
UpdateChecker.Name,
|
|
||||||
Utils.i18N.Translate("ACL update failed") + args.Error,
|
|
||||||
ToolTipIcon.Error);*/
|
|
||||||
MessageBox.Show(Utils.i18N.Translate("ACL update failed") + "\n" + args.Error);
|
MessageBox.Show(Utils.i18N.Translate("ACL update failed") + "\n" + args.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1474,11 +1478,7 @@ namespace Netch.Forms
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Utils.Logging.Info("使用代理更新ACL失败!" + e.Message);
|
Utils.Logging.Info("使用代理更新 ACL 失败!" + e.Message);
|
||||||
/*NotifyIcon.ShowBalloonTip(5,
|
|
||||||
UpdateChecker.Name,
|
|
||||||
Utils.i18N.Translate("ACL update failed") + args.Error,
|
|
||||||
ToolTipIcon.Error);*/
|
|
||||||
MessageBox.Show(Utils.i18N.Translate("ACL update failed") + "\n" + e.Message);
|
MessageBox.Show(Utils.i18N.Translate("ACL update failed") + "\n" + e.Message);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
@@ -1497,20 +1497,20 @@ namespace Netch.Forms
|
|||||||
{
|
{
|
||||||
Task.Run(() =>
|
Task.Run(() =>
|
||||||
{
|
{
|
||||||
StatusText($"{Utils.i18N.Translate("Status")}{Utils.i18N.Translate(": ")}{Utils.i18N.Translate("Reinstalling Tap driver")}");
|
StatusText($"{Utils.i18N.Translate("Status")}{Utils.i18N.Translate(": ")}{Utils.i18N.Translate("Reinstalling TUN/TAP driver")}");
|
||||||
Enabled = false;
|
Enabled = false;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Configuration.deltapall();
|
Configuration.deltapall();
|
||||||
Configuration.addtap();
|
Configuration.addtap();
|
||||||
NotifyIcon.ShowBalloonTip(5,
|
NotifyIcon.ShowBalloonTip(5,
|
||||||
UpdateChecker.Name, Utils.i18N.Translate("Reinstall Tap driver successfully"),
|
UpdateChecker.Name, Utils.i18N.Translate("Reinstall TUN/TAP driver successfully"),
|
||||||
ToolTipIcon.Info);
|
ToolTipIcon.Info);
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
NotifyIcon.ShowBalloonTip(5,
|
NotifyIcon.ShowBalloonTip(5,
|
||||||
UpdateChecker.Name, Utils.i18N.Translate("Reinstall Tap driver failed"),
|
UpdateChecker.Name, Utils.i18N.Translate("Reinstall TUN/TAP driver failed"),
|
||||||
ToolTipIcon.Error);
|
ToolTipIcon.Error);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
|||||||
@@ -114,7 +114,8 @@ namespace Netch.Forms.Server
|
|||||||
Password = PasswordTextBox.Text,
|
Password = PasswordTextBox.Text,
|
||||||
EncryptMethod = EncryptMethodComboBox.Text,
|
EncryptMethod = EncryptMethodComboBox.Text,
|
||||||
Plugin = PluginTextBox.Text,
|
Plugin = PluginTextBox.Text,
|
||||||
PluginOption = PluginOptionsTextBox.Text
|
PluginOption = PluginOptionsTextBox.Text,
|
||||||
|
Country = null
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -134,7 +134,8 @@ namespace Netch.Forms.Server
|
|||||||
Protocol = ProtocolComboBox.Text,
|
Protocol = ProtocolComboBox.Text,
|
||||||
ProtocolParam = ProtocolParamTextBox.Text,
|
ProtocolParam = ProtocolParamTextBox.Text,
|
||||||
OBFS = OBFSComboBox.Text,
|
OBFS = OBFSComboBox.Text,
|
||||||
OBFSParam = OBFSOptionParamTextBox.Text
|
OBFSParam = OBFSOptionParamTextBox.Text,
|
||||||
|
Country = null
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -97,7 +97,8 @@ namespace Netch.Forms.Server
|
|||||||
Hostname = AddressTextBox.Text,
|
Hostname = AddressTextBox.Text,
|
||||||
Port = int.Parse(PortTextBox.Text),
|
Port = int.Parse(PortTextBox.Text),
|
||||||
Username = UsernameTextBox.Text,
|
Username = UsernameTextBox.Text,
|
||||||
Password = PasswordTextBox.Text
|
Password = PasswordTextBox.Text,
|
||||||
|
Country = null
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
176
Netch/Forms/Server/Trojan.Designer.cs
generated
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
107
Netch/Forms/Server/Trojan.cs
Normal file
@@ -0,0 +1,107 @@
|
|||||||
|
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,
|
||||||
|
Country = null
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
Utils.Configuration.Save();
|
||||||
|
MessageBox.Show(Utils.i18N.Translate("Saved"), Utils.i18N.Translate("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
Global.MainForm.InitServer();
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
4986
Netch/Forms/Server/Trojan.resx
Normal file
@@ -155,7 +155,8 @@ namespace Netch.Forms.Server
|
|||||||
QUICSecure = QUICSecurityComboBox.Text,
|
QUICSecure = QUICSecurityComboBox.Text,
|
||||||
QUICSecret = QUICSecretTextBox.Text,
|
QUICSecret = QUICSecretTextBox.Text,
|
||||||
TLSSecure = TLSSecureCheckBox.Checked,
|
TLSSecure = TLSSecureCheckBox.Checked,
|
||||||
UseMux = UseMuxCheckBox.Checked
|
UseMux = UseMuxCheckBox.Checked,
|
||||||
|
Country = null
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
163
Netch/Forms/SettingForm.Designer.cs
generated
@@ -39,8 +39,8 @@
|
|||||||
this.Socks5PortTextBox = new System.Windows.Forms.TextBox();
|
this.Socks5PortTextBox = new System.Windows.Forms.TextBox();
|
||||||
this.TUNTAPGroupBox = new System.Windows.Forms.GroupBox();
|
this.TUNTAPGroupBox = new System.Windows.Forms.GroupBox();
|
||||||
this.UseFakeDNSCheckBox = new System.Windows.Forms.CheckBox();
|
this.UseFakeDNSCheckBox = new System.Windows.Forms.CheckBox();
|
||||||
this.TUNTAPProxyDNSCheckBox = new System.Windows.Forms.CheckBox();
|
this.ProxyDNSCheckBox = new System.Windows.Forms.CheckBox();
|
||||||
this.TUNTAPUseCustomDNSCheckBox = new System.Windows.Forms.CheckBox();
|
this.UseCustomDNSCheckBox = new System.Windows.Forms.CheckBox();
|
||||||
this.TUNTAPDNSLabel = new System.Windows.Forms.Label();
|
this.TUNTAPDNSLabel = new System.Windows.Forms.Label();
|
||||||
this.TUNTAPDNSTextBox = new System.Windows.Forms.TextBox();
|
this.TUNTAPDNSTextBox = new System.Windows.Forms.TextBox();
|
||||||
this.TUNTAPGatewayLabel = new System.Windows.Forms.Label();
|
this.TUNTAPGatewayLabel = new System.Windows.Forms.Label();
|
||||||
@@ -59,12 +59,9 @@
|
|||||||
this.DetectionInterval_TextBox = new System.Windows.Forms.TextBox();
|
this.DetectionInterval_TextBox = new System.Windows.Forms.TextBox();
|
||||||
this.EnableStartedTcping_CheckBox = new System.Windows.Forms.CheckBox();
|
this.EnableStartedTcping_CheckBox = new System.Windows.Forms.CheckBox();
|
||||||
this.DelayTestAfterStartup_Label = new System.Windows.Forms.Label();
|
this.DelayTestAfterStartup_Label = new System.Windows.Forms.Label();
|
||||||
this.BypassModeCheckBox = new System.Windows.Forms.CheckBox();
|
|
||||||
this.Redirector2checkBox = new System.Windows.Forms.CheckBox();
|
|
||||||
this.ExperimentalFunction_Label = new System.Windows.Forms.Label();
|
|
||||||
this.STUN_ServerPortTextBox = new System.Windows.Forms.TextBox();
|
this.STUN_ServerPortTextBox = new System.Windows.Forms.TextBox();
|
||||||
this.label2 = new System.Windows.Forms.Label();
|
this.STUNServerPortLabel = new System.Windows.Forms.Label();
|
||||||
this.label1 = new System.Windows.Forms.Label();
|
this.STUNServerLabel = new System.Windows.Forms.Label();
|
||||||
this.RunAtStartup = new System.Windows.Forms.CheckBox();
|
this.RunAtStartup = new System.Windows.Forms.CheckBox();
|
||||||
this.STUN_ServerTextBox = new System.Windows.Forms.TextBox();
|
this.STUN_ServerTextBox = new System.Windows.Forms.TextBox();
|
||||||
this.MinimizeWhenStartedCheckBox = new System.Windows.Forms.CheckBox();
|
this.MinimizeWhenStartedCheckBox = new System.Windows.Forms.CheckBox();
|
||||||
@@ -160,8 +157,8 @@
|
|||||||
// TUNTAPGroupBox
|
// TUNTAPGroupBox
|
||||||
//
|
//
|
||||||
this.TUNTAPGroupBox.Controls.Add(this.UseFakeDNSCheckBox);
|
this.TUNTAPGroupBox.Controls.Add(this.UseFakeDNSCheckBox);
|
||||||
this.TUNTAPGroupBox.Controls.Add(this.TUNTAPProxyDNSCheckBox);
|
this.TUNTAPGroupBox.Controls.Add(this.ProxyDNSCheckBox);
|
||||||
this.TUNTAPGroupBox.Controls.Add(this.TUNTAPUseCustomDNSCheckBox);
|
this.TUNTAPGroupBox.Controls.Add(this.UseCustomDNSCheckBox);
|
||||||
this.TUNTAPGroupBox.Controls.Add(this.TUNTAPDNSLabel);
|
this.TUNTAPGroupBox.Controls.Add(this.TUNTAPDNSLabel);
|
||||||
this.TUNTAPGroupBox.Controls.Add(this.TUNTAPDNSTextBox);
|
this.TUNTAPGroupBox.Controls.Add(this.TUNTAPDNSTextBox);
|
||||||
this.TUNTAPGroupBox.Controls.Add(this.TUNTAPGatewayLabel);
|
this.TUNTAPGroupBox.Controls.Add(this.TUNTAPGatewayLabel);
|
||||||
@@ -182,31 +179,31 @@
|
|||||||
this.UseFakeDNSCheckBox.AutoSize = true;
|
this.UseFakeDNSCheckBox.AutoSize = true;
|
||||||
this.UseFakeDNSCheckBox.Location = new System.Drawing.Point(10, 160);
|
this.UseFakeDNSCheckBox.Location = new System.Drawing.Point(10, 160);
|
||||||
this.UseFakeDNSCheckBox.Name = "UseFakeDNSCheckBox";
|
this.UseFakeDNSCheckBox.Name = "UseFakeDNSCheckBox";
|
||||||
this.UseFakeDNSCheckBox.Size = new System.Drawing.Size(316, 21);
|
this.UseFakeDNSCheckBox.Size = new System.Drawing.Size(110, 21);
|
||||||
this.UseFakeDNSCheckBox.TabIndex = 11;
|
this.UseFakeDNSCheckBox.TabIndex = 11;
|
||||||
this.UseFakeDNSCheckBox.Text = "Use Fake DNS (Suggest open if NTT is Udpblock)";
|
this.UseFakeDNSCheckBox.Text = "Use Fake DNS";
|
||||||
this.UseFakeDNSCheckBox.UseVisualStyleBackColor = true;
|
this.UseFakeDNSCheckBox.UseVisualStyleBackColor = true;
|
||||||
//
|
//
|
||||||
// TUNTAPProxyDNSCheckBox
|
// ProxyDNSCheckBox
|
||||||
//
|
//
|
||||||
this.TUNTAPProxyDNSCheckBox.AutoSize = true;
|
this.ProxyDNSCheckBox.AutoSize = true;
|
||||||
this.TUNTAPProxyDNSCheckBox.Location = new System.Drawing.Point(261, 139);
|
this.ProxyDNSCheckBox.Location = new System.Drawing.Point(261, 139);
|
||||||
this.TUNTAPProxyDNSCheckBox.Name = "TUNTAPProxyDNSCheckBox";
|
this.ProxyDNSCheckBox.Name = "ProxyDNSCheckBox";
|
||||||
this.TUNTAPProxyDNSCheckBox.Size = new System.Drawing.Size(153, 21);
|
this.ProxyDNSCheckBox.Size = new System.Drawing.Size(153, 21);
|
||||||
this.TUNTAPProxyDNSCheckBox.TabIndex = 10;
|
this.ProxyDNSCheckBox.TabIndex = 10;
|
||||||
this.TUNTAPProxyDNSCheckBox.Text = "Proxy DNS in Mode 2";
|
this.ProxyDNSCheckBox.Text = "Proxy DNS in Mode 2";
|
||||||
this.TUNTAPProxyDNSCheckBox.UseVisualStyleBackColor = true;
|
this.ProxyDNSCheckBox.UseVisualStyleBackColor = true;
|
||||||
//
|
//
|
||||||
// TUNTAPUseCustomDNSCheckBox
|
// UseCustomDNSCheckBox
|
||||||
//
|
//
|
||||||
this.TUNTAPUseCustomDNSCheckBox.AutoSize = true;
|
this.UseCustomDNSCheckBox.AutoSize = true;
|
||||||
this.TUNTAPUseCustomDNSCheckBox.Location = new System.Drawing.Point(10, 139);
|
this.UseCustomDNSCheckBox.Location = new System.Drawing.Point(10, 139);
|
||||||
this.TUNTAPUseCustomDNSCheckBox.Name = "TUNTAPUseCustomDNSCheckBox";
|
this.UseCustomDNSCheckBox.Name = "UseCustomDNSCheckBox";
|
||||||
this.TUNTAPUseCustomDNSCheckBox.Size = new System.Drawing.Size(127, 21);
|
this.UseCustomDNSCheckBox.Size = new System.Drawing.Size(127, 21);
|
||||||
this.TUNTAPUseCustomDNSCheckBox.TabIndex = 9;
|
this.UseCustomDNSCheckBox.TabIndex = 9;
|
||||||
this.TUNTAPUseCustomDNSCheckBox.Text = "Use Custom DNS";
|
this.UseCustomDNSCheckBox.Text = "Use Custom DNS";
|
||||||
this.TUNTAPUseCustomDNSCheckBox.UseVisualStyleBackColor = true;
|
this.UseCustomDNSCheckBox.UseVisualStyleBackColor = true;
|
||||||
this.TUNTAPUseCustomDNSCheckBox.CheckedChanged += new System.EventHandler(this.TUNTAPUseCustomDNSCheckBox_CheckedChanged);
|
this.UseCustomDNSCheckBox.CheckedChanged += new System.EventHandler(this.TUNTAPUseCustomDNSCheckBox_CheckedChanged);
|
||||||
//
|
//
|
||||||
// TUNTAPDNSLabel
|
// TUNTAPDNSLabel
|
||||||
//
|
//
|
||||||
@@ -307,12 +304,9 @@
|
|||||||
this.BehaviorGroupBox.Controls.Add(this.DetectionInterval_TextBox);
|
this.BehaviorGroupBox.Controls.Add(this.DetectionInterval_TextBox);
|
||||||
this.BehaviorGroupBox.Controls.Add(this.EnableStartedTcping_CheckBox);
|
this.BehaviorGroupBox.Controls.Add(this.EnableStartedTcping_CheckBox);
|
||||||
this.BehaviorGroupBox.Controls.Add(this.DelayTestAfterStartup_Label);
|
this.BehaviorGroupBox.Controls.Add(this.DelayTestAfterStartup_Label);
|
||||||
this.BehaviorGroupBox.Controls.Add(this.BypassModeCheckBox);
|
|
||||||
this.BehaviorGroupBox.Controls.Add(this.Redirector2checkBox);
|
|
||||||
this.BehaviorGroupBox.Controls.Add(this.ExperimentalFunction_Label);
|
|
||||||
this.BehaviorGroupBox.Controls.Add(this.STUN_ServerPortTextBox);
|
this.BehaviorGroupBox.Controls.Add(this.STUN_ServerPortTextBox);
|
||||||
this.BehaviorGroupBox.Controls.Add(this.label2);
|
this.BehaviorGroupBox.Controls.Add(this.STUNServerPortLabel);
|
||||||
this.BehaviorGroupBox.Controls.Add(this.label1);
|
this.BehaviorGroupBox.Controls.Add(this.STUNServerLabel);
|
||||||
this.BehaviorGroupBox.Controls.Add(this.RunAtStartup);
|
this.BehaviorGroupBox.Controls.Add(this.RunAtStartup);
|
||||||
this.BehaviorGroupBox.Controls.Add(this.STUN_ServerTextBox);
|
this.BehaviorGroupBox.Controls.Add(this.STUN_ServerTextBox);
|
||||||
this.BehaviorGroupBox.Controls.Add(this.MinimizeWhenStartedCheckBox);
|
this.BehaviorGroupBox.Controls.Add(this.MinimizeWhenStartedCheckBox);
|
||||||
@@ -332,16 +326,16 @@
|
|||||||
// BootShadowsocksFromDLLCheckBox
|
// BootShadowsocksFromDLLCheckBox
|
||||||
//
|
//
|
||||||
this.BootShadowsocksFromDLLCheckBox.AutoSize = true;
|
this.BootShadowsocksFromDLLCheckBox.AutoSize = true;
|
||||||
this.BootShadowsocksFromDLLCheckBox.Location = new System.Drawing.Point(12, 128);
|
this.BootShadowsocksFromDLLCheckBox.Location = new System.Drawing.Point(12, 102);
|
||||||
this.BootShadowsocksFromDLLCheckBox.Name = "BootShadowsocksFromDLLCheckBox";
|
this.BootShadowsocksFromDLLCheckBox.Name = "BootShadowsocksFromDLLCheckBox";
|
||||||
this.BootShadowsocksFromDLLCheckBox.Size = new System.Drawing.Size(297, 21);
|
this.BootShadowsocksFromDLLCheckBox.Size = new System.Drawing.Size(321, 21);
|
||||||
this.BootShadowsocksFromDLLCheckBox.TabIndex = 21;
|
this.BootShadowsocksFromDLLCheckBox.TabIndex = 21;
|
||||||
this.BootShadowsocksFromDLLCheckBox.Text = "Boot Shadowsocks from DLL(No support ACL)";
|
this.BootShadowsocksFromDLLCheckBox.Text = "Start Shadowsocks from DLL (No support for ACL)";
|
||||||
this.BootShadowsocksFromDLLCheckBox.UseVisualStyleBackColor = true;
|
this.BootShadowsocksFromDLLCheckBox.UseVisualStyleBackColor = true;
|
||||||
//
|
//
|
||||||
// AclAddr
|
// AclAddr
|
||||||
//
|
//
|
||||||
this.AclAddr.Location = new System.Drawing.Point(117, 274);
|
this.AclAddr.Location = new System.Drawing.Point(120, 302);
|
||||||
this.AclAddr.Name = "AclAddr";
|
this.AclAddr.Name = "AclAddr";
|
||||||
this.AclAddr.Size = new System.Drawing.Size(315, 23);
|
this.AclAddr.Size = new System.Drawing.Size(315, 23);
|
||||||
this.AclAddr.TabIndex = 19;
|
this.AclAddr.TabIndex = 19;
|
||||||
@@ -350,7 +344,7 @@
|
|||||||
// AclLabel
|
// AclLabel
|
||||||
//
|
//
|
||||||
this.AclLabel.AutoSize = true;
|
this.AclLabel.AutoSize = true;
|
||||||
this.AclLabel.Location = new System.Drawing.Point(9, 277);
|
this.AclLabel.Location = new System.Drawing.Point(12, 305);
|
||||||
this.AclLabel.Name = "AclLabel";
|
this.AclLabel.Name = "AclLabel";
|
||||||
this.AclLabel.Size = new System.Drawing.Size(78, 17);
|
this.AclLabel.Size = new System.Drawing.Size(78, 17);
|
||||||
this.AclLabel.TabIndex = 20;
|
this.AclLabel.TabIndex = 20;
|
||||||
@@ -359,15 +353,15 @@
|
|||||||
// DetectionInterval_Label
|
// DetectionInterval_Label
|
||||||
//
|
//
|
||||||
this.DetectionInterval_Label.AutoSize = true;
|
this.DetectionInterval_Label.AutoSize = true;
|
||||||
this.DetectionInterval_Label.Location = new System.Drawing.Point(230, 193);
|
this.DetectionInterval_Label.Location = new System.Drawing.Point(229, 221);
|
||||||
this.DetectionInterval_Label.Name = "DetectionInterval_Label";
|
this.DetectionInterval_Label.Name = "DetectionInterval_Label";
|
||||||
this.DetectionInterval_Label.Size = new System.Drawing.Size(128, 17);
|
this.DetectionInterval_Label.Size = new System.Drawing.Size(136, 17);
|
||||||
this.DetectionInterval_Label.TabIndex = 18;
|
this.DetectionInterval_Label.TabIndex = 18;
|
||||||
this.DetectionInterval_Label.Text = "Detection interval(/s)";
|
this.DetectionInterval_Label.Text = "Detection interval(sec)";
|
||||||
//
|
//
|
||||||
// DetectionInterval_TextBox
|
// DetectionInterval_TextBox
|
||||||
//
|
//
|
||||||
this.DetectionInterval_TextBox.Location = new System.Drawing.Point(364, 190);
|
this.DetectionInterval_TextBox.Location = new System.Drawing.Point(367, 218);
|
||||||
this.DetectionInterval_TextBox.Name = "DetectionInterval_TextBox";
|
this.DetectionInterval_TextBox.Name = "DetectionInterval_TextBox";
|
||||||
this.DetectionInterval_TextBox.Size = new System.Drawing.Size(68, 23);
|
this.DetectionInterval_TextBox.Size = new System.Drawing.Size(68, 23);
|
||||||
this.DetectionInterval_TextBox.TabIndex = 17;
|
this.DetectionInterval_TextBox.TabIndex = 17;
|
||||||
@@ -376,7 +370,7 @@
|
|||||||
// EnableStartedTcping_CheckBox
|
// EnableStartedTcping_CheckBox
|
||||||
//
|
//
|
||||||
this.EnableStartedTcping_CheckBox.AutoSize = true;
|
this.EnableStartedTcping_CheckBox.AutoSize = true;
|
||||||
this.EnableStartedTcping_CheckBox.Location = new System.Drawing.Point(152, 192);
|
this.EnableStartedTcping_CheckBox.Location = new System.Drawing.Point(144, 220);
|
||||||
this.EnableStartedTcping_CheckBox.Name = "EnableStartedTcping_CheckBox";
|
this.EnableStartedTcping_CheckBox.Name = "EnableStartedTcping_CheckBox";
|
||||||
this.EnableStartedTcping_CheckBox.Size = new System.Drawing.Size(66, 21);
|
this.EnableStartedTcping_CheckBox.Size = new System.Drawing.Size(66, 21);
|
||||||
this.EnableStartedTcping_CheckBox.TabIndex = 15;
|
this.EnableStartedTcping_CheckBox.TabIndex = 15;
|
||||||
@@ -386,67 +380,37 @@
|
|||||||
// DelayTestAfterStartup_Label
|
// DelayTestAfterStartup_Label
|
||||||
//
|
//
|
||||||
this.DelayTestAfterStartup_Label.AutoSize = true;
|
this.DelayTestAfterStartup_Label.AutoSize = true;
|
||||||
this.DelayTestAfterStartup_Label.Location = new System.Drawing.Point(9, 193);
|
this.DelayTestAfterStartup_Label.Location = new System.Drawing.Point(12, 221);
|
||||||
this.DelayTestAfterStartup_Label.Name = "DelayTestAfterStartup_Label";
|
this.DelayTestAfterStartup_Label.Name = "DelayTestAfterStartup_Label";
|
||||||
this.DelayTestAfterStartup_Label.Size = new System.Drawing.Size(141, 17);
|
this.DelayTestAfterStartup_Label.Size = new System.Drawing.Size(126, 17);
|
||||||
this.DelayTestAfterStartup_Label.TabIndex = 16;
|
this.DelayTestAfterStartup_Label.TabIndex = 16;
|
||||||
this.DelayTestAfterStartup_Label.Text = "Delay test after startup";
|
this.DelayTestAfterStartup_Label.Text = "Delay test after start";
|
||||||
//
|
|
||||||
// BypassModeCheckBox
|
|
||||||
//
|
|
||||||
this.BypassModeCheckBox.AutoSize = true;
|
|
||||||
this.BypassModeCheckBox.Location = new System.Drawing.Point(12, 102);
|
|
||||||
this.BypassModeCheckBox.Name = "BypassModeCheckBox";
|
|
||||||
this.BypassModeCheckBox.Size = new System.Drawing.Size(160, 21);
|
|
||||||
this.BypassModeCheckBox.TabIndex = 14;
|
|
||||||
this.BypassModeCheckBox.Text = "Process whitelist mode";
|
|
||||||
this.BypassModeCheckBox.UseVisualStyleBackColor = true;
|
|
||||||
this.BypassModeCheckBox.CheckedChanged += new System.EventHandler(this.BypassModeCheckBox_CheckedChanged);
|
|
||||||
//
|
|
||||||
// Redirector2checkBox
|
|
||||||
//
|
|
||||||
this.Redirector2checkBox.AutoSize = true;
|
|
||||||
this.Redirector2checkBox.Location = new System.Drawing.Point(148, 310);
|
|
||||||
this.Redirector2checkBox.Name = "Redirector2checkBox";
|
|
||||||
this.Redirector2checkBox.Size = new System.Drawing.Size(118, 21);
|
|
||||||
this.Redirector2checkBox.TabIndex = 11;
|
|
||||||
this.Redirector2checkBox.Text = "是否启用2号核心";
|
|
||||||
this.Redirector2checkBox.UseVisualStyleBackColor = true;
|
|
||||||
//
|
|
||||||
// ExperimentalFunction_Label
|
|
||||||
//
|
|
||||||
this.ExperimentalFunction_Label.AutoSize = true;
|
|
||||||
this.ExperimentalFunction_Label.Location = new System.Drawing.Point(9, 310);
|
|
||||||
this.ExperimentalFunction_Label.Name = "ExperimentalFunction_Label";
|
|
||||||
this.ExperimentalFunction_Label.Size = new System.Drawing.Size(133, 17);
|
|
||||||
this.ExperimentalFunction_Label.TabIndex = 13;
|
|
||||||
this.ExperimentalFunction_Label.Text = "Experimental function";
|
|
||||||
//
|
//
|
||||||
// STUN_ServerPortTextBox
|
// STUN_ServerPortTextBox
|
||||||
//
|
//
|
||||||
this.STUN_ServerPortTextBox.Location = new System.Drawing.Point(117, 245);
|
this.STUN_ServerPortTextBox.Location = new System.Drawing.Point(120, 273);
|
||||||
this.STUN_ServerPortTextBox.Name = "STUN_ServerPortTextBox";
|
this.STUN_ServerPortTextBox.Name = "STUN_ServerPortTextBox";
|
||||||
this.STUN_ServerPortTextBox.Size = new System.Drawing.Size(315, 23);
|
this.STUN_ServerPortTextBox.Size = new System.Drawing.Size(315, 23);
|
||||||
this.STUN_ServerPortTextBox.TabIndex = 8;
|
this.STUN_ServerPortTextBox.TabIndex = 8;
|
||||||
this.STUN_ServerPortTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
this.STUN_ServerPortTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||||
//
|
//
|
||||||
// label2
|
// STUNServerPortLabel
|
||||||
//
|
//
|
||||||
this.label2.AutoSize = true;
|
this.STUNServerPortLabel.AutoSize = true;
|
||||||
this.label2.Location = new System.Drawing.Point(9, 248);
|
this.STUNServerPortLabel.Location = new System.Drawing.Point(12, 276);
|
||||||
this.label2.Name = "label2";
|
this.STUNServerPortLabel.Name = "STUNServerPortLabel";
|
||||||
this.label2.Size = new System.Drawing.Size(110, 17);
|
this.STUNServerPortLabel.Size = new System.Drawing.Size(110, 17);
|
||||||
this.label2.TabIndex = 12;
|
this.STUNServerPortLabel.TabIndex = 12;
|
||||||
this.label2.Text = "STUN Server Port";
|
this.STUNServerPortLabel.Text = "STUN Server Port";
|
||||||
//
|
//
|
||||||
// label1
|
// STUNServerLabel
|
||||||
//
|
//
|
||||||
this.label1.AutoSize = true;
|
this.STUNServerLabel.AutoSize = true;
|
||||||
this.label1.Location = new System.Drawing.Point(9, 222);
|
this.STUNServerLabel.Location = new System.Drawing.Point(12, 250);
|
||||||
this.label1.Name = "label1";
|
this.STUNServerLabel.Name = "STUNServerLabel";
|
||||||
this.label1.Size = new System.Drawing.Size(82, 17);
|
this.STUNServerLabel.Size = new System.Drawing.Size(82, 17);
|
||||||
this.label1.TabIndex = 10;
|
this.STUNServerLabel.TabIndex = 10;
|
||||||
this.label1.Text = "STUN Server";
|
this.STUNServerLabel.Text = "STUN Server";
|
||||||
//
|
//
|
||||||
// RunAtStartup
|
// RunAtStartup
|
||||||
//
|
//
|
||||||
@@ -460,7 +424,7 @@
|
|||||||
//
|
//
|
||||||
// STUN_ServerTextBox
|
// STUN_ServerTextBox
|
||||||
//
|
//
|
||||||
this.STUN_ServerTextBox.Location = new System.Drawing.Point(117, 216);
|
this.STUN_ServerTextBox.Location = new System.Drawing.Point(120, 244);
|
||||||
this.STUN_ServerTextBox.Name = "STUN_ServerTextBox";
|
this.STUN_ServerTextBox.Name = "STUN_ServerTextBox";
|
||||||
this.STUN_ServerTextBox.Size = new System.Drawing.Size(315, 23);
|
this.STUN_ServerTextBox.Size = new System.Drawing.Size(315, 23);
|
||||||
this.STUN_ServerTextBox.TabIndex = 11;
|
this.STUN_ServerTextBox.TabIndex = 11;
|
||||||
@@ -479,7 +443,7 @@
|
|||||||
// ProfileCount_Label
|
// ProfileCount_Label
|
||||||
//
|
//
|
||||||
this.ProfileCount_Label.AutoSize = true;
|
this.ProfileCount_Label.AutoSize = true;
|
||||||
this.ProfileCount_Label.Location = new System.Drawing.Point(9, 168);
|
this.ProfileCount_Label.Location = new System.Drawing.Point(12, 196);
|
||||||
this.ProfileCount_Label.Name = "ProfileCount_Label";
|
this.ProfileCount_Label.Name = "ProfileCount_Label";
|
||||||
this.ProfileCount_Label.Size = new System.Drawing.Size(79, 17);
|
this.ProfileCount_Label.Size = new System.Drawing.Size(79, 17);
|
||||||
this.ProfileCount_Label.TabIndex = 8;
|
this.ProfileCount_Label.TabIndex = 8;
|
||||||
@@ -487,7 +451,7 @@
|
|||||||
//
|
//
|
||||||
// ProfileCount_TextBox
|
// ProfileCount_TextBox
|
||||||
//
|
//
|
||||||
this.ProfileCount_TextBox.Location = new System.Drawing.Point(206, 165);
|
this.ProfileCount_TextBox.Location = new System.Drawing.Point(209, 193);
|
||||||
this.ProfileCount_TextBox.Name = "ProfileCount_TextBox";
|
this.ProfileCount_TextBox.Name = "ProfileCount_TextBox";
|
||||||
this.ProfileCount_TextBox.Size = new System.Drawing.Size(226, 23);
|
this.ProfileCount_TextBox.Size = new System.Drawing.Size(226, 23);
|
||||||
this.ProfileCount_TextBox.TabIndex = 9;
|
this.ProfileCount_TextBox.TabIndex = 9;
|
||||||
@@ -585,7 +549,7 @@
|
|||||||
private System.Windows.Forms.TextBox TUNTAPDNSTextBox;
|
private System.Windows.Forms.TextBox TUNTAPDNSTextBox;
|
||||||
private System.Windows.Forms.Button ControlButton;
|
private System.Windows.Forms.Button ControlButton;
|
||||||
private System.Windows.Forms.Button GlobalBypassIPsButton;
|
private System.Windows.Forms.Button GlobalBypassIPsButton;
|
||||||
private System.Windows.Forms.CheckBox TUNTAPUseCustomDNSCheckBox;
|
private System.Windows.Forms.CheckBox UseCustomDNSCheckBox;
|
||||||
private System.Windows.Forms.CheckBox AllowDevicesCheckBox;
|
private System.Windows.Forms.CheckBox AllowDevicesCheckBox;
|
||||||
private System.Windows.Forms.GroupBox BehaviorGroupBox;
|
private System.Windows.Forms.GroupBox BehaviorGroupBox;
|
||||||
private System.Windows.Forms.CheckBox ExitWhenClosedCheckBox;
|
private System.Windows.Forms.CheckBox ExitWhenClosedCheckBox;
|
||||||
@@ -596,14 +560,11 @@
|
|||||||
private System.Windows.Forms.TextBox ProfileCount_TextBox;
|
private System.Windows.Forms.TextBox ProfileCount_TextBox;
|
||||||
private System.Windows.Forms.CheckBox MinimizeWhenStartedCheckBox;
|
private System.Windows.Forms.CheckBox MinimizeWhenStartedCheckBox;
|
||||||
private System.Windows.Forms.CheckBox RunAtStartup;
|
private System.Windows.Forms.CheckBox RunAtStartup;
|
||||||
private System.Windows.Forms.Label label2;
|
private System.Windows.Forms.Label STUNServerPortLabel;
|
||||||
private System.Windows.Forms.Label label1;
|
private System.Windows.Forms.Label STUNServerLabel;
|
||||||
private System.Windows.Forms.TextBox STUN_ServerTextBox;
|
private System.Windows.Forms.TextBox STUN_ServerTextBox;
|
||||||
private System.Windows.Forms.TextBox STUN_ServerPortTextBox;
|
private System.Windows.Forms.TextBox STUN_ServerPortTextBox;
|
||||||
private System.Windows.Forms.CheckBox TUNTAPProxyDNSCheckBox;
|
private System.Windows.Forms.CheckBox ProxyDNSCheckBox;
|
||||||
private System.Windows.Forms.CheckBox Redirector2checkBox;
|
|
||||||
private System.Windows.Forms.Label ExperimentalFunction_Label;
|
|
||||||
private System.Windows.Forms.CheckBox BypassModeCheckBox;
|
|
||||||
private System.Windows.Forms.TextBox DetectionInterval_TextBox;
|
private System.Windows.Forms.TextBox DetectionInterval_TextBox;
|
||||||
private System.Windows.Forms.CheckBox EnableStartedTcping_CheckBox;
|
private System.Windows.Forms.CheckBox EnableStartedTcping_CheckBox;
|
||||||
private System.Windows.Forms.Label DelayTestAfterStartup_Label;
|
private System.Windows.Forms.Label DelayTestAfterStartup_Label;
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ namespace Netch.Forms
|
|||||||
|
|
||||||
private void TUNTAPUseCustomDNSCheckBox_CheckedChanged(object sender, EventArgs e)
|
private void TUNTAPUseCustomDNSCheckBox_CheckedChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (!TUNTAPUseCustomDNSCheckBox.Checked)
|
if (!UseCustomDNSCheckBox.Checked)
|
||||||
{
|
{
|
||||||
TUNTAPDNSTextBox.Enabled = false;
|
TUNTAPDNSTextBox.Enabled = false;
|
||||||
}
|
}
|
||||||
@@ -50,12 +50,11 @@ namespace Netch.Forms
|
|||||||
TUNTAPAddressLabel.Text = Utils.i18N.Translate(TUNTAPAddressLabel.Text);
|
TUNTAPAddressLabel.Text = Utils.i18N.Translate(TUNTAPAddressLabel.Text);
|
||||||
TUNTAPNetmaskLabel.Text = Utils.i18N.Translate(TUNTAPNetmaskLabel.Text);
|
TUNTAPNetmaskLabel.Text = Utils.i18N.Translate(TUNTAPNetmaskLabel.Text);
|
||||||
TUNTAPGatewayLabel.Text = Utils.i18N.Translate(TUNTAPGatewayLabel.Text);
|
TUNTAPGatewayLabel.Text = Utils.i18N.Translate(TUNTAPGatewayLabel.Text);
|
||||||
TUNTAPUseCustomDNSCheckBox.Text = Utils.i18N.Translate(TUNTAPUseCustomDNSCheckBox.Text);
|
UseCustomDNSCheckBox.Text = Utils.i18N.Translate(UseCustomDNSCheckBox.Text);
|
||||||
TUNTAPProxyDNSCheckBox.Text = Utils.i18N.Translate(TUNTAPProxyDNSCheckBox.Text);
|
ProxyDNSCheckBox.Text = Utils.i18N.Translate(ProxyDNSCheckBox.Text);
|
||||||
UseFakeDNSCheckBox.Text = Utils.i18N.Translate(UseFakeDNSCheckBox.Text);
|
UseFakeDNSCheckBox.Text = Utils.i18N.Translate(UseFakeDNSCheckBox.Text);
|
||||||
GlobalBypassIPsButton.Text = Utils.i18N.Translate(GlobalBypassIPsButton.Text);
|
GlobalBypassIPsButton.Text = Utils.i18N.Translate(GlobalBypassIPsButton.Text);
|
||||||
ControlButton.Text = Utils.i18N.Translate(ControlButton.Text);
|
ControlButton.Text = Utils.i18N.Translate(ControlButton.Text);
|
||||||
BypassModeCheckBox.Text = Utils.i18N.Translate(BypassModeCheckBox.Text);
|
|
||||||
BootShadowsocksFromDLLCheckBox.Text = Utils.i18N.Translate(BootShadowsocksFromDLLCheckBox.Text);
|
BootShadowsocksFromDLLCheckBox.Text = Utils.i18N.Translate(BootShadowsocksFromDLLCheckBox.Text);
|
||||||
|
|
||||||
ExitWhenClosedCheckBox.Checked = Global.Settings.ExitWhenClosed;
|
ExitWhenClosedCheckBox.Checked = Global.Settings.ExitWhenClosed;
|
||||||
@@ -64,8 +63,6 @@ namespace Netch.Forms
|
|||||||
CheckUpdateWhenOpenedCheckBox.Checked = Global.Settings.CheckUpdateWhenOpened;
|
CheckUpdateWhenOpenedCheckBox.Checked = Global.Settings.CheckUpdateWhenOpened;
|
||||||
MinimizeWhenStartedCheckBox.Checked = Global.Settings.MinimizeWhenStarted;
|
MinimizeWhenStartedCheckBox.Checked = Global.Settings.MinimizeWhenStarted;
|
||||||
RunAtStartup.Checked = Global.Settings.RunAtStartup;
|
RunAtStartup.Checked = Global.Settings.RunAtStartup;
|
||||||
Redirector2checkBox.Checked = Global.Settings.UseRedirector2;
|
|
||||||
BypassModeCheckBox.Checked = Global.Settings.ProcessBypassMode;
|
|
||||||
EnableStartedTcping_CheckBox.Checked = Global.Settings.StartedTcping;
|
EnableStartedTcping_CheckBox.Checked = Global.Settings.StartedTcping;
|
||||||
DetectionInterval_TextBox.Text = Global.Settings.StartedTcping_Interval.ToString();
|
DetectionInterval_TextBox.Text = Global.Settings.StartedTcping_Interval.ToString();
|
||||||
BootShadowsocksFromDLLCheckBox.Checked = Global.Settings.BootShadowsocksFromDLL;
|
BootShadowsocksFromDLLCheckBox.Checked = Global.Settings.BootShadowsocksFromDLL;
|
||||||
@@ -78,8 +75,8 @@ namespace Netch.Forms
|
|||||||
TUNTAPNetmaskTextBox.Text = Global.Settings.TUNTAP.Netmask;
|
TUNTAPNetmaskTextBox.Text = Global.Settings.TUNTAP.Netmask;
|
||||||
TUNTAPGatewayTextBox.Text = Global.Settings.TUNTAP.Gateway;
|
TUNTAPGatewayTextBox.Text = Global.Settings.TUNTAP.Gateway;
|
||||||
|
|
||||||
TUNTAPUseCustomDNSCheckBox.Checked = Global.Settings.TUNTAP.UseCustomDNS;
|
UseCustomDNSCheckBox.Checked = Global.Settings.TUNTAP.UseCustomDNS;
|
||||||
TUNTAPProxyDNSCheckBox.Checked = Global.Settings.TUNTAP.ProxyDNS;
|
ProxyDNSCheckBox.Checked = Global.Settings.TUNTAP.ProxyDNS;
|
||||||
UseFakeDNSCheckBox.Checked = Global.Settings.TUNTAP.UseFakeDNS;
|
UseFakeDNSCheckBox.Checked = Global.Settings.TUNTAP.UseFakeDNS;
|
||||||
|
|
||||||
BehaviorGroupBox.Text = Utils.i18N.Translate(BehaviorGroupBox.Text);
|
BehaviorGroupBox.Text = Utils.i18N.Translate(BehaviorGroupBox.Text);
|
||||||
@@ -90,11 +87,12 @@ namespace Netch.Forms
|
|||||||
RunAtStartup.Text = Utils.i18N.Translate(RunAtStartup.Text);
|
RunAtStartup.Text = Utils.i18N.Translate(RunAtStartup.Text);
|
||||||
CheckUpdateWhenOpenedCheckBox.Text = Utils.i18N.Translate(CheckUpdateWhenOpenedCheckBox.Text);
|
CheckUpdateWhenOpenedCheckBox.Text = Utils.i18N.Translate(CheckUpdateWhenOpenedCheckBox.Text);
|
||||||
ProfileCount_Label.Text = Utils.i18N.Translate(ProfileCount_Label.Text);
|
ProfileCount_Label.Text = Utils.i18N.Translate(ProfileCount_Label.Text);
|
||||||
ExperimentalFunction_Label.Text = Utils.i18N.Translate(ExperimentalFunction_Label.Text);
|
|
||||||
DelayTestAfterStartup_Label.Text = Utils.i18N.Translate(DelayTestAfterStartup_Label.Text);
|
DelayTestAfterStartup_Label.Text = Utils.i18N.Translate(DelayTestAfterStartup_Label.Text);
|
||||||
EnableStartedTcping_CheckBox.Text = Utils.i18N.Translate(EnableStartedTcping_CheckBox.Text);
|
EnableStartedTcping_CheckBox.Text = Utils.i18N.Translate(EnableStartedTcping_CheckBox.Text);
|
||||||
DetectionInterval_Label.Text = Utils.i18N.Translate(DetectionInterval_Label.Text);
|
DetectionInterval_Label.Text = Utils.i18N.Translate(DetectionInterval_Label.Text);
|
||||||
DelayTestAfterStartup_Label.Text = Utils.i18N.Translate(DelayTestAfterStartup_Label.Text);
|
DelayTestAfterStartup_Label.Text = Utils.i18N.Translate(DelayTestAfterStartup_Label.Text);
|
||||||
|
STUNServerLabel.Text = Utils.i18N.Translate(STUNServerLabel.Text);
|
||||||
|
STUNServerPortLabel.Text = Utils.i18N.Translate(STUNServerPortLabel.Text);
|
||||||
|
|
||||||
ProfileCount_TextBox.Text = Global.Settings.ProfileCount.ToString();
|
ProfileCount_TextBox.Text = Global.Settings.ProfileCount.ToString();
|
||||||
STUN_ServerTextBox.Text = Global.Settings.STUN_Server.ToString();
|
STUN_ServerTextBox.Text = Global.Settings.STUN_Server.ToString();
|
||||||
@@ -121,7 +119,7 @@ namespace Netch.Forms
|
|||||||
TUNTAPDNSTextBox.Text = "1.1.1.1";
|
TUNTAPDNSTextBox.Text = "1.1.1.1";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!TUNTAPUseCustomDNSCheckBox.Checked)
|
if (!UseCustomDNSCheckBox.Checked)
|
||||||
{
|
{
|
||||||
TUNTAPDNSTextBox.Enabled = false;
|
TUNTAPDNSTextBox.Enabled = false;
|
||||||
}
|
}
|
||||||
@@ -161,8 +159,6 @@ namespace Netch.Forms
|
|||||||
Global.Settings.CheckUpdateWhenOpened = CheckUpdateWhenOpenedCheckBox.Checked;
|
Global.Settings.CheckUpdateWhenOpened = CheckUpdateWhenOpenedCheckBox.Checked;
|
||||||
Global.Settings.MinimizeWhenStarted = MinimizeWhenStartedCheckBox.Checked;
|
Global.Settings.MinimizeWhenStarted = MinimizeWhenStartedCheckBox.Checked;
|
||||||
Global.Settings.RunAtStartup = RunAtStartup.Checked;
|
Global.Settings.RunAtStartup = RunAtStartup.Checked;
|
||||||
Global.Settings.UseRedirector2 = Redirector2checkBox.Checked;
|
|
||||||
Global.Settings.ProcessBypassMode = BypassModeCheckBox.Checked;
|
|
||||||
Global.Settings.BootShadowsocksFromDLL = BootShadowsocksFromDLLCheckBox.Checked;
|
Global.Settings.BootShadowsocksFromDLL = BootShadowsocksFromDLLCheckBox.Checked;
|
||||||
|
|
||||||
|
|
||||||
@@ -305,7 +301,7 @@ namespace Netch.Forms
|
|||||||
}
|
}
|
||||||
DNS = DNS.Trim();
|
DNS = DNS.Trim();
|
||||||
TUNTAPDNSTextBox.Text = DNS.Substring(0, DNS.Length - 1);
|
TUNTAPDNSTextBox.Text = DNS.Substring(0, DNS.Length - 1);
|
||||||
TUNTAPUseCustomDNSCheckBox.Checked = Global.Settings.TUNTAP.UseCustomDNS;
|
UseCustomDNSCheckBox.Checked = Global.Settings.TUNTAP.UseCustomDNS;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -387,27 +383,13 @@ namespace Netch.Forms
|
|||||||
Global.Settings.TUNTAP.DNS.Add(ip);
|
Global.Settings.TUNTAP.DNS.Add(ip);
|
||||||
}
|
}
|
||||||
|
|
||||||
Global.Settings.TUNTAP.UseCustomDNS = TUNTAPUseCustomDNSCheckBox.Checked;
|
Global.Settings.TUNTAP.UseCustomDNS = UseCustomDNSCheckBox.Checked;
|
||||||
Global.Settings.TUNTAP.ProxyDNS = TUNTAPProxyDNSCheckBox.Checked;
|
Global.Settings.TUNTAP.ProxyDNS = ProxyDNSCheckBox.Checked;
|
||||||
Global.Settings.TUNTAP.UseFakeDNS = UseFakeDNSCheckBox.Checked;
|
Global.Settings.TUNTAP.UseFakeDNS = UseFakeDNSCheckBox.Checked;
|
||||||
|
|
||||||
Utils.Configuration.Save();
|
Utils.Configuration.Save();
|
||||||
MessageBox.Show(Utils.i18N.Translate("Saved"), Utils.i18N.Translate("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
|
MessageBox.Show(Utils.i18N.Translate("Saved"), Utils.i18N.Translate("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void BypassModeCheckBox_CheckedChanged(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (BypassModeCheckBox.Checked)
|
|
||||||
{
|
|
||||||
Redirector2checkBox.Checked = false;
|
|
||||||
Redirector2checkBox.Enabled = false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Redirector2checkBox.Enabled = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -134,17 +134,16 @@ namespace Netch.Forms
|
|||||||
{
|
{
|
||||||
if (!subitem.Remark.Equals(RemarkTextBox.Text))
|
if (!subitem.Remark.Equals(RemarkTextBox.Text))
|
||||||
{
|
{
|
||||||
//修改了订阅备注,删除旧订阅服务器
|
//修改了订阅备注,修改旧订阅服务器
|
||||||
Global.Settings.Server.ForEach((serverItem) =>
|
Global.Settings.Server.ForEach((serverItem) =>
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
//当前服务器组群组为订阅群组时批量修改备注
|
//当前服务器组群组为订阅群组时批量修改备注
|
||||||
if (serverItem.Group == subitem.Remark)
|
if (serverItem.Group == subitem.Remark) {
|
||||||
{
|
|
||||||
string OldServerRemark = "[" + serverItem.Group + "] ";
|
//serverItem.Group OldGroupRemark
|
||||||
Logging.Info(serverItem.Remark.Split(OldServerRemark.ToCharArray())[1]);
|
//RemarkTextBox.Text NewGroupRemark
|
||||||
serverItem.Remark = "[" + RemarkTextBox.Text + "] " + serverItem.Remark.Split(new string[] { OldServerRemark }, StringSplitOptions.None)[1];
|
|
||||||
serverItem.Group = RemarkTextBox.Text;
|
serverItem.Group = RemarkTextBox.Text;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,32 +42,7 @@ namespace Netch.Models
|
|||||||
/// <returns>备注</returns>
|
/// <returns>备注</returns>
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
if (CultureInfo.CurrentCulture.Name == "zh-CN")
|
return string.Format("[{0}] {1}", Type + 1, Remark);
|
||||||
{
|
|
||||||
string Stype;
|
|
||||||
if (Type == 0)
|
|
||||||
{
|
|
||||||
Stype = "[进程模式] ";
|
|
||||||
}
|
|
||||||
else if (Type == 1)
|
|
||||||
{
|
|
||||||
Stype = "[TUN/TAP 黑] ";
|
|
||||||
}
|
|
||||||
else if (Type == 2)
|
|
||||||
{
|
|
||||||
Stype = "[TUN/TAP 白] ";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Stype = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
return string.Format("{0}{1}", Stype, Remark);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return string.Format("[{0}] {1}", Type + 1, Remark);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
using System;
|
using MaxMind.GeoIP2;
|
||||||
|
using Netch.Utils;
|
||||||
|
using System;
|
||||||
|
using System.Net;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Netch.Models
|
namespace Netch.Models
|
||||||
@@ -135,6 +138,11 @@ namespace Netch.Models
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public int Delay = -1;
|
public int Delay = -1;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 地区
|
||||||
|
/// </summary>
|
||||||
|
public string Country;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取备注
|
/// 获取备注
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -146,16 +154,50 @@ namespace Netch.Models
|
|||||||
Remark = $"{Hostname}:{Port}";
|
Remark = $"{Hostname}:{Port}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Country == null)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var databaseReader = new DatabaseReader("bin\\GeoLite2-Country.mmdb");
|
||||||
|
|
||||||
|
if (IPAddress.TryParse(Hostname, out _) == true)
|
||||||
|
{
|
||||||
|
Country = databaseReader.Country(Hostname).Country.IsoCode;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var DnsResult = DNS.Lookup(Hostname);
|
||||||
|
|
||||||
|
if (DnsResult != null)
|
||||||
|
{
|
||||||
|
Country = databaseReader.Country(DnsResult).Country.IsoCode;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Country = "UN";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
Country = "UN";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Group = Group.Equals("None") ? Group.ToUpper() : Group;
|
||||||
|
|
||||||
switch (Type)
|
switch (Type)
|
||||||
{
|
{
|
||||||
case "Socks5":
|
case "Socks5":
|
||||||
return $"[S5] {Remark}";
|
return $"[S5][{Country}][{Group}] {Remark}";
|
||||||
case "SS":
|
case "SS":
|
||||||
return $"[SS] {Remark}";
|
return $"[SS][{Country}][{Group}] {Remark}";
|
||||||
case "SSR":
|
case "SSR":
|
||||||
return $"[SR] {Remark}";
|
return $"[SR][{Country}][{Group}] {Remark}";
|
||||||
case "VMess":
|
case "VMess":
|
||||||
return $"[V2] {Remark}";
|
return $"[V2][{Country}][{Group}] {Remark}";
|
||||||
|
case "Trojan":
|
||||||
|
return $"[TR][{Country}][{Group}] {Remark}";
|
||||||
default:
|
default:
|
||||||
return "WTF";
|
return "WTF";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ namespace Netch.Models
|
|||||||
public bool UseCustomDNS = false;
|
public bool UseCustomDNS = false;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 模式2下是否代理DNS
|
/// 模式 2 下是否代理 DNS
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool ProxyDNS = false;
|
public bool ProxyDNS = false;
|
||||||
|
|
||||||
@@ -159,20 +159,10 @@ namespace Netch.Models
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public int STUN_Server_Port = 3478;
|
public int STUN_Server_Port = 3478;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 是否切换为2号核心
|
|
||||||
/// </summary>
|
|
||||||
public bool UseRedirector2 = false;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 是否启用进程代理白名单模式
|
|
||||||
/// </summary>
|
|
||||||
public bool ProcessBypassMode = false;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 是否启用启动后延迟测试
|
/// 是否启用启动后延迟测试
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool StartedTcping = true;
|
public bool StartedTcping = false;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 启动后延迟测试间隔/秒
|
/// 启动后延迟测试间隔/秒
|
||||||
|
|||||||
76
Netch/Models/Trojan.cs
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -50,8 +50,9 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="ini-parser" Version="2.5.2" />
|
<PackageReference Include="ini-parser" Version="2.5.2" />
|
||||||
|
<PackageReference Include="MaxMind.GeoIP2" Version="3.2.0" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||||
<PackageReference Include="System.Buffers" Version="4.5.0" />
|
<PackageReference Include="System.Buffers" Version="4.5.1" />
|
||||||
<PackageReference Include="WindowsAPICodePack-Shell" Version="1.1.1" />
|
<PackageReference Include="WindowsAPICodePack-Shell" Version="1.1.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
@@ -66,6 +67,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>
|
||||||
|
|||||||
20
Netch/Properties/Resources.Designer.cs
generated
@@ -110,16 +110,6 @@ namespace Netch.Properties {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
|
||||||
/// </summary>
|
|
||||||
internal static System.Drawing.Bitmap N3RO {
|
|
||||||
get {
|
|
||||||
object obj = ResourceManager.GetObject("N3RO", resourceCulture);
|
|
||||||
return ((System.Drawing.Bitmap)(obj));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -140,6 +130,16 @@ namespace Netch.Properties {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap Sponsor {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("Sponsor", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找 System.Byte[] 类型的本地化资源。
|
/// 查找 System.Byte[] 类型的本地化资源。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -139,8 +139,8 @@
|
|||||||
<data name="Netch" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="Netch" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>..\Resources\Netch.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
<value>..\Resources\Netch.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="N3RO" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="Sponsor" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>..\Resources\N3RO.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
<value>..\Resources\Sponsor.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="CopyLink" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="CopyLink" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>..\Resources\CopyLink.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
<value>..\Resources\CopyLink.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 37 KiB |
@@ -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": "发现新版本",
|
||||||
@@ -89,14 +91,14 @@
|
|||||||
"Modes have been reload": "模式已重载",
|
"Modes have been reload": "模式已重载",
|
||||||
"Clean DNS Cache": "清理 DNS 缓存",
|
"Clean DNS Cache": "清理 DNS 缓存",
|
||||||
"DNS cache cleanup succeeded": "DNS 缓存清理成功",
|
"DNS cache cleanup succeeded": "DNS 缓存清理成功",
|
||||||
"Update ACL": "更新ACL规则",
|
"Update ACL": "更新 ACL 规则",
|
||||||
"Update ACL with proxy": "使用代理更新 ACL 规则",
|
"Update ACL with proxy": "使用代理更新 ACL 规则",
|
||||||
"ACL updated successfully": "ACL 更新成功",
|
"ACL updated successfully": "ACL 更新成功",
|
||||||
"ACL update failed": "ACL更新失败",
|
"ACL update failed": "ACL 更新失败",
|
||||||
"Reinstall Tap driver": "重新安装 TUN/TAP 驱动",
|
"Reinstall TUN/TAP driver": "重新安装 TUN/TAP 驱动",
|
||||||
"Reinstall Tap driver successfully": "重装 TUN/TAP 驱动成功",
|
"Reinstall TUN/TAP driver successfully": "重装 TUN/TAP 驱动成功",
|
||||||
"Reinstall Tap driver failed": "重装 TUN/TAP 驱动失败",
|
"Reinstall TUN/TAP driver failed": "重装 TUN/TAP 驱动失败",
|
||||||
"Reinstalling Tap driver": "正在重装 TUN/TAP 驱动",
|
"Reinstalling TUN/TAP driver": "正在重装 TUN/TAP 驱动",
|
||||||
|
|
||||||
"About": "关于",
|
"About": "关于",
|
||||||
"Telegram Channel": "Telegram 频道",
|
"Telegram Channel": "Telegram 频道",
|
||||||
@@ -154,13 +156,14 @@
|
|||||||
"Gateway": "网关",
|
"Gateway": "网关",
|
||||||
"Use Custom DNS": "使用自定义 DNS",
|
"Use Custom DNS": "使用自定义 DNS",
|
||||||
"Proxy DNS in Mode 2": "在模式 2 下代理 DNS",
|
"Proxy DNS in Mode 2": "在模式 2 下代理 DNS",
|
||||||
"Use Fake DNS (Suggest open if NTT is Udpblock)": "使用 Fake DNS (建议节点 NAT 测试为 UdpBlocked 时开启)",
|
"Use Fake DNS": "使用 Fake DNS",
|
||||||
"Behavior": "行为",
|
"Behavior": "行为",
|
||||||
"Exit when closed": "关闭时退出",
|
"Exit when closed": "关闭时退出",
|
||||||
"Stop when exited": "退出时停止",
|
"Stop when exited": "退出时停止",
|
||||||
"Global Bypass IPs": "全局直连 IP",
|
"Global Bypass IPs": "全局直连 IP",
|
||||||
"Port value illegal. Try again.": "端口值非法。请重试。",
|
"Port value illegal. Try again.": "端口值非法。请重试。",
|
||||||
"Check update when opened": "打开软件时检查更新",
|
"Check update when opened": "打开软件时检查更新",
|
||||||
|
"Start Shadowsocks from DLL (No support for ACL)": "SS DLL(推荐使用,不支持 ACL)",
|
||||||
"ProfileCount": "快捷配置数量(重启软件生效)",
|
"ProfileCount": "快捷配置数量(重启软件生效)",
|
||||||
"ProfileCount value illegal. Try again.": "快捷配置数值非法。请重试。",
|
"ProfileCount value illegal. Try again.": "快捷配置数值非法。请重试。",
|
||||||
"STUN_ServerPort value illegal. Try again.": "STUN 端口数值非法。请重试。",
|
"STUN_ServerPort value illegal. Try again.": "STUN 端口数值非法。请重试。",
|
||||||
@@ -168,12 +171,12 @@
|
|||||||
"TUN/TAP driver is not detected. Is it installed now?": "未检测到 TUN/TAP 驱动,是否现在安装?",
|
"TUN/TAP driver is not detected. Is it installed now?": "未检测到 TUN/TAP 驱动,是否现在安装?",
|
||||||
"Failed to set the system proxy, it may be caused by the lack of dependent programs. Do you want to jump to Netch's official website to download dependent programs?": "设置系统代理失败,可能是缺少依赖导致,是否跳转 Netch 官网下载依赖程序?",
|
"Failed to set the system proxy, it may be caused by the lack of dependent programs. Do you want to jump to Netch's official website to download dependent programs?": "设置系统代理失败,可能是缺少依赖导致,是否跳转 Netch 官网下载依赖程序?",
|
||||||
"Experimental function": "实验性功能",
|
"Experimental function": "实验性功能",
|
||||||
"Delay test after startup": "启动后延迟测试",
|
"Delay test after start": "启动后延迟测试",
|
||||||
"Enable": "启用",
|
"Enable": "启用",
|
||||||
"Detection interval(/s)": "检测间隔(/秒)",
|
"Detection interval(sec)": "检测间隔(秒)",
|
||||||
|
"STUN Server": "STUN 服务器",
|
||||||
|
"STUN Server Port": "STUN 服务器端口",
|
||||||
"Custom ACL": "自定义 ACL 规则",
|
"Custom ACL": "自定义 ACL 规则",
|
||||||
"Process whitelist mode": "进程白名单模式",
|
|
||||||
"Boot Shadowsocks from DLL(No support ACL)": "SS DLL(推荐使用,不支持 ACL)",
|
|
||||||
|
|
||||||
"Profile": "配置名",
|
"Profile": "配置名",
|
||||||
"Profiles": "配置",
|
"Profiles": "配置",
|
||||||
@@ -184,7 +187,7 @@
|
|||||||
|
|
||||||
"Bypass LAN": "[网页代理] 绕过局域网",
|
"Bypass LAN": "[网页代理] 绕过局域网",
|
||||||
"Bypass LAN (Non System Proxy)": "[网页代理] 绕过局域网(不设置系统代理)",
|
"Bypass LAN (Non System Proxy)": "[网页代理] 绕过局域网(不设置系统代理)",
|
||||||
"Bypass LAN (TUN/TAP)": "[TAP/TAP] 绕过局域网",
|
"Bypass LAN (TUN/TAP)": "[TUN/TAP] 绕过局域网",
|
||||||
"Bypass LAN and China": "[网页代理] 绕过局域网和中国大陆",
|
"Bypass LAN and China": "[网页代理] 绕过局域网和中国大陆",
|
||||||
"Bypass LAN and China (Non System Proxy)": "[网页代理] 绕过局域网和中国大陆 (不设置系统代理)",
|
"Bypass LAN and China (Non System Proxy)": "[网页代理] 绕过局域网和中国大陆 (不设置系统代理)",
|
||||||
"Bypass LAN and China (TUN/TAP)": "[TUN/TAP] 绕过局域网和中国大陆"
|
"Bypass LAN and China (TUN/TAP)": "[TUN/TAP] 绕过局域网和中国大陆"
|
||||||
|
|||||||
@@ -516,6 +516,56 @@ namespace Netch.Utils
|
|||||||
}
|
}
|
||||||
list.Add(NetchLink);
|
list.Add(NetchLink);
|
||||||
}
|
}
|
||||||
|
else if(text.StartsWith("trojan://"))
|
||||||
|
{
|
||||||
|
var data = new Server();
|
||||||
|
data.Type = "Trojan";
|
||||||
|
|
||||||
|
text = text.Replace("/?", "?");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (text.Contains("#"))
|
||||||
|
{
|
||||||
|
data.Remark = HttpUtility.UrlDecode(text.Split('#')[1]);
|
||||||
|
text = text.Split('#')[0];
|
||||||
|
}
|
||||||
|
if (text.Contains("?"))
|
||||||
|
{
|
||||||
|
var reg = new Regex(@"^(?<data>.+?)\?(.+)$");
|
||||||
|
var regmatch = reg.Match(text);
|
||||||
|
|
||||||
|
if (regmatch.Success)
|
||||||
|
{
|
||||||
|
var peer = HttpUtility.UrlDecode(HttpUtility.ParseQueryString(new Uri(text).Query).Get("peer"));
|
||||||
|
|
||||||
|
if (peer != null)
|
||||||
|
data.Host = peer;
|
||||||
|
|
||||||
|
text = regmatch.Groups["data"].Value;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new FormatException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var finder = new Regex(@"^trojan://(?<psk>.+?)@(?<server>.+):(?<port>\d+)");
|
||||||
|
var match = finder.Match(text);
|
||||||
|
if (!match.Success)
|
||||||
|
{
|
||||||
|
throw new FormatException();
|
||||||
|
}
|
||||||
|
|
||||||
|
data.Password = match.Groups["psk"].Value;
|
||||||
|
data.Hostname = match.Groups["server"].Value;
|
||||||
|
data.Port = int.Parse(match.Groups["port"].Value);
|
||||||
|
|
||||||
|
list.Add(data);
|
||||||
|
}
|
||||||
|
catch (FormatException)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
# Netch
|
# Netch
|
||||||
[](https://t.me/Netch) [](https://t.me/Netch_Discuss_Group) 
|
[](https://t.me/Netch) [](https://t.me/Netch_Discuss_Group) 
|
||||||
|
|
||||||
Game accelerator
|
Game accelerator
|
||||||
|
|
||||||
[简体中文](docs/README.zh-CN.md) (此版本内容更丰富)
|
[简体中文](docs/README.zh-CN.md) (此版本内容更丰富)
|
||||||
|
|
||||||
|
[Website](https://netch.org/)
|
||||||
|
|
||||||
## TOC
|
## TOC
|
||||||
- [Netch](#netch)
|
- [Netch](#netch)
|
||||||
- [TOC](#toc)
|
- [TOC](#toc)
|
||||||
@@ -34,6 +36,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)
|
||||||
|
|||||||
2
binaries
41
build.ps1
@@ -1,41 +0,0 @@
|
|||||||
# 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')
|
|
||||||
|
|
||||||
Write-Host 'dotnet SDK version'
|
|
||||||
dotnet --version
|
|
||||||
|
|
||||||
$exe = 'Netch.exe'
|
|
||||||
$mainDir = (Get-Item -Path ".\").FullName
|
|
||||||
$net_baseoutput = "$mainDir\Netch\bin\$configuration"
|
|
||||||
|
|
||||||
Write-Host $mainDir
|
|
||||||
Write-Host $net_baseoutput
|
|
||||||
|
|
||||||
function Build-NetFrameworkx64
|
|
||||||
{
|
|
||||||
Write-Host 'Building .NET Framework 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
|
|
||||||
if ($LASTEXITCODE) { cd $mainDir ; exit $LASTEXITCODE }
|
|
||||||
|
|
||||||
Write-Host 'Build x64 Complete ,Started Copy bin,mode,i18n file'
|
|
||||||
|
|
||||||
Copy-Item "$mainDir\translations\i18n\*" "$net_baseoutput\x64\Release\win-x64\i18n" -recurse
|
|
||||||
|
|
||||||
Copy-Item "$mainDir\modes\mode\*" "$net_baseoutput\x64\Release\win-x64\mode" -recurse
|
|
||||||
|
|
||||||
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'
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
cd $mainDir\Netch
|
|
||||||
|
|
||||||
Build-NetFrameworkx64
|
|
||||||
|
|
||||||
cd $mainDir
|
|
||||||
@@ -1,14 +1,16 @@
|
|||||||
# Netch
|
# Netch
|
||||||
[](https://t.me/Netch) [](https://t.me/Netch_Discuss_Group) 
|
[](https://t.me/Netch) [](https://t.me/Netch_Discuss_Group) 
|
||||||
|
|
||||||
游戏加速工具
|
游戏加速工具
|
||||||
|
|
||||||
|
[网站](https://netch.org/)
|
||||||
|
|
||||||
## TOC
|
## TOC
|
||||||
- [Netch](#Netch)
|
- [Netch](#Netch)
|
||||||
- [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 +41,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)
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 85 KiB |
|
Before Width: | Height: | Size: 33 KiB |
BIN
docs/screenshots/addLink.zh-CN.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
docs/screenshots/addServer.zh-CN.png
Normal file
|
After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 18 KiB |