Compare commits

...

52 Commits
1.4.3 ... 1.4.6

Author SHA1 Message Date
Connection Refused
d34a43a790 Bump version to 1.4.6 2020-05-08 18:10:06 +08:00
Connection Refused
c9c023aad8 Fix trojan not exit 2020-05-08 18:07:45 +08:00
Connection Refused
8e202e6800 Fix trojan not exit 2020-05-08 16:50:26 +08:00
Connection Refused
9fe2541f18 Add wait for exit 2020-05-08 16:41:50 +08:00
Connection Refused
b83f6d6c3d Fix trojan not exit 2020-05-08 16:41:39 +08:00
Connection Refused
2bcd942675 Fix server remark rendering 2020-05-08 16:29:35 +08:00
Connection Refused
8c05ba2289 Fix trojan can not start 2020-05-08 16:29:11 +08:00
Connection Refused
95f26332a6 Fix translation 2020-05-08 16:20:50 +08:00
Connection Refused
e946b01b6f Update build scripts 2020-05-08 16:19:36 +08:00
Connection Refused
b2b19be32b Dump version to 1.4.5 2020-05-08 16:10:16 +08:00
Connection Refused
ffc6b7adc9 Update zh-CN 2020-05-08 16:05:09 +08:00
Connection Refused
9ecde61b52 Update README.md 2020-05-08 16:02:18 +08:00
Connection Refused
083364ae9d Update README.md 2020-05-08 16:01:36 +08:00
Connection Refused
96f8b9944d Update zh-CN 2020-05-08 15:59:11 +08:00
Connection Refused
8d7a5613fa Support edit Trojan server 2020-05-08 15:58:04 +08:00
Connection Refused
d8133bcc35 Update submodule for support trojan 2020-05-08 15:54:13 +08:00
Connection Refused
9149f23986 Add Trojan Support 2020-05-08 15:53:19 +08:00
Connection Refused
92d1cfdb50 Update README.md 2020-05-07 21:28:47 +08:00
Connection Refused
53e847ce1d CLEAN.BAT → CLEAN.ps1 2020-05-07 21:26:33 +08:00
Connection Refused
08524f08f3 Fix CI 2020-05-07 21:20:03 +08:00
Connection Refused
222ddfe434 Fix CI 2020-05-07 21:11:20 +08:00
Connection Refused
6872ca94e7 Update submodule 2020-05-07 21:09:18 +08:00
Connection Refused
152f49c161 Update build scripts 2020-05-07 21:00:34 +08:00
Connection Refused
0b46f8d8af Lowercase SHA256 2020-05-07 20:52:50 +08:00
Amazing_DM
b69ed09dd6 🚑 2020-05-07 19:33:34 +08:00
Amazing_DM
5276d90af0 Update README.zh-CN.md 2020-05-07 19:02:46 +08:00
Amazing_DM
bea9ce6583 Update README.md 2020-05-07 19:02:18 +08:00
Connection Refused
3b939ab984 Update zh-CN 2020-05-07 16:54:33 +08:00
Connection Refused
bebb904a43 Only use shadowsocks-windows-dynamic in some modes 2020-05-07 16:45:38 +08:00
Amazing_DM
895cc40c36 Bump versions to 1.4.4 2020-05-07 13:45:41 +08:00
Amazing_DM
577e0e01a7 :globe_with_meridians:完善内部中文 2020-05-07 13:37:19 +08:00
Amazing_DM
635654336d :lipstick:调整设置界面 2020-05-07 11:30:58 +08:00
Amazing_DM
90c44bcaf3 Update submodule 2020-05-07 08:51:34 +08:00
Amazing_DM
31d64f308c :bug:修复一个bug 2020-05-05 16:36:22 +08:00
Amazing_DM
8a0d64c135 :boom:停止对32位系统支持 2020-05-05 16:06:04 +08:00
Amazing_DM
76ad8187e0 :boom:停止对32位系统支持 2020-05-05 15:13:51 +08:00
Amazing_DM
663e8fdcc0 Update README.zh-CN.md 2020-05-05 11:09:31 +08:00
Amazing_DM
8140fba21e 2020-05-05 09:27:16 +08:00
Connection Refused
23d0970ed3 Update zh-CN 2020-05-04 17:04:20 +08:00
Connection Refused
64ce265872 Update README.md 2020-05-04 17:03:52 +08:00
Connection Refused
e83c4ca449 Update zh-CN 2020-05-04 17:01:57 +08:00
Connection Refused
e4befbf3f0 Update README.md 2020-05-04 17:00:05 +08:00
Connection Refused
3f4b03870f Add XMR donate method 2020-05-03 16:15:38 +08:00
Amazing_DM
ae0ac6595e Update submodule 2020-05-01 15:46:00 +08:00
Amazing_DM
2a0c2e9f83 Update submodule 2020-05-01 15:41:03 +08:00
Amazing_DM
e4eba0a386 Update README.zh-CN.md 2020-04-30 10:29:38 +08:00
Amazing_DM
5b6a0650ce Update README.md 2020-04-30 10:29:26 +08:00
Amazing_DM
1707764d39 Merge branch 'master' of https://github.com/NetchX/Netch 2020-04-30 10:15:53 +08:00
Amazing_DM
d62cd46094 Update submodule 2020-04-30 10:15:32 +08:00
Amazing_DM
e9f1110217 Merge pull request #267 from zhuzai123/master
Update SSRController.cs
2020-04-29 13:42:09 +08:00
He Houzhu
57706e6c96 Update SSRController.cs 2020-04-29 00:25:16 +08:00
Amazing_DM
6375407d53 :sparkles:支持Fake DNS
:globe_with_meridians:更新翻译
2020-04-28 15:56:25 +08:00
36 changed files with 5880 additions and 316 deletions

View File

@@ -1,71 +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.x64-${{ env.GITHUB_TAG_NAME }}.zip Compress-Archive -Path Netch\bin\x64\Release\win-x64\* -DestinationPath C:\builtfiles\Netch.zip
echo "::set-env name=Netch64_SHA256::$(.\getSHA256.ps1 C:\builtfiles\Netch.x64-${{ env.GITHUB_TAG_NAME }}.zip)" echo "::set-env name=Netch_SHA256::$(.\GetSHA256.ps1 C:\builtfiles\Netch.zip)"
Compress-Archive -Path Netch\bin\x86\Release\win-x86\* -DestinationPath C:\builtfiles\Netch.x86-${{ env.GITHUB_TAG_NAME }}.zip
echo "::set-env name=Netch86_SHA256::$(.\getSHA256.ps1 C:\builtfiles\Netch.x86-${{ env.GITHUB_TAG_NAME }}.zip)"
- name: Upload Netch.x64 - name: Upload
uses: actions/upload-artifact@v1 uses: actions/upload-artifact@v1
with: with:
name: Netch.x64 name: Netch
path: Netch\bin\x64\Release\win-x64 path: Netch\bin\x64\Release\win-x64
- name: Upload Netch.x86 - name: Release
uses: actions/upload-artifact@v1
with:
name: Netch.x86
path: Netch\bin\x86\Release\win-x86
# Create a new release: create a tag, then 'git push origin <tagname>', wait for it to build
- 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.x64-${{ env.GITHUB_TAG_NAME }}.zip C:\builtfiles\Netch.zip
C:\builtfiles\Netch.x86-${{ env.GITHUB_TAG_NAME }}.zip
body: | body: |
[![](https://img.shields.io/badge/Telegram-Channel-blue)](https://t.me/Netch) [![](https://img.shields.io/badge/Telegram-Group-green)](https://t.me/Netch_Discuss_Group) [![](https://img.shields.io/badge/Telegram-Channel-blue)](https://t.me/Netch) [![](https://img.shields.io/badge/Telegram-Group-green)](https://t.me/Netch_Discuss_Group)
## 更新日志: ## 更新日志:
* 这是 GitHub Action 自动化部署,更新日志应该很快会手动更新:D * 这是 GitHub Action 自动化部署,更新日志应该很快会手动更新
## 文件校验 ## 校验
| 文件名 | SHA256 | | 文件名 | SHA256 |
| :- | :- | | :- | :- |
| <sub>Netch.x64-${{ env.GITHUB_TAG_NAME }}.zip</sub> | <sub>${{ env.Netch64_SHA256 }}</sub> | | Netch.zip | ${{ env.Netch_SHA256 }} |
| <sub>Netch.x86-${{ env.GITHUB_TAG_NAME }}.zip</sub> | <sub>${{ env.Netch86_SHA256 }}</sub> |
if: startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

View File

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

21
CLEAN.ps1 Normal file
View File

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

View File

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

View File

@@ -9,34 +9,18 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NetchLib", "NetchLib\NetchL
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64 Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64 Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{4B041B91-5790-4571-8C58-C63FFE4BC9F8}.Debug|Any CPU.ActiveCfg = Debug|x86
{4B041B91-5790-4571-8C58-C63FFE4BC9F8}.Debug|x64.ActiveCfg = Debug|x64 {4B041B91-5790-4571-8C58-C63FFE4BC9F8}.Debug|x64.ActiveCfg = Debug|x64
{4B041B91-5790-4571-8C58-C63FFE4BC9F8}.Debug|x64.Build.0 = Debug|x64 {4B041B91-5790-4571-8C58-C63FFE4BC9F8}.Debug|x64.Build.0 = Debug|x64
{4B041B91-5790-4571-8C58-C63FFE4BC9F8}.Debug|x86.ActiveCfg = Debug|x86
{4B041B91-5790-4571-8C58-C63FFE4BC9F8}.Debug|x86.Build.0 = Debug|x86
{4B041B91-5790-4571-8C58-C63FFE4BC9F8}.Release|Any CPU.ActiveCfg = Release|x86
{4B041B91-5790-4571-8C58-C63FFE4BC9F8}.Release|x64.ActiveCfg = Release|x64 {4B041B91-5790-4571-8C58-C63FFE4BC9F8}.Release|x64.ActiveCfg = Release|x64
{4B041B91-5790-4571-8C58-C63FFE4BC9F8}.Release|x64.Build.0 = Release|x64 {4B041B91-5790-4571-8C58-C63FFE4BC9F8}.Release|x64.Build.0 = Release|x64
{4B041B91-5790-4571-8C58-C63FFE4BC9F8}.Release|x86.ActiveCfg = Release|x86
{4B041B91-5790-4571-8C58-C63FFE4BC9F8}.Release|x86.Build.0 = Release|x86
{A8715AF4-ACC6-43F9-9381-4294C5360623}.Debug|Any CPU.ActiveCfg = Debug|x86
{A8715AF4-ACC6-43F9-9381-4294C5360623}.Debug|x64.ActiveCfg = Debug|x64 {A8715AF4-ACC6-43F9-9381-4294C5360623}.Debug|x64.ActiveCfg = Debug|x64
{A8715AF4-ACC6-43F9-9381-4294C5360623}.Debug|x64.Build.0 = Debug|x64 {A8715AF4-ACC6-43F9-9381-4294C5360623}.Debug|x64.Build.0 = Debug|x64
{A8715AF4-ACC6-43F9-9381-4294C5360623}.Debug|x86.ActiveCfg = Debug|x86
{A8715AF4-ACC6-43F9-9381-4294C5360623}.Debug|x86.Build.0 = Debug|x86
{A8715AF4-ACC6-43F9-9381-4294C5360623}.Release|Any CPU.ActiveCfg = Release|x86
{A8715AF4-ACC6-43F9-9381-4294C5360623}.Release|x64.ActiveCfg = Release|x64 {A8715AF4-ACC6-43F9-9381-4294C5360623}.Release|x64.ActiveCfg = Release|x64
{A8715AF4-ACC6-43F9-9381-4294C5360623}.Release|x64.Build.0 = Release|x64 {A8715AF4-ACC6-43F9-9381-4294C5360623}.Release|x64.Build.0 = Release|x64
{A8715AF4-ACC6-43F9-9381-4294C5360623}.Release|x86.ActiveCfg = Release|x86
{A8715AF4-ACC6-43F9-9381-4294C5360623}.Release|x86.Build.0 = Release|x86
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

View File

@@ -499,7 +499,7 @@ namespace nfapinet
* @param driverName The name of hooking driver, without ".sys" extension. * @param driverName The name of hooking driver, without ".sys" extension.
* @param pHandler Pointer to event handling object * @param pHandler Pointer to event handling object
**/ **/
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)] [DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
public static extern NF_STATUS nf_init(String driverName, IntPtr pHandler); public static extern NF_STATUS nf_init(String driverName, IntPtr pHandler);
public static NF_STATUS nf_init(String driverName, NF_EventHandler pHandler) public static NF_STATUS nf_init(String driverName, NF_EventHandler pHandler)
@@ -537,21 +537,21 @@ namespace nfapinet
* Stops the filtering thread, breaks all filtered connections and closes * Stops the filtering thread, breaks all filtered connections and closes
* a connection with the hooking driver. * a connection with the hooking driver.
**/ **/
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)] [DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
public static extern void nf_free(); public static extern void nf_free();
/** /**
* Registers and starts a driver with specified name (without ".sys" extension) * Registers and starts a driver with specified name (without ".sys" extension)
* @param driverName * @param driverName
**/ **/
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)] [DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
public static extern NF_STATUS nf_registerDriver(String driverName); public static extern NF_STATUS nf_registerDriver(String driverName);
/** /**
* Unregisters a driver with specified name (without ".sys" extension) * Unregisters a driver with specified name (without ".sys" extension)
* @param driverName * @param driverName
**/ **/
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)] [DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
public static extern NF_STATUS nf_unRegisterDriver(String driverName); public static extern NF_STATUS nf_unRegisterDriver(String driverName);
@@ -564,7 +564,7 @@ namespace nfapinet
* @param id Connection identifier * @param id Connection identifier
* @param suspended true for suspend, false for resume * @param suspended true for suspend, false for resume
**/ **/
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)] [DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
public static extern NF_STATUS nf_tcpSetConnectionState(ulong id, int suspended); public static extern NF_STATUS nf_tcpSetConnectionState(ulong id, int suspended);
/** /**
@@ -573,7 +573,7 @@ namespace nfapinet
* @param buf Pointer to data buffer * @param buf Pointer to data buffer
* @param len Buffer length * @param len Buffer length
**/ **/
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)] [DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
public static extern NF_STATUS nf_tcpPostSend(ulong id, IntPtr buf, int len); public static extern NF_STATUS nf_tcpPostSend(ulong id, IntPtr buf, int len);
/** /**
@@ -582,14 +582,14 @@ namespace nfapinet
* @param buf Pointer to data buffer * @param buf Pointer to data buffer
* @param len Buffer length * @param len Buffer length
**/ **/
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)] [DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
public static extern NF_STATUS nf_tcpPostReceive(ulong id, IntPtr buf, int len); public static extern NF_STATUS nf_tcpPostReceive(ulong id, IntPtr buf, int len);
/** /**
* Breaks the connection with given id. * Breaks the connection with given id.
* @param id Connection identifier * @param id Connection identifier
**/ **/
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)] [DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
public static extern NF_STATUS nf_tcpClose(ulong id); public static extern NF_STATUS nf_tcpClose(ulong id);
// //
@@ -601,7 +601,7 @@ namespace nfapinet
* @param id Socket identifier * @param id Socket identifier
* @param suspended true for suspend, false for resume * @param suspended true for suspend, false for resume
**/ **/
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)] [DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
public static extern NF_STATUS nf_udpSetConnectionState(ulong id, int suspended); public static extern NF_STATUS nf_udpSetConnectionState(ulong id, int suspended);
/** /**
@@ -611,7 +611,7 @@ namespace nfapinet
* @param buf Pointer to data buffer * @param buf Pointer to data buffer
* @param len Buffer length * @param len Buffer length
**/ **/
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)] [DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
public static extern NF_STATUS nf_udpPostSend(ulong id, public static extern NF_STATUS nf_udpPostSend(ulong id,
IntPtr remoteAddress, IntPtr remoteAddress,
IntPtr buf, int len, IntPtr buf, int len,
@@ -624,7 +624,7 @@ namespace nfapinet
* @param buf Pointer to data buffer * @param buf Pointer to data buffer
* @param len Buffer length * @param len Buffer length
**/ **/
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)] [DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
public static extern NF_STATUS nf_udpPostReceive(ulong id, public static extern NF_STATUS nf_udpPostReceive(ulong id,
IntPtr remoteAddress, IntPtr remoteAddress,
IntPtr buf, int len, IntPtr buf, int len,
@@ -636,7 +636,7 @@ namespace nfapinet
* @param len Buffer length * @param len Buffer length
* @param options IP options * @param options IP options
**/ **/
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)] [DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
public static extern NF_STATUS nf_ipPostReceive( public static extern NF_STATUS nf_ipPostReceive(
IntPtr buf, int len, IntPtr buf, int len,
ref NF_IP_PACKET_OPTIONS options); ref NF_IP_PACKET_OPTIONS options);
@@ -647,7 +647,7 @@ namespace nfapinet
* @param len Buffer length * @param len Buffer length
* @param options IP options * @param options IP options
**/ **/
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)] [DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
public static extern NF_STATUS nf_ipPostSend( public static extern NF_STATUS nf_ipPostSend(
IntPtr buf, int len, IntPtr buf, int len,
ref NF_IP_PACKET_OPTIONS options); ref NF_IP_PACKET_OPTIONS options);
@@ -661,7 +661,7 @@ namespace nfapinet
* @param pRule See <tt>NF_RULE</tt> * @param pRule See <tt>NF_RULE</tt>
* @param toHead TRUE (1) - add rule to list head, FALSE (0) - add rule to tail * @param toHead TRUE (1) - add rule to list head, FALSE (0) - add rule to tail
**/ **/
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)] [DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
private static extern NF_STATUS nf_addRule(ref NF_RULE pRule, int toHead); private static extern NF_STATUS nf_addRule(ref NF_RULE pRule, int toHead);
private static void updateAddressLength(ref byte[] buf) private static void updateAddressLength(ref byte[] buf)
@@ -694,7 +694,7 @@ namespace nfapinet
* @param pRule See <tt>NF_RULE</tt> * @param pRule See <tt>NF_RULE</tt>
* @param toHead TRUE (1) - add rule to list head, FALSE (0) - add rule to tail * @param toHead TRUE (1) - add rule to list head, FALSE (0) - add rule to tail
**/ **/
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)] [DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
private static extern NF_STATUS nf_addRuleEx(ref NF_RULE_EX pRule, int toHead); private static extern NF_STATUS nf_addRuleEx(ref NF_RULE_EX pRule, int toHead);
public static NF_STATUS nf_addRuleEx(NF_RULE_EX pRule, int toHead) public static NF_STATUS nf_addRuleEx(NF_RULE_EX pRule, int toHead)
@@ -712,7 +712,7 @@ namespace nfapinet
* @param pRules Array of <tt>NF_RULE</tt> structures * @param pRules Array of <tt>NF_RULE</tt> structures
* @param count Number of items in array * @param count Number of items in array
**/ **/
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)] [DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
private static extern NF_STATUS nf_setRules(IntPtr pRules, int count); private static extern NF_STATUS nf_setRules(IntPtr pRules, int count);
public static NF_STATUS nf_setRules(NF_RULE[] rules) public static NF_STATUS nf_setRules(NF_RULE[] rules)
@@ -744,7 +744,7 @@ namespace nfapinet
* @param pRules Array of <tt>NF_RULE</tt> structures * @param pRules Array of <tt>NF_RULE</tt> structures
* @param count Number of items in array * @param count Number of items in array
**/ **/
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)] [DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
private static extern NF_STATUS nf_setRulesEx(IntPtr pRules, int count); private static extern NF_STATUS nf_setRulesEx(IntPtr pRules, int count);
public static NF_STATUS nf_setRulesEx(NF_RULE_EX[] rules) public static NF_STATUS nf_setRulesEx(NF_RULE_EX[] rules)
@@ -774,34 +774,34 @@ namespace nfapinet
/** /**
* Removes all rules from driver. * Removes all rules from driver.
**/ **/
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)] [DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
public static extern NF_STATUS nf_deleteRules(); public static extern NF_STATUS nf_deleteRules();
/** /**
* Sets the timeout for TCP connections and returns old timeout. * Sets the timeout for TCP connections and returns old timeout.
* @param timeout Timeout value in milliseconds. Specify zero value to disable timeouts. * @param timeout Timeout value in milliseconds. Specify zero value to disable timeouts.
*/ */
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)] [DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
public static extern UInt32 nf_setTCPTimeout(UInt32 timeout); public static extern UInt32 nf_setTCPTimeout(UInt32 timeout);
/** /**
* Disables indicating TCP packets to user mode for the specified endpoint * Disables indicating TCP packets to user mode for the specified endpoint
* @param id Socket identifier * @param id Socket identifier
*/ */
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)] [DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
public static extern NF_STATUS nf_tcpDisableFiltering(ulong id); public static extern NF_STATUS nf_tcpDisableFiltering(ulong id);
/** /**
* Disables indicating UDP packets to user mode for the specified endpoint * Disables indicating UDP packets to user mode for the specified endpoint
* @param id Socket identifier * @param id Socket identifier
*/ */
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)] [DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
public static extern NF_STATUS nf_udpDisableFiltering(ulong id); public static extern NF_STATUS nf_udpDisableFiltering(ulong id);
/** /**
* Returns TRUE if the specified process acts as a local proxy, accepting the redirected TCP connections. * Returns TRUE if the specified process acts as a local proxy, accepting the redirected TCP connections.
**/ **/
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)] [DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
private static extern bool nf_tcpIsProxy(uint processId); private static extern bool nf_tcpIsProxy(uint processId);
/** /**
@@ -811,37 +811,37 @@ namespace nfapinet
* @param nThreads Number of worker threads for NF_EventHandler events * @param nThreads Number of worker threads for NF_EventHandler events
* @param flags A combination of flags from <tt>NF_FLAGS</tt> * @param flags A combination of flags from <tt>NF_FLAGS</tt>
**/ **/
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)] [DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
public static extern void nf_setOptions(uint nThreads, uint flags); public static extern void nf_setOptions(uint nThreads, uint flags);
/** /**
* Complete TCP connect request pended using flag NF_PEND_CONNECT_REQUEST. * Complete TCP connect request pended using flag NF_PEND_CONNECT_REQUEST.
**/ **/
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)] [DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
public static extern NF_STATUS nf_completeTCPConnectRequest(ulong id, ref NF_TCP_CONN_INFO pConnInfo); public static extern NF_STATUS nf_completeTCPConnectRequest(ulong id, ref NF_TCP_CONN_INFO pConnInfo);
/** /**
* Complete UDP connect request pended using flag NF_PEND_CONNECT_REQUEST. * Complete UDP connect request pended using flag NF_PEND_CONNECT_REQUEST.
**/ **/
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)] [DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
public static extern NF_STATUS nf_completeUDPConnectRequest(ulong id, ref NF_UDP_CONN_REQUEST pConnInfo); public static extern NF_STATUS nf_completeUDPConnectRequest(ulong id, ref NF_UDP_CONN_REQUEST pConnInfo);
/** /**
* Returns in pConnInfo the properties of TCP connection with specified id. * Returns in pConnInfo the properties of TCP connection with specified id.
**/ **/
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)] [DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
public static extern NF_STATUS nf_getTCPConnInfo(ulong id, ref NF_TCP_CONN_INFO pConnInfo); public static extern NF_STATUS nf_getTCPConnInfo(ulong id, ref NF_TCP_CONN_INFO pConnInfo);
/** /**
* Returns in pConnInfo the properties of UDP socket with specified id. * Returns in pConnInfo the properties of UDP socket with specified id.
**/ **/
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)] [DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
public static extern NF_STATUS nf_getUDPConnInfo(ulong id, ref NF_UDP_CONN_INFO pConnInfo); public static extern NF_STATUS nf_getUDPConnInfo(ulong id, ref NF_UDP_CONN_INFO pConnInfo);
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)] [DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
private static extern bool nf_getProcessNameW(uint processId, IntPtr buf, int len); private static extern bool nf_getProcessNameW(uint processId, IntPtr buf, int len);
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)] [DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
private static extern bool nf_getProcessNameFromKernel(uint processId, IntPtr buf, int len); private static extern bool nf_getProcessNameFromKernel(uint processId, IntPtr buf, int len);
/** /**
@@ -880,13 +880,13 @@ namespace nfapinet
return "System"; return "System";
} }
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)] [DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
public static extern void nf_adjustProcessPriviledges(); public static extern void nf_adjustProcessPriviledges();
/* /*
* Set the event handler for IP filtering events * Set the event handler for IP filtering events
*/ */
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)] [DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
private static extern void nf_setIPEventHandler(IntPtr pHandler); private static extern void nf_setIPEventHandler(IntPtr pHandler);
/* /*
@@ -910,51 +910,51 @@ namespace nfapinet
/** /**
* Add flow control context * Add flow control context
*/ */
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)] [DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
public static extern NF_STATUS nf_addFlowCtl(ref NF_FLOWCTL_DATA pData, ref UInt32 pFcHandle); public static extern NF_STATUS nf_addFlowCtl(ref NF_FLOWCTL_DATA pData, ref UInt32 pFcHandle);
/** /**
* Delete flow control context * Delete flow control context
*/ */
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)] [DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
public static extern NF_STATUS nf_deleteFlowCtl(UInt32 fcHandle); public static extern NF_STATUS nf_deleteFlowCtl(UInt32 fcHandle);
/** /**
* Associate flow control context with TCP connection * Associate flow control context with TCP connection
*/ */
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)] [DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
public static extern NF_STATUS nf_setTCPFlowCtl(ulong id, UInt32 fcHandle); public static extern NF_STATUS nf_setTCPFlowCtl(ulong id, UInt32 fcHandle);
/** /**
* Associate flow control context with UDP socket * Associate flow control context with UDP socket
*/ */
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)] [DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
public static extern NF_STATUS nf_setUDPFlowCtl(ulong id, UInt32 fcHandle); public static extern NF_STATUS nf_setUDPFlowCtl(ulong id, UInt32 fcHandle);
/** /**
* Modify flow control context limits * Modify flow control context limits
*/ */
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)] [DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
public static extern NF_STATUS nf_modifyFlowCtl(UInt32 fcHandle, ref NF_FLOWCTL_DATA pData); public static extern NF_STATUS nf_modifyFlowCtl(UInt32 fcHandle, ref NF_FLOWCTL_DATA pData);
/** /**
* Get flow control context statistics as the numbers of in/out bytes * Get flow control context statistics as the numbers of in/out bytes
*/ */
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)] [DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
public static extern NF_STATUS nf_getFlowCtlStat(UInt32 fcHandle, ref NF_FLOWCTL_STAT pStat); public static extern NF_STATUS nf_getFlowCtlStat(UInt32 fcHandle, ref NF_FLOWCTL_STAT pStat);
/** /**
* Get TCP connection statistics as the numbers of in/out bytes. * Get TCP connection statistics as the numbers of in/out bytes.
* The function can be called only from tcpClosed handler! * The function can be called only from tcpClosed handler!
*/ */
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)] [DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
public static extern NF_STATUS nf_getTCPStat(ulong id, ref NF_FLOWCTL_STAT pStat); public static extern NF_STATUS nf_getTCPStat(ulong id, ref NF_FLOWCTL_STAT pStat);
/** /**
* Get UDP socket statistics as the numbers of in/out bytes. * Get UDP socket statistics as the numbers of in/out bytes.
* The function can be called only from udpClosed handler! * The function can be called only from udpClosed handler!
*/ */
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)] [DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
public static extern NF_STATUS nf_getUDPStat(ulong id, ref NF_FLOWCTL_STAT pStat); public static extern NF_STATUS nf_getUDPStat(ulong id, ref NF_FLOWCTL_STAT pStat);
public enum NF_SOCKET_OPTIONS public enum NF_SOCKET_OPTIONS
@@ -967,10 +967,10 @@ namespace nfapinet
TCP_SOCKET_WINDOW = 6 TCP_SOCKET_WINDOW = 6
} }
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)] [DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
public static extern NF_STATUS nf_tcpSetSockOpt(ulong id, NF_SOCKET_OPTIONS optname, ref int optval, int optlen); public static extern NF_STATUS nf_tcpSetSockOpt(ulong id, NF_SOCKET_OPTIONS optname, ref int optval, int optlen);
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)] [DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
public static extern NF_STATUS nf_tcpSetSockOpt(ulong id, NF_SOCKET_OPTIONS optname, IntPtr optval, int optlen); public static extern NF_STATUS nf_tcpSetSockOpt(ulong id, NF_SOCKET_OPTIONS optname, IntPtr optval, int optlen);
public static NF_STATUS nf_tcpSetSockOpt(ulong id, NF_SOCKET_OPTIONS optname, bool optval) public static NF_STATUS nf_tcpSetSockOpt(ulong id, NF_SOCKET_OPTIONS optname, bool optval)
@@ -982,7 +982,7 @@ namespace nfapinet
/** /**
* Add binding rule to driver * Add binding rule to driver
*/ */
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)] [DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
private static extern NF_STATUS private static extern NF_STATUS
nf_addBindingRule(ref NF_BINDING_RULE pRule, int toHead); nf_addBindingRule(ref NF_BINDING_RULE pRule, int toHead);
@@ -999,14 +999,14 @@ namespace nfapinet
/** /**
* Delete all binding rules from driver * Delete all binding rules from driver
*/ */
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)] [DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
public static extern NF_STATUS public static extern NF_STATUS
nf_deleteBindingRules(); nf_deleteBindingRules();
/** /**
* Returns the type of attached driver (DT_WFP, DT_TDI or DT_UNKNOWN) * Returns the type of attached driver (DT_WFP, DT_TDI or DT_UNKNOWN)
*/ */
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)] [DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
public static extern UInt32 public static extern UInt32
nf_getDriverType(); nf_getDriverType();
}; };

View File

@@ -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)

View File

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

View File

@@ -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)

View File

@@ -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)

View File

@@ -1,7 +1,10 @@
using Netch.Forms; using Netch.Forms;
using Netch.Utils;
using System; using System;
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading; using System.Threading;
namespace Netch.Controllers namespace Netch.Controllers
@@ -27,11 +30,39 @@ namespace Netch.Controllers
public bool Start(Models.Server server, Models.Mode mode) public bool Start(Models.Server server, Models.Mode mode)
{ {
MainForm.Instance.StatusText($"{Utils.i18N.Translate("Status")}{Utils.i18N.Translate(": ")}{Utils.i18N.Translate("Starting Shadowsocks")}"); MainForm.Instance.StatusText($"{Utils.i18N.Translate("Status")}{Utils.i18N.Translate(": ")}{Utils.i18N.Translate("Starting Shadowsocks")}");
File.Delete("logging\\shadowsocks.log");
//从DLL启动Shaowsocks
if (Global.Settings.BootShadowsocksFromDLL && (mode.Type == 0 || mode.Type == 1 || mode.Type == 2 || mode.Type == 3))
{
State = Models.State.Starting;
var client = Encoding.UTF8.GetBytes($"0.0.0.0:{Global.Settings.Socks5LocalPort}");
var remote = Encoding.UTF8.GetBytes($"{server.Hostname}:{server.Port}");
var passwd = Encoding.UTF8.GetBytes($"{server.Password}");
var method = Encoding.UTF8.GetBytes($"{server.EncryptMethod}");
if (!NativeMethods.Shadowsocks.Info(client, remote, passwd, method))
{
State = Models.State.Stopped;
Logging.Info("DLL SS INFO 设置失败!");
return false;
}
Logging.Info("DLL SS INFO 设置成功!");
if (!NativeMethods.Shadowsocks.Start())
{
State = Models.State.Stopped;
Logging.Info("DLL SS 启动失败!");
return false;
}
Logging.Info("DLL SS 启动成功!");
State = Models.State.Started;
return true;
}
if (!File.Exists("bin\\Shadowsocks.exe")) if (!File.Exists("bin\\Shadowsocks.exe"))
{ {
return false; return false;
} }
Instance = MainController.GetProcess(); Instance = MainController.GetProcess();
Instance.StartInfo.FileName = "bin\\Shadowsocks.exe"; Instance.StartInfo.FileName = "bin\\Shadowsocks.exe";
@@ -86,9 +117,16 @@ 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();
} }
} }
catch (Exception e) catch (Exception e)
@@ -101,7 +139,7 @@ namespace Netch.Controllers
{ {
if (!string.IsNullOrWhiteSpace(e.Data)) if (!string.IsNullOrWhiteSpace(e.Data))
{ {
// File.AppendAllText("logging\\shadowsocks.log", $"{e.Data}\r\n"); File.AppendAllText("logging\\shadowsocks.log", $"{e.Data}\r\n");
if (State == Models.State.Starting) if (State == Models.State.Starting)
{ {

View File

@@ -27,6 +27,9 @@ namespace Netch.Controllers
public bool Start(Models.Server server, Models.Mode mode) public bool Start(Models.Server server, Models.Mode mode)
{ {
MainForm.Instance.StatusText($"{Utils.i18N.Translate("Status")}{Utils.i18N.Translate(": ")}{Utils.i18N.Translate("Starting ShadowsocksR")}"); MainForm.Instance.StatusText($"{Utils.i18N.Translate("Status")}{Utils.i18N.Translate(": ")}{Utils.i18N.Translate("Starting ShadowsocksR")}");
File.Delete("logging\\shadowsocksr.log");
if (!File.Exists("bin\\ShadowsocksR.exe")) if (!File.Exists("bin\\ShadowsocksR.exe"))
{ {
return false; return false;
@@ -34,7 +37,7 @@ namespace Netch.Controllers
Instance = MainController.GetProcess(); Instance = MainController.GetProcess();
Instance.StartInfo.FileName = "bin\\ShadowsocksR.exe"; Instance.StartInfo.FileName = "bin\\ShadowsocksR.exe";
Instance.StartInfo.Arguments = $"-s {server.Hostname} -p {server.Port} -k \"{server.Password}\" -m {server.EncryptMethod} -t 600"; Instance.StartInfo.Arguments = $"-s {server.Hostname} -p {server.Port} -k \"{server.Password}\" -m {server.EncryptMethod} -t 120";
if (!string.IsNullOrEmpty(server.Protocol)) if (!string.IsNullOrEmpty(server.Protocol))
{ {
@@ -103,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)

View File

@@ -430,6 +430,10 @@ namespace Netch.Controllers
dns = "127.0.0.1"; dns = "127.0.0.1";
//dns = "1.1.1.1,1.0.0.1"; //dns = "1.1.1.1,1.0.0.1";
} }
if (Global.Settings.TUNTAP.UseFakeDNS)
{
dns += " -fakeDns";
}
if (server.Type == "Socks5") if (server.Type == "Socks5")
{ {
@@ -449,6 +453,8 @@ namespace Netch.Controllers
Instance.ErrorDataReceived += OnOutputDataReceived; Instance.ErrorDataReceived += OnOutputDataReceived;
Instance.OutputDataReceived += OnOutputDataReceived; Instance.OutputDataReceived += OnOutputDataReceived;
Logging.Info(Instance.StartInfo.Arguments);
State = Models.State.Starting; State = Models.State.Starting;
Instance.Start(); Instance.Start();
Instance.BeginErrorReadLine(); Instance.BeginErrorReadLine();

View 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;
}
}
}
}
}
}

View File

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

View File

@@ -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)

View File

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

View File

@@ -173,7 +173,7 @@ namespace Netch.Forms
if (splited.Length >= 1) if (splited.Length >= 1)
{ {
mode.Remark = splited[0].Trim(); mode.Remark = Utils.i18N.Translate(splited[0].Trim());
} }
if (splited.Length >= 2) if (splited.Length >= 2)
@@ -255,13 +255,17 @@ namespace Netch.Forms
private void SaveConfigs() private void SaveConfigs()
{ {
Global.Settings.ServerComboBoxSelectedIndex = ServerComboBox.SelectedIndex; Global.Settings.ServerComboBoxSelectedIndex = ServerComboBox.SelectedIndex;
if (ModeComboBox.Tag is object[] list) if (ModeComboBox.SelectedItem != null)
{ {
Global.Settings.ModeComboBoxSelectedIndex = list.ToList().IndexOf(ModeComboBox.SelectedItem);
} if (ModeComboBox.Tag is object[] list)
else {
{ Global.Settings.ModeComboBoxSelectedIndex = list.ToList().IndexOf(ModeComboBox.SelectedItem);
Global.Settings.ModeComboBoxSelectedIndex = ModeComboBox.Items.IndexOf(ModeComboBox.SelectedItem); }
else
{
Global.Settings.ModeComboBoxSelectedIndex = ModeComboBox.Items.IndexOf(ModeComboBox.SelectedItem);
}
} }
Utils.Configuration.Save(); Utils.Configuration.Save();
} }
@@ -348,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);
@@ -489,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();
@@ -760,6 +771,9 @@ namespace Netch.Forms
case "VMess": case "VMess":
new Server.VMess(ServerComboBox.SelectedIndex).Show(); new Server.VMess(ServerComboBox.SelectedIndex).Show();
break; break;
case "Trojan":
new Server.Trojan(ServerComboBox.SelectedIndex).Show();
break;
default: default:
return; return;
} }

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

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

View File

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

File diff suppressed because it is too large Load Diff

View File

@@ -38,6 +38,7 @@
this.Socks5PortLabel = new System.Windows.Forms.Label(); this.Socks5PortLabel = new System.Windows.Forms.Label();
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.TUNTAPProxyDNSCheckBox = new System.Windows.Forms.CheckBox(); this.TUNTAPProxyDNSCheckBox = new System.Windows.Forms.CheckBox();
this.TUNTAPUseCustomDNSCheckBox = new System.Windows.Forms.CheckBox(); this.TUNTAPUseCustomDNSCheckBox = new System.Windows.Forms.CheckBox();
this.TUNTAPDNSLabel = new System.Windows.Forms.Label(); this.TUNTAPDNSLabel = new System.Windows.Forms.Label();
@@ -51,6 +52,9 @@
this.ControlButton = new System.Windows.Forms.Button(); this.ControlButton = new System.Windows.Forms.Button();
this.GlobalBypassIPsButton = new System.Windows.Forms.Button(); this.GlobalBypassIPsButton = new System.Windows.Forms.Button();
this.BehaviorGroupBox = new System.Windows.Forms.GroupBox(); this.BehaviorGroupBox = new System.Windows.Forms.GroupBox();
this.BootShadowsocksFromDLLCheckBox = new System.Windows.Forms.CheckBox();
this.AclAddr = new System.Windows.Forms.TextBox();
this.AclLabel = new System.Windows.Forms.Label();
this.DetectionInterval_Label = new System.Windows.Forms.Label(); this.DetectionInterval_Label = new System.Windows.Forms.Label();
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();
@@ -70,8 +74,6 @@
this.StartWhenOpenedCheckBox = new System.Windows.Forms.CheckBox(); this.StartWhenOpenedCheckBox = new System.Windows.Forms.CheckBox();
this.StopWhenExitedCheckBox = new System.Windows.Forms.CheckBox(); this.StopWhenExitedCheckBox = new System.Windows.Forms.CheckBox();
this.ExitWhenClosedCheckBox = new System.Windows.Forms.CheckBox(); this.ExitWhenClosedCheckBox = new System.Windows.Forms.CheckBox();
this.AclAddr = new System.Windows.Forms.TextBox();
this.AclLabel = new System.Windows.Forms.Label();
this.PortGroupBox.SuspendLayout(); this.PortGroupBox.SuspendLayout();
this.TUNTAPGroupBox.SuspendLayout(); this.TUNTAPGroupBox.SuspendLayout();
this.BehaviorGroupBox.SuspendLayout(); this.BehaviorGroupBox.SuspendLayout();
@@ -157,6 +159,7 @@
// //
// TUNTAPGroupBox // TUNTAPGroupBox
// //
this.TUNTAPGroupBox.Controls.Add(this.UseFakeDNSCheckBox);
this.TUNTAPGroupBox.Controls.Add(this.TUNTAPProxyDNSCheckBox); this.TUNTAPGroupBox.Controls.Add(this.TUNTAPProxyDNSCheckBox);
this.TUNTAPGroupBox.Controls.Add(this.TUNTAPUseCustomDNSCheckBox); this.TUNTAPGroupBox.Controls.Add(this.TUNTAPUseCustomDNSCheckBox);
this.TUNTAPGroupBox.Controls.Add(this.TUNTAPDNSLabel); this.TUNTAPGroupBox.Controls.Add(this.TUNTAPDNSLabel);
@@ -174,10 +177,20 @@
this.TUNTAPGroupBox.TabStop = false; this.TUNTAPGroupBox.TabStop = false;
this.TUNTAPGroupBox.Text = "TUN/TAP"; this.TUNTAPGroupBox.Text = "TUN/TAP";
// //
// UseFakeDNSCheckBox
//
this.UseFakeDNSCheckBox.AutoSize = true;
this.UseFakeDNSCheckBox.Location = new System.Drawing.Point(10, 160);
this.UseFakeDNSCheckBox.Name = "UseFakeDNSCheckBox";
this.UseFakeDNSCheckBox.Size = new System.Drawing.Size(316, 21);
this.UseFakeDNSCheckBox.TabIndex = 11;
this.UseFakeDNSCheckBox.Text = "Use Fake DNS (Suggest open if NTT is Udpblock)";
this.UseFakeDNSCheckBox.UseVisualStyleBackColor = true;
//
// TUNTAPProxyDNSCheckBox // TUNTAPProxyDNSCheckBox
// //
this.TUNTAPProxyDNSCheckBox.AutoSize = true; this.TUNTAPProxyDNSCheckBox.AutoSize = true;
this.TUNTAPProxyDNSCheckBox.Location = new System.Drawing.Point(120, 162); this.TUNTAPProxyDNSCheckBox.Location = new System.Drawing.Point(261, 139);
this.TUNTAPProxyDNSCheckBox.Name = "TUNTAPProxyDNSCheckBox"; this.TUNTAPProxyDNSCheckBox.Name = "TUNTAPProxyDNSCheckBox";
this.TUNTAPProxyDNSCheckBox.Size = new System.Drawing.Size(153, 21); this.TUNTAPProxyDNSCheckBox.Size = new System.Drawing.Size(153, 21);
this.TUNTAPProxyDNSCheckBox.TabIndex = 10; this.TUNTAPProxyDNSCheckBox.TabIndex = 10;
@@ -187,7 +200,7 @@
// TUNTAPUseCustomDNSCheckBox // TUNTAPUseCustomDNSCheckBox
// //
this.TUNTAPUseCustomDNSCheckBox.AutoSize = true; this.TUNTAPUseCustomDNSCheckBox.AutoSize = true;
this.TUNTAPUseCustomDNSCheckBox.Location = new System.Drawing.Point(120, 138); this.TUNTAPUseCustomDNSCheckBox.Location = new System.Drawing.Point(10, 139);
this.TUNTAPUseCustomDNSCheckBox.Name = "TUNTAPUseCustomDNSCheckBox"; this.TUNTAPUseCustomDNSCheckBox.Name = "TUNTAPUseCustomDNSCheckBox";
this.TUNTAPUseCustomDNSCheckBox.Size = new System.Drawing.Size(127, 21); this.TUNTAPUseCustomDNSCheckBox.Size = new System.Drawing.Size(127, 21);
this.TUNTAPUseCustomDNSCheckBox.TabIndex = 9; this.TUNTAPUseCustomDNSCheckBox.TabIndex = 9;
@@ -266,7 +279,7 @@
// ControlButton // ControlButton
// //
this.ControlButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.ControlButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.ControlButton.Location = new System.Drawing.Point(781, 356); this.ControlButton.Location = new System.Drawing.Point(804, 356);
this.ControlButton.Name = "ControlButton"; this.ControlButton.Name = "ControlButton";
this.ControlButton.Size = new System.Drawing.Size(75, 23); this.ControlButton.Size = new System.Drawing.Size(75, 23);
this.ControlButton.TabIndex = 11; this.ControlButton.TabIndex = 11;
@@ -287,6 +300,7 @@
// //
// BehaviorGroupBox // BehaviorGroupBox
// //
this.BehaviorGroupBox.Controls.Add(this.BootShadowsocksFromDLLCheckBox);
this.BehaviorGroupBox.Controls.Add(this.AclAddr); this.BehaviorGroupBox.Controls.Add(this.AclAddr);
this.BehaviorGroupBox.Controls.Add(this.AclLabel); this.BehaviorGroupBox.Controls.Add(this.AclLabel);
this.BehaviorGroupBox.Controls.Add(this.DetectionInterval_Label); this.BehaviorGroupBox.Controls.Add(this.DetectionInterval_Label);
@@ -310,15 +324,42 @@
this.BehaviorGroupBox.Controls.Add(this.ExitWhenClosedCheckBox); this.BehaviorGroupBox.Controls.Add(this.ExitWhenClosedCheckBox);
this.BehaviorGroupBox.Location = new System.Drawing.Point(438, 12); this.BehaviorGroupBox.Location = new System.Drawing.Point(438, 12);
this.BehaviorGroupBox.Name = "BehaviorGroupBox"; this.BehaviorGroupBox.Name = "BehaviorGroupBox";
this.BehaviorGroupBox.Size = new System.Drawing.Size(420, 333); this.BehaviorGroupBox.Size = new System.Drawing.Size(441, 333);
this.BehaviorGroupBox.TabIndex = 8; this.BehaviorGroupBox.TabIndex = 8;
this.BehaviorGroupBox.TabStop = false; this.BehaviorGroupBox.TabStop = false;
this.BehaviorGroupBox.Text = "Behavior"; this.BehaviorGroupBox.Text = "Behavior";
// //
// BootShadowsocksFromDLLCheckBox
//
this.BootShadowsocksFromDLLCheckBox.AutoSize = true;
this.BootShadowsocksFromDLLCheckBox.Location = new System.Drawing.Point(12, 128);
this.BootShadowsocksFromDLLCheckBox.Name = "BootShadowsocksFromDLLCheckBox";
this.BootShadowsocksFromDLLCheckBox.Size = new System.Drawing.Size(297, 21);
this.BootShadowsocksFromDLLCheckBox.TabIndex = 21;
this.BootShadowsocksFromDLLCheckBox.Text = "Boot Shadowsocks from DLL(No support ACL)";
this.BootShadowsocksFromDLLCheckBox.UseVisualStyleBackColor = true;
//
// AclAddr
//
this.AclAddr.Location = new System.Drawing.Point(117, 274);
this.AclAddr.Name = "AclAddr";
this.AclAddr.Size = new System.Drawing.Size(315, 23);
this.AclAddr.TabIndex = 19;
this.AclAddr.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// AclLabel
//
this.AclLabel.AutoSize = true;
this.AclLabel.Location = new System.Drawing.Point(9, 277);
this.AclLabel.Name = "AclLabel";
this.AclLabel.Size = new System.Drawing.Size(78, 17);
this.AclLabel.TabIndex = 20;
this.AclLabel.Text = "Custom ACL";
//
// DetectionInterval_Label // DetectionInterval_Label
// //
this.DetectionInterval_Label.AutoSize = true; this.DetectionInterval_Label.AutoSize = true;
this.DetectionInterval_Label.Location = new System.Drawing.Point(230, 151); this.DetectionInterval_Label.Location = new System.Drawing.Point(230, 193);
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(128, 17);
this.DetectionInterval_Label.TabIndex = 18; this.DetectionInterval_Label.TabIndex = 18;
@@ -326,16 +367,16 @@
// //
// DetectionInterval_TextBox // DetectionInterval_TextBox
// //
this.DetectionInterval_TextBox.Location = new System.Drawing.Point(364, 148); this.DetectionInterval_TextBox.Location = new System.Drawing.Point(364, 190);
this.DetectionInterval_TextBox.Name = "DetectionInterval_TextBox"; this.DetectionInterval_TextBox.Name = "DetectionInterval_TextBox";
this.DetectionInterval_TextBox.Size = new System.Drawing.Size(47, 23); this.DetectionInterval_TextBox.Size = new System.Drawing.Size(68, 23);
this.DetectionInterval_TextBox.TabIndex = 17; this.DetectionInterval_TextBox.TabIndex = 17;
this.DetectionInterval_TextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; this.DetectionInterval_TextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
// //
// EnableStartedTcping_CheckBox // EnableStartedTcping_CheckBox
// //
this.EnableStartedTcping_CheckBox.AutoSize = true; this.EnableStartedTcping_CheckBox.AutoSize = true;
this.EnableStartedTcping_CheckBox.Location = new System.Drawing.Point(152, 150); this.EnableStartedTcping_CheckBox.Location = new System.Drawing.Point(152, 192);
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;
@@ -345,7 +386,7 @@
// DelayTestAfterStartup_Label // DelayTestAfterStartup_Label
// //
this.DelayTestAfterStartup_Label.AutoSize = true; this.DelayTestAfterStartup_Label.AutoSize = true;
this.DelayTestAfterStartup_Label.Location = new System.Drawing.Point(6, 151); this.DelayTestAfterStartup_Label.Location = new System.Drawing.Point(9, 193);
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(141, 17);
this.DelayTestAfterStartup_Label.TabIndex = 16; this.DelayTestAfterStartup_Label.TabIndex = 16;
@@ -354,18 +395,18 @@
// BypassModeCheckBox // BypassModeCheckBox
// //
this.BypassModeCheckBox.AutoSize = true; this.BypassModeCheckBox.AutoSize = true;
this.BypassModeCheckBox.Location = new System.Drawing.Point(276, 307); this.BypassModeCheckBox.Location = new System.Drawing.Point(12, 102);
this.BypassModeCheckBox.Name = "BypassModeCheckBox"; this.BypassModeCheckBox.Name = "BypassModeCheckBox";
this.BypassModeCheckBox.Size = new System.Drawing.Size(135, 21); this.BypassModeCheckBox.Size = new System.Drawing.Size(160, 21);
this.BypassModeCheckBox.TabIndex = 14; this.BypassModeCheckBox.TabIndex = 14;
this.BypassModeCheckBox.Text = "进程代理白名单模式"; this.BypassModeCheckBox.Text = "Process whitelist mode";
this.BypassModeCheckBox.UseVisualStyleBackColor = true; this.BypassModeCheckBox.UseVisualStyleBackColor = true;
this.BypassModeCheckBox.CheckedChanged += new System.EventHandler(this.BypassModeCheckBox_CheckedChanged); this.BypassModeCheckBox.CheckedChanged += new System.EventHandler(this.BypassModeCheckBox_CheckedChanged);
// //
// Redirector2checkBox // Redirector2checkBox
// //
this.Redirector2checkBox.AutoSize = true; this.Redirector2checkBox.AutoSize = true;
this.Redirector2checkBox.Location = new System.Drawing.Point(152, 306); this.Redirector2checkBox.Location = new System.Drawing.Point(148, 310);
this.Redirector2checkBox.Name = "Redirector2checkBox"; this.Redirector2checkBox.Name = "Redirector2checkBox";
this.Redirector2checkBox.Size = new System.Drawing.Size(118, 21); this.Redirector2checkBox.Size = new System.Drawing.Size(118, 21);
this.Redirector2checkBox.TabIndex = 11; this.Redirector2checkBox.TabIndex = 11;
@@ -375,7 +416,7 @@
// ExperimentalFunction_Label // ExperimentalFunction_Label
// //
this.ExperimentalFunction_Label.AutoSize = true; this.ExperimentalFunction_Label.AutoSize = true;
this.ExperimentalFunction_Label.Location = new System.Drawing.Point(6, 307); this.ExperimentalFunction_Label.Location = new System.Drawing.Point(9, 310);
this.ExperimentalFunction_Label.Name = "ExperimentalFunction_Label"; this.ExperimentalFunction_Label.Name = "ExperimentalFunction_Label";
this.ExperimentalFunction_Label.Size = new System.Drawing.Size(133, 17); this.ExperimentalFunction_Label.Size = new System.Drawing.Size(133, 17);
this.ExperimentalFunction_Label.TabIndex = 13; this.ExperimentalFunction_Label.TabIndex = 13;
@@ -383,16 +424,16 @@
// //
// STUN_ServerPortTextBox // STUN_ServerPortTextBox
// //
this.STUN_ServerPortTextBox.Location = new System.Drawing.Point(117, 206); this.STUN_ServerPortTextBox.Location = new System.Drawing.Point(117, 245);
this.STUN_ServerPortTextBox.Name = "STUN_ServerPortTextBox"; this.STUN_ServerPortTextBox.Name = "STUN_ServerPortTextBox";
this.STUN_ServerPortTextBox.Size = new System.Drawing.Size(294, 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 // label2
// //
this.label2.AutoSize = true; this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(6, 209); this.label2.Location = new System.Drawing.Point(9, 248);
this.label2.Name = "label2"; this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(110, 17); this.label2.Size = new System.Drawing.Size(110, 17);
this.label2.TabIndex = 12; this.label2.TabIndex = 12;
@@ -401,7 +442,7 @@
// label1 // label1
// //
this.label1.AutoSize = true; this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(6, 180); this.label1.Location = new System.Drawing.Point(9, 222);
this.label1.Name = "label1"; this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(82, 17); this.label1.Size = new System.Drawing.Size(82, 17);
this.label1.TabIndex = 10; this.label1.TabIndex = 10;
@@ -419,9 +460,9 @@
// //
// STUN_ServerTextBox // STUN_ServerTextBox
// //
this.STUN_ServerTextBox.Location = new System.Drawing.Point(117, 177); this.STUN_ServerTextBox.Location = new System.Drawing.Point(117, 216);
this.STUN_ServerTextBox.Name = "STUN_ServerTextBox"; this.STUN_ServerTextBox.Name = "STUN_ServerTextBox";
this.STUN_ServerTextBox.Size = new System.Drawing.Size(294, 23); this.STUN_ServerTextBox.Size = new System.Drawing.Size(315, 23);
this.STUN_ServerTextBox.TabIndex = 11; this.STUN_ServerTextBox.TabIndex = 11;
this.STUN_ServerTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; this.STUN_ServerTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
// //
@@ -438,7 +479,7 @@
// ProfileCount_Label // ProfileCount_Label
// //
this.ProfileCount_Label.AutoSize = true; this.ProfileCount_Label.AutoSize = true;
this.ProfileCount_Label.Location = new System.Drawing.Point(6, 123); this.ProfileCount_Label.Location = new System.Drawing.Point(9, 168);
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;
@@ -446,9 +487,9 @@
// //
// ProfileCount_TextBox // ProfileCount_TextBox
// //
this.ProfileCount_TextBox.Location = new System.Drawing.Point(203, 120); this.ProfileCount_TextBox.Location = new System.Drawing.Point(206, 165);
this.ProfileCount_TextBox.Name = "ProfileCount_TextBox"; this.ProfileCount_TextBox.Name = "ProfileCount_TextBox";
this.ProfileCount_TextBox.Size = new System.Drawing.Size(208, 23); this.ProfileCount_TextBox.Size = new System.Drawing.Size(226, 23);
this.ProfileCount_TextBox.TabIndex = 9; this.ProfileCount_TextBox.TabIndex = 9;
this.ProfileCount_TextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; this.ProfileCount_TextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
// //
@@ -496,28 +537,11 @@
this.ExitWhenClosedCheckBox.TextAlign = System.Drawing.ContentAlignment.MiddleRight; this.ExitWhenClosedCheckBox.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.ExitWhenClosedCheckBox.UseVisualStyleBackColor = true; this.ExitWhenClosedCheckBox.UseVisualStyleBackColor = true;
// //
// AclAddr
//
this.AclAddr.Location = new System.Drawing.Point(117, 235);
this.AclAddr.Name = "AclAddr";
this.AclAddr.Size = new System.Drawing.Size(294, 23);
this.AclAddr.TabIndex = 19;
this.AclAddr.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// AclLabel
//
this.AclLabel.AutoSize = true;
this.AclLabel.Location = new System.Drawing.Point(6, 238);
this.AclLabel.Name = "AclLabel";
this.AclLabel.Size = new System.Drawing.Size(78, 17);
this.AclLabel.TabIndex = 20;
this.AclLabel.Text = "Custom ACL";
//
// SettingForm // SettingForm
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.ClientSize = new System.Drawing.Size(868, 390); this.ClientSize = new System.Drawing.Size(891, 390);
this.Controls.Add(this.BehaviorGroupBox); this.Controls.Add(this.BehaviorGroupBox);
this.Controls.Add(this.PortGroupBox); this.Controls.Add(this.PortGroupBox);
this.Controls.Add(this.GlobalBypassIPsButton); this.Controls.Add(this.GlobalBypassIPsButton);
@@ -588,5 +612,7 @@
private System.Windows.Forms.TextBox RedirectorTextBox; private System.Windows.Forms.TextBox RedirectorTextBox;
private System.Windows.Forms.TextBox AclAddr; private System.Windows.Forms.TextBox AclAddr;
private System.Windows.Forms.Label AclLabel; private System.Windows.Forms.Label AclLabel;
private System.Windows.Forms.CheckBox UseFakeDNSCheckBox;
private System.Windows.Forms.CheckBox BootShadowsocksFromDLLCheckBox;
} }
} }

View File

@@ -52,8 +52,11 @@ namespace Netch.Forms
TUNTAPGatewayLabel.Text = Utils.i18N.Translate(TUNTAPGatewayLabel.Text); TUNTAPGatewayLabel.Text = Utils.i18N.Translate(TUNTAPGatewayLabel.Text);
TUNTAPUseCustomDNSCheckBox.Text = Utils.i18N.Translate(TUNTAPUseCustomDNSCheckBox.Text); TUNTAPUseCustomDNSCheckBox.Text = Utils.i18N.Translate(TUNTAPUseCustomDNSCheckBox.Text);
TUNTAPProxyDNSCheckBox.Text = Utils.i18N.Translate(TUNTAPProxyDNSCheckBox.Text); TUNTAPProxyDNSCheckBox.Text = Utils.i18N.Translate(TUNTAPProxyDNSCheckBox.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);
ExitWhenClosedCheckBox.Checked = Global.Settings.ExitWhenClosed; ExitWhenClosedCheckBox.Checked = Global.Settings.ExitWhenClosed;
StopWhenExitedCheckBox.Checked = Global.Settings.StopWhenExited; StopWhenExitedCheckBox.Checked = Global.Settings.StopWhenExited;
@@ -65,6 +68,7 @@ namespace Netch.Forms
BypassModeCheckBox.Checked = Global.Settings.ProcessBypassMode; 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;
Socks5PortTextBox.Text = Global.Settings.Socks5LocalPort.ToString(); Socks5PortTextBox.Text = Global.Settings.Socks5LocalPort.ToString();
HTTPPortTextBox.Text = Global.Settings.HTTPLocalPort.ToString(); HTTPPortTextBox.Text = Global.Settings.HTTPLocalPort.ToString();
@@ -76,6 +80,7 @@ namespace Netch.Forms
TUNTAPUseCustomDNSCheckBox.Checked = Global.Settings.TUNTAP.UseCustomDNS; TUNTAPUseCustomDNSCheckBox.Checked = Global.Settings.TUNTAP.UseCustomDNS;
TUNTAPProxyDNSCheckBox.Checked = Global.Settings.TUNTAP.ProxyDNS; TUNTAPProxyDNSCheckBox.Checked = Global.Settings.TUNTAP.ProxyDNS;
UseFakeDNSCheckBox.Checked = Global.Settings.TUNTAP.UseFakeDNS;
BehaviorGroupBox.Text = Utils.i18N.Translate(BehaviorGroupBox.Text); BehaviorGroupBox.Text = Utils.i18N.Translate(BehaviorGroupBox.Text);
ExitWhenClosedCheckBox.Text = Utils.i18N.Translate(ExitWhenClosedCheckBox.Text); ExitWhenClosedCheckBox.Text = Utils.i18N.Translate(ExitWhenClosedCheckBox.Text);
@@ -158,7 +163,8 @@ namespace Netch.Forms
Global.Settings.RunAtStartup = RunAtStartup.Checked; Global.Settings.RunAtStartup = RunAtStartup.Checked;
Global.Settings.UseRedirector2 = Redirector2checkBox.Checked; Global.Settings.UseRedirector2 = Redirector2checkBox.Checked;
Global.Settings.ProcessBypassMode = BypassModeCheckBox.Checked; Global.Settings.ProcessBypassMode = BypassModeCheckBox.Checked;
Global.Settings.StartedTcping = EnableStartedTcping_CheckBox.Checked; Global.Settings.BootShadowsocksFromDLL = BootShadowsocksFromDLLCheckBox.Checked;
// 开机自启判断 // 开机自启判断
TaskSchedulerClass scheduler = new TaskSchedulerClass(); TaskSchedulerClass scheduler = new TaskSchedulerClass();
@@ -383,6 +389,7 @@ namespace Netch.Forms
Global.Settings.TUNTAP.UseCustomDNS = TUNTAPUseCustomDNSCheckBox.Checked; Global.Settings.TUNTAP.UseCustomDNS = TUNTAPUseCustomDNSCheckBox.Checked;
Global.Settings.TUNTAP.ProxyDNS = TUNTAPProxyDNSCheckBox.Checked; Global.Settings.TUNTAP.ProxyDNS = TUNTAPProxyDNSCheckBox.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);

View File

@@ -1,4 +1,5 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization;
namespace Netch.Models namespace Netch.Models
{ {
@@ -41,7 +42,32 @@ namespace Netch.Models
/// <returns>备注</returns> /// <returns>备注</returns>
public override string ToString() public override string ToString()
{ {
return string.Format("[{0}] {1}", Type + 1, Remark); if (CultureInfo.CurrentCulture.Name == "zh-CN")
{
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>

View File

@@ -156,6 +156,8 @@ namespace Netch.Models
return $"[SR] {Remark}"; return $"[SR] {Remark}";
case "VMess": case "VMess":
return $"[V2] {Remark}"; return $"[V2] {Remark}";
case "Trojan":
return $"[TR] {Remark}";
default: default:
return "WTF"; return "WTF";
} }

View File

@@ -36,6 +36,11 @@ namespace Netch.Models
/// 模式2下是否代理DNS /// 模式2下是否代理DNS
/// </summary> /// </summary>
public bool ProxyDNS = false; public bool ProxyDNS = false;
/// <summary>
/// 使用Fake DNS
/// </summary>
public bool UseFakeDNS = false;
} }
/// <summary> /// <summary>
@@ -167,7 +172,7 @@ namespace Netch.Models
/// <summary> /// <summary>
/// 是否启用启动后延迟测试 /// 是否启用启动后延迟测试
/// </summary> /// </summary>
public bool StartedTcping = false; public bool StartedTcping = true;
/// <summary> /// <summary>
/// 启动后延迟测试间隔/秒 /// 启动后延迟测试间隔/秒
@@ -179,5 +184,9 @@ namespace Netch.Models
/// </summary> /// </summary>
public string ACL = "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/banAD.acl"; public string ACL = "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/banAD.acl";
/// <summary>
/// 是否使用DLL启动Shadowsocks
/// </summary>
public bool BootShadowsocksFromDLL = false;
} }
} }

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

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

View File

@@ -63,5 +63,15 @@ namespace Netch
/// <returns>是否成功</returns> /// <returns>是否成功</returns>
[DllImport("bin\\sysproxy", CallingConvention = CallingConvention.Cdecl)] [DllImport("bin\\sysproxy", CallingConvention = CallingConvention.Cdecl)]
public static extern bool SetURL([MarshalAs(UnmanagedType.LPTStr)] string remote); public static extern bool SetURL([MarshalAs(UnmanagedType.LPTStr)] string remote);
public class Shadowsocks
{
[DllImport("bin\\shadowsocks-windows-dynamic", CallingConvention = CallingConvention.Cdecl)]
public static extern bool Info(byte[] client, byte[] remote, byte[] passwd, byte[] method);
[DllImport("bin\\shadowsocks-windows-dynamic", CallingConvention = CallingConvention.Cdecl)]
public static extern bool Start();
[DllImport("bin\\shadowsocks-windows-dynamic", CallingConvention = CallingConvention.Cdecl)]
public static extern void Stop();
}
} }
} }

View File

@@ -9,9 +9,10 @@
<StartupObject>Netch.Netch</StartupObject> <StartupObject>Netch.Netch</StartupObject>
<ApplicationManifest>App.manifest</ApplicationManifest> <ApplicationManifest>App.manifest</ApplicationManifest>
<ApplicationIcon>Netch.ico</ApplicationIcon> <ApplicationIcon>Netch.ico</ApplicationIcon>
<Platforms>x86;x64</Platforms> <Platforms>x64</Platforms>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath> <AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<LangVersion>latest</LangVersion> <LangVersion>latest</LangVersion>
<PackageProjectUrl>https://github.com/NetchX/Netch</PackageProjectUrl>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
@@ -23,23 +24,6 @@
<NoWarn /> <NoWarn />
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x86'">
<DefineConstants>DEBUG;TRACE</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<NoWarn />
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<WarningsAsErrors />
<OutputPath>bin\x86\Debug\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x86'">
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<NoWarn />
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<WarningsAsErrors />
<OutputPath>bin\x86\Release\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<NoWarn /> <NoWarn />
@@ -82,6 +66,9 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Update="Forms\Server\Trojan.cs">
<SubType>Form</SubType>
</Compile>
<Compile Update="Properties\Resources.Designer.cs"> <Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime> <DesignTime>True</DesignTime>
<AutoGen>True</AutoGen> <AutoGen>True</AutoGen>
@@ -107,8 +94,8 @@
<LastGenOutput>Settings.Designer.cs</LastGenOutput> <LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None> </None>
</ItemGroup> </ItemGroup>
<Target Condition="'$(VisualStudioDir)' != ''" Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="@ECHO OFF&#xD;&#xA;RD /S /Q $(TargetDir)bin &gt; NUL 2&gt;&amp;1&#xD;&#xA;RD /S /Q $(TargetDir)i18n &gt; NUL 2&gt;&amp;1&#xD;&#xA;RD /S /Q $(TargetDir)mode &gt; NUL 2&gt;&amp;1&#xD;&#xA;&#xD;&#xA;MKDIR $(TargetDir)bin &gt; NUL 2&gt;&amp;1&#xD;&#xA;MKDIR $(TargetDir)i18n &gt; NUL 2&gt;&amp;1&#xD;&#xA;MKDIR $(TargetDir)mode &gt; NUL 2&gt;&amp;1&#xD;&#xA;&#xD;&#xA;COPY /Y $(SolutionDir)binaries\$(PlatformName)\* $(TargetDir)bin &gt; NUL 2&gt;&amp;1&#xD;&#xA;COPY /Y $(SolutionDir)binaries\* $(TargetDir)bin &gt; NUL 2&gt;&amp;1&#xD;&#xA;MOVE /Y $(TargetDir)bin\nfapinet.dll $(TargetDir)nfapinet.dll &gt; NUL 2&gt;&amp;1&#xD;&#xA;COPY /Y $(SolutionDir)translations\i18n\* $(TargetDir)i18n &gt; NUL 2&gt;&amp;1&#xD;&#xA;COPY /Y $(SolutionDir)modes\mode\*.txt $(TargetDir)mode &gt; NUL 2&gt;&amp;1&#xD;&#xA;MKDIR $(TargetDir)bin\tap-driver &gt; NUL 2&gt;&amp;1&#xD;&#xA;COPY /Y $(SolutionDir)binaries\tap-driver\* $(TargetDir)bin\tap-driver &gt; NUL 2&gt;&amp;1" />
</Target>
<ProjectExtensions><VisualStudio><UserProperties /></VisualStudio></ProjectExtensions> <ProjectExtensions><VisualStudio><UserProperties /></VisualStudio></ProjectExtensions>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="@ECHO OFF&#xD;&#xA;RD /S /Q $(TargetDir)bin &gt; NUL 2&gt;&amp;1&#xD;&#xA;RD /S /Q $(TargetDir)i18n &gt; NUL 2&gt;&amp;1&#xD;&#xA;RD /S /Q $(TargetDir)mode &gt; NUL 2&gt;&amp;1&#xD;&#xA;&#xD;&#xA;MKDIR $(TargetDir)bin &gt; NUL 2&gt;&amp;1&#xD;&#xA;MKDIR $(TargetDir)i18n &gt; NUL 2&gt;&amp;1&#xD;&#xA;MKDIR $(TargetDir)mode &gt; NUL 2&gt;&amp;1&#xD;&#xA;&#xD;&#xA;COPY /Y $(SolutionDir)binaries\* $(TargetDir)bin &gt; NUL 2&gt;&amp;1&#xD;&#xA;COPY /Y $(SolutionDir)translations\i18n\* $(TargetDir)i18n &gt; NUL 2&gt;&amp;1&#xD;&#xA;COPY /Y $(SolutionDir)modes\mode\* $(TargetDir)mode &gt; NUL 2&gt;&amp;1&#xD;&#xA;MKDIR $(TargetDir)bin\tap-driver &gt; NUL 2&gt;&amp;1&#xD;&#xA;COPY /Y $(SolutionDir)binaries\tap-driver\* $(TargetDir)bin\tap-driver &gt; NUL 2&gt;&amp;1&#xD;&#xA;&#xD;&#xA;DEL / f $(TargetDir)\*.config&#xD;&#xA;DEL / f $(TargetDir)\*.pdb" />
</Target>
</Project> </Project>

View File

@@ -19,6 +19,7 @@
"Starting Shadowsocks": "正在启动 Shadowsocks", "Starting Shadowsocks": "正在启动 Shadowsocks",
"Starting ShadowsocksR": "正在启动 ShadowsocksR", "Starting ShadowsocksR": "正在启动 ShadowsocksR",
"Starting V2ray": "正在启动 V2Ray", "Starting V2ray": "正在启动 V2Ray",
"Starting Trojan": "正在启动 Trojan",
"Starting Tap": "正在启动 TUN/TAP", "Starting Tap": "正在启动 TUN/TAP",
"Starting NatTester": "正在启动 NAT 测试", "Starting NatTester": "正在启动 NAT 测试",
"Starting LocalDns service": "正在启动本地 DNS 服务", "Starting LocalDns service": "正在启动本地 DNS 服务",
@@ -29,7 +30,7 @@
"SetupBypass": "设置绕行规则", "SetupBypass": "设置绕行规则",
"Test failed": "测试失败", "Test failed": "测试失败",
"Starting update subscription": "正在更新订阅", "Starting update subscription": "正在更新订阅",
"Starting update ACL": "正在更新ACL", "Starting update ACL": "正在更新 ACL",
"Subscription updated": "订阅更新完毕", "Subscription updated": "订阅更新完毕",
"Register driver": "正在注册驱动", "Register driver": "正在注册驱动",
@@ -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": "发现新版本",
@@ -93,10 +95,10 @@
"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": "重新安装Tap驱动", "Reinstall Tap driver": "重新安装 TUN/TAP 驱动",
"Reinstall Tap driver successfully": "重装Tap驱动成功", "Reinstall Tap driver successfully": "重装 TUN/TAP 驱动成功",
"Reinstall Tap driver failed": "重装Tap驱动失败", "Reinstall Tap driver failed": "重装 TUN/TAP 驱动失败",
"Reinstalling Tap driver": "正在重装Tap驱动", "Reinstalling Tap driver": "正在重装 TUN/TAP 驱动",
"About": "关于", "About": "关于",
"Telegram Channel": "Telegram 频道", "Telegram Channel": "Telegram 频道",
@@ -154,6 +156,7 @@
"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 时开启)",
"Behavior": "行为", "Behavior": "行为",
"Exit when closed": "关闭时退出", "Exit when closed": "关闭时退出",
"Stop when exited": "退出时停止", "Stop when exited": "退出时停止",
@@ -165,17 +168,26 @@
"STUN_ServerPort value illegal. Try again.": "STUN 端口数值非法。请重试。", "STUN_ServerPort value illegal. Try again.": "STUN 端口数值非法。请重试。",
"Detection interval value illegal. Try again.": "检测间隔值非法。请重试。", "Detection interval value illegal. Try again.": "检测间隔值非法。请重试。",
"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 startup": "启动后延迟测试",
"Enable": "启用", "Enable": "启用",
"Detection interval(/s)": "检测间隔(/秒)", "Detection interval(/s)": "检测间隔(/秒)",
"Custom ACL": "自定义 ACL 规则", "Custom ACL": "自定义 ACL 规则",
"Process whitelist mode": "进程白名单模式",
"Boot Shadowsocks from DLL(No support ACL)": "SS DLL推荐使用不支持 ACL",
"Profile": "配置名", "Profile": "配置名",
"Profiles": "配置", "Profiles": "配置",
"None": "无", "None": "无",
"Show": "显示", "Show": "显示",
"Exit": "退出" "Exit": "退出",
"Bypass LAN": "[网页代理] 绕过局域网",
"Bypass LAN (Non System Proxy)": "[网页代理] 绕过局域网(不设置系统代理)",
"Bypass LAN (TUN/TAP)": "[TAP/TAP] 绕过局域网",
"Bypass LAN and China": "[网页代理] 绕过局域网和中国大陆",
"Bypass LAN and China (Non System Proxy)": "[网页代理] 绕过局域网和中国大陆 (不设置系统代理)",
"Bypass LAN and China (TUN/TAP)": "[TUN/TAP] 绕过局域网和中国大陆"
} }

View File

@@ -1,5 +1,5 @@
# Netch # Netch
[![](https://img.shields.io/badge/Telegram-Channel-blue)](https://t.me/Netch) [![](https://img.shields.io/badge/Telegram-Group-green)](https://t.me/Netch_Discuss_Group) ![GitHub Actions & Netch CI](https://github.com/NetchX/Netch/workflows/GitHub%20Actions%20&%20Netch%20CI/badge.svg) [![](https://img.shields.io/badge/Telegram-Channel-blue)](https://t.me/Netch) [![](https://img.shields.io/badge/Telegram-Group-green)](https://t.me/Netch_Discuss_Group) ![Netch CI](https://github.com/NetchX/Netch/workflows/Netch%20CI/badge.svg)
Game accelerator Game accelerator
@@ -9,7 +9,7 @@ Game accelerator
- [Netch](#netch) - [Netch](#netch)
- [TOC](#toc) - [TOC](#toc)
- [Description](#description) - [Description](#description)
- [Sponsor](#sponsor) - [Donate](#donate)
- [Screenshots](#screenshots) - [Screenshots](#screenshots)
- [Requirements](#requirements) - [Requirements](#requirements)
@@ -19,40 +19,26 @@ Netch is an open source game accelerator. Unlike SSTap, which needs to add rules
As well, Netch avoid the restricted NAT problem caused by SSTap. You can use an NATTypeTester to test out what your NAT type is. When using SSTap to speed up some P2P gaming connections or the game is required for that kind of open NAT type, you may experience some bad situations such as unable to join the game. As well, Netch avoid the restricted NAT problem caused by SSTap. You can use an NATTypeTester to test out what your NAT type is. When using SSTap to speed up some P2P gaming connections or the game is required for that kind of open NAT type, you may experience some bad situations such as unable to join the game.
## Sponsor ## Donate
开发不易,以下为恰饭时间 - XMR *48ju3ELNZEa6wwPBMexCJ9G218BGY2XwhH6B6bmkFuJ3QgM4hPw2Pra35jPtuBZSc7SLNWeBpiWJZWjQeMAiLnTx2tH2Efx*
[![NyanCAT](docs/sponsor/nyancat.jpg)](https://nyancat.info)
NyanCAT Network全中转高质量节点多条低倍率节点保证流量无忧节点极低延迟涵盖五大洲。Netflix 视频党,游戏党,海外回国党必备,无需年付,月付 19 元起。[测速图](https://t.me/BGP2020/935)
[加入 Telegram 群组](https://t.me/NyanCaaaat)
[![ManSora](docs/sponsor/mansora.jpg)](https://www.mansora.net/cart.php)
## Screenshots ## Screenshots
![](docs/screenshots/main.png) ![](docs/screenshots/main.png)
## Requirements ## Requirements
- Microsoft Visual C++ Runtime - Microsoft Visual C++ Runtime
- [.NET Framework 4.8](https://dotnet.microsoft.com/download/dotnet-framework/net48) - [.NET Framework 4.8](https://dotnet.microsoft.com/download/dotnet-framework/net48)
## Quote ## Quote
https://github.com/eycorsican/go-tun2socks - [go-tun2socks](https://github.com/eycorsican/go-tun2socks)
- [shadowsocks-libev](https://github.com/shadowsocks/shadowsocks-libev)
https://github.com/shadowsocks/shadowsocks-libev - [shadowsocksr-libev](https://github.com/shadowsocksrr/shadowsocksr-libev)
- [v2ray-core](https://github.com/v2ray/v2ray-core)
https://github.com/shadowsocksrr/shadowsocksr-libev - [trojan](https://github.com/trojan-gfw/trojan)
- [ACL4SSR](https://github.com/ACL4SSR/ACL4SSR)
https://github.com/v2ray/v2ray-core - [dnsmasq-china-list](https://github.com/felixonmars/dnsmasq-china-list)
- [unbound](https://github.com/NLnetLabs/unbound)
https://github.com/ACL4SSR/ACL4SSR - [tap-windows6](https://github.com/OpenVPN/tap-windows6)
- [Privoxy](https://www.privoxy.org/)
https://github.com/felixonmars/dnsmasq-china-list - [NatTypeTester](https://github.com/HMBSbige/NatTypeTester)
- [NetFilter SDK](https://netfiltersdk.com/)
https://github.com/NLnetLabs/unbound
https://github.com/OpenVPN/tap-windows6
https://sourceforge.net/projects/ijbswa/

View File

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

View File

@@ -25,18 +25,18 @@
## 选择模式 ## 选择模式
> 此处需要会一点英语,比如你应该知道`吃鸡`的英文名称是`PlayerUnknown's Battlegrounds` > 此处需要会一点英语,比如你应该知道 `吃鸡` 的英文名称是 `PlayerUnknown's Battlegrounds`
1.3.7 上线了模式搜索功能,即在模式框里输入字符即可搜索,使用英文名称进行搜索,搜索到所需的模式后单击选择,启用模式。相对应的游戏即可被加速 1.3.7 上线了模式搜索功能,即在模式框里输入字符即可搜索,使用英文名称进行搜索,搜索到所需的模式后单击选择,启用模式。相对应的游戏即可被加速
若没有所需的模式,请选择`[3] Bypass LAN and China (TUN/TAP)`的模式。此模式需要安装 [Tap-Windows](https://github.com/OpenVPN/tap-windows) 适配器,如果 Netch 提示没有该适配器,可以直接安装 [Tap-Windows](https://build.openvpn.net/downloads/releases/latest/tap-windows-latest-stable.exe) 来获得该适配器 若没有所需的模式,请选择 `[3] Bypass LAN and China (TUN/TAP)` 的模式。此模式需要安装 [TAP-Windows](https://github.com/OpenVPN/tap-windows) 适配器,如果 Netch 提示没有该适配器,可以直接安装 [TAP-Windows](https://build.openvpn.net/downloads/releases/latest/tap-windows-latest-stable.exe) 来获得该适配器
关于更多的模式说明,详见[进阶用法](https://github.com/NormanBB/NetchMode/blob/master/docs/README.zh-CN.md)。 关于更多的模式说明,详见 [进阶用法](https://github.com/NormanBB/NetchMode/blob/master/docs/README.zh-CN.md)。
选择完模式后,点击启用,游戏已被代理。这一步需在开启游戏前完成。 选择完模式后,点击启用,游戏已被代理。这一步需在开启游戏前完成。
## 配置说明 ## 配置说明
目前,netch支持自定义四个配置填入配置名选择相应的服务器和游戏模式按下`Ctrl`与鼠标左键,即可保存当前配置。下次使用时,点击配置名即可快速启用。 目前,Netch 支持自定义四个配置,填入配置名,选择相应的服务器和游戏模式,按下 `Ctrl` 与鼠标左键,即可保存当前配置。下次使用时,点击配置名即可快速启用。
~~如果你还觉得不会用可以去用SStap (逃~~ ~~ 如果你还觉得不会用,可以去用 SSTap (逃~~

View File

@@ -1,37 +1,27 @@
# Netch # Netch
[![](https://img.shields.io/badge/Telegram-频道-blue.svg)](https://t.me/Netch) [![](https://img.shields.io/badge/Telegram-频道-blue)](https://t.me/Netch) [![](https://img.shields.io/badge/Telegram-讨论组-green)](https://t.me/Netch_Discuss_Group) ![Netch CI](https://github.com/NetchX/Netch/workflows/Netch%20CI/badge.svg)
> ~~issue已关有问题可进tele群问不保证回答不保证解决咕~~
游戏加速工具 游戏加速工具
## TOC ## TOC
- [Netch](#netch) - [Netch](#Netch)
- [TOC](#toc) - [TOC](#TOC)
- [简介](#%e7%ae%80%e4%bb%8b) - [简介](#简介)
- [赞助商](#%e8%b5%9e%e5%8a%a9%e5%95%86) - [捐赠](#捐赠)
- [新手入门](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)
- [依赖](#%e4%be%9d%e8%b5%96) - [依赖](#依赖)
- [语言支持](#语言支持) - [语言支持](#语言支持)
## 简介 ## 简介
Netch 是一款 Windows 平台的开源游戏加速工具Netch 可以实现类似 SocksCap64 那样的进程代理,也可以实现 SSTap 那样的全局 TUN/TAP 代理,和 Shadowsocks-Windows 那样的本地 Socks5HTTP 和系统代理。至于连接至远程服务器的代理协议,目前 Netch 支持以下代理协议ShadowsocksVMessSocks5ShadowsocksR Netch 是一款 Windows 平台的开源游戏加速工具Netch 可以实现类似 SocksCap64 那样的进程代理,也可以实现 SSTap 那样的全局 TUN/TAP 代理,和 Shadowsocks-Windows 那样的本地 Socks5HTTP 和系统代理。至于连接至远程服务器的代理协议,目前 Netch 支持以下代理协议ShadowsocksVMessSocks5ShadowsocksR
与此同时 Netch 避免了 SSTap 的 NAT 问题 ,检查 NAT 类型即可知道是否有 NAT 问题。使用 SSTap 加速部分 P2P 联机,对 NAT 类型有要求的游戏时,可能会因为 NAT 类型严格遇到无法加入联机,或者其他影响游戏体验的情况 与此同时 Netch 避免了 SSTap 的 NAT 问题 ,检查 NAT 类型即可知道是否有 NAT 问题。使用 SSTap 加速部分 P2P 联机,对 NAT 类型有要求的游戏时,可能会因为 NAT 类型严格遇到无法加入联机,或者其他影响游戏体验的情况
## 赞助商 ## 捐赠
开发不易,以下为恰饭时间 - XMR *48ju3ELNZEa6wwPBMexCJ9G218BGY2XwhH6B6bmkFuJ3QgM4hPw2Pra35jPtuBZSc7SLNWeBpiWJZWjQeMAiLnTx2tH2Efx*
[![NyanCAT](sponsor/nyancat.jpg)](https://nyancat.info)
NyanCAT Network全中转高质量节点多条低倍率节点保证流量无忧节点极低延迟涵盖五大洲。Netflix 视频党,游戏党,海外回国党必备,无需年付,月付 19 元起。[测速图](https://t.me/BGP2020/935)
[加入 Telegram 群组](https://t.me/NyanCaaaat)
[![ManSora](sponsor/mansora.jpg)](https://www.mansora.net/cart.php)
## 新手入门 ## 新手入门
[新手入门教程](Basic-usage.md) [新手入门教程](Basic-usage.md)
## 进阶用法 ## 进阶用法
@@ -42,24 +32,18 @@ NyanCAT Network全中转高质量节点多条低倍率节点保证流量
- [TAP-Windows](https://build.openvpn.net/downloads/releases/tap-windows-9.21.2.exe) - [TAP-Windows](https://build.openvpn.net/downloads/releases/tap-windows-9.21.2.exe)
## 语言支持 ## 语言支持
Netch 支持多种语言,在启动时会根据系统语言选择自身语言。如果需要手动切换语言,可以在启动时加入命令行参数,命令行参数为目前支持的语言代码,可以去 [NetchTranslation/i18n](https://github.com/NetchX/NetchTranslation/tree/master/i18n) 文件夹下查看外部支持的语言代码文件。Netch 目前内置 en-USzh-CN外置 zh-TW。欢迎大家为 [NetchTranslation](https://github.com/NetchX/NetchTranslation) 提供其他语言的翻译 Netch 支持多种语言,在启动时会根据系统语言选择自身语言。如果需要手动切换语言,可以在启动时加入命令行参数,命令行参数为目前支持的语言代码,可以去 [NetchTranslation/i18n](https://github.com/NetchX/NetchTranslation/tree/master/i18n) 文件夹下查看外部支持的语言代码文件。Netch 目前内置 en-USzh-CN外置 zh-TW。欢迎大家为 [NetchTranslation](https://github.com/NetchX/NetchTranslation) 提供其他语言的翻译
## 引用 ## 引用
https://github.com/eycorsican/go-tun2socks - [go-tun2socks](https://github.com/eycorsican/go-tun2socks)
- [shadowsocks-libev](https://github.com/shadowsocks/shadowsocks-libev)
https://github.com/shadowsocks/shadowsocks-libev - [shadowsocksr-libev](https://github.com/shadowsocksrr/shadowsocksr-libev)
- [v2ray-core](https://github.com/v2ray/v2ray-core)
https://github.com/shadowsocksrr/shadowsocksr-libev - [trojan](https://github.com/trojan-gfw/trojan)
- [ACL4SSR](https://github.com/ACL4SSR/ACL4SSR)
https://github.com/v2ray/v2ray-core - [dnsmasq-china-list](https://github.com/felixonmars/dnsmasq-china-list)
- [unbound](https://github.com/NLnetLabs/unbound)
https://github.com/ACL4SSR/ACL4SSR - [tap-windows6](https://github.com/OpenVPN/tap-windows6)
- [Privoxy](https://www.privoxy.org/)
https://github.com/felixonmars/dnsmasq-china-list - [NatTypeTester](https://github.com/HMBSbige/NatTypeTester)
- [NetFilter SDK](https://netfiltersdk.com/)
https://github.com/NLnetLabs/unbound
https://github.com/OpenVPN/tap-windows6
https://sourceforge.net/projects/ijbswa/

2
modes

Submodule modes updated: a9329cd3f1...ed69e875fa