Compare commits
182 Commits
1.4.1-Beta
...
1.4.11
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
40f74252a9 | ||
|
|
47044548b1 | ||
|
|
2f74c36b26 | ||
|
|
9665e6c788 | ||
|
|
c2cf338931 | ||
|
|
b41ab4d25e | ||
|
|
be0770d81b | ||
|
|
6106cb4878 | ||
|
|
b1202b47eb | ||
|
|
da54abda3d | ||
|
|
d0f604eb42 | ||
|
|
957222cc7b | ||
|
|
6dd26574e0 | ||
|
|
9e8659a8ea | ||
|
|
e7daef1226 | ||
|
|
e77b551e68 | ||
|
|
16d9cb77ce | ||
|
|
6b872701a4 | ||
|
|
f1e39102f5 | ||
|
|
bd6e8d4d76 | ||
|
|
e893b4e5d4 | ||
|
|
d67b219e4a | ||
|
|
166bf6a53e | ||
|
|
577f69f33e | ||
|
|
c7d6dee6c3 | ||
|
|
d17a216fe3 | ||
|
|
8a75b86e95 | ||
|
|
04b18239d1 | ||
|
|
debfa76ea2 | ||
|
|
f71b319741 | ||
|
|
37f29128f1 | ||
|
|
dc4251c48f | ||
|
|
4a4dcd1537 | ||
|
|
48e3d6ee60 | ||
|
|
4d4bc0f050 | ||
|
|
d09700b54a | ||
|
|
427e1bba80 | ||
|
|
01d0ffcdc9 | ||
|
|
ae095ba99a | ||
|
|
3e3c41e7f9 | ||
|
|
edae4bd9d5 | ||
|
|
415baea580 | ||
|
|
bc98a9cd42 | ||
|
|
2d22608d48 | ||
|
|
5df2b77ec0 | ||
|
|
1bc7ea95eb | ||
|
|
f240dc9da8 | ||
|
|
338170f10b | ||
|
|
f02c9151de | ||
|
|
a711ee4f3f | ||
|
|
1c628492e8 | ||
|
|
045eb9e751 | ||
|
|
445013af99 | ||
|
|
156686bc98 | ||
|
|
47b611d350 | ||
|
|
b615119dcd | ||
|
|
fea60efa45 | ||
|
|
2da11beb7a | ||
|
|
9aafefad37 | ||
|
|
e8879379c9 | ||
|
|
2585c3967f | ||
|
|
2914a2d9dc | ||
|
|
f62bf91857 | ||
|
|
d34a43a790 | ||
|
|
c9c023aad8 | ||
|
|
8e202e6800 | ||
|
|
9fe2541f18 | ||
|
|
b83f6d6c3d | ||
|
|
2bcd942675 | ||
|
|
8c05ba2289 | ||
|
|
95f26332a6 | ||
|
|
e946b01b6f | ||
|
|
b2b19be32b | ||
|
|
ffc6b7adc9 | ||
|
|
9ecde61b52 | ||
|
|
083364ae9d | ||
|
|
96f8b9944d | ||
|
|
8d7a5613fa | ||
|
|
d8133bcc35 | ||
|
|
9149f23986 | ||
|
|
92d1cfdb50 | ||
|
|
53e847ce1d | ||
|
|
08524f08f3 | ||
|
|
222ddfe434 | ||
|
|
6872ca94e7 | ||
|
|
152f49c161 | ||
|
|
0b46f8d8af | ||
|
|
b69ed09dd6 | ||
|
|
5276d90af0 | ||
|
|
bea9ce6583 | ||
|
|
3b939ab984 | ||
|
|
bebb904a43 | ||
|
|
895cc40c36 | ||
|
|
577e0e01a7 | ||
|
|
635654336d | ||
|
|
90c44bcaf3 | ||
|
|
31d64f308c | ||
|
|
8a0d64c135 | ||
|
|
76ad8187e0 | ||
|
|
663e8fdcc0 | ||
|
|
8140fba21e | ||
|
|
23d0970ed3 | ||
|
|
64ce265872 | ||
|
|
e83c4ca449 | ||
|
|
e4befbf3f0 | ||
|
|
3f4b03870f | ||
|
|
ae0ac6595e | ||
|
|
2a0c2e9f83 | ||
|
|
e4eba0a386 | ||
|
|
5b6a0650ce | ||
|
|
1707764d39 | ||
|
|
d62cd46094 | ||
|
|
e9f1110217 | ||
|
|
57706e6c96 | ||
|
|
6375407d53 | ||
|
|
e556ab1622 | ||
|
|
e8cb32f8c0 | ||
|
|
5b7be73427 | ||
|
|
76f9258953 | ||
|
|
141db8ad63 | ||
|
|
5c10b5c92d | ||
|
|
96a3d0cc52 | ||
|
|
f199641c64 | ||
|
|
65df583f0c | ||
|
|
cacbb5db16 | ||
|
|
feccfcab7a | ||
|
|
365d4b5ff5 | ||
|
|
704def859a | ||
|
|
a9433f8c22 | ||
|
|
d156ada795 | ||
|
|
be1e8eb8e6 | ||
|
|
0c63d8c80d | ||
|
|
5f9c944619 | ||
|
|
4e6bcdcf88 | ||
|
|
f244212cdf | ||
|
|
6649a1fce9 | ||
|
|
c31338ee1f | ||
|
|
5f3a300ccc | ||
|
|
bc0e88ae5e | ||
|
|
fac28ca88b | ||
|
|
5efd88b60c | ||
|
|
3f59a63766 | ||
|
|
8f14b030bb | ||
|
|
f941df0af2 | ||
|
|
13a66d0648 | ||
|
|
9548a3d03a | ||
|
|
c2f33ba15b | ||
|
|
2895989b13 | ||
|
|
7cddb75cef | ||
|
|
f05ae498c6 | ||
|
|
ff0fe2ab9f | ||
|
|
764e78d662 | ||
|
|
bdaab4f1ac | ||
|
|
9ad5e16f47 | ||
|
|
c861ed4116 | ||
|
|
c39b758fe6 | ||
|
|
e1901587a5 | ||
|
|
8aea21a2c6 | ||
|
|
d97d461354 | ||
|
|
d8f3bdaa78 | ||
|
|
7516ecf946 | ||
|
|
69d6397383 | ||
|
|
7854a91fef | ||
|
|
853da97ffc | ||
|
|
a0fbcb588d | ||
|
|
1e2c284a18 | ||
|
|
499898fdf5 | ||
|
|
5874bf7599 | ||
|
|
137456f6e6 | ||
|
|
5fe0e33722 | ||
|
|
6c1d2c9e4e | ||
|
|
0196dbb487 | ||
|
|
0343a1ab0c | ||
|
|
5ddc75ae16 | ||
|
|
bcb587e4b5 | ||
|
|
ba50a23914 | ||
|
|
1912d2055f | ||
|
|
ab2348afc7 | ||
|
|
a42890fdbd | ||
|
|
5d96127b5a | ||
|
|
f2912a334a | ||
|
|
09bddd9ad4 |
57
.github/workflows/build.yml
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
name: Netch CI
|
||||
on: [push]
|
||||
jobs:
|
||||
build:
|
||||
name: Build
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- name: NuGet
|
||||
uses: nuget/setup-nuget@v1
|
||||
|
||||
- name: MSBuild
|
||||
uses: microsoft/setup-msbuild@v1.0.0
|
||||
|
||||
- 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
|
||||
run: |
|
||||
.\BUILD.ps1
|
||||
New-Item -ItemType Directory -Path C:\builtfiles -Force > $null
|
||||
Compress-Archive -Path Netch\bin\x64\Release\win-x64\* -DestinationPath C:\builtfiles\Netch.zip
|
||||
echo "::set-env name=Netch_SHA256::$(.\GetSHA256.ps1 C:\builtfiles\Netch.zip)"
|
||||
|
||||
- name: Upload
|
||||
uses: actions/upload-artifact@v1
|
||||
with:
|
||||
name: Netch
|
||||
path: Netch\bin\x64\Release\win-x64
|
||||
|
||||
- name: Release
|
||||
uses: softprops/action-gh-release@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
with:
|
||||
name: ${{ env.GITHUB_TAG_NAME }}
|
||||
prerelease: true
|
||||
draft: false
|
||||
files: |
|
||||
C:\builtfiles\Netch.zip
|
||||
body: |
|
||||
[](https://t.me/Netch) [](https://t.me/Netch_Discuss_Group)
|
||||
|
||||
## 更新日志
|
||||
* 这是 GitHub Action 自动化部署,更新日志应该很快会手动更新
|
||||
|
||||
## 校验和
|
||||
| 文件名 | SHA256 |
|
||||
| :- | :- |
|
||||
| Netch.zip | ${{ env.Netch_SHA256 }} |
|
||||
71
.github/workflows/dotnetcore.yml
vendored
@@ -1,71 +0,0 @@
|
||||
name: GitHub Actions & Netch CI
|
||||
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build
|
||||
runs-on: windows-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Get tag name
|
||||
uses: olegtarasov/get-tag@v1
|
||||
|
||||
- name: submodules-init
|
||||
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
|
||||
|
||||
- name: Build .NET 4.8 Netch
|
||||
shell: pwsh
|
||||
run: |
|
||||
.\build.ps1
|
||||
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
|
||||
echo "::set-env name=Netch64_SHA256::$(.\getSHA256.ps1 C:\builtfiles\Netch.x64-${{ env.GITHUB_TAG_NAME }}.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
|
||||
uses: actions/upload-artifact@v1
|
||||
with:
|
||||
name: Netch.x64
|
||||
path: Netch\bin\x64\Release\win-x64
|
||||
|
||||
- name: Upload Netch.x86
|
||||
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
|
||||
with:
|
||||
name: ${{ env.GITHUB_TAG_NAME }}
|
||||
prerelease: true
|
||||
draft: false
|
||||
files: |
|
||||
C:\builtfiles\Netch.x64-${{ env.GITHUB_TAG_NAME }}.zip
|
||||
C:\builtfiles\Netch.x86-${{ env.GITHUB_TAG_NAME }}.zip
|
||||
body: |
|
||||
|
||||
[](https://t.me/Netch) [](https://t.me/Netch_Discuss_Group)
|
||||
|
||||
## 更新日志:
|
||||
* 这是 GitHub Action 自动化部署,更新日志应该很快会手动更新:D
|
||||
|
||||
## 文件校验
|
||||
| 文件名 | SHA256 |
|
||||
| :- | :- |
|
||||
| <sub>Netch.x64-${{ env.GITHUB_TAG_NAME }}.zip</sub> | <sub>${{ env.Netch64_SHA256 }}</sub> |
|
||||
| <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}}
|
||||
35
BUILD.ps1
Normal file
@@ -0,0 +1,35 @@
|
||||
param([string]$buildtfm = 'all')
|
||||
|
||||
Write-Host 'DotNet SDK Version'
|
||||
dotnet --version
|
||||
|
||||
$exe = 'Netch.exe'
|
||||
$mainDir = (Get-Item -Path ".\").FullName
|
||||
$net_baseoutput = "$mainDir\Netch\bin\$configuration"
|
||||
|
||||
Write-Host $mainDir
|
||||
Write-Host $net_baseoutput
|
||||
|
||||
function Build-NetFrameworkx64
|
||||
{
|
||||
Write-Host 'Building .NET Framework x64'
|
||||
|
||||
$outdir = "$net_baseoutput\x64"
|
||||
|
||||
msbuild -v:m -m -t:Build /p:Configuration="Release" /p:Platform="x64" /p:TargetFramework=net48 /p:Runtimeidentifier=win-x64 /restore
|
||||
if ($LASTEXITCODE) { cd $mainDir ; exit $LASTEXITCODE }
|
||||
|
||||
Write-Host 'Build x64 Completed, start copy bin, mode, i18n file'
|
||||
Remove-Item -Recurse -Force "$net_baseoutput\x64\Release\win-x64\bin\tap-driver"
|
||||
Copy-Item -Recurse "$mainDir\binaries\*" "$net_baseoutput\x64\Release\win-x64\bin"
|
||||
Copy-Item -Recurse "$mainDir\modes\mode\*" "$net_baseoutput\x64\Release\win-x64\mode"
|
||||
Copy-Item -Recurse "$mainDir\translations\i18n\*" "$net_baseoutput\x64\Release\win-x64\i18n"
|
||||
|
||||
Write-Host 'Build done'
|
||||
}
|
||||
|
||||
cd $mainDir\Netch
|
||||
Build-NetFrameworkx64
|
||||
cd $mainDir
|
||||
|
||||
exit 0
|
||||
@@ -1,3 +0,0 @@
|
||||
@ECHO OFF
|
||||
RD /S /Q Netch\bin > NUL 2>&1
|
||||
RD /S /Q Netch\obj > NUL 2>&1
|
||||
21
CLEAN.ps1
Normal file
@@ -0,0 +1,21 @@
|
||||
if (Test-Path Netch\bin)
|
||||
{
|
||||
Remove-Item -Recurse -Force Netch\bin
|
||||
}
|
||||
|
||||
if (Test-Path Netch\obj)
|
||||
{
|
||||
Remove-Item -Recurse -Force Netch\obj
|
||||
}
|
||||
|
||||
if (Test-Path NetchLib\bin)
|
||||
{
|
||||
Remove-Item -Recurse -Force NetchLib\bin
|
||||
}
|
||||
|
||||
if (Test-Path NetchLib\obj)
|
||||
{
|
||||
Remove-Item -Recurse -Force NetchLib\obj
|
||||
}
|
||||
|
||||
exit 0
|
||||
@@ -1,5 +1,5 @@
|
||||
param([string]$file)
|
||||
$hash = [Security.Cryptography.HashAlgorithm]::Create( "SHA256" )
|
||||
$stream = ([IO.StreamReader]$file).BaseStream
|
||||
-join ($hash.ComputeHash($stream) | ForEach { "{0:X2}" -f $_ })
|
||||
-join ($hash.ComputeHash($stream) | ForEach { "{0:x2}" -f $_ })
|
||||
$stream.Close()
|
||||
|
||||
14
Netch.sln
@@ -3,24 +3,24 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.29009.5
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Netch", "Netch\Netch.csproj", "{4B041B91-5790-4571-8C58-C63FFE4BC9F8}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Netch", "Netch\Netch.csproj", "{4B041B91-5790-4571-8C58-C63FFE4BC9F8}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NetchLib", "NetchLib\NetchLib.csproj", "{A8715AF4-ACC6-43F9-9381-4294C5360623}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{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|x86.ActiveCfg = Debug|x86
|
||||
{4B041B91-5790-4571-8C58-C63FFE4BC9F8}.Debug|x86.Build.0 = Debug|x86
|
||||
{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|x86.ActiveCfg = Release|x86
|
||||
{4B041B91-5790-4571-8C58-C63FFE4BC9F8}.Release|x86.Build.0 = Release|x86
|
||||
{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}.Release|x64.ActiveCfg = Release|x64
|
||||
{A8715AF4-ACC6-43F9-9381-4294C5360623}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
@@ -499,7 +499,7 @@ namespace nfapinet
|
||||
* @param driverName The name of hooking driver, without ".sys" extension.
|
||||
* @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 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
|
||||
* a connection with the hooking driver.
|
||||
**/
|
||||
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
[DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void nf_free();
|
||||
|
||||
/**
|
||||
* Registers and starts a driver with specified name (without ".sys" extension)
|
||||
* @param driverName
|
||||
**/
|
||||
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
[DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern NF_STATUS nf_registerDriver(String driverName);
|
||||
|
||||
/**
|
||||
* Unregisters a driver with specified name (without ".sys" extension)
|
||||
* @param driverName
|
||||
**/
|
||||
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
[DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern NF_STATUS nf_unRegisterDriver(String driverName);
|
||||
|
||||
|
||||
@@ -564,7 +564,7 @@ namespace nfapinet
|
||||
* @param id Connection identifier
|
||||
* @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);
|
||||
|
||||
/**
|
||||
@@ -573,7 +573,7 @@ namespace nfapinet
|
||||
* @param buf Pointer to data buffer
|
||||
* @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);
|
||||
|
||||
/**
|
||||
@@ -582,14 +582,14 @@ namespace nfapinet
|
||||
* @param buf Pointer to data buffer
|
||||
* @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);
|
||||
|
||||
/**
|
||||
* Breaks the connection with given id.
|
||||
* @param id Connection identifier
|
||||
**/
|
||||
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
[DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern NF_STATUS nf_tcpClose(ulong id);
|
||||
|
||||
//
|
||||
@@ -601,7 +601,7 @@ namespace nfapinet
|
||||
* @param id Socket identifier
|
||||
* @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);
|
||||
|
||||
/**
|
||||
@@ -611,7 +611,7 @@ namespace nfapinet
|
||||
* @param buf Pointer to data buffer
|
||||
* @param len Buffer length
|
||||
**/
|
||||
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
[DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern NF_STATUS nf_udpPostSend(ulong id,
|
||||
IntPtr remoteAddress,
|
||||
IntPtr buf, int len,
|
||||
@@ -624,7 +624,7 @@ namespace nfapinet
|
||||
* @param buf Pointer to data buffer
|
||||
* @param len Buffer length
|
||||
**/
|
||||
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
[DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern NF_STATUS nf_udpPostReceive(ulong id,
|
||||
IntPtr remoteAddress,
|
||||
IntPtr buf, int len,
|
||||
@@ -636,7 +636,7 @@ namespace nfapinet
|
||||
* @param len Buffer length
|
||||
* @param options IP options
|
||||
**/
|
||||
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
[DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern NF_STATUS nf_ipPostReceive(
|
||||
IntPtr buf, int len,
|
||||
ref NF_IP_PACKET_OPTIONS options);
|
||||
@@ -647,7 +647,7 @@ namespace nfapinet
|
||||
* @param len Buffer length
|
||||
* @param options IP options
|
||||
**/
|
||||
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
[DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern NF_STATUS nf_ipPostSend(
|
||||
IntPtr buf, int len,
|
||||
ref NF_IP_PACKET_OPTIONS options);
|
||||
@@ -661,7 +661,7 @@ namespace nfapinet
|
||||
* @param pRule See <tt>NF_RULE</tt>
|
||||
* @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 void updateAddressLength(ref byte[] buf)
|
||||
@@ -694,7 +694,7 @@ namespace nfapinet
|
||||
* @param pRule See <tt>NF_RULE</tt>
|
||||
* @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);
|
||||
|
||||
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 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);
|
||||
|
||||
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 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);
|
||||
|
||||
public static NF_STATUS nf_setRulesEx(NF_RULE_EX[] rules)
|
||||
@@ -774,34 +774,34 @@ namespace nfapinet
|
||||
/**
|
||||
* Removes all rules from driver.
|
||||
**/
|
||||
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
[DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern NF_STATUS nf_deleteRules();
|
||||
|
||||
/**
|
||||
* Sets the timeout for TCP connections and returns old timeout.
|
||||
* @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);
|
||||
|
||||
/**
|
||||
* Disables indicating TCP packets to user mode for the specified endpoint
|
||||
* @param id Socket identifier
|
||||
*/
|
||||
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
[DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern NF_STATUS nf_tcpDisableFiltering(ulong id);
|
||||
|
||||
/**
|
||||
* Disables indicating UDP packets to user mode for the specified endpoint
|
||||
* @param id Socket identifier
|
||||
*/
|
||||
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
[DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
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.
|
||||
**/
|
||||
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
[DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
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 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);
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
[DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
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);
|
||||
|
||||
/**
|
||||
@@ -880,13 +880,13 @@ namespace nfapinet
|
||||
return "System";
|
||||
}
|
||||
|
||||
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
[DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void nf_adjustProcessPriviledges();
|
||||
|
||||
/*
|
||||
* 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);
|
||||
|
||||
/*
|
||||
@@ -910,51 +910,51 @@ namespace nfapinet
|
||||
/**
|
||||
* 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);
|
||||
|
||||
/**
|
||||
* Delete flow control context
|
||||
*/
|
||||
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
[DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern NF_STATUS nf_deleteFlowCtl(UInt32 fcHandle);
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
/**
|
||||
* Get TCP connection statistics as the numbers of in/out bytes.
|
||||
* 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);
|
||||
|
||||
/**
|
||||
* Get UDP socket statistics as the numbers of in/out bytes.
|
||||
* 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 enum NF_SOCKET_OPTIONS
|
||||
@@ -967,10 +967,10 @@ namespace nfapinet
|
||||
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);
|
||||
|
||||
[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 NF_STATUS nf_tcpSetSockOpt(ulong id, NF_SOCKET_OPTIONS optname, bool optval)
|
||||
@@ -982,7 +982,7 @@ namespace nfapinet
|
||||
/**
|
||||
* Add binding rule to driver
|
||||
*/
|
||||
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
[DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern NF_STATUS
|
||||
nf_addBindingRule(ref NF_BINDING_RULE pRule, int toHead);
|
||||
|
||||
@@ -999,14 +999,14 @@ namespace nfapinet
|
||||
/**
|
||||
* Delete all binding rules from driver
|
||||
*/
|
||||
[DllImport("nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
[DllImport("bin\\nfapinet", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern NF_STATUS
|
||||
nf_deleteBindingRules();
|
||||
|
||||
/**
|
||||
* 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
|
||||
nf_getDriverType();
|
||||
};
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
using Netch.Forms;
|
||||
using Netch.Utils;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Threading;
|
||||
|
||||
namespace Netch.Controllers
|
||||
{
|
||||
@@ -15,23 +14,23 @@ namespace Netch.Controllers
|
||||
public Process Instance;
|
||||
|
||||
/// <summary>
|
||||
/// 启动NatTypeTester
|
||||
/// 启动DNS服务
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool Start()
|
||||
{
|
||||
MainForm.Instance.StatusText($"{Utils.i18N.Translate("Starting dns2tcp Service")}");
|
||||
MainForm.Instance.StatusText($"{Utils.i18N.Translate("Starting dns Service")}");
|
||||
try
|
||||
{
|
||||
if (!File.Exists("bin\\dns2tcp.exe"))
|
||||
if (!File.Exists("bin\\unbound.exe") && !File.Exists("bin\\unbound-service.conf") && !File.Exists("bin\\forward-zone.conf"))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Instance = MainController.GetProcess();
|
||||
Instance.StartInfo.FileName = "bin\\dns2tcp.exe";
|
||||
Instance.StartInfo.FileName = "bin\\unbound.exe";
|
||||
|
||||
Instance.StartInfo.Arguments = " -L 127.0.0.1:53 -R 1.1.1.1:53";
|
||||
Instance.StartInfo.Arguments = "-c unbound-service.conf -v";
|
||||
|
||||
Instance.OutputDataReceived += OnOutputDataReceived;
|
||||
Instance.ErrorDataReceived += OnOutputDataReceived;
|
||||
@@ -39,11 +38,12 @@ namespace Netch.Controllers
|
||||
Instance.Start();
|
||||
Instance.BeginOutputReadLine();
|
||||
Instance.BeginErrorReadLine();
|
||||
Logging.Info("dns-unbound 启动完毕");
|
||||
return true;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
Utils.Logging.Info("dns2tcp 进程出错");
|
||||
Utils.Logging.Info("dns-unbound 进程出错");
|
||||
Stop();
|
||||
return false;
|
||||
}
|
||||
@@ -59,6 +59,7 @@ namespace Netch.Controllers
|
||||
if (Instance != null && !Instance.HasExited)
|
||||
{
|
||||
Instance.Kill();
|
||||
Instance.WaitForExit();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
@@ -71,42 +72,12 @@ namespace Netch.Controllers
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(e.Data))
|
||||
{
|
||||
if (File.Exists("logging\\dns2tcp.log"))
|
||||
if (File.Exists("logging\\dns-unbound.log"))
|
||||
{
|
||||
File.Delete("logging\\dns2tcp.log");
|
||||
File.Delete("logging\\dns-unbound.log");
|
||||
}
|
||||
File.AppendAllText("logging\\dns2tcp.log", $"{e.Data}\r\n");
|
||||
File.AppendAllText("logging\\dns-unbound.log", $"{e.Data}\r\n");
|
||||
}
|
||||
}
|
||||
|
||||
/* public static DNS.Server.DnsServer Server = new DNS.Server.DnsServer(new Resolver());
|
||||
|
||||
public bool Start()
|
||||
{
|
||||
MainForm.Instance.StatusText($"{Utils.i18N.Translate("Status")}{Utils.i18N.Translate(": ")}{Utils.i18N.Translate("Starting LocalDns service")}");
|
||||
try
|
||||
{
|
||||
_ = Server.Listen(new IPEndPoint(IPAddress.IPv6Any, 53));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Utils.Logging.Info(e.ToString());
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
try
|
||||
{
|
||||
Server.Dispose();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Utils.Logging.Info(e.ToString());
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using System;
|
||||
using Microsoft.Win32;
|
||||
using Netch.Utils;
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Netch.Controllers
|
||||
{
|
||||
@@ -53,7 +55,11 @@ namespace Netch.Controllers
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Utils.Logging.Info(e.ToString());
|
||||
if (System.Windows.Forms.MessageBox.Show(i18N.Translate("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?"), i18N.Translate("Information"), MessageBoxButtons.OKCancel, MessageBoxIcon.Information) == DialogResult.OK)
|
||||
{
|
||||
System.Diagnostics.Process.Start("https://netch.org/#/?id=%e4%be%9d%e8%b5%96");
|
||||
}
|
||||
Utils.Logging.Info("设置系统代理失败" + e.ToString());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using Netch.Forms;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
@@ -39,6 +40,11 @@ namespace Netch.Controllers
|
||||
/// </summary>
|
||||
public VMessController pVMessController;
|
||||
|
||||
/// <summary>
|
||||
/// Trojan 控制器
|
||||
/// </summary>
|
||||
public TrojanController pTrojanController;
|
||||
|
||||
/// <summary>
|
||||
/// NF 控制器
|
||||
/// </summary>
|
||||
@@ -107,6 +113,14 @@ namespace Netch.Controllers
|
||||
}
|
||||
result = pVMessController.Start(server, mode);
|
||||
break;
|
||||
case "Trojan":
|
||||
KillProcess("Trojan");
|
||||
if (pTrojanController == null)
|
||||
{
|
||||
pTrojanController = new TrojanController();
|
||||
}
|
||||
result = pTrojanController.Start(server, mode);
|
||||
break;
|
||||
}
|
||||
|
||||
if (result)
|
||||
@@ -122,13 +136,18 @@ namespace Netch.Controllers
|
||||
pNTTController = new NTTController();
|
||||
}
|
||||
// 进程代理模式,启动 NF 控制器
|
||||
result = pNFController.Start(server, mode);
|
||||
|
||||
Task.Run(() =>
|
||||
result = pNFController.Start(server, mode, false);
|
||||
if (!result)
|
||||
{
|
||||
pNTTController.Start();
|
||||
});
|
||||
|
||||
MainForm.Instance.StatusText($"{Utils.i18N.Translate("Status")}{Utils.i18N.Translate(": ")}{Utils.i18N.Translate("Restarting Redirector")}");
|
||||
Utils.Logging.Info("正常启动失败后尝试停止驱动服务再重新启动");
|
||||
//正常启动失败后尝试停止驱动服务再重新启动
|
||||
result = pNFController.Start(server, mode, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
Task.Run(() => pNTTController.Start());
|
||||
}
|
||||
}
|
||||
else if (mode.Type == 1)
|
||||
{
|
||||
@@ -142,11 +161,10 @@ namespace Netch.Controllers
|
||||
}
|
||||
// TUN/TAP 黑名单代理模式,启动 TUN/TAP 控制器
|
||||
result = pTUNTAPController.Start(server, mode);
|
||||
|
||||
Task.Run(() =>
|
||||
if (result)
|
||||
{
|
||||
pNTTController.Start();
|
||||
});
|
||||
Task.Run(() => pNTTController.Start());
|
||||
}
|
||||
}
|
||||
else if (mode.Type == 2)
|
||||
{
|
||||
@@ -160,11 +178,10 @@ namespace Netch.Controllers
|
||||
}
|
||||
// TUN/TAP 白名单代理模式,启动 TUN/TAP 控制器
|
||||
result = pTUNTAPController.Start(server, mode);
|
||||
|
||||
Task.Run(() =>
|
||||
if (result)
|
||||
{
|
||||
pNTTController.Start();
|
||||
});
|
||||
Task.Run(() => pNTTController.Start());
|
||||
}
|
||||
}
|
||||
else if (mode.Type == 3 || mode.Type == 5)
|
||||
{
|
||||
@@ -210,6 +227,10 @@ namespace Netch.Controllers
|
||||
{
|
||||
pVMessController.Stop();
|
||||
}
|
||||
else if (pTrojanController != null)
|
||||
{
|
||||
pTrojanController.Stop();
|
||||
}
|
||||
|
||||
if (pNFController != null)
|
||||
{
|
||||
|
||||
@@ -32,94 +32,105 @@ namespace Netch.Controllers
|
||||
/// </summary>
|
||||
public Models.State State = Models.State.Waiting;
|
||||
|
||||
// 生成驱动文件路径
|
||||
public string driverPath = string.Format("{0}\\drivers\\netfilter2.sys", Environment.SystemDirectory);
|
||||
|
||||
/// <summary>
|
||||
/// 启动
|
||||
/// </summary>
|
||||
/// <param name="server">服务器</param>
|
||||
/// <param name="mode">模式</param>
|
||||
/// <param name="StopServiceAndRestart">先停止驱动服务再重新启动</param>
|
||||
/// <returns>是否成功</returns>
|
||||
public bool Start(Models.Server server, Models.Mode mode)
|
||||
public bool Start(Models.Server server, Models.Mode mode, bool StopServiceAndRestart)
|
||||
{
|
||||
MainForm.Instance.StatusText($"{Utils.i18N.Translate("Status")}{Utils.i18N.Translate(": ")}{Utils.i18N.Translate("Starting Redirector")}");
|
||||
if (!StopServiceAndRestart)
|
||||
MainForm.Instance.StatusText($"{Utils.i18N.Translate("Status")}{Utils.i18N.Translate(": ")}{Utils.i18N.Translate("Starting Redirector")}");
|
||||
|
||||
if (!File.Exists("bin\\Redirector.exe"))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// 生成驱动文件路径
|
||||
var driver = string.Format("{0}\\drivers\\netfilter2.sys", Environment.SystemDirectory);
|
||||
|
||||
if (File.Exists(driver))
|
||||
// 检查驱动是否存在
|
||||
if (File.Exists(driverPath))
|
||||
{
|
||||
//为了防止小白一直问如何卸载老驱动核心,每次启动时卸载删除一次驱动,保证系统使用最新驱动核心(简单粗暴 但有效:D。增加启动成功率,驱动在被其他加速器占用的情况下可能会导致启动失败
|
||||
try
|
||||
{
|
||||
var service = new ServiceController("netfilter2");
|
||||
if (service.Status == ServiceControllerStatus.Running)
|
||||
{
|
||||
service.Stop();
|
||||
service.WaitForStatus(ServiceControllerStatus.Stopped);
|
||||
}
|
||||
nfapinet.NFAPI.nf_unRegisterDriver("netfilter2");
|
||||
|
||||
File.Delete(driver);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
// 跳过
|
||||
}
|
||||
|
||||
// 生成系统版本
|
||||
var version = $"{Environment.OSVersion.Version.Major.ToString()}.{Environment.OSVersion.Version.Minor.ToString()}";
|
||||
var driverName = "";
|
||||
|
||||
// 检查系统版本并复制对应驱动
|
||||
try
|
||||
switch (version)
|
||||
{
|
||||
switch (version)
|
||||
case "10.0":
|
||||
driverName = "Win-10.sys";
|
||||
break;
|
||||
case "6.3":
|
||||
case "6.2":
|
||||
driverName = "Win-8.sys";
|
||||
break;
|
||||
case "6.1":
|
||||
case "6.0":
|
||||
driverName = "Win-7.sys";
|
||||
break;
|
||||
default:
|
||||
Utils.Logging.Info($"不支持的系统版本:{version}");
|
||||
return false;
|
||||
}
|
||||
|
||||
// 检查驱动版本号
|
||||
FileVersionInfo SystemfileVerInfo = System.Diagnostics.FileVersionInfo.GetVersionInfo(driverPath);
|
||||
FileVersionInfo BinFileVerInfo = System.Diagnostics.FileVersionInfo.GetVersionInfo(string.Format("bin\\{0}", driverName));
|
||||
|
||||
if (!SystemfileVerInfo.FileVersion.Equals(BinFileVerInfo.FileVersion))
|
||||
{
|
||||
Utils.Logging.Info("开始更新驱动");
|
||||
// 需要更新驱动
|
||||
try
|
||||
{
|
||||
case "10.0":
|
||||
File.Copy("bin\\Win-10.sys", driver);
|
||||
Utils.Logging.Info("已复制 Win10 驱动");
|
||||
break;
|
||||
case "6.3":
|
||||
case "6.2":
|
||||
File.Copy("bin\\Win-8.sys", driver);
|
||||
Utils.Logging.Info("已复制 Win8 驱动");
|
||||
break;
|
||||
case "6.1":
|
||||
case "6.0":
|
||||
File.Copy("bin\\Win-7.sys", driver);
|
||||
Utils.Logging.Info("已复制 Win7 驱动");
|
||||
break;
|
||||
default:
|
||||
Utils.Logging.Info($"不支持的系统版本:{version}");
|
||||
var service = new ServiceController("netfilter2");
|
||||
if (service.Status == ServiceControllerStatus.Running)
|
||||
{
|
||||
service.Stop();
|
||||
service.WaitForStatus(ServiceControllerStatus.Stopped);
|
||||
}
|
||||
nfapinet.NFAPI.nf_unRegisterDriver("netfilter2");
|
||||
|
||||
//删除老驱动
|
||||
File.Delete(driverPath);
|
||||
if (!InstallDriver())
|
||||
return false;
|
||||
|
||||
Utils.Logging.Info($"驱动更新完毕,当前驱动版本:{BinFileVerInfo.FileVersion}");
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Utils.Logging.Info("复制驱动文件失败");
|
||||
Utils.Logging.Info(e.ToString());
|
||||
return false;
|
||||
catch (Exception)
|
||||
{
|
||||
Utils.Logging.Info($"更新驱动出错");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 注册驱动文件
|
||||
var result = nfapinet.NFAPI.nf_registerDriver("netfilter2");
|
||||
if (result != nfapinet.NF_STATUS.NF_STATUS_SUCCESS)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!InstallDriver())
|
||||
{
|
||||
Utils.Logging.Info($"注册驱动失败,返回值:{result}");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// 检查驱动是否存在
|
||||
/*if (!File.Exists(driver))
|
||||
{
|
||||
}*/
|
||||
|
||||
try
|
||||
{
|
||||
// 启动驱动服务
|
||||
var service = new ServiceController("netfilter2");
|
||||
if (service.Status == ServiceControllerStatus.Stopped)
|
||||
if (service.Status == ServiceControllerStatus.Running && StopServiceAndRestart)
|
||||
{
|
||||
// 防止其他程序占用 重置 NF 百万连接数限制
|
||||
service.Stop();
|
||||
service.WaitForStatus(ServiceControllerStatus.Stopped);
|
||||
MainForm.Instance.StatusText($"{Utils.i18N.Translate("Status")}{Utils.i18N.Translate(": ")}{Utils.i18N.Translate("Starting netfilter2 Service")}");
|
||||
service.Start();
|
||||
}
|
||||
else if (service.Status == ServiceControllerStatus.Stopped)
|
||||
{
|
||||
MainForm.Instance.StatusText($"{Utils.i18N.Translate("Status")}{Utils.i18N.Translate(": ")}{Utils.i18N.Translate("Starting netfilter2 Service")}");
|
||||
service.Start();
|
||||
@@ -137,23 +148,21 @@ namespace Netch.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
var processes = "NTT.exe,";
|
||||
|
||||
var processes = "";
|
||||
foreach (var proc in mode.Rule)
|
||||
{
|
||||
processes += proc;
|
||||
processes += ",";
|
||||
}
|
||||
processes = processes.Substring(0, processes.Length - 1);
|
||||
processes += "NTT.exe";
|
||||
|
||||
Instance = MainController.GetProcess();
|
||||
Instance.StartInfo.FileName = "bin\\Redirector.exe";
|
||||
|
||||
var fallback = "";
|
||||
Instance.StartInfo.Arguments = "";
|
||||
|
||||
if (server.Type != "Socks5")
|
||||
{
|
||||
fallback = $"-r 127.0.0.1:{Global.Settings.Socks5LocalPort} -p \"{processes}\"";
|
||||
Instance.StartInfo.Arguments += $"-r 127.0.0.1:{Global.Settings.Socks5LocalPort} -p \"{processes}\"";
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -164,15 +173,20 @@ namespace Netch.Controllers
|
||||
return false;
|
||||
}
|
||||
|
||||
fallback = $"-r {result}:{server.Port} -p \"{processes}\"";
|
||||
|
||||
Instance.StartInfo.Arguments += $"-r {result}:{server.Port} -p \"{processes}\"";
|
||||
if (!string.IsNullOrWhiteSpace(server.Username) && !string.IsNullOrWhiteSpace(server.Password))
|
||||
{
|
||||
fallback += $" -username \"{server.Username}\" -password \"{server.Password}\"";
|
||||
Instance.StartInfo.Arguments += $" -username \"{server.Username}\" -password \"{server.Password}\"";
|
||||
}
|
||||
}
|
||||
|
||||
Instance.StartInfo.Arguments = fallback;
|
||||
if (File.Exists("logging\\redirector.log"))
|
||||
{
|
||||
File.Delete("logging\\redirector.log");
|
||||
}
|
||||
|
||||
Instance.StartInfo.Arguments += $" -t {Global.Settings.RedirectorTCPPort}";
|
||||
Utils.Logging.Info(Instance.StartInfo.Arguments);
|
||||
Instance.OutputDataReceived += OnOutputDataReceived;
|
||||
Instance.ErrorDataReceived += OnOutputDataReceived;
|
||||
State = Models.State.Starting;
|
||||
@@ -180,9 +194,9 @@ namespace Netch.Controllers
|
||||
Instance.BeginOutputReadLine();
|
||||
Instance.BeginErrorReadLine();
|
||||
|
||||
for (var i = 0; i < 1000; i++)
|
||||
for (var i = 0; i < 10; i++)
|
||||
{
|
||||
Thread.Sleep(10);
|
||||
Thread.Sleep(1000);
|
||||
|
||||
if (State == Models.State.Started)
|
||||
{
|
||||
@@ -213,6 +227,53 @@ namespace Netch.Controllers
|
||||
Utils.Logging.Info(e.ToString());
|
||||
}
|
||||
}
|
||||
public bool InstallDriver()
|
||||
{
|
||||
|
||||
Utils.Logging.Info("安装驱动中");
|
||||
// 生成系统版本
|
||||
var version = $"{Environment.OSVersion.Version.Major.ToString()}.{Environment.OSVersion.Version.Minor.ToString()}";
|
||||
|
||||
// 检查系统版本并复制对应驱动
|
||||
try
|
||||
{
|
||||
switch (version)
|
||||
{
|
||||
case "10.0":
|
||||
File.Copy("bin\\Win-10.sys", driverPath);
|
||||
Utils.Logging.Info("已复制 Win10 驱动");
|
||||
break;
|
||||
case "6.3":
|
||||
case "6.2":
|
||||
File.Copy("bin\\Win-8.sys", driverPath);
|
||||
Utils.Logging.Info("已复制 Win8 驱动");
|
||||
break;
|
||||
case "6.1":
|
||||
case "6.0":
|
||||
File.Copy("bin\\Win-7.sys", driverPath);
|
||||
Utils.Logging.Info("已复制 Win7 驱动");
|
||||
break;
|
||||
default:
|
||||
Utils.Logging.Info($"不支持的系统版本:{version}");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Utils.Logging.Info("复制驱动文件失败");
|
||||
Utils.Logging.Info(e.ToString());
|
||||
return false;
|
||||
}
|
||||
MainForm.Instance.StatusText($"{Utils.i18N.Translate("Status")}{Utils.i18N.Translate(": ")}{Utils.i18N.Translate("Register driver")}");
|
||||
// 注册驱动文件
|
||||
var result = nfapinet.NFAPI.nf_registerDriver("netfilter2");
|
||||
if (result != nfapinet.NF_STATUS.NF_STATUS_SUCCESS)
|
||||
{
|
||||
Utils.Logging.Info($"注册驱动失败,返回值:{result}");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void OnOutputDataReceived(object sender, DataReceivedEventArgs e)
|
||||
{
|
||||
@@ -226,7 +287,7 @@ namespace Netch.Controllers
|
||||
{
|
||||
State = Models.State.Stopped;
|
||||
}
|
||||
else if (e.Data.Contains("Started") || e.Data.Contains("Redirect to"))
|
||||
else if (e.Data.Contains("Started"))
|
||||
{
|
||||
State = Models.State.Started;
|
||||
}
|
||||
@@ -237,9 +298,9 @@ namespace Netch.Controllers
|
||||
}
|
||||
else if (State == Models.State.Started)
|
||||
{
|
||||
if (e.Data.StartsWith("[Application][Bandwidth]"))
|
||||
if (e.Data.StartsWith("[APP][Bandwidth]"))
|
||||
{
|
||||
var splited = e.Data.Replace("[Application][Bandwidth]", "").Trim().Split(',');
|
||||
var splited = e.Data.Replace("[APP][Bandwidth]", "").Trim().Split(',');
|
||||
if (splited.Length == 2)
|
||||
{
|
||||
var uploadSplited = splited[0].Split(':');
|
||||
@@ -258,4 +319,4 @@ namespace Netch.Controllers
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ namespace Netch.Controllers
|
||||
/// <returns></returns>
|
||||
public (bool, string, string, string) Start()
|
||||
{
|
||||
Thread.Sleep(1000);
|
||||
MainForm.Instance.NatTypeStatusText($"{Utils.i18N.Translate("Starting NatTester")}");
|
||||
try
|
||||
{
|
||||
@@ -72,6 +73,7 @@ namespace Netch.Controllers
|
||||
if (Instance != null && !Instance.HasExited)
|
||||
{
|
||||
Instance.Kill();
|
||||
Instance.WaitForExit();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
@@ -88,6 +90,7 @@ namespace Netch.Controllers
|
||||
{
|
||||
File.Delete("logging\\NTT.log");
|
||||
}
|
||||
|
||||
File.AppendAllText("logging\\NTT.log", $"{e.Data}\r\n");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,6 +73,7 @@ namespace Netch.Controllers
|
||||
if (Instance != null && !Instance.HasExited)
|
||||
{
|
||||
Instance.Kill();
|
||||
Instance.WaitForExit();
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
using Netch.Forms;
|
||||
using Netch.Utils;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
|
||||
namespace Netch.Controllers
|
||||
@@ -27,11 +30,39 @@ namespace Netch.Controllers
|
||||
public bool Start(Models.Server server, Models.Mode mode)
|
||||
{
|
||||
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"))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Instance = MainController.GetProcess();
|
||||
Instance.StartInfo.FileName = "bin\\Shadowsocks.exe";
|
||||
|
||||
@@ -43,7 +74,7 @@ namespace Netch.Controllers
|
||||
{
|
||||
Instance.StartInfo.Arguments = $"-s {server.Hostname} -p {server.Port} -b {Global.Settings.LocalAddress} -l {Global.Settings.Socks5LocalPort} -m {server.EncryptMethod} -k \"{server.Password}\" -u";
|
||||
}
|
||||
|
||||
|
||||
if (mode.BypassChina)
|
||||
{
|
||||
Instance.StartInfo.Arguments += " --acl default.acl";
|
||||
@@ -86,9 +117,16 @@ namespace Netch.Controllers
|
||||
{
|
||||
try
|
||||
{
|
||||
if (Global.Settings.BootShadowsocksFromDLL)
|
||||
{
|
||||
NativeMethods.Shadowsocks.Stop();
|
||||
return;
|
||||
}
|
||||
|
||||
if (Instance != null && !Instance.HasExited)
|
||||
{
|
||||
Instance.Kill();
|
||||
Instance.WaitForExit();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
@@ -99,26 +137,33 @@ namespace Netch.Controllers
|
||||
|
||||
public void OnOutputDataReceived(object sender, DataReceivedEventArgs e)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(e.Data))
|
||||
try
|
||||
{
|
||||
// File.AppendAllText("logging\\shadowsocks.log", $"{e.Data}\r\n");
|
||||
|
||||
if (State == Models.State.Starting)
|
||||
if (!string.IsNullOrWhiteSpace(e.Data))
|
||||
{
|
||||
if (Instance.HasExited)
|
||||
File.AppendAllText("logging\\shadowsocks.log", $"{e.Data}\r\n");
|
||||
|
||||
if (State == Models.State.Starting)
|
||||
{
|
||||
State = Models.State.Stopped;
|
||||
}
|
||||
else if (e.Data.Contains("listening at"))
|
||||
{
|
||||
State = Models.State.Started;
|
||||
}
|
||||
else if (e.Data.Contains("Invalid config path") || e.Data.Contains("usage") || e.Data.Contains("plugin service exit unexpectedly"))
|
||||
{
|
||||
State = Models.State.Stopped;
|
||||
if (Instance.HasExited)
|
||||
{
|
||||
State = Models.State.Stopped;
|
||||
}
|
||||
else if (e.Data.Contains("listening at"))
|
||||
{
|
||||
State = Models.State.Started;
|
||||
}
|
||||
else if (e.Data.Contains("Invalid config path") || e.Data.Contains("usage") || e.Data.Contains("plugin service exit unexpectedly"))
|
||||
{
|
||||
State = Models.State.Stopped;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ec)
|
||||
{
|
||||
Logging.Info("写入Shadowsocks日志失败" + ec.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,9 @@ namespace Netch.Controllers
|
||||
public bool Start(Models.Server server, Models.Mode mode)
|
||||
{
|
||||
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"))
|
||||
{
|
||||
return false;
|
||||
@@ -34,7 +37,7 @@ namespace Netch.Controllers
|
||||
|
||||
Instance = MainController.GetProcess();
|
||||
Instance.StartInfo.FileName = "bin\\ShadowsocksR.exe";
|
||||
Instance.StartInfo.Arguments = $"-s {server.Hostname} -p {server.Port} -k \"{server.Password}\" -m {server.EncryptMethod}";
|
||||
Instance.StartInfo.Arguments = $"-s {server.Hostname} -p {server.Port} -k \"{server.Password}\" -m {server.EncryptMethod} -t 120";
|
||||
|
||||
if (!string.IsNullOrEmpty(server.Protocol))
|
||||
{
|
||||
@@ -103,6 +106,7 @@ namespace Netch.Controllers
|
||||
if (Instance != null && !Instance.HasExited)
|
||||
{
|
||||
Instance.Kill();
|
||||
Instance.WaitForExit();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
using System;
|
||||
using Netch.Forms;
|
||||
using Netch.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using Netch.Forms;
|
||||
using Netch.Utils;
|
||||
|
||||
namespace Netch.Controllers
|
||||
{
|
||||
@@ -39,7 +39,7 @@ namespace Netch.Controllers
|
||||
public DNSController pDNSController = new DNSController();
|
||||
|
||||
// ByPassLan IP
|
||||
List<string> BypassLanIPs = new List<string>() { "10.0.0.0/8", "172.16.0.0/16", "192.168.0.0/24" };
|
||||
List<string> BypassLanIPs = new List<string>() { "10.0.0.0/8", "172.16.0.0/16", "192.168.0.0/16" };
|
||||
|
||||
/// <summary>
|
||||
/// 配置 TUNTAP 适配器
|
||||
@@ -68,6 +68,7 @@ namespace Netch.Controllers
|
||||
public bool SetupBypass()
|
||||
{
|
||||
MainForm.Instance.StatusText($"{Utils.i18N.Translate("Status")}{Utils.i18N.Translate(": ")}{Utils.i18N.Translate("SetupBypass")}");
|
||||
Logging.Info("设置绕行规则 → 设置让服务器 IP 走直连");
|
||||
// 让服务器 IP 走直连
|
||||
foreach (var address in ServerAddresses)
|
||||
{
|
||||
@@ -80,6 +81,7 @@ namespace Netch.Controllers
|
||||
// 处理模式的绕过中国
|
||||
if (SavedMode.BypassChina)
|
||||
{
|
||||
Logging.Info("设置绕行规则 → 处理模式的绕过中国");
|
||||
using (var sr = new StringReader(Encoding.UTF8.GetString(Properties.Resources.CNIP)))
|
||||
{
|
||||
string text;
|
||||
@@ -93,6 +95,7 @@ namespace Netch.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
Logging.Info("设置绕行规则 → 处理全局绕过 IP");
|
||||
// 处理全局绕过 IP
|
||||
foreach (var ip in Global.Settings.BypassIPs)
|
||||
{
|
||||
@@ -105,6 +108,8 @@ namespace Netch.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
Logging.Info("设置绕行规则 → 处理绕过局域网 IP");
|
||||
// 处理绕过局域网 IP
|
||||
foreach (var ip in BypassLanIPs)
|
||||
{
|
||||
var info = ip.Split('/');
|
||||
@@ -118,6 +123,7 @@ namespace Netch.Controllers
|
||||
|
||||
if (SavedMode.Type == 2) // 处理仅规则内走直连
|
||||
{
|
||||
Logging.Info("设置绕行规则 → 处理仅规则内走直连");
|
||||
// 将 TUN/TAP 网卡权重放到最高
|
||||
var instance = new Process
|
||||
{
|
||||
@@ -132,6 +138,7 @@ namespace Netch.Controllers
|
||||
};
|
||||
instance.Start();
|
||||
|
||||
Logging.Info("设置绕行规则 → 创建默认路由");
|
||||
// 创建默认路由
|
||||
if (!NativeMethods.CreateRoute("0.0.0.0", 0, Global.Settings.TUNTAP.Gateway, Global.TUNTAP.Index, 10))
|
||||
{
|
||||
@@ -145,6 +152,8 @@ namespace Netch.Controllers
|
||||
return false;
|
||||
}
|
||||
|
||||
Logging.Info("设置绕行规则 → 创建规则路由");
|
||||
// 创建规则路由
|
||||
foreach (var ip in SavedMode.Rule)
|
||||
{
|
||||
var info = ip.Split('/');
|
||||
@@ -160,6 +169,7 @@ namespace Netch.Controllers
|
||||
}
|
||||
else if (SavedMode.Type == 1) // 处理仅规则内走代理
|
||||
{
|
||||
Logging.Info("设置绕行规则->处理仅规则内走代理");
|
||||
foreach (var ip in SavedMode.Rule)
|
||||
{
|
||||
var info = ip.Split('/');
|
||||
@@ -172,7 +182,7 @@ namespace Netch.Controllers
|
||||
}
|
||||
}
|
||||
}
|
||||
//处理NAT类型检测,由于协议的原因,无法仅通过域名确定需要代理的IP,自己记录解析了返回的IP,仅支持默认检测服务器
|
||||
//处理 NAT 类型检测,由于协议的原因,无法仅通过域名确定需要代理的 IP,自己记录解析了返回的 IP,仅支持默认检测服务器
|
||||
if (Global.Settings.STUN_Server == "stun.stunprotocol.org")
|
||||
{
|
||||
try
|
||||
@@ -190,12 +200,13 @@ namespace Netch.Controllers
|
||||
}
|
||||
catch
|
||||
{
|
||||
Logging.Info("NAT类型测试域名解析失败,将不会被添加到代理列表。");
|
||||
Logging.Info("NAT 类型测试域名解析失败,将不会被添加到代理列表");
|
||||
}
|
||||
}
|
||||
//处理DNS代理
|
||||
if (Global.Settings.TUNTAP.ProxyDNS)
|
||||
{
|
||||
Logging.Info("设置绕行规则 → 处理自定义 DNS 代理");
|
||||
if (Global.Settings.TUNTAP.UseCustomDNS)
|
||||
{
|
||||
string dns = "";
|
||||
@@ -217,6 +228,9 @@ namespace Netch.Controllers
|
||||
if (int.TryParse("32", out var prefix))
|
||||
{
|
||||
NativeMethods.CreateRoute("1.1.1.1", prefix, Global.Settings.TUNTAP.Gateway, Global.TUNTAP.Index);
|
||||
NativeMethods.CreateRoute("8.8.8.8", prefix, Global.Settings.TUNTAP.Gateway, Global.TUNTAP.Index);
|
||||
NativeMethods.CreateRoute("9.9.9.9", prefix, Global.Settings.TUNTAP.Gateway, Global.TUNTAP.Index);
|
||||
NativeMethods.CreateRoute("185.222.222.222", prefix, Global.Settings.TUNTAP.Gateway, Global.TUNTAP.Index);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -401,6 +415,8 @@ namespace Netch.Controllers
|
||||
Logging.Info($"tun2sock使用适配器:{adapterName}");
|
||||
|
||||
string dns;
|
||||
//V2ray使用Unbound本地DNS会导致查询异常缓慢故此V2ray不启动unbound而是使用自定义DNS
|
||||
//if (Global.Settings.TUNTAP.UseCustomDNS || server.Type.Equals("VMess"))
|
||||
if (Global.Settings.TUNTAP.UseCustomDNS)
|
||||
{
|
||||
dns = "";
|
||||
@@ -417,7 +433,10 @@ namespace Netch.Controllers
|
||||
{
|
||||
pDNSController.Start();
|
||||
dns = "127.0.0.1";
|
||||
//dns = "1.1.1.1,1.0.0.1";
|
||||
}
|
||||
if (Global.Settings.TUNTAP.UseFakeDNS)
|
||||
{
|
||||
dns += " -fakeDns";
|
||||
}
|
||||
|
||||
if (server.Type == "Socks5")
|
||||
@@ -438,6 +457,8 @@ namespace Netch.Controllers
|
||||
Instance.ErrorDataReceived += OnOutputDataReceived;
|
||||
Instance.OutputDataReceived += OnOutputDataReceived;
|
||||
|
||||
Logging.Info(Instance.StartInfo.Arguments);
|
||||
|
||||
State = Models.State.Starting;
|
||||
Instance.Start();
|
||||
Instance.BeginErrorReadLine();
|
||||
|
||||
128
Netch/Controllers/TrojanController.cs
Normal file
@@ -0,0 +1,128 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Netch.Controllers
|
||||
{
|
||||
public class TrojanController
|
||||
{
|
||||
/// <summary>
|
||||
/// 进程实例
|
||||
/// </summary>
|
||||
public Process Instance;
|
||||
|
||||
/// <summary>
|
||||
/// 当前状态
|
||||
/// </summary>
|
||||
public Models.State State = Models.State.Waiting;
|
||||
|
||||
/// <summary>
|
||||
/// 启动
|
||||
/// </summary>
|
||||
/// <param name="server">服务器</param>
|
||||
/// <param name="mode">模式</param>
|
||||
/// <returns>是否启动成功</returns>
|
||||
public bool Start(Models.Server server, Models.Mode mode)
|
||||
{
|
||||
Forms.MainForm.Instance.StatusText($"{Utils.i18N.Translate("Status")}{Utils.i18N.Translate(": ")}{Utils.i18N.Translate("Starting Trojan")}");
|
||||
|
||||
File.Delete("logging\\trojan.log");
|
||||
if (!File.Exists("bin\\Trojan.exe"))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
File.WriteAllText("data\\last.json", Newtonsoft.Json.JsonConvert.SerializeObject(new Models.Trojan()
|
||||
{
|
||||
local_addr = Global.Settings.LocalAddress,
|
||||
local_port = Global.Settings.Socks5LocalPort,
|
||||
remote_addr = server.Hostname,
|
||||
remote_port = server.Port,
|
||||
password = new List<string>()
|
||||
{
|
||||
server.Password
|
||||
}
|
||||
}));
|
||||
|
||||
Instance = MainController.GetProcess();
|
||||
Instance.StartInfo.FileName = "bin\\Trojan.exe";
|
||||
Instance.StartInfo.Arguments = "-c ..\\data\\last.json";
|
||||
Instance.OutputDataReceived += OnOutputDataReceived;
|
||||
Instance.ErrorDataReceived += OnOutputDataReceived;
|
||||
|
||||
State = Models.State.Starting;
|
||||
Instance.Start();
|
||||
Instance.BeginOutputReadLine();
|
||||
Instance.BeginErrorReadLine();
|
||||
for (var i = 0; i < 1000; i++)
|
||||
{
|
||||
Thread.Sleep(10);
|
||||
|
||||
if (State == Models.State.Started)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (State == Models.State.Stopped)
|
||||
{
|
||||
Utils.Logging.Info("Trojan 进程启动失败");
|
||||
|
||||
Stop();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Utils.Logging.Info("Trojan 进程启动超时");
|
||||
Stop();
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 停止
|
||||
/// </summary>
|
||||
public void Stop()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (Instance != null && !Instance.HasExited)
|
||||
{
|
||||
Instance.Kill();
|
||||
Instance.WaitForExit();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Utils.Logging.Info(e.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public void OnOutputDataReceived(object sender, DataReceivedEventArgs e)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(e.Data))
|
||||
{
|
||||
File.AppendAllText("logging\\trojan.log", $"{e.Data}\r\n");
|
||||
|
||||
if (State == Models.State.Starting)
|
||||
{
|
||||
if (Instance.HasExited)
|
||||
{
|
||||
State = Models.State.Stopped;
|
||||
}
|
||||
else if (e.Data.Contains("started"))
|
||||
{
|
||||
State = Models.State.Started;
|
||||
}
|
||||
else if (e.Data.Contains("exiting"))
|
||||
{
|
||||
State = Models.State.Stopped;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
using System;
|
||||
using Netch.Models.GitHubRelease;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using Netch.Models.GitHubRelease;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Netch.Controllers
|
||||
{
|
||||
@@ -14,8 +14,8 @@ namespace Netch.Controllers
|
||||
|
||||
private const int DefaultGetTimeout = 30000;
|
||||
|
||||
private const string Owner = @"NetchX";
|
||||
private const string Repo = @"Netch";
|
||||
public const string Owner = @"NetchX";
|
||||
public const string Repo = @"Netch";
|
||||
|
||||
public string LatestVersionNumber;
|
||||
public string LatestVersionUrl;
|
||||
@@ -26,7 +26,7 @@ namespace Netch.Controllers
|
||||
|
||||
public const string Name = @"Netch";
|
||||
public const string Copyright = @"Copyright © 2019 - 2020";
|
||||
public const string Version = @"1.4.0";
|
||||
public const string Version = @"1.4.11";
|
||||
|
||||
public async void Check(bool notifyNoFound, bool isPreRelease)
|
||||
{
|
||||
|
||||
@@ -127,13 +127,14 @@ namespace Netch.Controllers
|
||||
enabled = server.UseMux
|
||||
}
|
||||
},
|
||||
new Models.Information.VMess.Outbounds
|
||||
(mode.Type==0||mode.Type==1||mode.Type==2) ? new Models.Information.VMess.Outbounds
|
||||
{
|
||||
tag = "TUNTAP",
|
||||
protocol = "freedom"
|
||||
}: new Models.Information.VMess.Outbounds
|
||||
{
|
||||
tag = "direct",
|
||||
protocol = "freedom",
|
||||
settings = null,
|
||||
streamSettings = null,
|
||||
mux = null
|
||||
protocol = "freedom"
|
||||
}
|
||||
},
|
||||
routing = new Models.Information.VMess.Routing
|
||||
@@ -147,7 +148,7 @@ namespace Netch.Controllers
|
||||
{
|
||||
"geoip:cn",
|
||||
"geoip:private"
|
||||
|
||||
|
||||
},
|
||||
domain = new List<string>
|
||||
{
|
||||
@@ -224,6 +225,7 @@ namespace Netch.Controllers
|
||||
if (Instance != null && !Instance.HasExited)
|
||||
{
|
||||
Instance.Kill();
|
||||
Instance.WaitForExit();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
|
||||
2
Netch/Forms/AboutForm.Designer.cs
generated
@@ -51,7 +51,7 @@
|
||||
// SponsorPictureBox
|
||||
//
|
||||
this.SponsorPictureBox.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.SponsorPictureBox.Image = global::Netch.Properties.Resources.N3RO;
|
||||
this.SponsorPictureBox.Image = global::Netch.Properties.Resources.Sponsor;
|
||||
this.SponsorPictureBox.Location = new System.Drawing.Point(6, 22);
|
||||
this.SponsorPictureBox.Name = "SponsorPictureBox";
|
||||
this.SponsorPictureBox.Size = new System.Drawing.Size(300, 200);
|
||||
|
||||
444
Netch/Forms/MainForm.Designer.cs
generated
@@ -39,6 +39,7 @@ namespace Netch.Forms
|
||||
this.AddShadowsocksServerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.AddShadowsocksRServerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.AddVMessServerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.AddTrojanServerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.ModeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.CreateProcessModeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.ManageProcessModeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
@@ -50,26 +51,35 @@ namespace Netch.Forms
|
||||
this.RestartServiceToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.UninstallServiceToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.CleanDNSCacheToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.UpdateACLToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.updateACLWithProxyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.reinstallTapDriverToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.AboutToolStripButton = new System.Windows.Forms.ToolStripButton();
|
||||
this.VersionLabel = new System.Windows.Forms.ToolStripLabel();
|
||||
this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.RelyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.ConfigurationGroupBox = new System.Windows.Forms.GroupBox();
|
||||
this.CopyLinkPictureBox = new System.Windows.Forms.PictureBox();
|
||||
this.DeleteModePictureBox = new System.Windows.Forms.PictureBox();
|
||||
this.EditModePictureBox = new System.Windows.Forms.PictureBox();
|
||||
this.ProfileNameText = new System.Windows.Forms.TextBox();
|
||||
this.configLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.ProfileLabel = new System.Windows.Forms.Label();
|
||||
this.SpeedPictureBox = new System.Windows.Forms.PictureBox();
|
||||
this.DeletePictureBox = new System.Windows.Forms.PictureBox();
|
||||
this.EditPictureBox = new System.Windows.Forms.PictureBox();
|
||||
this.ModeLabel = new System.Windows.Forms.Label();
|
||||
this.ServerLabel = new System.Windows.Forms.Label();
|
||||
this.ProfileNameText = new System.Windows.Forms.TextBox();
|
||||
this.ModeComboBox = new System.Windows.Forms.SearchComboBox();
|
||||
this.ServerComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.ServerLabel = new System.Windows.Forms.Label();
|
||||
this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.EditPictureBox = new System.Windows.Forms.PictureBox();
|
||||
this.CopyLinkPictureBox = new System.Windows.Forms.PictureBox();
|
||||
this.DeletePictureBox = new System.Windows.Forms.PictureBox();
|
||||
this.SpeedPictureBox = new System.Windows.Forms.PictureBox();
|
||||
this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.EditModePictureBox = new System.Windows.Forms.PictureBox();
|
||||
this.DeleteModePictureBox = new System.Windows.Forms.PictureBox();
|
||||
this.StatusStrip = new System.Windows.Forms.StatusStrip();
|
||||
this.StatusLabel = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
this.UsedBandwidthLabel = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
this.DownloadSpeedLabel = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
this.UploadSpeedLabel = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
this.NatTypeStatusLabel = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
this.ControlButton = new System.Windows.Forms.Button();
|
||||
this.NotifyIcon = new System.Windows.Forms.NotifyIcon(this.components);
|
||||
this.NotifyMenu = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
@@ -78,15 +88,17 @@ namespace Netch.Forms
|
||||
this.SettingsButton = new System.Windows.Forms.Button();
|
||||
this.ProfileGroupBox = new System.Windows.Forms.GroupBox();
|
||||
this.ProfileTable = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.NatTypeStatusLabel = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
this.MenuStrip.SuspendLayout();
|
||||
this.ConfigurationGroupBox.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.CopyLinkPictureBox)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.DeleteModePictureBox)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.EditModePictureBox)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.SpeedPictureBox)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.DeletePictureBox)).BeginInit();
|
||||
this.configLayoutPanel.SuspendLayout();
|
||||
this.tableLayoutPanel2.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.EditPictureBox)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.CopyLinkPictureBox)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.DeletePictureBox)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.SpeedPictureBox)).BeginInit();
|
||||
this.tableLayoutPanel3.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.EditModePictureBox)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.DeleteModePictureBox)).BeginInit();
|
||||
this.StatusStrip.SuspendLayout();
|
||||
this.NotifyMenu.SuspendLayout();
|
||||
this.ProfileGroupBox.SuspendLayout();
|
||||
@@ -102,11 +114,13 @@ namespace Netch.Forms
|
||||
this.SubscribeToolStripMenuItem,
|
||||
this.OptionsToolStripMenuItem,
|
||||
this.AboutToolStripButton,
|
||||
this.VersionLabel});
|
||||
this.VersionLabel,
|
||||
this.exitToolStripMenuItem,
|
||||
this.RelyToolStripMenuItem});
|
||||
this.MenuStrip.Location = new System.Drawing.Point(0, 0);
|
||||
this.MenuStrip.Name = "MenuStrip";
|
||||
this.MenuStrip.RenderMode = System.Windows.Forms.ToolStripRenderMode.Professional;
|
||||
this.MenuStrip.Size = new System.Drawing.Size(629, 26);
|
||||
this.MenuStrip.Size = new System.Drawing.Size(733, 26);
|
||||
this.MenuStrip.TabIndex = 0;
|
||||
//
|
||||
// ServerToolStripMenuItem
|
||||
@@ -116,7 +130,8 @@ namespace Netch.Forms
|
||||
this.AddSocks5ServerToolStripMenuItem,
|
||||
this.AddShadowsocksServerToolStripMenuItem,
|
||||
this.AddShadowsocksRServerToolStripMenuItem,
|
||||
this.AddVMessServerToolStripMenuItem});
|
||||
this.AddVMessServerToolStripMenuItem,
|
||||
this.AddTrojanServerToolStripMenuItem});
|
||||
this.ServerToolStripMenuItem.Margin = new System.Windows.Forms.Padding(3, 0, 0, 1);
|
||||
this.ServerToolStripMenuItem.Name = "ServerToolStripMenuItem";
|
||||
this.ServerToolStripMenuItem.Size = new System.Drawing.Size(57, 21);
|
||||
@@ -157,6 +172,13 @@ namespace Netch.Forms
|
||||
this.AddVMessServerToolStripMenuItem.Text = "Add [VMess] Server";
|
||||
this.AddVMessServerToolStripMenuItem.Click += new System.EventHandler(this.AddVMessServerToolStripMenuItem_Click);
|
||||
//
|
||||
// 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);
|
||||
//
|
||||
// ModeToolStripMenuItem
|
||||
//
|
||||
this.ModeToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
@@ -211,7 +233,10 @@ namespace Netch.Forms
|
||||
this.ReloadModesToolStripMenuItem,
|
||||
this.RestartServiceToolStripMenuItem,
|
||||
this.UninstallServiceToolStripMenuItem,
|
||||
this.CleanDNSCacheToolStripMenuItem});
|
||||
this.CleanDNSCacheToolStripMenuItem,
|
||||
this.UpdateACLToolStripMenuItem,
|
||||
this.updateACLWithProxyToolStripMenuItem,
|
||||
this.reinstallTapDriverToolStripMenuItem});
|
||||
this.OptionsToolStripMenuItem.Margin = new System.Windows.Forms.Padding(0, 0, 0, 1);
|
||||
this.OptionsToolStripMenuItem.Name = "OptionsToolStripMenuItem";
|
||||
this.OptionsToolStripMenuItem.Size = new System.Drawing.Size(66, 21);
|
||||
@@ -220,31 +245,52 @@ namespace Netch.Forms
|
||||
// ReloadModesToolStripMenuItem
|
||||
//
|
||||
this.ReloadModesToolStripMenuItem.Name = "ReloadModesToolStripMenuItem";
|
||||
this.ReloadModesToolStripMenuItem.Size = new System.Drawing.Size(177, 22);
|
||||
this.ReloadModesToolStripMenuItem.Size = new System.Drawing.Size(219, 22);
|
||||
this.ReloadModesToolStripMenuItem.Text = "Reload Modes";
|
||||
this.ReloadModesToolStripMenuItem.Click += new System.EventHandler(this.ReloadModesToolStripMenuItem_Click);
|
||||
//
|
||||
// RestartServiceToolStripMenuItem
|
||||
//
|
||||
this.RestartServiceToolStripMenuItem.Name = "RestartServiceToolStripMenuItem";
|
||||
this.RestartServiceToolStripMenuItem.Size = new System.Drawing.Size(177, 22);
|
||||
this.RestartServiceToolStripMenuItem.Size = new System.Drawing.Size(219, 22);
|
||||
this.RestartServiceToolStripMenuItem.Text = "Restart Service";
|
||||
this.RestartServiceToolStripMenuItem.Click += new System.EventHandler(this.RestartServiceToolStripMenuItem_Click);
|
||||
//
|
||||
// UninstallServiceToolStripMenuItem
|
||||
//
|
||||
this.UninstallServiceToolStripMenuItem.Name = "UninstallServiceToolStripMenuItem";
|
||||
this.UninstallServiceToolStripMenuItem.Size = new System.Drawing.Size(177, 22);
|
||||
this.UninstallServiceToolStripMenuItem.Size = new System.Drawing.Size(219, 22);
|
||||
this.UninstallServiceToolStripMenuItem.Text = "Uninstall Service";
|
||||
this.UninstallServiceToolStripMenuItem.Click += new System.EventHandler(this.UninstallServiceToolStripMenuItem_Click);
|
||||
//
|
||||
// CleanDNSCacheToolStripMenuItem
|
||||
//
|
||||
this.CleanDNSCacheToolStripMenuItem.Name = "CleanDNSCacheToolStripMenuItem";
|
||||
this.CleanDNSCacheToolStripMenuItem.Size = new System.Drawing.Size(177, 22);
|
||||
this.CleanDNSCacheToolStripMenuItem.Size = new System.Drawing.Size(219, 22);
|
||||
this.CleanDNSCacheToolStripMenuItem.Text = "Clean DNS Cache";
|
||||
this.CleanDNSCacheToolStripMenuItem.Click += new System.EventHandler(this.CleanDNSCacheToolStripMenuItem_Click);
|
||||
//
|
||||
// UpdateACLToolStripMenuItem
|
||||
//
|
||||
this.UpdateACLToolStripMenuItem.Name = "UpdateACLToolStripMenuItem";
|
||||
this.UpdateACLToolStripMenuItem.Size = new System.Drawing.Size(219, 22);
|
||||
this.UpdateACLToolStripMenuItem.Text = "Update ACL";
|
||||
this.UpdateACLToolStripMenuItem.Click += new System.EventHandler(this.updateACLToolStripMenuItem_Click);
|
||||
//
|
||||
// updateACLWithProxyToolStripMenuItem
|
||||
//
|
||||
this.updateACLWithProxyToolStripMenuItem.Name = "updateACLWithProxyToolStripMenuItem";
|
||||
this.updateACLWithProxyToolStripMenuItem.Size = new System.Drawing.Size(219, 22);
|
||||
this.updateACLWithProxyToolStripMenuItem.Text = "Update ACL with proxy";
|
||||
this.updateACLWithProxyToolStripMenuItem.Click += new System.EventHandler(this.updateACLWithProxyToolStripMenuItem_Click);
|
||||
//
|
||||
// reinstallTapDriverToolStripMenuItem
|
||||
//
|
||||
this.reinstallTapDriverToolStripMenuItem.Name = "reinstallTapDriverToolStripMenuItem";
|
||||
this.reinstallTapDriverToolStripMenuItem.Size = new System.Drawing.Size(219, 22);
|
||||
this.reinstallTapDriverToolStripMenuItem.Text = "Reinstall TUN/TAP driver";
|
||||
this.reinstallTapDriverToolStripMenuItem.Click += new System.EventHandler(this.reinstallTapDriverToolStripMenuItem_Click);
|
||||
//
|
||||
// AboutToolStripButton
|
||||
//
|
||||
this.AboutToolStripButton.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right;
|
||||
@@ -263,52 +309,202 @@ namespace Netch.Forms
|
||||
this.VersionLabel.IsLink = true;
|
||||
this.VersionLabel.LinkBehavior = System.Windows.Forms.LinkBehavior.NeverUnderline;
|
||||
this.VersionLabel.Name = "VersionLabel";
|
||||
this.VersionLabel.Size = new System.Drawing.Size(32, 19);
|
||||
this.VersionLabel.Text = "x.x.x";
|
||||
this.VersionLabel.Size = new System.Drawing.Size(26, 19);
|
||||
this.VersionLabel.Text = "xxx";
|
||||
this.VersionLabel.Click += new System.EventHandler(this.VersionLabel_Click);
|
||||
//
|
||||
// exitToolStripMenuItem
|
||||
//
|
||||
this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
|
||||
this.exitToolStripMenuItem.Size = new System.Drawing.Size(40, 22);
|
||||
this.exitToolStripMenuItem.Text = "Exit";
|
||||
this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
|
||||
//
|
||||
// RelyToolStripMenuItem
|
||||
//
|
||||
this.RelyToolStripMenuItem.BackColor = System.Drawing.SystemColors.Control;
|
||||
this.RelyToolStripMenuItem.ForeColor = System.Drawing.Color.Red;
|
||||
this.RelyToolStripMenuItem.Name = "RelyToolStripMenuItem";
|
||||
this.RelyToolStripMenuItem.Size = new System.Drawing.Size(244, 22);
|
||||
this.RelyToolStripMenuItem.Text = "Unable to start? Click me to download";
|
||||
this.RelyToolStripMenuItem.Click += new System.EventHandler(this.RelyToolStripMenuItem_Click);
|
||||
//
|
||||
// ConfigurationGroupBox
|
||||
//
|
||||
this.ConfigurationGroupBox.Controls.Add(this.CopyLinkPictureBox);
|
||||
this.ConfigurationGroupBox.Controls.Add(this.DeleteModePictureBox);
|
||||
this.ConfigurationGroupBox.Controls.Add(this.EditModePictureBox);
|
||||
this.ConfigurationGroupBox.Controls.Add(this.ProfileNameText);
|
||||
this.ConfigurationGroupBox.Controls.Add(this.ProfileLabel);
|
||||
this.ConfigurationGroupBox.Controls.Add(this.SpeedPictureBox);
|
||||
this.ConfigurationGroupBox.Controls.Add(this.DeletePictureBox);
|
||||
this.ConfigurationGroupBox.Controls.Add(this.EditPictureBox);
|
||||
this.ConfigurationGroupBox.Controls.Add(this.ModeLabel);
|
||||
this.ConfigurationGroupBox.Controls.Add(this.ModeComboBox);
|
||||
this.ConfigurationGroupBox.Controls.Add(this.ServerComboBox);
|
||||
this.ConfigurationGroupBox.Controls.Add(this.ServerLabel);
|
||||
this.ConfigurationGroupBox.Controls.Add(this.configLayoutPanel);
|
||||
this.ConfigurationGroupBox.Location = new System.Drawing.Point(12, 28);
|
||||
this.ConfigurationGroupBox.Name = "ConfigurationGroupBox";
|
||||
this.ConfigurationGroupBox.Size = new System.Drawing.Size(605, 113);
|
||||
this.ConfigurationGroupBox.Size = new System.Drawing.Size(709, 115);
|
||||
this.ConfigurationGroupBox.TabIndex = 1;
|
||||
this.ConfigurationGroupBox.TabStop = false;
|
||||
this.ConfigurationGroupBox.Text = "Configuration";
|
||||
//
|
||||
// configLayoutPanel
|
||||
//
|
||||
this.configLayoutPanel.ColumnCount = 3;
|
||||
this.configLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
|
||||
this.configLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||
this.configLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
|
||||
this.configLayoutPanel.Controls.Add(this.ProfileLabel, 0, 2);
|
||||
this.configLayoutPanel.Controls.Add(this.ModeLabel, 0, 1);
|
||||
this.configLayoutPanel.Controls.Add(this.ServerLabel, 0, 0);
|
||||
this.configLayoutPanel.Controls.Add(this.ProfileNameText, 1, 2);
|
||||
this.configLayoutPanel.Controls.Add(this.ModeComboBox, 1, 1);
|
||||
this.configLayoutPanel.Controls.Add(this.ServerComboBox, 1, 0);
|
||||
this.configLayoutPanel.Controls.Add(this.tableLayoutPanel2, 2, 0);
|
||||
this.configLayoutPanel.Controls.Add(this.tableLayoutPanel3, 2, 1);
|
||||
this.configLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.configLayoutPanel.Location = new System.Drawing.Point(3, 19);
|
||||
this.configLayoutPanel.Name = "configLayoutPanel";
|
||||
this.configLayoutPanel.RowCount = 3;
|
||||
this.configLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
|
||||
this.configLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
|
||||
this.configLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
|
||||
this.configLayoutPanel.Size = new System.Drawing.Size(703, 93);
|
||||
this.configLayoutPanel.TabIndex = 15;
|
||||
//
|
||||
// ProfileLabel
|
||||
//
|
||||
this.ProfileLabel.Anchor = System.Windows.Forms.AnchorStyles.Left;
|
||||
this.ProfileLabel.AutoSize = true;
|
||||
this.ProfileLabel.Location = new System.Drawing.Point(3, 69);
|
||||
this.ProfileLabel.Name = "ProfileLabel";
|
||||
this.ProfileLabel.Size = new System.Drawing.Size(45, 17);
|
||||
this.ProfileLabel.TabIndex = 10;
|
||||
this.ProfileLabel.Text = "Profile";
|
||||
//
|
||||
// ModeLabel
|
||||
//
|
||||
this.ModeLabel.Anchor = System.Windows.Forms.AnchorStyles.Left;
|
||||
this.ModeLabel.AutoSize = true;
|
||||
this.ModeLabel.Location = new System.Drawing.Point(3, 38);
|
||||
this.ModeLabel.Name = "ModeLabel";
|
||||
this.ModeLabel.Size = new System.Drawing.Size(43, 17);
|
||||
this.ModeLabel.TabIndex = 3;
|
||||
this.ModeLabel.Text = "Mode";
|
||||
//
|
||||
// ServerLabel
|
||||
//
|
||||
this.ServerLabel.Anchor = System.Windows.Forms.AnchorStyles.Left;
|
||||
this.ServerLabel.AutoSize = true;
|
||||
this.ServerLabel.Location = new System.Drawing.Point(3, 7);
|
||||
this.ServerLabel.Name = "ServerLabel";
|
||||
this.ServerLabel.Size = new System.Drawing.Size(45, 17);
|
||||
this.ServerLabel.TabIndex = 0;
|
||||
this.ServerLabel.Text = "Server";
|
||||
//
|
||||
// ProfileNameText
|
||||
//
|
||||
this.ProfileNameText.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.ProfileNameText.Location = new System.Drawing.Point(54, 65);
|
||||
this.ProfileNameText.Name = "ProfileNameText";
|
||||
this.ProfileNameText.Size = new System.Drawing.Size(546, 23);
|
||||
this.ProfileNameText.TabIndex = 11;
|
||||
//
|
||||
// ModeComboBox
|
||||
//
|
||||
this.ModeComboBox.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest;
|
||||
this.ModeComboBox.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.ModeComboBox.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
|
||||
this.ModeComboBox.FormattingEnabled = true;
|
||||
this.ModeComboBox.IntegralHeight = false;
|
||||
this.ModeComboBox.Location = new System.Drawing.Point(54, 34);
|
||||
this.ModeComboBox.Name = "ModeComboBox";
|
||||
this.ModeComboBox.Size = new System.Drawing.Size(546, 24);
|
||||
this.ModeComboBox.TabIndex = 2;
|
||||
this.ModeComboBox.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.ComboBox_DrawItem);
|
||||
//
|
||||
// ServerComboBox
|
||||
//
|
||||
this.ServerComboBox.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.ServerComboBox.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
|
||||
this.ServerComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.ServerComboBox.FormattingEnabled = true;
|
||||
this.ServerComboBox.IntegralHeight = false;
|
||||
this.ServerComboBox.Location = new System.Drawing.Point(54, 3);
|
||||
this.ServerComboBox.MaxDropDownItems = 16;
|
||||
this.ServerComboBox.Name = "ServerComboBox";
|
||||
this.ServerComboBox.Size = new System.Drawing.Size(546, 24);
|
||||
this.ServerComboBox.TabIndex = 1;
|
||||
this.ServerComboBox.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.ComboBox_DrawItem);
|
||||
//
|
||||
// tableLayoutPanel2
|
||||
//
|
||||
this.tableLayoutPanel2.ColumnCount = 4;
|
||||
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
|
||||
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
|
||||
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
|
||||
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
|
||||
this.tableLayoutPanel2.Controls.Add(this.EditPictureBox, 0, 0);
|
||||
this.tableLayoutPanel2.Controls.Add(this.CopyLinkPictureBox, 3, 0);
|
||||
this.tableLayoutPanel2.Controls.Add(this.DeletePictureBox, 1, 0);
|
||||
this.tableLayoutPanel2.Controls.Add(this.SpeedPictureBox, 2, 0);
|
||||
this.tableLayoutPanel2.Location = new System.Drawing.Point(606, 3);
|
||||
this.tableLayoutPanel2.Name = "tableLayoutPanel2";
|
||||
this.tableLayoutPanel2.RowCount = 1;
|
||||
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||
this.tableLayoutPanel2.Size = new System.Drawing.Size(94, 24);
|
||||
this.tableLayoutPanel2.TabIndex = 12;
|
||||
//
|
||||
// EditPictureBox
|
||||
//
|
||||
this.EditPictureBox.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.EditPictureBox.Image = ((System.Drawing.Image)(resources.GetObject("EditPictureBox.Image")));
|
||||
this.EditPictureBox.Location = new System.Drawing.Point(3, 3);
|
||||
this.EditPictureBox.Name = "EditPictureBox";
|
||||
this.EditPictureBox.Size = new System.Drawing.Size(16, 16);
|
||||
this.EditPictureBox.TabIndex = 7;
|
||||
this.EditPictureBox.TabStop = false;
|
||||
this.EditPictureBox.Click += new System.EventHandler(this.EditPictureBox_Click);
|
||||
//
|
||||
// CopyLinkPictureBox
|
||||
//
|
||||
this.CopyLinkPictureBox.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.CopyLinkPictureBox.Image = global::Netch.Properties.Resources.CopyLink;
|
||||
this.CopyLinkPictureBox.Location = new System.Drawing.Point(582, 25);
|
||||
this.CopyLinkPictureBox.Location = new System.Drawing.Point(72, 3);
|
||||
this.CopyLinkPictureBox.Name = "CopyLinkPictureBox";
|
||||
this.CopyLinkPictureBox.Size = new System.Drawing.Size(18, 18);
|
||||
this.CopyLinkPictureBox.TabIndex = 14;
|
||||
this.CopyLinkPictureBox.TabStop = false;
|
||||
this.CopyLinkPictureBox.Click += new System.EventHandler(this.CopyLinkPictureBox_Click);
|
||||
//
|
||||
// DeleteModePictureBox
|
||||
// DeletePictureBox
|
||||
//
|
||||
this.DeleteModePictureBox.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.DeleteModePictureBox.Image = global::Netch.Properties.Resources.delete;
|
||||
this.DeleteModePictureBox.Location = new System.Drawing.Point(540, 57);
|
||||
this.DeleteModePictureBox.Name = "DeleteModePictureBox";
|
||||
this.DeleteModePictureBox.Size = new System.Drawing.Size(16, 16);
|
||||
this.DeleteModePictureBox.TabIndex = 13;
|
||||
this.DeleteModePictureBox.TabStop = false;
|
||||
this.DeleteModePictureBox.Click += new System.EventHandler(this.DeleteModePictureBox_Click);
|
||||
this.DeletePictureBox.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.DeletePictureBox.Image = ((System.Drawing.Image)(resources.GetObject("DeletePictureBox.Image")));
|
||||
this.DeletePictureBox.Location = new System.Drawing.Point(26, 3);
|
||||
this.DeletePictureBox.Name = "DeletePictureBox";
|
||||
this.DeletePictureBox.Size = new System.Drawing.Size(16, 16);
|
||||
this.DeletePictureBox.TabIndex = 8;
|
||||
this.DeletePictureBox.TabStop = false;
|
||||
this.DeletePictureBox.Click += new System.EventHandler(this.DeletePictureBox_Click);
|
||||
//
|
||||
// SpeedPictureBox
|
||||
//
|
||||
this.SpeedPictureBox.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.SpeedPictureBox.Image = ((System.Drawing.Image)(resources.GetObject("SpeedPictureBox.Image")));
|
||||
this.SpeedPictureBox.Location = new System.Drawing.Point(49, 3);
|
||||
this.SpeedPictureBox.Name = "SpeedPictureBox";
|
||||
this.SpeedPictureBox.Size = new System.Drawing.Size(16, 16);
|
||||
this.SpeedPictureBox.TabIndex = 9;
|
||||
this.SpeedPictureBox.TabStop = false;
|
||||
this.SpeedPictureBox.Click += new System.EventHandler(this.SpeedPictureBox_Click);
|
||||
//
|
||||
// tableLayoutPanel3
|
||||
//
|
||||
this.tableLayoutPanel3.ColumnCount = 4;
|
||||
this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
|
||||
this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
|
||||
this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
|
||||
this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
|
||||
this.tableLayoutPanel3.Controls.Add(this.EditModePictureBox, 0, 0);
|
||||
this.tableLayoutPanel3.Controls.Add(this.DeleteModePictureBox, 1, 0);
|
||||
this.tableLayoutPanel3.Location = new System.Drawing.Point(606, 34);
|
||||
this.tableLayoutPanel3.Name = "tableLayoutPanel3";
|
||||
this.tableLayoutPanel3.RowCount = 1;
|
||||
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||
this.tableLayoutPanel3.Size = new System.Drawing.Size(94, 24);
|
||||
this.tableLayoutPanel3.TabIndex = 13;
|
||||
//
|
||||
// EditModePictureBox
|
||||
//
|
||||
@@ -316,104 +512,23 @@ namespace Netch.Forms
|
||||
this.EditModePictureBox.ErrorImage = global::Netch.Properties.Resources.edit;
|
||||
this.EditModePictureBox.Image = global::Netch.Properties.Resources.edit;
|
||||
this.EditModePictureBox.InitialImage = global::Netch.Properties.Resources.edit;
|
||||
this.EditModePictureBox.Location = new System.Drawing.Point(518, 56);
|
||||
this.EditModePictureBox.Location = new System.Drawing.Point(3, 3);
|
||||
this.EditModePictureBox.Name = "EditModePictureBox";
|
||||
this.EditModePictureBox.Size = new System.Drawing.Size(16, 16);
|
||||
this.EditModePictureBox.TabIndex = 12;
|
||||
this.EditModePictureBox.TabStop = false;
|
||||
this.EditModePictureBox.Click += new System.EventHandler(this.EditModePictureBox_Click);
|
||||
//
|
||||
// ProfileNameText
|
||||
// DeleteModePictureBox
|
||||
//
|
||||
this.ProfileNameText.Location = new System.Drawing.Point(57, 83);
|
||||
this.ProfileNameText.Name = "ProfileNameText";
|
||||
this.ProfileNameText.Size = new System.Drawing.Size(455, 23);
|
||||
this.ProfileNameText.TabIndex = 11;
|
||||
//
|
||||
// ProfileLabel
|
||||
//
|
||||
this.ProfileLabel.AutoSize = true;
|
||||
this.ProfileLabel.Location = new System.Drawing.Point(6, 86);
|
||||
this.ProfileLabel.Name = "ProfileLabel";
|
||||
this.ProfileLabel.Size = new System.Drawing.Size(45, 17);
|
||||
this.ProfileLabel.TabIndex = 10;
|
||||
this.ProfileLabel.Text = "Profile";
|
||||
//
|
||||
// SpeedPictureBox
|
||||
//
|
||||
this.SpeedPictureBox.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.SpeedPictureBox.Image = ((System.Drawing.Image)(resources.GetObject("SpeedPictureBox.Image")));
|
||||
this.SpeedPictureBox.Location = new System.Drawing.Point(562, 26);
|
||||
this.SpeedPictureBox.Name = "SpeedPictureBox";
|
||||
this.SpeedPictureBox.Size = new System.Drawing.Size(16, 16);
|
||||
this.SpeedPictureBox.TabIndex = 9;
|
||||
this.SpeedPictureBox.TabStop = false;
|
||||
this.SpeedPictureBox.Click += new System.EventHandler(this.SpeedPictureBox_Click);
|
||||
//
|
||||
// DeletePictureBox
|
||||
//
|
||||
this.DeletePictureBox.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.DeletePictureBox.Image = ((System.Drawing.Image)(resources.GetObject("DeletePictureBox.Image")));
|
||||
this.DeletePictureBox.Location = new System.Drawing.Point(540, 26);
|
||||
this.DeletePictureBox.Name = "DeletePictureBox";
|
||||
this.DeletePictureBox.Size = new System.Drawing.Size(16, 16);
|
||||
this.DeletePictureBox.TabIndex = 8;
|
||||
this.DeletePictureBox.TabStop = false;
|
||||
this.DeletePictureBox.Click += new System.EventHandler(this.DeletePictureBox_Click);
|
||||
//
|
||||
// EditPictureBox
|
||||
//
|
||||
this.EditPictureBox.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.EditPictureBox.Image = ((System.Drawing.Image)(resources.GetObject("EditPictureBox.Image")));
|
||||
this.EditPictureBox.Location = new System.Drawing.Point(518, 26);
|
||||
this.EditPictureBox.Name = "EditPictureBox";
|
||||
this.EditPictureBox.Size = new System.Drawing.Size(16, 16);
|
||||
this.EditPictureBox.TabIndex = 7;
|
||||
this.EditPictureBox.TabStop = false;
|
||||
this.EditPictureBox.Click += new System.EventHandler(this.EditPictureBox_Click);
|
||||
//
|
||||
// ModeLabel
|
||||
//
|
||||
this.ModeLabel.AutoSize = true;
|
||||
this.ModeLabel.Location = new System.Drawing.Point(6, 56);
|
||||
this.ModeLabel.Name = "ModeLabel";
|
||||
this.ModeLabel.Size = new System.Drawing.Size(43, 17);
|
||||
this.ModeLabel.TabIndex = 3;
|
||||
this.ModeLabel.Text = "Mode";
|
||||
//
|
||||
// ModeComboBox
|
||||
//
|
||||
this.ModeComboBox.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest;
|
||||
this.ModeComboBox.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
|
||||
this.ModeComboBox.FormattingEnabled = true;
|
||||
this.ModeComboBox.IntegralHeight = false;
|
||||
this.ModeComboBox.Location = new System.Drawing.Point(57, 53);
|
||||
this.ModeComboBox.Name = "ModeComboBox";
|
||||
this.ModeComboBox.Size = new System.Drawing.Size(455, 24);
|
||||
this.ModeComboBox.TabIndex = 2;
|
||||
this.ModeComboBox.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.ComboBox_DrawItem);
|
||||
//
|
||||
// ServerComboBox
|
||||
//
|
||||
this.ServerComboBox.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
|
||||
this.ServerComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.ServerComboBox.FormattingEnabled = true;
|
||||
this.ServerComboBox.IntegralHeight = false;
|
||||
this.ServerComboBox.Location = new System.Drawing.Point(57, 22);
|
||||
this.ServerComboBox.MaxDropDownItems = 16;
|
||||
this.ServerComboBox.Name = "ServerComboBox";
|
||||
this.ServerComboBox.Size = new System.Drawing.Size(455, 24);
|
||||
this.ServerComboBox.TabIndex = 1;
|
||||
this.ServerComboBox.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.ComboBox_DrawItem);
|
||||
//
|
||||
// ServerLabel
|
||||
//
|
||||
this.ServerLabel.AutoSize = true;
|
||||
this.ServerLabel.Location = new System.Drawing.Point(6, 26);
|
||||
this.ServerLabel.Name = "ServerLabel";
|
||||
this.ServerLabel.Size = new System.Drawing.Size(45, 17);
|
||||
this.ServerLabel.TabIndex = 0;
|
||||
this.ServerLabel.Text = "Server";
|
||||
this.DeleteModePictureBox.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.DeleteModePictureBox.Image = global::Netch.Properties.Resources.delete;
|
||||
this.DeleteModePictureBox.Location = new System.Drawing.Point(26, 3);
|
||||
this.DeleteModePictureBox.Name = "DeleteModePictureBox";
|
||||
this.DeleteModePictureBox.Size = new System.Drawing.Size(16, 16);
|
||||
this.DeleteModePictureBox.TabIndex = 13;
|
||||
this.DeleteModePictureBox.TabStop = false;
|
||||
this.DeleteModePictureBox.Click += new System.EventHandler(this.DeleteModePictureBox_Click);
|
||||
//
|
||||
// StatusStrip
|
||||
//
|
||||
@@ -424,9 +539,9 @@ namespace Netch.Forms
|
||||
this.DownloadSpeedLabel,
|
||||
this.UploadSpeedLabel,
|
||||
this.NatTypeStatusLabel});
|
||||
this.StatusStrip.Location = new System.Drawing.Point(0, 254);
|
||||
this.StatusStrip.Location = new System.Drawing.Point(0, 250);
|
||||
this.StatusStrip.Name = "StatusStrip";
|
||||
this.StatusStrip.Size = new System.Drawing.Size(629, 22);
|
||||
this.StatusStrip.Size = new System.Drawing.Size(733, 22);
|
||||
this.StatusStrip.SizingGrip = false;
|
||||
this.StatusStrip.TabIndex = 2;
|
||||
//
|
||||
@@ -458,9 +573,15 @@ namespace Netch.Forms
|
||||
this.UploadSpeedLabel.Text = "↑: 0 KB/s";
|
||||
this.UploadSpeedLabel.Visible = false;
|
||||
//
|
||||
// NatTypeStatusLabel
|
||||
//
|
||||
this.NatTypeStatusLabel.Name = "NatTypeStatusLabel";
|
||||
this.NatTypeStatusLabel.Size = new System.Drawing.Size(0, 17);
|
||||
//
|
||||
// ControlButton
|
||||
//
|
||||
this.ControlButton.Location = new System.Drawing.Point(542, 219);
|
||||
this.ControlButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.ControlButton.Location = new System.Drawing.Point(646, 214);
|
||||
this.ControlButton.Name = "ControlButton";
|
||||
this.ControlButton.Size = new System.Drawing.Size(75, 27);
|
||||
this.ControlButton.TabIndex = 3;
|
||||
@@ -502,7 +623,8 @@ namespace Netch.Forms
|
||||
//
|
||||
// SettingsButton
|
||||
//
|
||||
this.SettingsButton.Location = new System.Drawing.Point(12, 219);
|
||||
this.SettingsButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.SettingsButton.Location = new System.Drawing.Point(12, 215);
|
||||
this.SettingsButton.Name = "SettingsButton";
|
||||
this.SettingsButton.Size = new System.Drawing.Size(72, 27);
|
||||
this.SettingsButton.TabIndex = 4;
|
||||
@@ -513,9 +635,9 @@ namespace Netch.Forms
|
||||
// ProfileGroupBox
|
||||
//
|
||||
this.ProfileGroupBox.Controls.Add(this.ProfileTable);
|
||||
this.ProfileGroupBox.Location = new System.Drawing.Point(12, 147);
|
||||
this.ProfileGroupBox.Location = new System.Drawing.Point(12, 146);
|
||||
this.ProfileGroupBox.Name = "ProfileGroupBox";
|
||||
this.ProfileGroupBox.Size = new System.Drawing.Size(605, 65);
|
||||
this.ProfileGroupBox.Size = new System.Drawing.Size(709, 65);
|
||||
this.ProfileGroupBox.TabIndex = 13;
|
||||
this.ProfileGroupBox.TabStop = false;
|
||||
this.ProfileGroupBox.Text = "Profiles";
|
||||
@@ -533,20 +655,14 @@ namespace Netch.Forms
|
||||
this.ProfileTable.RowCount = 1;
|
||||
this.ProfileTable.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
|
||||
this.ProfileTable.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
|
||||
this.ProfileTable.Size = new System.Drawing.Size(599, 43);
|
||||
this.ProfileTable.Size = new System.Drawing.Size(703, 43);
|
||||
this.ProfileTable.TabIndex = 0;
|
||||
//
|
||||
// NatTypeStatusLabel
|
||||
//
|
||||
this.NatTypeStatusLabel.Name = "NatTypeStatusLabel";
|
||||
this.NatTypeStatusLabel.Size = new System.Drawing.Size(109, 17);
|
||||
this.NatTypeStatusLabel.Text = "";
|
||||
//
|
||||
// MainForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
|
||||
this.ClientSize = new System.Drawing.Size(629, 276);
|
||||
this.ClientSize = new System.Drawing.Size(733, 272);
|
||||
this.Controls.Add(this.ProfileGroupBox);
|
||||
this.Controls.Add(this.SettingsButton);
|
||||
this.Controls.Add(this.ControlButton);
|
||||
@@ -566,13 +682,16 @@ namespace Netch.Forms
|
||||
this.MenuStrip.ResumeLayout(false);
|
||||
this.MenuStrip.PerformLayout();
|
||||
this.ConfigurationGroupBox.ResumeLayout(false);
|
||||
this.ConfigurationGroupBox.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.CopyLinkPictureBox)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.DeleteModePictureBox)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.EditModePictureBox)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.SpeedPictureBox)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.DeletePictureBox)).EndInit();
|
||||
this.configLayoutPanel.ResumeLayout(false);
|
||||
this.configLayoutPanel.PerformLayout();
|
||||
this.tableLayoutPanel2.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.EditPictureBox)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.CopyLinkPictureBox)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.DeletePictureBox)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.SpeedPictureBox)).EndInit();
|
||||
this.tableLayoutPanel3.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.EditModePictureBox)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.DeleteModePictureBox)).EndInit();
|
||||
this.StatusStrip.ResumeLayout(false);
|
||||
this.StatusStrip.PerformLayout();
|
||||
this.NotifyMenu.ResumeLayout(false);
|
||||
@@ -632,5 +751,14 @@ namespace Netch.Forms
|
||||
private System.Windows.Forms.PictureBox DeleteModePictureBox;
|
||||
private System.Windows.Forms.PictureBox CopyLinkPictureBox;
|
||||
private System.Windows.Forms.ToolStripStatusLabel NatTypeStatusLabel;
|
||||
private System.Windows.Forms.TableLayoutPanel configLayoutPanel;
|
||||
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2;
|
||||
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel3;
|
||||
private System.Windows.Forms.ToolStripMenuItem UpdateACLToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem updateACLWithProxyToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem reinstallTapDriverToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem AddTrojanServerToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem RelyToolStripMenuItem;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,6 @@
|
||||
using Microsoft.Win32;
|
||||
using Netch.Controllers;
|
||||
using Netch.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
@@ -49,13 +51,40 @@ namespace Netch.Forms
|
||||
public MainForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
// 监听电源事件
|
||||
SystemEvents.PowerModeChanged += new PowerModeChangedEventHandler(SystemEvents_PowerModeChanged);
|
||||
|
||||
VersionLabel.Text = UpdateChecker.Version;
|
||||
|
||||
CheckForIllegalCrossThreadCalls = false;
|
||||
// MenuStrip.Renderer = new Override.ToolStripProfessionalRender();
|
||||
Instance = this;
|
||||
}
|
||||
/// <summary>
|
||||
/// 监听电源事件,自动重启Netch服务
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
void SystemEvents_PowerModeChanged(object sender, PowerModeChangedEventArgs e)
|
||||
{
|
||||
//不对Netch命令等待状态的电源事件做任何处理
|
||||
if (!State.Equals(Models.State.Waiting))
|
||||
{
|
||||
switch (e.Mode)
|
||||
{
|
||||
case PowerModes.Suspend://操作系统即将挂起
|
||||
Logging.Info("操作系统即将挂起,自动停止===>" + DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"));
|
||||
ControlFun();
|
||||
break;
|
||||
case PowerModes.Resume://操作系统即将从挂起状态继续
|
||||
Logging.Info("操作系统即将从挂起状态继续,自动重启===>" + DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"));
|
||||
ControlFun();
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
private void CheckUpdate()
|
||||
{
|
||||
var updater = new UpdateChecker();
|
||||
@@ -71,10 +100,16 @@ namespace Netch.Forms
|
||||
|
||||
public void TestServer()
|
||||
{
|
||||
Parallel.ForEach(Global.Settings.Server, new ParallelOptions { MaxDegreeOfParallelism = 16 }, server =>
|
||||
try
|
||||
{
|
||||
server.Test();
|
||||
});
|
||||
Parallel.ForEach(Global.Settings.Server, new ParallelOptions { MaxDegreeOfParallelism = 16 }, server =>
|
||||
{
|
||||
server.Test();
|
||||
});
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public void InitServer()
|
||||
@@ -143,7 +178,7 @@ namespace Netch.Forms
|
||||
|
||||
if (splited.Length >= 1)
|
||||
{
|
||||
mode.Remark = splited[0].Trim();
|
||||
mode.Remark = Utils.i18N.Translate(splited[0].Trim());
|
||||
}
|
||||
|
||||
if (splited.Length >= 2)
|
||||
@@ -225,13 +260,17 @@ namespace Netch.Forms
|
||||
private void SaveConfigs()
|
||||
{
|
||||
Global.Settings.ServerComboBoxSelectedIndex = ServerComboBox.SelectedIndex;
|
||||
if (ModeComboBox.Tag is object[] list)
|
||||
if (ModeComboBox.Items.Count != 0 && ModeComboBox.SelectedItem != null)
|
||||
{
|
||||
Global.Settings.ModeComboBoxSelectedIndex = list.ToList().IndexOf(ModeComboBox.SelectedItem);
|
||||
}
|
||||
else
|
||||
{
|
||||
Global.Settings.ModeComboBoxSelectedIndex = ModeComboBox.Items.IndexOf(ModeComboBox.SelectedItem);
|
||||
|
||||
if (ModeComboBox.Tag is object[] list)
|
||||
{
|
||||
Global.Settings.ModeComboBoxSelectedIndex = list.ToList().IndexOf(ModeComboBox.SelectedItem);
|
||||
}
|
||||
else
|
||||
{
|
||||
Global.Settings.ModeComboBoxSelectedIndex = ModeComboBox.Items.IndexOf(ModeComboBox.SelectedItem);
|
||||
}
|
||||
}
|
||||
Utils.Configuration.Save();
|
||||
}
|
||||
@@ -302,9 +341,6 @@ namespace Netch.Forms
|
||||
|
||||
private void MainForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
// 加载配置
|
||||
Utils.Configuration.Load();
|
||||
|
||||
// 加载服务器
|
||||
InitServer();
|
||||
|
||||
@@ -318,6 +354,7 @@ namespace Netch.Forms
|
||||
AddShadowsocksServerToolStripMenuItem.Text = Utils.i18N.Translate(AddShadowsocksServerToolStripMenuItem.Text);
|
||||
AddShadowsocksRServerToolStripMenuItem.Text = Utils.i18N.Translate(AddShadowsocksRServerToolStripMenuItem.Text);
|
||||
AddVMessServerToolStripMenuItem.Text = Utils.i18N.Translate(AddVMessServerToolStripMenuItem.Text);
|
||||
AddTrojanServerToolStripMenuItem.Text = Utils.i18N.Translate(AddTrojanServerToolStripMenuItem.Text);
|
||||
ModeToolStripMenuItem.Text = Utils.i18N.Translate(ModeToolStripMenuItem.Text);
|
||||
CreateProcessModeToolStripMenuItem.Text = Utils.i18N.Translate(CreateProcessModeToolStripMenuItem.Text);
|
||||
ManageProcessModeToolStripMenuItem.Text = Utils.i18N.Translate(ManageProcessModeToolStripMenuItem.Text);
|
||||
@@ -325,10 +362,14 @@ namespace Netch.Forms
|
||||
ManageSubscribeLinksToolStripMenuItem.Text = Utils.i18N.Translate(ManageSubscribeLinksToolStripMenuItem.Text);
|
||||
UpdateServersFromSubscribeLinksToolStripMenuItem.Text = Utils.i18N.Translate(UpdateServersFromSubscribeLinksToolStripMenuItem.Text);
|
||||
OptionsToolStripMenuItem.Text = Utils.i18N.Translate(OptionsToolStripMenuItem.Text);
|
||||
exitToolStripMenuItem.Text = Utils.i18N.Translate(exitToolStripMenuItem.Text);
|
||||
RestartServiceToolStripMenuItem.Text = Utils.i18N.Translate(RestartServiceToolStripMenuItem.Text);
|
||||
UninstallServiceToolStripMenuItem.Text = Utils.i18N.Translate(UninstallServiceToolStripMenuItem.Text);
|
||||
ReloadModesToolStripMenuItem.Text = Utils.i18N.Translate(ReloadModesToolStripMenuItem.Text);
|
||||
CleanDNSCacheToolStripMenuItem.Text = Utils.i18N.Translate(CleanDNSCacheToolStripMenuItem.Text);
|
||||
UpdateACLToolStripMenuItem.Text = Utils.i18N.Translate(UpdateACLToolStripMenuItem.Text);
|
||||
updateACLWithProxyToolStripMenuItem.Text = Utils.i18N.Translate(updateACLWithProxyToolStripMenuItem.Text);
|
||||
reinstallTapDriverToolStripMenuItem.Text = Utils.i18N.Translate(reinstallTapDriverToolStripMenuItem.Text);
|
||||
AboutToolStripButton.Text = Utils.i18N.Translate(AboutToolStripButton.Text);
|
||||
ConfigurationGroupBox.Text = Utils.i18N.Translate(ConfigurationGroupBox.Text);
|
||||
ServerLabel.Text = Utils.i18N.Translate(ServerLabel.Text);
|
||||
@@ -341,6 +382,7 @@ namespace Netch.Forms
|
||||
StatusLabel.Text = $@"{Utils.i18N.Translate("Status")}{Utils.i18N.Translate(": ")}{Utils.i18N.Translate("Waiting for command")}";
|
||||
ShowMainFormToolStripButton.Text = Utils.i18N.Translate(ShowMainFormToolStripButton.Text);
|
||||
ExitToolStripButton.Text = Utils.i18N.Translate(ExitToolStripButton.Text);
|
||||
RelyToolStripMenuItem.Text = Utils.i18N.Translate(RelyToolStripMenuItem.Text);
|
||||
|
||||
InitProfile();
|
||||
|
||||
@@ -455,6 +497,12 @@ namespace Netch.Forms
|
||||
Hide();
|
||||
}
|
||||
|
||||
private void AddTrojanServerToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
new Server.Trojan().Show();
|
||||
Hide();
|
||||
}
|
||||
|
||||
private void CreateProcessModeToolStripButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
new Mode.Process().Show();
|
||||
@@ -474,6 +522,9 @@ namespace Netch.Forms
|
||||
|
||||
private void UpdateServersFromSubscribeLinksToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (Global.Settings.UseProxyToUpdateSubscription && ServerComboBox.SelectedIndex == -1)
|
||||
Global.Settings.UseProxyToUpdateSubscription = false;
|
||||
|
||||
if (Global.Settings.UseProxyToUpdateSubscription)
|
||||
{
|
||||
// 当前 ServerComboBox 中至少有一项
|
||||
@@ -699,7 +750,7 @@ namespace Netch.Forms
|
||||
|
||||
private void VersionLabel_Click(object sender, EventArgs e)
|
||||
{
|
||||
Process.Start("https://github.com/NetchX/Netch/releases");
|
||||
Process.Start($"https://github.com/{UpdateChecker.Owner}/{UpdateChecker.Repo}/releases");
|
||||
}
|
||||
|
||||
private void EditPictureBox_Click(object sender, EventArgs e)
|
||||
@@ -722,6 +773,9 @@ namespace Netch.Forms
|
||||
case "VMess":
|
||||
new Server.VMess(ServerComboBox.SelectedIndex).Show();
|
||||
break;
|
||||
case "Trojan":
|
||||
new Server.Trojan(ServerComboBox.SelectedIndex).Show();
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
@@ -774,6 +828,12 @@ namespace Netch.Forms
|
||||
|
||||
private void ControlButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
ControlFun();
|
||||
}
|
||||
public void ControlFun()
|
||||
{
|
||||
//聚焦到启动按钮,防止模式选择框变成蓝色:D,不过好像没啥用
|
||||
ControlButton.Focus();
|
||||
SaveConfigs();
|
||||
if (State == Models.State.Waiting || State == Models.State.Stopped)
|
||||
{
|
||||
@@ -791,7 +851,20 @@ namespace Netch.Forms
|
||||
return;
|
||||
}
|
||||
|
||||
MenuStrip.Enabled = ConfigurationGroupBox.Enabled = ControlButton.Enabled = SettingsButton.Enabled = false;
|
||||
//MenuStrip.Enabled = ConfigurationGroupBox.Enabled = ControlButton.Enabled = SettingsButton.Enabled = false;
|
||||
|
||||
//关闭启动按钮
|
||||
ControlButton.Enabled = false;
|
||||
|
||||
//关闭部分选项功能
|
||||
RestartServiceToolStripMenuItem.Enabled = false;
|
||||
UninstallServiceToolStripMenuItem.Enabled = false;
|
||||
updateACLWithProxyToolStripMenuItem.Enabled = false;
|
||||
UpdateServersFromSubscribeLinksToolStripMenuItem.Enabled = false;
|
||||
reinstallTapDriverToolStripMenuItem.Enabled = false;
|
||||
ServerComboBox.Enabled = false;
|
||||
ModeComboBox.Enabled = false;
|
||||
|
||||
ControlButton.Text = "...";
|
||||
StatusLabel.Text = $"{Utils.i18N.Translate("Status")}{Utils.i18N.Translate(": ")}{Utils.i18N.Translate("Starting")}";
|
||||
State = Models.State.Starting;
|
||||
@@ -807,8 +880,20 @@ namespace Netch.Forms
|
||||
|
||||
if (startResult)
|
||||
{
|
||||
// UsedBandwidthLabel.Visible = UploadSpeedLabel.Visible = DownloadSpeedLabel.Visible = true;
|
||||
// MainController.pNFController.OnBandwidthUpdated += OnBandwidthUpdated;
|
||||
Task.Run(() =>
|
||||
{
|
||||
LastUploadBandwidth = 0;
|
||||
//LastDownloadBandwidth = 0;
|
||||
//UploadSpeedLabel.Text = "↑: 0 KB/s";
|
||||
DownloadSpeedLabel.Text = "↑↓: 0 KB/s";
|
||||
UsedBandwidthLabel.Text = $"{Utils.i18N.Translate("Used")}{Utils.i18N.Translate(": ")}0 KB";
|
||||
UsedBandwidthLabel.Visible = UploadSpeedLabel.Visible = DownloadSpeedLabel.Visible = true;
|
||||
|
||||
|
||||
UploadSpeedLabel.Visible = false;
|
||||
Bandwidth.NetTraffic(server, mode, MainController);
|
||||
});
|
||||
//MainController.pNFController.OnBandwidthUpdated += OnBandwidthUpdated;
|
||||
|
||||
// 如果勾选启动后最小化
|
||||
if (Global.Settings.MinimizeWhenStarted)
|
||||
@@ -875,10 +960,43 @@ namespace Netch.Forms
|
||||
}
|
||||
|
||||
State = Models.State.Started;
|
||||
if (Global.Settings.StartedTcping)
|
||||
{
|
||||
// 自动检测延迟
|
||||
Task.Run(() =>
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
if (State == Models.State.Started)
|
||||
{
|
||||
server.Test();
|
||||
// 重载服务器列表
|
||||
InitServer();
|
||||
|
||||
Thread.Sleep(Global.Settings.StartedTcping_Interval * 1000);
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MenuStrip.Enabled = ConfigurationGroupBox.Enabled = ControlButton.Enabled = SettingsButton.Enabled = true;
|
||||
|
||||
RestartServiceToolStripMenuItem.Enabled = true;
|
||||
UninstallServiceToolStripMenuItem.Enabled = true;
|
||||
updateACLWithProxyToolStripMenuItem.Enabled = true;
|
||||
UpdateServersFromSubscribeLinksToolStripMenuItem.Enabled = true;
|
||||
reinstallTapDriverToolStripMenuItem.Enabled = true;
|
||||
ServerComboBox.Enabled = true;
|
||||
ModeComboBox.Enabled = true;
|
||||
//隐藏NTT测试
|
||||
NatTypeStatusLabel.Visible = false;
|
||||
|
||||
ControlButton.Text = Utils.i18N.Translate("Start");
|
||||
StatusLabel.Text = $"{Utils.i18N.Translate("Status")}{Utils.i18N.Translate(": ")}{Utils.i18N.Translate("Start failed")}";
|
||||
State = Models.State.Stopped;
|
||||
@@ -887,6 +1005,7 @@ namespace Netch.Forms
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
ControlButton.Enabled = false;
|
||||
ControlButton.Text = "...";
|
||||
StatusLabel.Text = $"{Utils.i18N.Translate("Status")}{Utils.i18N.Translate(": ")}{Utils.i18N.Translate("Stopping")}";
|
||||
@@ -904,16 +1023,26 @@ namespace Netch.Forms
|
||||
MainController.Stop();
|
||||
NatTypeStatusLabel.Text = "";
|
||||
|
||||
// LastUploadBandwidth = 0;
|
||||
// LastDownloadBandwidth = 0;
|
||||
// UploadSpeedLabel.Text = "↑: 0 KB/s";
|
||||
// DownloadSpeedLabel.Text = "↓: 0 KB/s";
|
||||
// UsedBandwidthLabel.Text = $"{Utils.i18N.Translate("Used")}{Utils.i18N.Translate(": ")}0 KB";
|
||||
// UsedBandwidthLabel.Visible = UploadSpeedLabel.Visible = DownloadSpeedLabel.Visible = false;
|
||||
LastUploadBandwidth = 0;
|
||||
LastDownloadBandwidth = 0;
|
||||
UploadSpeedLabel.Text = "↑: 0 KB/s";
|
||||
DownloadSpeedLabel.Text = "↓: 0 KB/s";
|
||||
UsedBandwidthLabel.Text = $"{Utils.i18N.Translate("Used")}{Utils.i18N.Translate(": ")}0 KB";
|
||||
UsedBandwidthLabel.Visible = UploadSpeedLabel.Visible = DownloadSpeedLabel.Visible = false;
|
||||
|
||||
ControlButton.Enabled = true;
|
||||
ProfileGroupBox.Enabled = true;
|
||||
|
||||
RestartServiceToolStripMenuItem.Enabled = true;
|
||||
UninstallServiceToolStripMenuItem.Enabled = true;
|
||||
updateACLWithProxyToolStripMenuItem.Enabled = true;
|
||||
UpdateServersFromSubscribeLinksToolStripMenuItem.Enabled = true;
|
||||
reinstallTapDriverToolStripMenuItem.Enabled = true;
|
||||
ServerComboBox.Enabled = true;
|
||||
ModeComboBox.Enabled = true;
|
||||
//隐藏NTT测试
|
||||
NatTypeStatusLabel.Visible = false;
|
||||
|
||||
ControlButton.Text = Utils.i18N.Translate("Start");
|
||||
StatusLabel.Text = $"{Utils.i18N.Translate("Status")}{Utils.i18N.Translate(": ")}{Utils.i18N.Translate("Stopped")}";
|
||||
State = Models.State.Stopped;
|
||||
@@ -921,8 +1050,8 @@ namespace Netch.Forms
|
||||
TestServer();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
private void ShowMainFormToolStripButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (WindowState == FormWindowState.Minimized)
|
||||
@@ -990,16 +1119,42 @@ namespace Netch.Forms
|
||||
new AboutForm().Show();
|
||||
Hide();
|
||||
}
|
||||
public void OnBandwidthUpdated(long download)
|
||||
{
|
||||
try
|
||||
{
|
||||
UsedBandwidthLabel.Text = $"{Utils.i18N.Translate("Used")}{Utils.i18N.Translate(": ")}{Utils.Bandwidth.Compute(download)}";
|
||||
//UploadSpeedLabel.Text = $"↑: {Utils.Bandwidth.Compute(upload - LastUploadBandwidth)}/s";
|
||||
DownloadSpeedLabel.Text = $"↑↓: {Utils.Bandwidth.Compute(download - LastDownloadBandwidth)}/s";
|
||||
|
||||
//LastUploadBandwidth = upload;
|
||||
LastDownloadBandwidth = download;
|
||||
Refresh();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public void OnBandwidthUpdated(long upload, long download)
|
||||
{
|
||||
UsedBandwidthLabel.Text = $"{Utils.i18N.Translate("Used")}{Utils.i18N.Translate(": ")}{Utils.Bandwidth.Compute(upload + download)}";
|
||||
UploadSpeedLabel.Text = $"↑: {Utils.Bandwidth.Compute(upload - LastUploadBandwidth)}/s";
|
||||
DownloadSpeedLabel.Text = $"↓: {Utils.Bandwidth.Compute(download - LastDownloadBandwidth)}/s";
|
||||
try
|
||||
{
|
||||
if (upload < 1 || download < 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
UsedBandwidthLabel.Text = $"{Utils.i18N.Translate("Used")}{Utils.i18N.Translate(": ")}{Utils.Bandwidth.Compute(upload + download)}";
|
||||
UploadSpeedLabel.Text = $"↑: {Utils.Bandwidth.Compute(upload - LastUploadBandwidth)}/s";
|
||||
DownloadSpeedLabel.Text = $"↓: {Utils.Bandwidth.Compute(download - LastDownloadBandwidth)}/s";
|
||||
|
||||
LastUploadBandwidth = upload;
|
||||
LastDownloadBandwidth = download;
|
||||
Refresh();
|
||||
LastUploadBandwidth = upload;
|
||||
LastDownloadBandwidth = download;
|
||||
Refresh();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
private void ProfileButton_Click(object sender, EventArgs e)
|
||||
@@ -1018,6 +1173,10 @@ namespace Netch.Forms
|
||||
{
|
||||
MessageBox.Show(Utils.i18N.Translate("Please select an mode first"), Utils.i18N.Translate("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
else if (ProfileNameText.Text == "")
|
||||
{
|
||||
MessageBox.Show(Utils.i18N.Translate("Please enter a profile name first"), Utils.i18N.Translate("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
else
|
||||
{
|
||||
SaveProfile(index);
|
||||
@@ -1026,6 +1185,11 @@ namespace Netch.Forms
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ProfileButtons[index].Text == Utils.i18N.Translate("Error") || ProfileButtons[index].Text == Utils.i18N.Translate("None"))
|
||||
{
|
||||
MessageBox.Show(Utils.i18N.Translate("No saved profile here. Save a profile first by Ctrl+Click on the button"), Utils.i18N.Translate("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
ProfileNameText.Text = LoadProfile(index);
|
||||
@@ -1071,6 +1235,15 @@ namespace Netch.Forms
|
||||
public void InitProfile()
|
||||
{
|
||||
var num_profile = Global.Settings.ProfileCount;
|
||||
if (num_profile == 0)
|
||||
{
|
||||
ProfileGroupBox.Size = new Size(0, 0);
|
||||
ConfigurationGroupBox.Size -= new Size(0, 25);
|
||||
this.Size -= new Size(0, 70 + 25);
|
||||
configLayoutPanel.RowStyles[2].Height = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
ProfileTable.ColumnCount = num_profile;
|
||||
|
||||
while (Global.Settings.profiles.Count < num_profile)
|
||||
@@ -1214,7 +1387,15 @@ namespace Netch.Forms
|
||||
if (ServerComboBox.SelectedIndex != -1)
|
||||
{
|
||||
var selectedMode = (Models.Server)ServerComboBox.SelectedItem;
|
||||
Clipboard.SetText(Utils.ShareLink.GetShareLink(selectedMode));
|
||||
try
|
||||
{
|
||||
//听说巨硬BUG经常会炸,所以Catch一下 :D
|
||||
Clipboard.SetText(Utils.ShareLink.GetShareLink(selectedMode));
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1227,8 +1408,10 @@ namespace Netch.Forms
|
||||
}
|
||||
public void NatTypeStatusText(string text)
|
||||
{
|
||||
NatTypeStatusLabel.Visible = true;
|
||||
if (!string.IsNullOrWhiteSpace(text))
|
||||
{
|
||||
text = text.Trim();
|
||||
NatTypeStatusLabel.Text = "NAT" + Utils.i18N.Translate(": ") + text;
|
||||
}
|
||||
else
|
||||
@@ -1236,5 +1419,154 @@ namespace Netch.Forms
|
||||
NatTypeStatusLabel.Text = "NAT" + Utils.i18N.Translate(": ") + Utils.i18N.Translate("Test failed");
|
||||
}
|
||||
}
|
||||
|
||||
private void exitToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
// 当前状态如果不是已停止状态
|
||||
if (State != Models.State.Waiting && State != Models.State.Stopped)
|
||||
{
|
||||
// 如果未勾选退出时停止,要求先点击停止按钮
|
||||
if (!Global.Settings.StopWhenExited)
|
||||
{
|
||||
MessageBox.Show(Utils.i18N.Translate("Please press Stop button first"), Utils.i18N.Translate("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
|
||||
Visible = true;
|
||||
ShowInTaskbar = true; // 显示在系统任务栏
|
||||
WindowState = FormWindowState.Normal; // 还原窗体
|
||||
NotifyIcon.Visible = true; // 托盘图标隐藏
|
||||
|
||||
return;
|
||||
}
|
||||
// 否则直接调用停止按钮的方法
|
||||
|
||||
ControlButton_Click(sender, e);
|
||||
}
|
||||
|
||||
SaveConfigs();
|
||||
|
||||
State = Models.State.Terminating;
|
||||
NotifyIcon.Visible = false;
|
||||
Close();
|
||||
Dispose();
|
||||
Environment.Exit(Environment.ExitCode);
|
||||
}
|
||||
|
||||
private void updateACLToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
StatusText($"{Utils.i18N.Translate("Status")}{Utils.i18N.Translate(": ")}{Utils.i18N.Translate("Starting update ACL")}");
|
||||
using var client = new Override.WebClient();
|
||||
|
||||
client.DownloadFileTaskAsync(Global.Settings.ACL, "bin\\default.acl");
|
||||
client.DownloadFileCompleted += ((sender, args) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
if (args.Error == null)
|
||||
{
|
||||
NotifyIcon.ShowBalloonTip(5,
|
||||
UpdateChecker.Name, Utils.i18N.Translate("ACL updated successfully"),
|
||||
ToolTipIcon.Info);
|
||||
}
|
||||
else
|
||||
{
|
||||
Utils.Logging.Info("ACL 更新失败!" + args.Error);
|
||||
MessageBox.Show(Utils.i18N.Translate("ACL update failed") + "\n" + args.Error);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
StatusText($"{Utils.i18N.Translate("Status")}{Utils.i18N.Translate(": ")}{Utils.i18N.Translate("Waiting for command")}");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void updateACLWithProxyToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
updateACLWithProxyToolStripMenuItem.Enabled = false;
|
||||
if (Global.Settings.UseProxyToUpdateSubscription)
|
||||
{
|
||||
// 当前 ServerComboBox 中至少有一项
|
||||
if (ServerComboBox.SelectedIndex == -1)
|
||||
{
|
||||
MessageBox.Show(Utils.i18N.Translate("Please select a server first"), Utils.i18N.Translate("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
return;
|
||||
}
|
||||
MenuStrip.Enabled = ConfigurationGroupBox.Enabled = ControlButton.Enabled = SettingsButton.Enabled = false;
|
||||
ControlButton.Text = "...";
|
||||
}
|
||||
|
||||
Task.Run(() =>
|
||||
{
|
||||
var mode = new Models.Mode
|
||||
{
|
||||
Remark = "ProxyUpdate",
|
||||
Type = 5
|
||||
};
|
||||
MainController = new MainController();
|
||||
MainController.Start(ServerComboBox.SelectedItem as Models.Server, mode);
|
||||
|
||||
using var client = new Override.WebClient();
|
||||
|
||||
client.Proxy = new System.Net.WebProxy($"http://127.0.0.1:{Global.Settings.HTTPLocalPort}");
|
||||
|
||||
StatusText($"{Utils.i18N.Translate("Status")}{Utils.i18N.Translate(": ")}{Utils.i18N.Translate("Updating in the background")}");
|
||||
try
|
||||
{
|
||||
client.DownloadFile(Global.Settings.ACL, "bin\\default.acl");
|
||||
NotifyIcon.ShowBalloonTip(5,
|
||||
UpdateChecker.Name, Utils.i18N.Translate("ACL updated successfully"),
|
||||
ToolTipIcon.Info);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Utils.Logging.Info("使用代理更新 ACL 失败!" + e.Message);
|
||||
MessageBox.Show(Utils.i18N.Translate("ACL update failed") + "\n" + e.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
updateACLWithProxyToolStripMenuItem.Enabled = true;
|
||||
MenuStrip.Enabled = ConfigurationGroupBox.Enabled = ControlButton.Enabled = SettingsButton.Enabled = true;
|
||||
|
||||
ControlButton.Text = Utils.i18N.Translate("Start");
|
||||
StatusText($"{Utils.i18N.Translate("Status")}{Utils.i18N.Translate(": ")}{Utils.i18N.Translate("Waiting for command")}");
|
||||
MainController.Stop();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void reinstallTapDriverToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
Task.Run(() =>
|
||||
{
|
||||
StatusText($"{Utils.i18N.Translate("Status")}{Utils.i18N.Translate(": ")}{Utils.i18N.Translate("Reinstalling TUN/TAP driver")}");
|
||||
Enabled = false;
|
||||
try
|
||||
{
|
||||
Configuration.deltapall();
|
||||
Configuration.addtap();
|
||||
NotifyIcon.ShowBalloonTip(5,
|
||||
UpdateChecker.Name, Utils.i18N.Translate("Reinstall TUN/TAP driver successfully"),
|
||||
ToolTipIcon.Info);
|
||||
}
|
||||
catch
|
||||
{
|
||||
NotifyIcon.ShowBalloonTip(5,
|
||||
UpdateChecker.Name, Utils.i18N.Translate("Reinstall TUN/TAP driver failed"),
|
||||
ToolTipIcon.Error);
|
||||
}
|
||||
finally
|
||||
{
|
||||
ControlButton.Text = Utils.i18N.Translate("Start");
|
||||
StatusText($"{Utils.i18N.Translate("Status")}{Utils.i18N.Translate(": ")}{Utils.i18N.Translate("Waiting for command")}");
|
||||
Enabled = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void RelyToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
Process.Start($"https://mega.nz/file/9OQ1EazJ#0pjJ3xt57AVLr29vYEEv15GSACtXVQOGlEOPpi_2Ico");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,20 +121,18 @@
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="SpeedPictureBox.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<data name="EditPictureBox.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAk9JREFUOE9N
|
||||
k19ojWEcx8+xsRgzbSlaJouGRCNuXIyMXJ1LpVyYFAttqylEsdKQC1yZpF24oJQrN0q5UJKUlP3DWTPz
|
||||
pzmm2Tk753nf9+fzfd/3nJ2nPr3v8z7P7/d7nu/v+ybMbBUsA703wwk/sKcPJz07POzszOg8HXAKBr55
|
||||
bLMmWKOgxZCEBfH7zg9/fev55Gw8G9jUXGC/IFMI7HXGt7ZBZ9fGHNtsJVQogYIrQMFVOc8GLn5x4eby
|
||||
UWB6k8AXU75N5gJ9aoBkMYGqL4JLbHB9bFRA+Xj207Pr0fcbTNtgC1QWE1TC6t/5INvF0UdmwgqlkZ4N
|
||||
rJvvP3JBmul6OArSrloJ6mAz3H383bMHE6FApZFlqitpbcbZhTnfWrzA9rNUDfVKsAFSY1Q5+9mFopWP
|
||||
IU6TGnJ2nrXetCslY6hwnRLo/q1XWVTr/iHwdCECQS2PFpl81IUnBLZ+LNit8bALRyA8gTTY0f816vVl
|
||||
Klwh2UneH5GweJ53076d5pv04SrSQiLWKkEVbFUl9VtItPYRZ6/iVr7549sx5sORuP2wBw5BgxIsgY2w
|
||||
DVZAlwLVc21/GwdTWRfvhXp4Cbv1rgRrQRbeDge466xaplO8x5FxMEvWCctBRTpgH4RGWgdyoRZuSyiJ
|
||||
qcrSIQ5+DgtBCXQCuXAphFaWjfVsnMD752iX2tQ5b6g7sAv0w20CiV50b3gCuTDB1ub7mGjvYCF0XRzc
|
||||
B/rrGkGqK7BYVI5MaFILSdzVdI9WHuRvG42Cj4Mc2g4toEJKUAMZSJlZzX8eY2N9ZDKIEQAAAABJRU5E
|
||||
rkJggg==
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAg9JREFUOE+F
|
||||
U81uElEYnTdw58qFunBlYnwAE7e+QhMT38CNcefWxKWufADjiqqtmsZIW2gRulBTY4fGGGmLMFOGn5aB
|
||||
GYa5c+f4nTsINKF6kkPIxz3nO/f7Llas1IXXGyW8Wi9h+T/kmVx+C7WGA8F14S2LxR8HdfjDAMMwFI7O
|
||||
YQg/CI14pVDGKIoGYnDZomMgB4gk0VAqgUoWkxjHMd5t7eCkTz2uWIxGd601nHYPR66H+nH7LKXW9LrG
|
||||
JBrHeL+9g1N/gDRNl4wBoxHhKDJxmWierPG3lGeiaGrQ9DpPjMFADJjA7fSko4ff0nWerDntWQJegQbl
|
||||
XRsLEiweZMAEEoFn1opl9GXopa97sFaLlWmCY0nAjo2WdCYn3ednIGvHodPCSIw+2z9hrRQqZoWzBLOu
|
||||
jBvJ1MlYyARK+LGl8LCWYq+vsyvMttA17oduiwOaru4vEhGvdzSuVRUu2THu7KvJDCYJxrHKugr5XdZk
|
||||
6kSsgWJXo+pr7J5q3K7GeFoXA75EDuRfYOyCdLZFTDhhipyboDsIv2QGg6H5YREorvSyzgTFH7wEnh8g
|
||||
0frxdAbn4Vs/xYtmNguK10TcCXjF+JmUrlpvNj/lDxqu2cDZFxialb1sKly0FZYl8oZc4yRK+CYeiPie
|
||||
8IYlH3dz+W3zuub5Vv5x33/V8VwG9aimsCniMEl92dZN0SxRB+D+Hw2grtB8iuYFAAAAAElFTkSuQmCC
|
||||
</value>
|
||||
</data>
|
||||
<data name="DeletePictureBox.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
@@ -151,18 +149,20 @@
|
||||
R+QMmWB7l2jP55IkExaBIP+X+VaqtcbLMAynmftgqMOzv61mlBRRiHFjAAAAAElFTkSuQmCC
|
||||
</value>
|
||||
</data>
|
||||
<data name="EditPictureBox.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<data name="SpeedPictureBox.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAg9JREFUOE+F
|
||||
U81uElEYnTdw58qFunBlYnwAE7e+QhMT38CNcefWxKWufADjiqqtmsZIW2gRulBTY4fGGGmLMFOGn5aB
|
||||
GYa5c+f4nTsINKF6kkPIxz3nO/f7Llas1IXXGyW8Wi9h+T/kmVx+C7WGA8F14S2LxR8HdfjDAMMwFI7O
|
||||
YQg/CI14pVDGKIoGYnDZomMgB4gk0VAqgUoWkxjHMd5t7eCkTz2uWIxGd601nHYPR66H+nH7LKXW9LrG
|
||||
JBrHeL+9g1N/gDRNl4wBoxHhKDJxmWierPG3lGeiaGrQ9DpPjMFADJjA7fSko4ff0nWerDntWQJegQbl
|
||||
XRsLEiweZMAEEoFn1opl9GXopa97sFaLlWmCY0nAjo2WdCYn3ednIGvHodPCSIw+2z9hrRQqZoWzBLOu
|
||||
jBvJ1MlYyARK+LGl8LCWYq+vsyvMttA17oduiwOaru4vEhGvdzSuVRUu2THu7KvJDCYJxrHKugr5XdZk
|
||||
6kSsgWJXo+pr7J5q3K7GeFoXA75EDuRfYOyCdLZFTDhhipyboDsIv2QGg6H5YREorvSyzgTFH7wEnh8g
|
||||
0frxdAbn4Vs/xYtmNguK10TcCXjF+JmUrlpvNj/lDxqu2cDZFxialb1sKly0FZYl8oZc4yRK+CYeiPie
|
||||
8IYlH3dz+W3zuub5Vv5x33/V8VwG9aimsCniMEl92dZN0SxRB+D+Hw2grtB8iuYFAAAAAElFTkSuQmCC
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAk9JREFUOE9N
|
||||
k19ojWEcx8+xsRgzbSlaJouGRCNuXIyMXJ1LpVyYFAttqylEsdKQC1yZpF24oJQrN0q5UJKUlP3DWTPz
|
||||
pzmm2Tk753nf9+fzfd/3nJ2nPr3v8z7P7/d7nu/v+ybMbBUsA703wwk/sKcPJz07POzszOg8HXAKBr55
|
||||
bLMmWKOgxZCEBfH7zg9/fev55Gw8G9jUXGC/IFMI7HXGt7ZBZ9fGHNtsJVQogYIrQMFVOc8GLn5x4eby
|
||||
UWB6k8AXU75N5gJ9aoBkMYGqL4JLbHB9bFRA+Xj207Pr0fcbTNtgC1QWE1TC6t/5INvF0UdmwgqlkZ4N
|
||||
rJvvP3JBmul6OArSrloJ6mAz3H383bMHE6FApZFlqitpbcbZhTnfWrzA9rNUDfVKsAFSY1Q5+9mFopWP
|
||||
IU6TGnJ2nrXetCslY6hwnRLo/q1XWVTr/iHwdCECQS2PFpl81IUnBLZ+LNit8bALRyA8gTTY0f816vVl
|
||||
Klwh2UneH5GweJ53076d5pv04SrSQiLWKkEVbFUl9VtItPYRZ6/iVr7549sx5sORuP2wBw5BgxIsgY2w
|
||||
DVZAlwLVc21/GwdTWRfvhXp4Cbv1rgRrQRbeDge466xaplO8x5FxMEvWCctBRTpgH4RGWgdyoRZuSyiJ
|
||||
qcrSIQ5+DgtBCXQCuXAphFaWjfVsnMD752iX2tQ5b6g7sAv0w20CiV50b3gCuTDB1ub7mGjvYCF0XRzc
|
||||
B/rrGkGqK7BYVI5MaFILSdzVdI9WHuRvG42Cj4Mc2g4toEJKUAMZSJlZzX8eY2N9ZDKIEQAAAABJRU5E
|
||||
rkJggg==
|
||||
</value>
|
||||
</data>
|
||||
<metadata name="StatusStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
|
||||
@@ -114,7 +114,8 @@ namespace Netch.Forms.Server
|
||||
Password = PasswordTextBox.Text,
|
||||
EncryptMethod = EncryptMethodComboBox.Text,
|
||||
Plugin = PluginTextBox.Text,
|
||||
PluginOption = PluginOptionsTextBox.Text
|
||||
PluginOption = PluginOptionsTextBox.Text,
|
||||
Country = null
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -134,7 +134,8 @@ namespace Netch.Forms.Server
|
||||
Protocol = ProtocolComboBox.Text,
|
||||
ProtocolParam = ProtocolParamTextBox.Text,
|
||||
OBFS = OBFSComboBox.Text,
|
||||
OBFSParam = OBFSOptionParamTextBox.Text
|
||||
OBFSParam = OBFSOptionParamTextBox.Text,
|
||||
Country = null
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -97,7 +97,8 @@ namespace Netch.Forms.Server
|
||||
Hostname = AddressTextBox.Text,
|
||||
Port = int.Parse(PortTextBox.Text),
|
||||
Username = UsernameTextBox.Text,
|
||||
Password = PasswordTextBox.Text
|
||||
Password = PasswordTextBox.Text,
|
||||
Country = null
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
176
Netch/Forms/Server/Trojan.Designer.cs
generated
Normal file
@@ -0,0 +1,176 @@
|
||||
namespace Netch.Forms.Server
|
||||
{
|
||||
partial class Trojan
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Trojan));
|
||||
this.ConfigurationGroupBox = new System.Windows.Forms.GroupBox();
|
||||
this.PasswordTextBox = new System.Windows.Forms.TextBox();
|
||||
this.PasswordLabel = new System.Windows.Forms.Label();
|
||||
this.AddressLabel = new System.Windows.Forms.Label();
|
||||
this.PortTextBox = new System.Windows.Forms.TextBox();
|
||||
this.AddressTextBox = new System.Windows.Forms.TextBox();
|
||||
this.RemarkTextBox = new System.Windows.Forms.TextBox();
|
||||
this.RemarkLabel = new System.Windows.Forms.Label();
|
||||
this.PortLabel = new System.Windows.Forms.Label();
|
||||
this.ControlButton = new System.Windows.Forms.Button();
|
||||
this.ConfigurationGroupBox.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// ConfigurationGroupBox
|
||||
//
|
||||
this.ConfigurationGroupBox.Controls.Add(this.PasswordTextBox);
|
||||
this.ConfigurationGroupBox.Controls.Add(this.PasswordLabel);
|
||||
this.ConfigurationGroupBox.Controls.Add(this.AddressLabel);
|
||||
this.ConfigurationGroupBox.Controls.Add(this.PortTextBox);
|
||||
this.ConfigurationGroupBox.Controls.Add(this.AddressTextBox);
|
||||
this.ConfigurationGroupBox.Controls.Add(this.RemarkTextBox);
|
||||
this.ConfigurationGroupBox.Controls.Add(this.RemarkLabel);
|
||||
this.ConfigurationGroupBox.Controls.Add(this.PortLabel);
|
||||
this.ConfigurationGroupBox.Location = new System.Drawing.Point(12, 12);
|
||||
this.ConfigurationGroupBox.Name = "ConfigurationGroupBox";
|
||||
this.ConfigurationGroupBox.Size = new System.Drawing.Size(420, 109);
|
||||
this.ConfigurationGroupBox.TabIndex = 0;
|
||||
this.ConfigurationGroupBox.TabStop = false;
|
||||
this.ConfigurationGroupBox.Text = "Configuration";
|
||||
//
|
||||
// PasswordTextBox
|
||||
//
|
||||
this.PasswordTextBox.Location = new System.Drawing.Point(120, 77);
|
||||
this.PasswordTextBox.Name = "PasswordTextBox";
|
||||
this.PasswordTextBox.Size = new System.Drawing.Size(294, 23);
|
||||
this.PasswordTextBox.TabIndex = 7;
|
||||
this.PasswordTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||
//
|
||||
// PasswordLabel
|
||||
//
|
||||
this.PasswordLabel.AutoSize = true;
|
||||
this.PasswordLabel.Location = new System.Drawing.Point(10, 80);
|
||||
this.PasswordLabel.Name = "PasswordLabel";
|
||||
this.PasswordLabel.Size = new System.Drawing.Size(64, 17);
|
||||
this.PasswordLabel.TabIndex = 6;
|
||||
this.PasswordLabel.Text = "Password";
|
||||
//
|
||||
// AddressLabel
|
||||
//
|
||||
this.AddressLabel.AutoSize = true;
|
||||
this.AddressLabel.Location = new System.Drawing.Point(10, 51);
|
||||
this.AddressLabel.Name = "AddressLabel";
|
||||
this.AddressLabel.Size = new System.Drawing.Size(56, 17);
|
||||
this.AddressLabel.TabIndex = 2;
|
||||
this.AddressLabel.Text = "Address";
|
||||
//
|
||||
// PortTextBox
|
||||
//
|
||||
this.PortTextBox.Location = new System.Drawing.Point(358, 48);
|
||||
this.PortTextBox.Name = "PortTextBox";
|
||||
this.PortTextBox.Size = new System.Drawing.Size(56, 23);
|
||||
this.PortTextBox.TabIndex = 5;
|
||||
this.PortTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||
//
|
||||
// AddressTextBox
|
||||
//
|
||||
this.AddressTextBox.Location = new System.Drawing.Point(120, 48);
|
||||
this.AddressTextBox.Name = "AddressTextBox";
|
||||
this.AddressTextBox.Size = new System.Drawing.Size(232, 23);
|
||||
this.AddressTextBox.TabIndex = 3;
|
||||
this.AddressTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||
//
|
||||
// RemarkTextBox
|
||||
//
|
||||
this.RemarkTextBox.Location = new System.Drawing.Point(120, 19);
|
||||
this.RemarkTextBox.Name = "RemarkTextBox";
|
||||
this.RemarkTextBox.Size = new System.Drawing.Size(294, 23);
|
||||
this.RemarkTextBox.TabIndex = 1;
|
||||
this.RemarkTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||
//
|
||||
// RemarkLabel
|
||||
//
|
||||
this.RemarkLabel.AutoSize = true;
|
||||
this.RemarkLabel.Location = new System.Drawing.Point(10, 22);
|
||||
this.RemarkLabel.Name = "RemarkLabel";
|
||||
this.RemarkLabel.Size = new System.Drawing.Size(53, 17);
|
||||
this.RemarkLabel.TabIndex = 0;
|
||||
this.RemarkLabel.Text = "Remark";
|
||||
//
|
||||
// PortLabel
|
||||
//
|
||||
this.PortLabel.AutoSize = true;
|
||||
this.PortLabel.Location = new System.Drawing.Point(351, 51);
|
||||
this.PortLabel.Name = "PortLabel";
|
||||
this.PortLabel.Size = new System.Drawing.Size(11, 17);
|
||||
this.PortLabel.TabIndex = 4;
|
||||
this.PortLabel.Text = ":";
|
||||
//
|
||||
// ControlButton
|
||||
//
|
||||
this.ControlButton.Location = new System.Drawing.Point(357, 127);
|
||||
this.ControlButton.Name = "ControlButton";
|
||||
this.ControlButton.Size = new System.Drawing.Size(75, 23);
|
||||
this.ControlButton.TabIndex = 1;
|
||||
this.ControlButton.Text = "Save";
|
||||
this.ControlButton.UseVisualStyleBackColor = true;
|
||||
this.ControlButton.Click += new System.EventHandler(this.ControlButton_Click);
|
||||
//
|
||||
// Trojan
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
|
||||
this.ClientSize = new System.Drawing.Size(444, 161);
|
||||
this.Controls.Add(this.ControlButton);
|
||||
this.Controls.Add(this.ConfigurationGroupBox);
|
||||
this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.MaximizeBox = false;
|
||||
this.Name = "Trojan";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "Trojan";
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Trojan_FormClosing);
|
||||
this.Load += new System.EventHandler(this.Trojan_Load);
|
||||
this.ConfigurationGroupBox.ResumeLayout(false);
|
||||
this.ConfigurationGroupBox.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.GroupBox ConfigurationGroupBox;
|
||||
private System.Windows.Forms.Button ControlButton;
|
||||
private System.Windows.Forms.Label RemarkLabel;
|
||||
private System.Windows.Forms.TextBox RemarkTextBox;
|
||||
private System.Windows.Forms.Label PortLabel;
|
||||
private System.Windows.Forms.TextBox AddressTextBox;
|
||||
private System.Windows.Forms.TextBox PortTextBox;
|
||||
private System.Windows.Forms.Label AddressLabel;
|
||||
private System.Windows.Forms.TextBox PasswordTextBox;
|
||||
private System.Windows.Forms.Label PasswordLabel;
|
||||
}
|
||||
}
|
||||
107
Netch/Forms/Server/Trojan.cs
Normal file
@@ -0,0 +1,107 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Netch.Forms.Server
|
||||
{
|
||||
public partial class Trojan : Form
|
||||
{
|
||||
public int Index;
|
||||
|
||||
/// <summary>
|
||||
/// 初始化
|
||||
/// </summary>
|
||||
/// <param name="index">需要编辑的索引</param>
|
||||
public Trojan(int index = -1)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
Index = index;
|
||||
}
|
||||
|
||||
private void Trojan_Load(object sender, EventArgs e)
|
||||
{
|
||||
ConfigurationGroupBox.Text = Utils.i18N.Translate(ConfigurationGroupBox.Text);
|
||||
RemarkLabel.Text = Utils.i18N.Translate(RemarkLabel.Text);
|
||||
AddressLabel.Text = Utils.i18N.Translate(AddressLabel.Text);
|
||||
PasswordLabel.Text = Utils.i18N.Translate(PasswordLabel.Text);
|
||||
ControlButton.Text = Utils.i18N.Translate(ControlButton.Text);
|
||||
|
||||
if (Index != -1)
|
||||
{
|
||||
RemarkTextBox.Text = Global.Settings.Server[Index].Remark;
|
||||
AddressTextBox.Text = Global.Settings.Server[Index].Hostname;
|
||||
PortTextBox.Text = Global.Settings.Server[Index].Port.ToString();
|
||||
PasswordTextBox.Text = Global.Settings.Server[Index].Password;
|
||||
}
|
||||
}
|
||||
|
||||
private void Trojan_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
Global.MainForm.Show();
|
||||
}
|
||||
|
||||
private void ComboBox_DrawItem(object sender, DrawItemEventArgs e)
|
||||
{
|
||||
var cbx = sender as ComboBox;
|
||||
if (cbx != null)
|
||||
{
|
||||
e.DrawBackground();
|
||||
|
||||
if (e.Index >= 0)
|
||||
{
|
||||
var sf = new StringFormat();
|
||||
sf.LineAlignment = StringAlignment.Center;
|
||||
sf.Alignment = StringAlignment.Center;
|
||||
|
||||
var brush = new SolidBrush(cbx.ForeColor);
|
||||
|
||||
if ((e.State & DrawItemState.Selected) == DrawItemState.Selected)
|
||||
{
|
||||
brush = SystemBrushes.HighlightText as SolidBrush;
|
||||
}
|
||||
|
||||
e.Graphics.DrawString(cbx.Items[e.Index].ToString(), cbx.Font, brush, e.Bounds, sf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ControlButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!Regex.Match(PortTextBox.Text, "^[0-9]+$").Success)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (Index == -1)
|
||||
{
|
||||
Global.Settings.Server.Add(new Models.Server
|
||||
{
|
||||
Remark = RemarkTextBox.Text,
|
||||
Type = "Trojan",
|
||||
Hostname = AddressTextBox.Text,
|
||||
Port = int.Parse(PortTextBox.Text),
|
||||
Password = PasswordTextBox.Text
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
Global.Settings.Server[Index] = new Models.Server
|
||||
{
|
||||
Remark = RemarkTextBox.Text,
|
||||
Group = Global.Settings.Server[Index].Group,
|
||||
Type = "Trojan",
|
||||
Hostname = AddressTextBox.Text,
|
||||
Port = int.Parse(PortTextBox.Text),
|
||||
Password = PasswordTextBox.Text,
|
||||
Country = null
|
||||
};
|
||||
}
|
||||
|
||||
Utils.Configuration.Save();
|
||||
MessageBox.Show(Utils.i18N.Translate("Saved"), Utils.i18N.Translate("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
Global.MainForm.InitServer();
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
4986
Netch/Forms/Server/Trojan.resx
Normal file
@@ -116,6 +116,11 @@ namespace Netch.Forms.Server
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (AlterIDTextBox.Text == "")
|
||||
{
|
||||
MessageBox.Show(Utils.i18N.Translate("Please fill in alterID"), Utils.i18N.Translate("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
return;
|
||||
}
|
||||
if (Index == -1)
|
||||
{
|
||||
Global.Settings.Server.Add(new Models.Server
|
||||
@@ -155,7 +160,8 @@ namespace Netch.Forms.Server
|
||||
QUICSecure = QUICSecurityComboBox.Text,
|
||||
QUICSecret = QUICSecretTextBox.Text,
|
||||
TLSSecure = TLSSecureCheckBox.Checked,
|
||||
UseMux = UseMuxCheckBox.Checked
|
||||
UseMux = UseMuxCheckBox.Checked,
|
||||
Country = null
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
383
Netch/Forms/SettingForm.Designer.cs
generated
@@ -30,14 +30,17 @@
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SettingForm));
|
||||
this.PortGroupBox = new System.Windows.Forms.GroupBox();
|
||||
this.RedirectorLabel = new System.Windows.Forms.Label();
|
||||
this.RedirectorTextBox = new System.Windows.Forms.TextBox();
|
||||
this.AllowDevicesCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.HTTPPortLabel = new System.Windows.Forms.Label();
|
||||
this.HTTPPortTextBox = new System.Windows.Forms.TextBox();
|
||||
this.Socks5PortLabel = new System.Windows.Forms.Label();
|
||||
this.Socks5PortTextBox = new System.Windows.Forms.TextBox();
|
||||
this.TUNTAPGroupBox = new System.Windows.Forms.GroupBox();
|
||||
this.TUNTAPProxyDNSCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.TUNTAPUseCustomDNSCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.UseFakeDNSCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.ProxyDNSCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.UseCustomDNSCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.TUNTAPDNSLabel = new System.Windows.Forms.Label();
|
||||
this.TUNTAPDNSTextBox = new System.Windows.Forms.TextBox();
|
||||
this.TUNTAPGatewayLabel = new System.Windows.Forms.Label();
|
||||
@@ -49,9 +52,18 @@
|
||||
this.ControlButton = new System.Windows.Forms.Button();
|
||||
this.GlobalBypassIPsButton = new System.Windows.Forms.Button();
|
||||
this.BehaviorGroupBox = new System.Windows.Forms.GroupBox();
|
||||
this.LanguageLabel = new System.Windows.Forms.Label();
|
||||
this.LanguageComboBox = new System.Windows.Forms.ComboBox();
|
||||
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_TextBox = new System.Windows.Forms.TextBox();
|
||||
this.EnableStartedTcping_CheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.DelayTestAfterStartup_Label = new System.Windows.Forms.Label();
|
||||
this.STUN_ServerPortTextBox = new System.Windows.Forms.TextBox();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.STUNServerPortLabel = new System.Windows.Forms.Label();
|
||||
this.STUNServerLabel = new System.Windows.Forms.Label();
|
||||
this.RunAtStartup = new System.Windows.Forms.CheckBox();
|
||||
this.STUN_ServerTextBox = new System.Windows.Forms.TextBox();
|
||||
this.MinimizeWhenStartedCheckBox = new System.Windows.Forms.CheckBox();
|
||||
@@ -68,27 +80,43 @@
|
||||
//
|
||||
// PortGroupBox
|
||||
//
|
||||
this.PortGroupBox.Controls.Add(this.RedirectorLabel);
|
||||
this.PortGroupBox.Controls.Add(this.RedirectorTextBox);
|
||||
this.PortGroupBox.Controls.Add(this.AllowDevicesCheckBox);
|
||||
this.PortGroupBox.Controls.Add(this.HTTPPortLabel);
|
||||
this.PortGroupBox.Controls.Add(this.HTTPPortTextBox);
|
||||
this.PortGroupBox.Controls.Add(this.Socks5PortLabel);
|
||||
this.PortGroupBox.Controls.Add(this.Socks5PortTextBox);
|
||||
this.PortGroupBox.Location = new System.Drawing.Point(18, 18);
|
||||
this.PortGroupBox.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.PortGroupBox.Location = new System.Drawing.Point(12, 12);
|
||||
this.PortGroupBox.Name = "PortGroupBox";
|
||||
this.PortGroupBox.Padding = new System.Windows.Forms.Padding(4);
|
||||
this.PortGroupBox.Size = new System.Drawing.Size(630, 210);
|
||||
this.PortGroupBox.Size = new System.Drawing.Size(420, 140);
|
||||
this.PortGroupBox.TabIndex = 0;
|
||||
this.PortGroupBox.TabStop = false;
|
||||
this.PortGroupBox.Text = "Local Port";
|
||||
//
|
||||
// RedirectorLabel
|
||||
//
|
||||
this.RedirectorLabel.AutoSize = true;
|
||||
this.RedirectorLabel.Location = new System.Drawing.Point(9, 83);
|
||||
this.RedirectorLabel.Name = "RedirectorLabel";
|
||||
this.RedirectorLabel.Size = new System.Drawing.Size(95, 17);
|
||||
this.RedirectorLabel.TabIndex = 6;
|
||||
this.RedirectorLabel.Text = "Redirector TCP";
|
||||
//
|
||||
// RedirectorTextBox
|
||||
//
|
||||
this.RedirectorTextBox.Location = new System.Drawing.Point(120, 80);
|
||||
this.RedirectorTextBox.Name = "RedirectorTextBox";
|
||||
this.RedirectorTextBox.Size = new System.Drawing.Size(294, 23);
|
||||
this.RedirectorTextBox.TabIndex = 7;
|
||||
this.RedirectorTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||
//
|
||||
// AllowDevicesCheckBox
|
||||
//
|
||||
this.AllowDevicesCheckBox.AutoSize = true;
|
||||
this.AllowDevicesCheckBox.Location = new System.Drawing.Point(180, 120);
|
||||
this.AllowDevicesCheckBox.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.AllowDevicesCheckBox.Location = new System.Drawing.Point(120, 109);
|
||||
this.AllowDevicesCheckBox.Name = "AllowDevicesCheckBox";
|
||||
this.AllowDevicesCheckBox.Size = new System.Drawing.Size(301, 28);
|
||||
this.AllowDevicesCheckBox.Size = new System.Drawing.Size(206, 21);
|
||||
this.AllowDevicesCheckBox.TabIndex = 5;
|
||||
this.AllowDevicesCheckBox.Text = "Allow other Devices to connect";
|
||||
this.AllowDevicesCheckBox.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
@@ -97,45 +125,42 @@
|
||||
// HTTPPortLabel
|
||||
//
|
||||
this.HTTPPortLabel.AutoSize = true;
|
||||
this.HTTPPortLabel.Location = new System.Drawing.Point(14, 81);
|
||||
this.HTTPPortLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.HTTPPortLabel.Location = new System.Drawing.Point(9, 54);
|
||||
this.HTTPPortLabel.Name = "HTTPPortLabel";
|
||||
this.HTTPPortLabel.Size = new System.Drawing.Size(55, 24);
|
||||
this.HTTPPortLabel.Size = new System.Drawing.Size(38, 17);
|
||||
this.HTTPPortLabel.TabIndex = 3;
|
||||
this.HTTPPortLabel.Text = "HTTP";
|
||||
//
|
||||
// HTTPPortTextBox
|
||||
//
|
||||
this.HTTPPortTextBox.Location = new System.Drawing.Point(180, 76);
|
||||
this.HTTPPortTextBox.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.HTTPPortTextBox.Location = new System.Drawing.Point(120, 51);
|
||||
this.HTTPPortTextBox.Name = "HTTPPortTextBox";
|
||||
this.HTTPPortTextBox.Size = new System.Drawing.Size(439, 31);
|
||||
this.HTTPPortTextBox.Size = new System.Drawing.Size(294, 23);
|
||||
this.HTTPPortTextBox.TabIndex = 4;
|
||||
this.HTTPPortTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||
//
|
||||
// Socks5PortLabel
|
||||
//
|
||||
this.Socks5PortLabel.AutoSize = true;
|
||||
this.Socks5PortLabel.Location = new System.Drawing.Point(14, 38);
|
||||
this.Socks5PortLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.Socks5PortLabel.Location = new System.Drawing.Point(9, 25);
|
||||
this.Socks5PortLabel.Name = "Socks5PortLabel";
|
||||
this.Socks5PortLabel.Size = new System.Drawing.Size(69, 24);
|
||||
this.Socks5PortLabel.Size = new System.Drawing.Size(49, 17);
|
||||
this.Socks5PortLabel.TabIndex = 0;
|
||||
this.Socks5PortLabel.Text = "Socks5";
|
||||
//
|
||||
// Socks5PortTextBox
|
||||
//
|
||||
this.Socks5PortTextBox.Location = new System.Drawing.Point(180, 33);
|
||||
this.Socks5PortTextBox.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.Socks5PortTextBox.Location = new System.Drawing.Point(120, 22);
|
||||
this.Socks5PortTextBox.Name = "Socks5PortTextBox";
|
||||
this.Socks5PortTextBox.Size = new System.Drawing.Size(439, 31);
|
||||
this.Socks5PortTextBox.Size = new System.Drawing.Size(294, 23);
|
||||
this.Socks5PortTextBox.TabIndex = 1;
|
||||
this.Socks5PortTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||
//
|
||||
// TUNTAPGroupBox
|
||||
//
|
||||
this.TUNTAPGroupBox.Controls.Add(this.TUNTAPProxyDNSCheckBox);
|
||||
this.TUNTAPGroupBox.Controls.Add(this.TUNTAPUseCustomDNSCheckBox);
|
||||
this.TUNTAPGroupBox.Controls.Add(this.UseFakeDNSCheckBox);
|
||||
this.TUNTAPGroupBox.Controls.Add(this.ProxyDNSCheckBox);
|
||||
this.TUNTAPGroupBox.Controls.Add(this.UseCustomDNSCheckBox);
|
||||
this.TUNTAPGroupBox.Controls.Add(this.TUNTAPDNSLabel);
|
||||
this.TUNTAPGroupBox.Controls.Add(this.TUNTAPDNSTextBox);
|
||||
this.TUNTAPGroupBox.Controls.Add(this.TUNTAPGatewayLabel);
|
||||
@@ -144,121 +169,118 @@
|
||||
this.TUNTAPGroupBox.Controls.Add(this.TUNTAPNetmaskTextBox);
|
||||
this.TUNTAPGroupBox.Controls.Add(this.TUNTAPAddressLabel);
|
||||
this.TUNTAPGroupBox.Controls.Add(this.TUNTAPAddressTextBox);
|
||||
this.TUNTAPGroupBox.Location = new System.Drawing.Point(18, 237);
|
||||
this.TUNTAPGroupBox.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.TUNTAPGroupBox.Location = new System.Drawing.Point(12, 158);
|
||||
this.TUNTAPGroupBox.Name = "TUNTAPGroupBox";
|
||||
this.TUNTAPGroupBox.Padding = new System.Windows.Forms.Padding(4);
|
||||
this.TUNTAPGroupBox.Size = new System.Drawing.Size(630, 281);
|
||||
this.TUNTAPGroupBox.Size = new System.Drawing.Size(420, 187);
|
||||
this.TUNTAPGroupBox.TabIndex = 3;
|
||||
this.TUNTAPGroupBox.TabStop = false;
|
||||
this.TUNTAPGroupBox.Text = "TUN/TAP";
|
||||
//
|
||||
// TUNTAPProxyDNSCheckBox
|
||||
// UseFakeDNSCheckBox
|
||||
//
|
||||
this.TUNTAPProxyDNSCheckBox.AutoSize = true;
|
||||
this.TUNTAPProxyDNSCheckBox.Location = new System.Drawing.Point(180, 243);
|
||||
this.TUNTAPProxyDNSCheckBox.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.TUNTAPProxyDNSCheckBox.Name = "TUNTAPProxyDNSCheckBox";
|
||||
this.TUNTAPProxyDNSCheckBox.Size = new System.Drawing.Size(221, 28);
|
||||
this.TUNTAPProxyDNSCheckBox.TabIndex = 10;
|
||||
this.TUNTAPProxyDNSCheckBox.Text = "Proxy DNS in Mode 2";
|
||||
this.TUNTAPProxyDNSCheckBox.UseVisualStyleBackColor = true;
|
||||
this.UseFakeDNSCheckBox.AutoSize = true;
|
||||
this.UseFakeDNSCheckBox.Location = new System.Drawing.Point(10, 160);
|
||||
this.UseFakeDNSCheckBox.Name = "UseFakeDNSCheckBox";
|
||||
this.UseFakeDNSCheckBox.Size = new System.Drawing.Size(110, 21);
|
||||
this.UseFakeDNSCheckBox.TabIndex = 11;
|
||||
this.UseFakeDNSCheckBox.Text = "Use Fake DNS";
|
||||
this.UseFakeDNSCheckBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// TUNTAPUseCustomDNSCheckBox
|
||||
// ProxyDNSCheckBox
|
||||
//
|
||||
this.TUNTAPUseCustomDNSCheckBox.AutoSize = true;
|
||||
this.TUNTAPUseCustomDNSCheckBox.Location = new System.Drawing.Point(180, 207);
|
||||
this.TUNTAPUseCustomDNSCheckBox.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.TUNTAPUseCustomDNSCheckBox.Name = "TUNTAPUseCustomDNSCheckBox";
|
||||
this.TUNTAPUseCustomDNSCheckBox.Size = new System.Drawing.Size(182, 28);
|
||||
this.TUNTAPUseCustomDNSCheckBox.TabIndex = 9;
|
||||
this.TUNTAPUseCustomDNSCheckBox.Text = "Use Custom DNS";
|
||||
this.TUNTAPUseCustomDNSCheckBox.UseVisualStyleBackColor = true;
|
||||
this.TUNTAPUseCustomDNSCheckBox.CheckedChanged += new System.EventHandler(this.TUNTAPUseCustomDNSCheckBox_CheckedChanged);
|
||||
this.ProxyDNSCheckBox.AutoSize = true;
|
||||
this.ProxyDNSCheckBox.Location = new System.Drawing.Point(261, 139);
|
||||
this.ProxyDNSCheckBox.Name = "ProxyDNSCheckBox";
|
||||
this.ProxyDNSCheckBox.Size = new System.Drawing.Size(153, 21);
|
||||
this.ProxyDNSCheckBox.TabIndex = 10;
|
||||
this.ProxyDNSCheckBox.Text = "Proxy DNS in Mode 2";
|
||||
this.ProxyDNSCheckBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// UseCustomDNSCheckBox
|
||||
//
|
||||
this.UseCustomDNSCheckBox.AutoSize = true;
|
||||
this.UseCustomDNSCheckBox.Location = new System.Drawing.Point(10, 139);
|
||||
this.UseCustomDNSCheckBox.Name = "UseCustomDNSCheckBox";
|
||||
this.UseCustomDNSCheckBox.Size = new System.Drawing.Size(127, 21);
|
||||
this.UseCustomDNSCheckBox.TabIndex = 9;
|
||||
this.UseCustomDNSCheckBox.Text = "Use Custom DNS";
|
||||
this.UseCustomDNSCheckBox.UseVisualStyleBackColor = true;
|
||||
this.UseCustomDNSCheckBox.CheckedChanged += new System.EventHandler(this.TUNTAPUseCustomDNSCheckBox_CheckedChanged);
|
||||
//
|
||||
// TUNTAPDNSLabel
|
||||
//
|
||||
this.TUNTAPDNSLabel.AutoSize = true;
|
||||
this.TUNTAPDNSLabel.Location = new System.Drawing.Point(14, 168);
|
||||
this.TUNTAPDNSLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.TUNTAPDNSLabel.Location = new System.Drawing.Point(9, 112);
|
||||
this.TUNTAPDNSLabel.Name = "TUNTAPDNSLabel";
|
||||
this.TUNTAPDNSLabel.Size = new System.Drawing.Size(49, 24);
|
||||
this.TUNTAPDNSLabel.Size = new System.Drawing.Size(34, 17);
|
||||
this.TUNTAPDNSLabel.TabIndex = 7;
|
||||
this.TUNTAPDNSLabel.Text = "DNS";
|
||||
//
|
||||
// TUNTAPDNSTextBox
|
||||
//
|
||||
this.TUNTAPDNSTextBox.Location = new System.Drawing.Point(180, 165);
|
||||
this.TUNTAPDNSTextBox.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.TUNTAPDNSTextBox.Location = new System.Drawing.Point(120, 110);
|
||||
this.TUNTAPDNSTextBox.Name = "TUNTAPDNSTextBox";
|
||||
this.TUNTAPDNSTextBox.Size = new System.Drawing.Size(439, 31);
|
||||
this.TUNTAPDNSTextBox.Size = new System.Drawing.Size(294, 23);
|
||||
this.TUNTAPDNSTextBox.TabIndex = 8;
|
||||
this.TUNTAPDNSTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||
//
|
||||
// TUNTAPGatewayLabel
|
||||
//
|
||||
this.TUNTAPGatewayLabel.AutoSize = true;
|
||||
this.TUNTAPGatewayLabel.Location = new System.Drawing.Point(14, 124);
|
||||
this.TUNTAPGatewayLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.TUNTAPGatewayLabel.Location = new System.Drawing.Point(9, 83);
|
||||
this.TUNTAPGatewayLabel.Name = "TUNTAPGatewayLabel";
|
||||
this.TUNTAPGatewayLabel.Size = new System.Drawing.Size(84, 24);
|
||||
this.TUNTAPGatewayLabel.Size = new System.Drawing.Size(57, 17);
|
||||
this.TUNTAPGatewayLabel.TabIndex = 5;
|
||||
this.TUNTAPGatewayLabel.Text = "Gateway";
|
||||
//
|
||||
// TUNTAPGatewayTextBox
|
||||
//
|
||||
this.TUNTAPGatewayTextBox.Location = new System.Drawing.Point(180, 120);
|
||||
this.TUNTAPGatewayTextBox.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.TUNTAPGatewayTextBox.Location = new System.Drawing.Point(120, 80);
|
||||
this.TUNTAPGatewayTextBox.Name = "TUNTAPGatewayTextBox";
|
||||
this.TUNTAPGatewayTextBox.Size = new System.Drawing.Size(439, 31);
|
||||
this.TUNTAPGatewayTextBox.Size = new System.Drawing.Size(294, 23);
|
||||
this.TUNTAPGatewayTextBox.TabIndex = 6;
|
||||
this.TUNTAPGatewayTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||
//
|
||||
// TUNTAPNetmaskLabel
|
||||
//
|
||||
this.TUNTAPNetmaskLabel.AutoSize = true;
|
||||
this.TUNTAPNetmaskLabel.Location = new System.Drawing.Point(14, 81);
|
||||
this.TUNTAPNetmaskLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.TUNTAPNetmaskLabel.Location = new System.Drawing.Point(9, 54);
|
||||
this.TUNTAPNetmaskLabel.Name = "TUNTAPNetmaskLabel";
|
||||
this.TUNTAPNetmaskLabel.Size = new System.Drawing.Size(87, 24);
|
||||
this.TUNTAPNetmaskLabel.Size = new System.Drawing.Size(60, 17);
|
||||
this.TUNTAPNetmaskLabel.TabIndex = 3;
|
||||
this.TUNTAPNetmaskLabel.Text = "Netmask";
|
||||
//
|
||||
// TUNTAPNetmaskTextBox
|
||||
//
|
||||
this.TUNTAPNetmaskTextBox.Location = new System.Drawing.Point(180, 76);
|
||||
this.TUNTAPNetmaskTextBox.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.TUNTAPNetmaskTextBox.Location = new System.Drawing.Point(120, 51);
|
||||
this.TUNTAPNetmaskTextBox.Name = "TUNTAPNetmaskTextBox";
|
||||
this.TUNTAPNetmaskTextBox.Size = new System.Drawing.Size(439, 31);
|
||||
this.TUNTAPNetmaskTextBox.Size = new System.Drawing.Size(294, 23);
|
||||
this.TUNTAPNetmaskTextBox.TabIndex = 4;
|
||||
this.TUNTAPNetmaskTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||
//
|
||||
// TUNTAPAddressLabel
|
||||
//
|
||||
this.TUNTAPAddressLabel.AutoSize = true;
|
||||
this.TUNTAPAddressLabel.Location = new System.Drawing.Point(14, 38);
|
||||
this.TUNTAPAddressLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.TUNTAPAddressLabel.Location = new System.Drawing.Point(9, 25);
|
||||
this.TUNTAPAddressLabel.Name = "TUNTAPAddressLabel";
|
||||
this.TUNTAPAddressLabel.Size = new System.Drawing.Size(80, 24);
|
||||
this.TUNTAPAddressLabel.Size = new System.Drawing.Size(56, 17);
|
||||
this.TUNTAPAddressLabel.TabIndex = 1;
|
||||
this.TUNTAPAddressLabel.Text = "Address";
|
||||
//
|
||||
// TUNTAPAddressTextBox
|
||||
//
|
||||
this.TUNTAPAddressTextBox.Location = new System.Drawing.Point(180, 33);
|
||||
this.TUNTAPAddressTextBox.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.TUNTAPAddressTextBox.Location = new System.Drawing.Point(120, 22);
|
||||
this.TUNTAPAddressTextBox.Name = "TUNTAPAddressTextBox";
|
||||
this.TUNTAPAddressTextBox.Size = new System.Drawing.Size(439, 31);
|
||||
this.TUNTAPAddressTextBox.Size = new System.Drawing.Size(294, 23);
|
||||
this.TUNTAPAddressTextBox.TabIndex = 2;
|
||||
this.TUNTAPAddressTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||
//
|
||||
// ControlButton
|
||||
//
|
||||
this.ControlButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.ControlButton.Location = new System.Drawing.Point(536, 1018);
|
||||
this.ControlButton.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.ControlButton.Location = new System.Drawing.Point(804, 356);
|
||||
this.ControlButton.Name = "ControlButton";
|
||||
this.ControlButton.Size = new System.Drawing.Size(112, 34);
|
||||
this.ControlButton.Size = new System.Drawing.Size(75, 23);
|
||||
this.ControlButton.TabIndex = 11;
|
||||
this.ControlButton.Text = "Save";
|
||||
this.ControlButton.UseVisualStyleBackColor = true;
|
||||
@@ -267,10 +289,9 @@
|
||||
// GlobalBypassIPsButton
|
||||
//
|
||||
this.GlobalBypassIPsButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.GlobalBypassIPsButton.Location = new System.Drawing.Point(18, 1018);
|
||||
this.GlobalBypassIPsButton.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.GlobalBypassIPsButton.Location = new System.Drawing.Point(12, 356);
|
||||
this.GlobalBypassIPsButton.Name = "GlobalBypassIPsButton";
|
||||
this.GlobalBypassIPsButton.Size = new System.Drawing.Size(192, 34);
|
||||
this.GlobalBypassIPsButton.Size = new System.Drawing.Size(128, 23);
|
||||
this.GlobalBypassIPsButton.TabIndex = 10;
|
||||
this.GlobalBypassIPsButton.Text = "Global Bypass IPs";
|
||||
this.GlobalBypassIPsButton.UseVisualStyleBackColor = true;
|
||||
@@ -278,9 +299,18 @@
|
||||
//
|
||||
// BehaviorGroupBox
|
||||
//
|
||||
this.BehaviorGroupBox.Controls.Add(this.LanguageLabel);
|
||||
this.BehaviorGroupBox.Controls.Add(this.LanguageComboBox);
|
||||
this.BehaviorGroupBox.Controls.Add(this.BootShadowsocksFromDLLCheckBox);
|
||||
this.BehaviorGroupBox.Controls.Add(this.AclAddr);
|
||||
this.BehaviorGroupBox.Controls.Add(this.AclLabel);
|
||||
this.BehaviorGroupBox.Controls.Add(this.DetectionInterval_Label);
|
||||
this.BehaviorGroupBox.Controls.Add(this.DetectionInterval_TextBox);
|
||||
this.BehaviorGroupBox.Controls.Add(this.EnableStartedTcping_CheckBox);
|
||||
this.BehaviorGroupBox.Controls.Add(this.DelayTestAfterStartup_Label);
|
||||
this.BehaviorGroupBox.Controls.Add(this.STUN_ServerPortTextBox);
|
||||
this.BehaviorGroupBox.Controls.Add(this.label2);
|
||||
this.BehaviorGroupBox.Controls.Add(this.label1);
|
||||
this.BehaviorGroupBox.Controls.Add(this.STUNServerPortLabel);
|
||||
this.BehaviorGroupBox.Controls.Add(this.STUNServerLabel);
|
||||
this.BehaviorGroupBox.Controls.Add(this.RunAtStartup);
|
||||
this.BehaviorGroupBox.Controls.Add(this.STUN_ServerTextBox);
|
||||
this.BehaviorGroupBox.Controls.Add(this.MinimizeWhenStartedCheckBox);
|
||||
@@ -290,71 +320,144 @@
|
||||
this.BehaviorGroupBox.Controls.Add(this.StartWhenOpenedCheckBox);
|
||||
this.BehaviorGroupBox.Controls.Add(this.StopWhenExitedCheckBox);
|
||||
this.BehaviorGroupBox.Controls.Add(this.ExitWhenClosedCheckBox);
|
||||
this.BehaviorGroupBox.Location = new System.Drawing.Point(18, 526);
|
||||
this.BehaviorGroupBox.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.BehaviorGroupBox.Location = new System.Drawing.Point(438, 12);
|
||||
this.BehaviorGroupBox.Name = "BehaviorGroupBox";
|
||||
this.BehaviorGroupBox.Padding = new System.Windows.Forms.Padding(4);
|
||||
this.BehaviorGroupBox.Size = new System.Drawing.Size(630, 468);
|
||||
this.BehaviorGroupBox.Size = new System.Drawing.Size(441, 333);
|
||||
this.BehaviorGroupBox.TabIndex = 8;
|
||||
this.BehaviorGroupBox.TabStop = false;
|
||||
this.BehaviorGroupBox.Text = "Behavior";
|
||||
//
|
||||
// LanguageLabel
|
||||
//
|
||||
this.LanguageLabel.AutoSize = true;
|
||||
this.LanguageLabel.Location = new System.Drawing.Point(12, 305);
|
||||
this.LanguageLabel.Name = "LanguageLabel";
|
||||
this.LanguageLabel.Size = new System.Drawing.Size(65, 17);
|
||||
this.LanguageLabel.TabIndex = 23;
|
||||
this.LanguageLabel.Text = "Language";
|
||||
//
|
||||
// LanguageComboBox
|
||||
//
|
||||
this.LanguageComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.LanguageComboBox.FormattingEnabled = true;
|
||||
this.LanguageComboBox.Location = new System.Drawing.Point(120, 302);
|
||||
this.LanguageComboBox.Name = "LanguageComboBox";
|
||||
this.LanguageComboBox.Size = new System.Drawing.Size(121, 25);
|
||||
this.LanguageComboBox.TabIndex = 22;
|
||||
//
|
||||
// BootShadowsocksFromDLLCheckBox
|
||||
//
|
||||
this.BootShadowsocksFromDLLCheckBox.AutoSize = true;
|
||||
this.BootShadowsocksFromDLLCheckBox.Location = new System.Drawing.Point(12, 102);
|
||||
this.BootShadowsocksFromDLLCheckBox.Name = "BootShadowsocksFromDLLCheckBox";
|
||||
this.BootShadowsocksFromDLLCheckBox.Size = new System.Drawing.Size(321, 21);
|
||||
this.BootShadowsocksFromDLLCheckBox.TabIndex = 21;
|
||||
this.BootShadowsocksFromDLLCheckBox.Text = "Start Shadowsocks from DLL (No support for ACL)";
|
||||
this.BootShadowsocksFromDLLCheckBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// AclAddr
|
||||
//
|
||||
this.AclAddr.Location = new System.Drawing.Point(120, 273);
|
||||
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(12, 276);
|
||||
this.AclLabel.Name = "AclLabel";
|
||||
this.AclLabel.Size = new System.Drawing.Size(78, 17);
|
||||
this.AclLabel.TabIndex = 20;
|
||||
this.AclLabel.Text = "Custom ACL";
|
||||
//
|
||||
// DetectionInterval_Label
|
||||
//
|
||||
this.DetectionInterval_Label.AutoSize = true;
|
||||
this.DetectionInterval_Label.Location = new System.Drawing.Point(229, 192);
|
||||
this.DetectionInterval_Label.Name = "DetectionInterval_Label";
|
||||
this.DetectionInterval_Label.Size = new System.Drawing.Size(136, 17);
|
||||
this.DetectionInterval_Label.TabIndex = 18;
|
||||
this.DetectionInterval_Label.Text = "Detection interval(sec)";
|
||||
//
|
||||
// DetectionInterval_TextBox
|
||||
//
|
||||
this.DetectionInterval_TextBox.Location = new System.Drawing.Point(367, 189);
|
||||
this.DetectionInterval_TextBox.Name = "DetectionInterval_TextBox";
|
||||
this.DetectionInterval_TextBox.Size = new System.Drawing.Size(68, 23);
|
||||
this.DetectionInterval_TextBox.TabIndex = 17;
|
||||
this.DetectionInterval_TextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||
//
|
||||
// EnableStartedTcping_CheckBox
|
||||
//
|
||||
this.EnableStartedTcping_CheckBox.AutoSize = true;
|
||||
this.EnableStartedTcping_CheckBox.Location = new System.Drawing.Point(144, 191);
|
||||
this.EnableStartedTcping_CheckBox.Name = "EnableStartedTcping_CheckBox";
|
||||
this.EnableStartedTcping_CheckBox.Size = new System.Drawing.Size(66, 21);
|
||||
this.EnableStartedTcping_CheckBox.TabIndex = 15;
|
||||
this.EnableStartedTcping_CheckBox.Text = "Enable";
|
||||
this.EnableStartedTcping_CheckBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// DelayTestAfterStartup_Label
|
||||
//
|
||||
this.DelayTestAfterStartup_Label.AutoSize = true;
|
||||
this.DelayTestAfterStartup_Label.Location = new System.Drawing.Point(12, 192);
|
||||
this.DelayTestAfterStartup_Label.Name = "DelayTestAfterStartup_Label";
|
||||
this.DelayTestAfterStartup_Label.Size = new System.Drawing.Size(126, 17);
|
||||
this.DelayTestAfterStartup_Label.TabIndex = 16;
|
||||
this.DelayTestAfterStartup_Label.Text = "Delay test after start";
|
||||
//
|
||||
// STUN_ServerPortTextBox
|
||||
//
|
||||
this.STUN_ServerPortTextBox.Location = new System.Drawing.Point(180, 356);
|
||||
this.STUN_ServerPortTextBox.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.STUN_ServerPortTextBox.Location = new System.Drawing.Point(120, 244);
|
||||
this.STUN_ServerPortTextBox.Name = "STUN_ServerPortTextBox";
|
||||
this.STUN_ServerPortTextBox.Size = new System.Drawing.Size(439, 31);
|
||||
this.STUN_ServerPortTextBox.Size = new System.Drawing.Size(315, 23);
|
||||
this.STUN_ServerPortTextBox.TabIndex = 8;
|
||||
this.STUN_ServerPortTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||
//
|
||||
// label2
|
||||
// STUNServerPortLabel
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(14, 364);
|
||||
this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(157, 24);
|
||||
this.label2.TabIndex = 12;
|
||||
this.label2.Text = "STUN Server Port";
|
||||
this.STUNServerPortLabel.AutoSize = true;
|
||||
this.STUNServerPortLabel.Location = new System.Drawing.Point(12, 247);
|
||||
this.STUNServerPortLabel.Name = "STUNServerPortLabel";
|
||||
this.STUNServerPortLabel.Size = new System.Drawing.Size(110, 17);
|
||||
this.STUNServerPortLabel.TabIndex = 12;
|
||||
this.STUNServerPortLabel.Text = "STUN Server Port";
|
||||
//
|
||||
// label1
|
||||
// STUNServerLabel
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(14, 321);
|
||||
this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(116, 24);
|
||||
this.label1.TabIndex = 10;
|
||||
this.label1.Text = "STUN Server";
|
||||
this.STUNServerLabel.AutoSize = true;
|
||||
this.STUNServerLabel.Location = new System.Drawing.Point(12, 221);
|
||||
this.STUNServerLabel.Name = "STUNServerLabel";
|
||||
this.STUNServerLabel.Size = new System.Drawing.Size(82, 17);
|
||||
this.STUNServerLabel.TabIndex = 10;
|
||||
this.STUNServerLabel.Text = "STUN Server";
|
||||
//
|
||||
// RunAtStartup
|
||||
//
|
||||
this.RunAtStartup.AutoSize = true;
|
||||
this.RunAtStartup.Location = new System.Drawing.Point(180, 195);
|
||||
this.RunAtStartup.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.RunAtStartup.Location = new System.Drawing.Point(12, 75);
|
||||
this.RunAtStartup.Name = "RunAtStartup";
|
||||
this.RunAtStartup.Size = new System.Drawing.Size(159, 28);
|
||||
this.RunAtStartup.Size = new System.Drawing.Size(109, 21);
|
||||
this.RunAtStartup.TabIndex = 11;
|
||||
this.RunAtStartup.Text = "Run at startup";
|
||||
this.RunAtStartup.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// STUN_ServerTextBox
|
||||
//
|
||||
this.STUN_ServerTextBox.Location = new System.Drawing.Point(180, 316);
|
||||
this.STUN_ServerTextBox.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.STUN_ServerTextBox.Location = new System.Drawing.Point(120, 215);
|
||||
this.STUN_ServerTextBox.Name = "STUN_ServerTextBox";
|
||||
this.STUN_ServerTextBox.Size = new System.Drawing.Size(439, 31);
|
||||
this.STUN_ServerTextBox.Size = new System.Drawing.Size(315, 23);
|
||||
this.STUN_ServerTextBox.TabIndex = 11;
|
||||
this.STUN_ServerTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||
//
|
||||
// MinimizeWhenStartedCheckBox
|
||||
//
|
||||
this.MinimizeWhenStartedCheckBox.AutoSize = true;
|
||||
this.MinimizeWhenStartedCheckBox.Location = new System.Drawing.Point(180, 154);
|
||||
this.MinimizeWhenStartedCheckBox.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.MinimizeWhenStartedCheckBox.Location = new System.Drawing.Point(206, 48);
|
||||
this.MinimizeWhenStartedCheckBox.Name = "MinimizeWhenStartedCheckBox";
|
||||
this.MinimizeWhenStartedCheckBox.Size = new System.Drawing.Size(233, 28);
|
||||
this.MinimizeWhenStartedCheckBox.Size = new System.Drawing.Size(158, 21);
|
||||
this.MinimizeWhenStartedCheckBox.TabIndex = 10;
|
||||
this.MinimizeWhenStartedCheckBox.Text = "Minimize when started";
|
||||
this.MinimizeWhenStartedCheckBox.UseVisualStyleBackColor = true;
|
||||
@@ -362,29 +465,26 @@
|
||||
// ProfileCount_Label
|
||||
//
|
||||
this.ProfileCount_Label.AutoSize = true;
|
||||
this.ProfileCount_Label.Location = new System.Drawing.Point(14, 278);
|
||||
this.ProfileCount_Label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.ProfileCount_Label.Location = new System.Drawing.Point(12, 167);
|
||||
this.ProfileCount_Label.Name = "ProfileCount_Label";
|
||||
this.ProfileCount_Label.Size = new System.Drawing.Size(117, 24);
|
||||
this.ProfileCount_Label.Size = new System.Drawing.Size(79, 17);
|
||||
this.ProfileCount_Label.TabIndex = 8;
|
||||
this.ProfileCount_Label.Text = "ProfileCount";
|
||||
//
|
||||
// ProfileCount_TextBox
|
||||
//
|
||||
this.ProfileCount_TextBox.Location = new System.Drawing.Point(333, 273);
|
||||
this.ProfileCount_TextBox.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.ProfileCount_TextBox.Location = new System.Drawing.Point(209, 164);
|
||||
this.ProfileCount_TextBox.Name = "ProfileCount_TextBox";
|
||||
this.ProfileCount_TextBox.Size = new System.Drawing.Size(286, 31);
|
||||
this.ProfileCount_TextBox.Size = new System.Drawing.Size(226, 23);
|
||||
this.ProfileCount_TextBox.TabIndex = 9;
|
||||
this.ProfileCount_TextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||
//
|
||||
// CheckUpdateWhenOpenedCheckBox
|
||||
//
|
||||
this.CheckUpdateWhenOpenedCheckBox.AutoSize = true;
|
||||
this.CheckUpdateWhenOpenedCheckBox.Location = new System.Drawing.Point(180, 236);
|
||||
this.CheckUpdateWhenOpenedCheckBox.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.CheckUpdateWhenOpenedCheckBox.Location = new System.Drawing.Point(206, 75);
|
||||
this.CheckUpdateWhenOpenedCheckBox.Name = "CheckUpdateWhenOpenedCheckBox";
|
||||
this.CheckUpdateWhenOpenedCheckBox.Size = new System.Drawing.Size(277, 28);
|
||||
this.CheckUpdateWhenOpenedCheckBox.Size = new System.Drawing.Size(190, 21);
|
||||
this.CheckUpdateWhenOpenedCheckBox.TabIndex = 8;
|
||||
this.CheckUpdateWhenOpenedCheckBox.Text = "Check update when opened";
|
||||
this.CheckUpdateWhenOpenedCheckBox.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
@@ -393,10 +493,9 @@
|
||||
// StartWhenOpenedCheckBox
|
||||
//
|
||||
this.StartWhenOpenedCheckBox.AutoSize = true;
|
||||
this.StartWhenOpenedCheckBox.Location = new System.Drawing.Point(180, 114);
|
||||
this.StartWhenOpenedCheckBox.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.StartWhenOpenedCheckBox.Location = new System.Drawing.Point(12, 48);
|
||||
this.StartWhenOpenedCheckBox.Name = "StartWhenOpenedCheckBox";
|
||||
this.StartWhenOpenedCheckBox.Size = new System.Drawing.Size(199, 28);
|
||||
this.StartWhenOpenedCheckBox.Size = new System.Drawing.Size(137, 21);
|
||||
this.StartWhenOpenedCheckBox.TabIndex = 7;
|
||||
this.StartWhenOpenedCheckBox.Text = "Start when opened";
|
||||
this.StartWhenOpenedCheckBox.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
@@ -405,10 +504,9 @@
|
||||
// StopWhenExitedCheckBox
|
||||
//
|
||||
this.StopWhenExitedCheckBox.AutoSize = true;
|
||||
this.StopWhenExitedCheckBox.Location = new System.Drawing.Point(180, 74);
|
||||
this.StopWhenExitedCheckBox.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.StopWhenExitedCheckBox.Location = new System.Drawing.Point(206, 22);
|
||||
this.StopWhenExitedCheckBox.Name = "StopWhenExitedCheckBox";
|
||||
this.StopWhenExitedCheckBox.Size = new System.Drawing.Size(185, 28);
|
||||
this.StopWhenExitedCheckBox.Size = new System.Drawing.Size(127, 21);
|
||||
this.StopWhenExitedCheckBox.TabIndex = 6;
|
||||
this.StopWhenExitedCheckBox.Text = "Stop when exited";
|
||||
this.StopWhenExitedCheckBox.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
@@ -417,10 +515,9 @@
|
||||
// ExitWhenClosedCheckBox
|
||||
//
|
||||
this.ExitWhenClosedCheckBox.AutoSize = true;
|
||||
this.ExitWhenClosedCheckBox.Location = new System.Drawing.Point(180, 33);
|
||||
this.ExitWhenClosedCheckBox.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.ExitWhenClosedCheckBox.Location = new System.Drawing.Point(12, 21);
|
||||
this.ExitWhenClosedCheckBox.Name = "ExitWhenClosedCheckBox";
|
||||
this.ExitWhenClosedCheckBox.Size = new System.Drawing.Size(178, 28);
|
||||
this.ExitWhenClosedCheckBox.Size = new System.Drawing.Size(123, 21);
|
||||
this.ExitWhenClosedCheckBox.TabIndex = 5;
|
||||
this.ExitWhenClosedCheckBox.Text = "Exit when closed";
|
||||
this.ExitWhenClosedCheckBox.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
@@ -428,9 +525,9 @@
|
||||
//
|
||||
// SettingForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(144F, 144F);
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
|
||||
this.ClientSize = new System.Drawing.Size(666, 1069);
|
||||
this.ClientSize = new System.Drawing.Size(891, 390);
|
||||
this.Controls.Add(this.BehaviorGroupBox);
|
||||
this.Controls.Add(this.PortGroupBox);
|
||||
this.Controls.Add(this.GlobalBypassIPsButton);
|
||||
@@ -439,7 +536,7 @@
|
||||
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(4, 6, 4, 6);
|
||||
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.MaximizeBox = false;
|
||||
this.Name = "SettingForm";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
@@ -474,7 +571,7 @@
|
||||
private System.Windows.Forms.TextBox TUNTAPDNSTextBox;
|
||||
private System.Windows.Forms.Button ControlButton;
|
||||
private System.Windows.Forms.Button GlobalBypassIPsButton;
|
||||
private System.Windows.Forms.CheckBox TUNTAPUseCustomDNSCheckBox;
|
||||
private System.Windows.Forms.CheckBox UseCustomDNSCheckBox;
|
||||
private System.Windows.Forms.CheckBox AllowDevicesCheckBox;
|
||||
private System.Windows.Forms.GroupBox BehaviorGroupBox;
|
||||
private System.Windows.Forms.CheckBox ExitWhenClosedCheckBox;
|
||||
@@ -485,10 +582,22 @@
|
||||
private System.Windows.Forms.TextBox ProfileCount_TextBox;
|
||||
private System.Windows.Forms.CheckBox MinimizeWhenStartedCheckBox;
|
||||
private System.Windows.Forms.CheckBox RunAtStartup;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.Label STUNServerPortLabel;
|
||||
private System.Windows.Forms.Label STUNServerLabel;
|
||||
private System.Windows.Forms.TextBox STUN_ServerTextBox;
|
||||
private System.Windows.Forms.TextBox STUN_ServerPortTextBox;
|
||||
private System.Windows.Forms.CheckBox TUNTAPProxyDNSCheckBox;
|
||||
private System.Windows.Forms.CheckBox ProxyDNSCheckBox;
|
||||
private System.Windows.Forms.TextBox DetectionInterval_TextBox;
|
||||
private System.Windows.Forms.CheckBox EnableStartedTcping_CheckBox;
|
||||
private System.Windows.Forms.Label DelayTestAfterStartup_Label;
|
||||
private System.Windows.Forms.Label DetectionInterval_Label;
|
||||
private System.Windows.Forms.Label RedirectorLabel;
|
||||
private System.Windows.Forms.TextBox RedirectorTextBox;
|
||||
private System.Windows.Forms.TextBox AclAddr;
|
||||
private System.Windows.Forms.Label AclLabel;
|
||||
private System.Windows.Forms.CheckBox UseFakeDNSCheckBox;
|
||||
private System.Windows.Forms.CheckBox BootShadowsocksFromDLLCheckBox;
|
||||
private System.Windows.Forms.Label LanguageLabel;
|
||||
private System.Windows.Forms.ComboBox LanguageComboBox;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,9 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using Netch.Models.SSD;
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using TaskScheduler;
|
||||
|
||||
@@ -15,7 +18,7 @@ namespace Netch.Forms
|
||||
|
||||
private void TUNTAPUseCustomDNSCheckBox_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (!TUNTAPUseCustomDNSCheckBox.Checked)
|
||||
if (!UseCustomDNSCheckBox.Checked)
|
||||
{
|
||||
TUNTAPDNSTextBox.Enabled = false;
|
||||
}
|
||||
@@ -51,10 +54,12 @@ namespace Netch.Forms
|
||||
TUNTAPAddressLabel.Text = Utils.i18N.Translate(TUNTAPAddressLabel.Text);
|
||||
TUNTAPNetmaskLabel.Text = Utils.i18N.Translate(TUNTAPNetmaskLabel.Text);
|
||||
TUNTAPGatewayLabel.Text = Utils.i18N.Translate(TUNTAPGatewayLabel.Text);
|
||||
TUNTAPUseCustomDNSCheckBox.Text = Utils.i18N.Translate(TUNTAPUseCustomDNSCheckBox.Text);
|
||||
TUNTAPProxyDNSCheckBox.Text = Utils.i18N.Translate(TUNTAPProxyDNSCheckBox.Text);
|
||||
UseCustomDNSCheckBox.Text = Utils.i18N.Translate(UseCustomDNSCheckBox.Text);
|
||||
ProxyDNSCheckBox.Text = Utils.i18N.Translate(ProxyDNSCheckBox.Text);
|
||||
UseFakeDNSCheckBox.Text = Utils.i18N.Translate(UseFakeDNSCheckBox.Text);
|
||||
GlobalBypassIPsButton.Text = Utils.i18N.Translate(GlobalBypassIPsButton.Text);
|
||||
ControlButton.Text = Utils.i18N.Translate(ControlButton.Text);
|
||||
BootShadowsocksFromDLLCheckBox.Text = Utils.i18N.Translate(BootShadowsocksFromDLLCheckBox.Text);
|
||||
|
||||
ExitWhenClosedCheckBox.Checked = Global.Settings.ExitWhenClosed;
|
||||
StopWhenExitedCheckBox.Checked = Global.Settings.StopWhenExited;
|
||||
@@ -62,16 +67,21 @@ namespace Netch.Forms
|
||||
CheckUpdateWhenOpenedCheckBox.Checked = Global.Settings.CheckUpdateWhenOpened;
|
||||
MinimizeWhenStartedCheckBox.Checked = Global.Settings.MinimizeWhenStarted;
|
||||
RunAtStartup.Checked = Global.Settings.RunAtStartup;
|
||||
EnableStartedTcping_CheckBox.Checked = Global.Settings.StartedTcping;
|
||||
DetectionInterval_TextBox.Text = Global.Settings.StartedTcping_Interval.ToString();
|
||||
BootShadowsocksFromDLLCheckBox.Checked = Global.Settings.BootShadowsocksFromDLL;
|
||||
|
||||
Socks5PortTextBox.Text = Global.Settings.Socks5LocalPort.ToString();
|
||||
HTTPPortTextBox.Text = Global.Settings.HTTPLocalPort.ToString();
|
||||
RedirectorTextBox.Text = Global.Settings.RedirectorTCPPort.ToString();
|
||||
|
||||
TUNTAPAddressTextBox.Text = Global.Settings.TUNTAP.Address;
|
||||
TUNTAPNetmaskTextBox.Text = Global.Settings.TUNTAP.Netmask;
|
||||
TUNTAPGatewayTextBox.Text = Global.Settings.TUNTAP.Gateway;
|
||||
|
||||
TUNTAPUseCustomDNSCheckBox.Checked = Global.Settings.TUNTAP.UseCustomDNS;
|
||||
TUNTAPProxyDNSCheckBox.Checked = Global.Settings.TUNTAP.ProxyDNS;
|
||||
UseCustomDNSCheckBox.Checked = Global.Settings.TUNTAP.UseCustomDNS;
|
||||
ProxyDNSCheckBox.Checked = Global.Settings.TUNTAP.ProxyDNS;
|
||||
UseFakeDNSCheckBox.Checked = Global.Settings.TUNTAP.UseFakeDNS;
|
||||
|
||||
BehaviorGroupBox.Text = Utils.i18N.Translate(BehaviorGroupBox.Text);
|
||||
ExitWhenClosedCheckBox.Text = Utils.i18N.Translate(ExitWhenClosedCheckBox.Text);
|
||||
@@ -81,11 +91,24 @@ namespace Netch.Forms
|
||||
RunAtStartup.Text = Utils.i18N.Translate(RunAtStartup.Text);
|
||||
CheckUpdateWhenOpenedCheckBox.Text = Utils.i18N.Translate(CheckUpdateWhenOpenedCheckBox.Text);
|
||||
ProfileCount_Label.Text = Utils.i18N.Translate(ProfileCount_Label.Text);
|
||||
DelayTestAfterStartup_Label.Text = Utils.i18N.Translate(DelayTestAfterStartup_Label.Text);
|
||||
EnableStartedTcping_CheckBox.Text = Utils.i18N.Translate(EnableStartedTcping_CheckBox.Text);
|
||||
DetectionInterval_Label.Text = Utils.i18N.Translate(DetectionInterval_Label.Text);
|
||||
DelayTestAfterStartup_Label.Text = Utils.i18N.Translate(DelayTestAfterStartup_Label.Text);
|
||||
STUNServerLabel.Text = Utils.i18N.Translate(STUNServerLabel.Text);
|
||||
STUNServerPortLabel.Text = Utils.i18N.Translate(STUNServerPortLabel.Text);
|
||||
|
||||
ProfileCount_TextBox.Text = Global.Settings.ProfileCount.ToString();
|
||||
STUN_ServerTextBox.Text = Global.Settings.STUN_Server.ToString();
|
||||
STUN_ServerPortTextBox.Text = Global.Settings.STUN_Server_Port.ToString();
|
||||
|
||||
AclLabel.Text = Utils.i18N.Translate(AclLabel.Text);
|
||||
AclAddr.Text = Global.Settings.ACL.ToString();
|
||||
|
||||
LanguageLabel.Text = Utils.i18N.Translate(LanguageLabel.Text);
|
||||
LanguageComboBox.Items.AddRange(Utils.i18N.GetTranslateList().ToArray());
|
||||
LanguageComboBox.SelectedItem = Global.Settings.Language;
|
||||
|
||||
if (Global.Settings.TUNTAP.DNS.Count > 0)
|
||||
{
|
||||
var dns = "";
|
||||
@@ -104,7 +127,7 @@ namespace Netch.Forms
|
||||
TUNTAPDNSTextBox.Text = "1.1.1.1";
|
||||
}
|
||||
|
||||
if (!TUNTAPUseCustomDNSCheckBox.Checked)
|
||||
if (!UseCustomDNSCheckBox.Checked)
|
||||
{
|
||||
TUNTAPDNSTextBox.Enabled = false;
|
||||
}
|
||||
@@ -144,6 +167,45 @@ namespace Netch.Forms
|
||||
Global.Settings.CheckUpdateWhenOpened = CheckUpdateWhenOpenedCheckBox.Checked;
|
||||
Global.Settings.MinimizeWhenStarted = MinimizeWhenStartedCheckBox.Checked;
|
||||
Global.Settings.RunAtStartup = RunAtStartup.Checked;
|
||||
Global.Settings.BootShadowsocksFromDLL = BootShadowsocksFromDLLCheckBox.Checked;
|
||||
Global.Settings.Language = LanguageComboBox.SelectedItem.ToString();
|
||||
|
||||
// 加载系统语言
|
||||
if (Global.Settings.Language.Equals("System"))
|
||||
{
|
||||
// 得到当前线程语言代码
|
||||
var culture = CultureInfo.CurrentCulture.Name;
|
||||
|
||||
// 尝试加载内置中文语言
|
||||
if (culture == "zh-CN")
|
||||
{
|
||||
// 加载语言
|
||||
Utils.i18N.Load(Encoding.UTF8.GetString(Properties.Resources.zh_CN));
|
||||
}
|
||||
|
||||
// 从外置文件中加载语言
|
||||
if (File.Exists($"i18n\\{culture}"))
|
||||
{
|
||||
// 加载语言
|
||||
Utils.i18N.Load(File.ReadAllText($"i18n\\{culture}"));
|
||||
}
|
||||
}
|
||||
|
||||
if (Global.Settings.Language.Equals("zh-CN"))
|
||||
{
|
||||
// 加载内置中文
|
||||
Utils.i18N.Load(Encoding.UTF8.GetString(Properties.Resources.zh_CN));
|
||||
}
|
||||
else if (Global.Settings.Language.Equals("en-US"))
|
||||
{
|
||||
// 加载内置英文
|
||||
Utils.i18N.Load(Global.Settings.Language);
|
||||
}
|
||||
else if (File.Exists($"i18n\\{Global.Settings.Language}"))
|
||||
{
|
||||
// 从外置文件中加载语言
|
||||
Utils.i18N.Load(File.ReadAllText($"i18n\\{Global.Settings.Language}"));
|
||||
}
|
||||
|
||||
// 开机自启判断
|
||||
TaskSchedulerClass scheduler = new TaskSchedulerClass();
|
||||
@@ -226,6 +288,27 @@ namespace Netch.Forms
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var RedirectorPort = int.Parse(RedirectorTextBox.Text);
|
||||
|
||||
if (RedirectorPort > 0 && RedirectorPort < 65536)
|
||||
{
|
||||
Global.Settings.RedirectorTCPPort = RedirectorPort;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new FormatException();
|
||||
}
|
||||
}
|
||||
catch (FormatException)
|
||||
{
|
||||
RedirectorTextBox.Text = Global.Settings.RedirectorTCPPort.ToString();
|
||||
MessageBox.Show(Utils.i18N.Translate("Port value illegal. Try again."), Utils.i18N.Translate("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (AllowDevicesCheckBox.Checked)
|
||||
{
|
||||
Global.Settings.LocalAddress = "0.0.0.0";
|
||||
@@ -263,7 +346,7 @@ namespace Netch.Forms
|
||||
}
|
||||
DNS = DNS.Trim();
|
||||
TUNTAPDNSTextBox.Text = DNS.Substring(0, DNS.Length - 1);
|
||||
TUNTAPUseCustomDNSCheckBox.Checked = Global.Settings.TUNTAP.UseCustomDNS;
|
||||
UseCustomDNSCheckBox.Checked = Global.Settings.TUNTAP.UseCustomDNS;
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -271,7 +354,7 @@ namespace Netch.Forms
|
||||
{
|
||||
var ProfileCount = int.Parse(ProfileCount_TextBox.Text);
|
||||
|
||||
if (ProfileCount > 0)
|
||||
if (ProfileCount > -1)
|
||||
{
|
||||
Global.Settings.ProfileCount = ProfileCount;
|
||||
}
|
||||
@@ -310,6 +393,30 @@ namespace Netch.Forms
|
||||
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
Global.Settings.StartedTcping = EnableStartedTcping_CheckBox.Checked;
|
||||
|
||||
var DetectionInterval = int.Parse(DetectionInterval_TextBox.Text);
|
||||
|
||||
if (DetectionInterval > 0)
|
||||
{
|
||||
Global.Settings.StartedTcping_Interval = DetectionInterval;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new FormatException();
|
||||
}
|
||||
}
|
||||
catch (FormatException)
|
||||
{
|
||||
ProfileCount_TextBox.Text = Global.Settings.ProfileCount.ToString();
|
||||
MessageBox.Show(Utils.i18N.Translate("Detection interval value illegal. Try again."), Utils.i18N.Translate("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Global.Settings.ACL = AclAddr.Text;
|
||||
|
||||
Global.Settings.TUNTAP.Address = TUNTAPAddressTextBox.Text;
|
||||
Global.Settings.TUNTAP.Netmask = TUNTAPNetmaskTextBox.Text;
|
||||
@@ -321,13 +428,13 @@ namespace Netch.Forms
|
||||
Global.Settings.TUNTAP.DNS.Add(ip);
|
||||
}
|
||||
|
||||
Global.Settings.TUNTAP.UseCustomDNS = TUNTAPUseCustomDNSCheckBox.Checked;
|
||||
Global.Settings.TUNTAP.ProxyDNS = TUNTAPProxyDNSCheckBox.Checked;
|
||||
Global.Settings.TUNTAP.UseCustomDNS = UseCustomDNSCheckBox.Checked;
|
||||
Global.Settings.TUNTAP.ProxyDNS = ProxyDNSCheckBox.Checked;
|
||||
Global.Settings.TUNTAP.UseFakeDNS = UseFakeDNSCheckBox.Checked;
|
||||
|
||||
Utils.Configuration.Save();
|
||||
MessageBox.Show(Utils.i18N.Translate("Saved"), Utils.i18N.Translate("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
MessageBox.Show(Utils.i18N.Translate("Saved. Modify some settings need to restart the software"), Utils.i18N.Translate("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
Close();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
22
Netch/Forms/SubscribeForm.Designer.cs
generated
@@ -62,7 +62,7 @@
|
||||
this.AddSubscriptionBox.Controls.Add(this.RemarkLabel);
|
||||
this.AddSubscriptionBox.Location = new System.Drawing.Point(12, 226);
|
||||
this.AddSubscriptionBox.Name = "AddSubscriptionBox";
|
||||
this.AddSubscriptionBox.Size = new System.Drawing.Size(660, 132);
|
||||
this.AddSubscriptionBox.Size = new System.Drawing.Size(660, 135);
|
||||
this.AddSubscriptionBox.TabIndex = 1;
|
||||
this.AddSubscriptionBox.TabStop = false;
|
||||
//
|
||||
@@ -75,11 +75,11 @@
|
||||
//
|
||||
// AddButton
|
||||
//
|
||||
this.AddButton.Location = new System.Drawing.Point(579, 103);
|
||||
this.AddButton.Location = new System.Drawing.Point(541, 103);
|
||||
this.AddButton.Name = "AddButton";
|
||||
this.AddButton.Size = new System.Drawing.Size(75, 23);
|
||||
this.AddButton.Size = new System.Drawing.Size(113, 26);
|
||||
this.AddButton.TabIndex = 7;
|
||||
this.AddButton.Text = "Add";
|
||||
this.AddButton.Text = "Add / Modify";
|
||||
this.AddButton.UseVisualStyleBackColor = true;
|
||||
this.AddButton.Click += new System.EventHandler(this.AddButton_Click);
|
||||
//
|
||||
@@ -88,7 +88,7 @@
|
||||
this.UserAgentLabel.AutoSize = true;
|
||||
this.UserAgentLabel.Location = new System.Drawing.Point(11, 77);
|
||||
this.UserAgentLabel.Name = "UserAgentLabel";
|
||||
this.UserAgentLabel.Size = new System.Drawing.Size(73, 17);
|
||||
this.UserAgentLabel.Size = new System.Drawing.Size(74, 17);
|
||||
this.UserAgentLabel.TabIndex = 5;
|
||||
this.UserAgentLabel.Text = "User-Agent";
|
||||
//
|
||||
@@ -150,6 +150,7 @@
|
||||
this.SubscribeLinkListView.TabIndex = 0;
|
||||
this.SubscribeLinkListView.UseCompatibleStateImageBehavior = false;
|
||||
this.SubscribeLinkListView.View = System.Windows.Forms.View.Details;
|
||||
this.SubscribeLinkListView.SelectedIndexChanged += new System.EventHandler(this.SubscribeLinkListView_SelectedIndexChanged);
|
||||
//
|
||||
// RemarkColumnHeader
|
||||
//
|
||||
@@ -169,30 +170,29 @@
|
||||
// pContextMenuStrip
|
||||
//
|
||||
this.pContextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.DeleteToolStripMenuItem});
|
||||
this.pContextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.DeleteToolStripMenuItem,
|
||||
this.CopyLinkToolStripMenuItem});
|
||||
this.pContextMenuStrip.Name = "pContextMenuStrip";
|
||||
this.pContextMenuStrip.Size = new System.Drawing.Size(114, 26);
|
||||
this.pContextMenuStrip.Size = new System.Drawing.Size(130, 48);
|
||||
//
|
||||
// DeleteToolStripMenuItem
|
||||
//
|
||||
this.DeleteToolStripMenuItem.Name = "DeleteToolStripMenuItem";
|
||||
this.DeleteToolStripMenuItem.Size = new System.Drawing.Size(113, 22);
|
||||
this.DeleteToolStripMenuItem.Size = new System.Drawing.Size(129, 22);
|
||||
this.DeleteToolStripMenuItem.Text = "Delete";
|
||||
this.DeleteToolStripMenuItem.Click += new System.EventHandler(this.DeleteToolStripMenuItem_Click);
|
||||
//
|
||||
// CopyLinkToolStripMenuItem
|
||||
//
|
||||
this.CopyLinkToolStripMenuItem.Name = "CopyLinkToolStripMenuItem";
|
||||
this.CopyLinkToolStripMenuItem.Size = new System.Drawing.Size(113, 22);
|
||||
this.CopyLinkToolStripMenuItem.Size = new System.Drawing.Size(129, 22);
|
||||
this.CopyLinkToolStripMenuItem.Text = "CopyLink";
|
||||
this.CopyLinkToolStripMenuItem.Click += new System.EventHandler(this.CopyLinkToolStripMenuItem_Click);
|
||||
//
|
||||
// UseSelectedServerCheckBox
|
||||
//
|
||||
this.UseSelectedServerCheckBox.AutoSize = true;
|
||||
this.UseSelectedServerCheckBox.Location = new System.Drawing.Point(12, 364);
|
||||
this.UseSelectedServerCheckBox.Location = new System.Drawing.Point(12, 396);
|
||||
this.UseSelectedServerCheckBox.Name = "UseSelectedServerCheckBox";
|
||||
this.UseSelectedServerCheckBox.Size = new System.Drawing.Size(285, 21);
|
||||
this.UseSelectedServerCheckBox.TabIndex = 9;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Netch.Models;
|
||||
using Netch.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Netch.Forms
|
||||
@@ -49,7 +50,17 @@ namespace Netch.Forms
|
||||
ControlButton.Text = Utils.i18N.Translate(ControlButton.Text);
|
||||
|
||||
UserAgentTextBox.Text = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36";
|
||||
UseSelectedServerCheckBox.Checked = Global.Settings.UseProxyToUpdateSubscription;
|
||||
|
||||
if (Global.Settings.Server.Count > 0)
|
||||
{
|
||||
UseSelectedServerCheckBox.Enabled = true;
|
||||
UseSelectedServerCheckBox.Checked = Global.Settings.UseProxyToUpdateSubscription;
|
||||
}
|
||||
else
|
||||
{
|
||||
UseSelectedServerCheckBox.Checked = false;
|
||||
UseSelectedServerCheckBox.Enabled = false;
|
||||
}
|
||||
|
||||
InitSubscribeLink();
|
||||
}
|
||||
@@ -76,26 +87,33 @@ namespace Netch.Forms
|
||||
{
|
||||
if (SubscribeLinkListView.SelectedItems.Count > 0)
|
||||
{
|
||||
for (var i = SubscribeLinkListView.SelectedItems.Count - 1; i >= 0; i--)
|
||||
DeleteSubscribe();
|
||||
}
|
||||
}
|
||||
}
|
||||
public void DeleteSubscribe()
|
||||
{
|
||||
if (SubscribeLinkListView.SelectedItems.Count > 0)
|
||||
{
|
||||
for (var i = SubscribeLinkListView.SelectedItems.Count - 1; i >= 0; i--)
|
||||
{
|
||||
var item = SubscribeLinkListView.SelectedItems[i];
|
||||
var link = Global.Settings.SubscribeLink[item.Index];
|
||||
|
||||
var list = new List<Models.Server>();
|
||||
foreach (var server in Global.Settings.Server)
|
||||
{
|
||||
var item = SubscribeLinkListView.SelectedItems[i];
|
||||
var link = Global.Settings.SubscribeLink[item.Index];
|
||||
|
||||
var list = new List<Models.Server>();
|
||||
foreach (var server in Global.Settings.Server)
|
||||
if (server.Group != link.Remark)
|
||||
{
|
||||
if (server.Group != link.Remark)
|
||||
{
|
||||
list.Add(server);
|
||||
}
|
||||
list.Add(server);
|
||||
}
|
||||
|
||||
Global.Settings.Server = list;
|
||||
Global.Settings.SubscribeLink.RemoveAt(item.Index);
|
||||
SubscribeLinkListView.Items.Remove(item);
|
||||
|
||||
Global.MainForm.InitServer();
|
||||
}
|
||||
|
||||
Global.Settings.Server = list;
|
||||
Global.Settings.SubscribeLink.RemoveAt(item.Index);
|
||||
SubscribeLinkListView.Items.Remove(item);
|
||||
|
||||
Global.MainForm.InitServer();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -108,12 +126,55 @@ namespace Netch.Forms
|
||||
{
|
||||
if (LinkTextBox.Text.StartsWith("HTTP://", StringComparison.OrdinalIgnoreCase) || LinkTextBox.Text.StartsWith("HTTPS://", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
Global.Settings.SubscribeLink.Add(new Models.SubscribeLink
|
||||
//是否为新增订阅
|
||||
var saveFlag = true;
|
||||
Global.Settings.SubscribeLink.ForEach((subitem) =>
|
||||
{
|
||||
Remark = RemarkTextBox.Text,
|
||||
Link = LinkTextBox.Text,
|
||||
UserAgent = UserAgentTextBox.Text
|
||||
if (subitem.Link.Equals(LinkTextBox.Text))
|
||||
{
|
||||
if (!subitem.Remark.Equals(RemarkTextBox.Text))
|
||||
{
|
||||
//修改了订阅备注,修改旧订阅服务器
|
||||
Global.Settings.Server.ForEach((serverItem) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
//当前服务器组群组为订阅群组时批量修改备注
|
||||
if (serverItem.Group == subitem.Remark) {
|
||||
|
||||
//serverItem.Group OldGroupRemark
|
||||
//RemarkTextBox.Text NewGroupRemark
|
||||
serverItem.Group = RemarkTextBox.Text;
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
});
|
||||
|
||||
subitem.Remark = RemarkTextBox.Text;
|
||||
Global.MainForm.InitServer();
|
||||
}
|
||||
|
||||
subitem.UserAgent = UserAgentTextBox.Text;
|
||||
saveFlag = false;
|
||||
|
||||
Utils.Configuration.Save();
|
||||
Global.Settings.UseProxyToUpdateSubscription = UseSelectedServerCheckBox.Checked;
|
||||
MessageBox.Show(Utils.i18N.Translate("Successfully saved"), Utils.i18N.Translate("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
|
||||
return;
|
||||
}
|
||||
});
|
||||
if (saveFlag)
|
||||
{
|
||||
Global.Settings.SubscribeLink.Add(new Models.SubscribeLink
|
||||
{
|
||||
Remark = RemarkTextBox.Text,
|
||||
Link = LinkTextBox.Text,
|
||||
UserAgent = UserAgentTextBox.Text
|
||||
});
|
||||
}
|
||||
|
||||
RemarkTextBox.Text = string.Empty;
|
||||
LinkTextBox.Text = string.Empty;
|
||||
@@ -144,5 +205,20 @@ namespace Netch.Forms
|
||||
MessageBox.Show(Utils.i18N.Translate("Successfully saved"), Utils.i18N.Translate("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
Close();
|
||||
}
|
||||
/// <summary>
|
||||
/// 订阅列表选中节点
|
||||
/// TODO 选中节点编辑
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void SubscribeLinkListView_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (SubscribeLinkListView.SelectedItems.Count > 0)
|
||||
{
|
||||
RemarkTextBox.Text = SubscribeLinkListView.SelectedItems[0].SubItems[0].Text;
|
||||
LinkTextBox.Text = SubscribeLinkListView.SelectedItems[0].SubItems[1].Text;
|
||||
UserAgentTextBox.Text = SubscribeLinkListView.SelectedItems[0].SubItems[2].Text;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
|
||||
namespace Netch.Models
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
namespace Netch.Models
|
||||
{
|
||||
public class Profile
|
||||
{
|
||||
{
|
||||
public string ServerRemark;
|
||||
public string ModeRemark;
|
||||
public string ProfileName;
|
||||
@@ -24,5 +24,5 @@
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using MaxMind.GeoIP2;
|
||||
using Netch.Utils;
|
||||
using System;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Netch.Models
|
||||
@@ -138,6 +138,11 @@ namespace Netch.Models
|
||||
/// </summary>
|
||||
public int Delay = -1;
|
||||
|
||||
/// <summary>
|
||||
/// 地区
|
||||
/// </summary>
|
||||
public string Country;
|
||||
|
||||
/// <summary>
|
||||
/// 获取备注
|
||||
/// </summary>
|
||||
@@ -149,16 +154,50 @@ namespace Netch.Models
|
||||
Remark = $"{Hostname}:{Port}";
|
||||
}
|
||||
|
||||
if (Country == null)
|
||||
{
|
||||
try
|
||||
{
|
||||
var databaseReader = new DatabaseReader("bin\\GeoLite2-Country.mmdb");
|
||||
|
||||
if (IPAddress.TryParse(Hostname, out _) == true)
|
||||
{
|
||||
Country = databaseReader.Country(Hostname).Country.IsoCode;
|
||||
}
|
||||
else
|
||||
{
|
||||
var DnsResult = DNS.Lookup(Hostname);
|
||||
|
||||
if (DnsResult != null)
|
||||
{
|
||||
Country = databaseReader.Country(DnsResult).Country.IsoCode;
|
||||
}
|
||||
else
|
||||
{
|
||||
Country = "UN";
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
Country = "UN";
|
||||
}
|
||||
}
|
||||
|
||||
Group = Group.Equals("None") || Group.Equals("") ? "NONE" : Group;
|
||||
|
||||
switch (Type)
|
||||
{
|
||||
case "Socks5":
|
||||
return $"[S5] {Remark}";
|
||||
return $"[S5][{Country}][{Group}] {Remark}";
|
||||
case "SS":
|
||||
return $"[SS] {Remark}";
|
||||
return $"[SS][{Country}][{Group}] {Remark}";
|
||||
case "SSR":
|
||||
return $"[SR] {Remark}";
|
||||
return $"[SR][{Country}][{Group}] {Remark}";
|
||||
case "VMess":
|
||||
return $"[V2] {Remark}";
|
||||
return $"[V2][{Country}][{Group}] {Remark}";
|
||||
case "Trojan":
|
||||
return $"[TR][{Country}][{Group}] {Remark}";
|
||||
default:
|
||||
return "WTF";
|
||||
}
|
||||
@@ -181,27 +220,11 @@ namespace Netch.Models
|
||||
var list = new Task<int>[3];
|
||||
for (var i = 0; i < 3; i++)
|
||||
{
|
||||
list[i] = Task.Run(() =>
|
||||
list[i] = Task.Run(async () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var client = new Socket(SocketType.Stream, ProtocolType.Tcp))
|
||||
{
|
||||
var watch = new Stopwatch();
|
||||
watch.Start();
|
||||
|
||||
var task = client.BeginConnect(new IPEndPoint(destination, Port), result =>
|
||||
{
|
||||
watch.Stop();
|
||||
}, 0);
|
||||
|
||||
if (task.AsyncWaitHandle.WaitOne(1000))
|
||||
{
|
||||
return (int)watch.ElapsedMilliseconds;
|
||||
}
|
||||
|
||||
return 1000;
|
||||
}
|
||||
return await Utils.Utils.TCPingAsync(destination, Port);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
@@ -210,7 +233,7 @@ namespace Netch.Models
|
||||
});
|
||||
}
|
||||
|
||||
Task.WaitAll(list);
|
||||
Task.WaitAll(list[0], list[1], list[2]);
|
||||
|
||||
var min = Math.Min(list[0].Result, list[1].Result);
|
||||
min = Math.Min(min, list[2].Result);
|
||||
|
||||
@@ -33,9 +33,14 @@ namespace Netch.Models
|
||||
public bool UseCustomDNS = false;
|
||||
|
||||
/// <summary>
|
||||
/// 模式2下是否代理DNS
|
||||
/// 模式 2 下是否代理 DNS
|
||||
/// </summary>
|
||||
public bool ProxyDNS = false;
|
||||
|
||||
/// <summary>
|
||||
/// 使用Fake DNS
|
||||
/// </summary>
|
||||
public bool UseFakeDNS = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -102,7 +107,7 @@ namespace Netch.Models
|
||||
/// <summary>
|
||||
/// Redirector TCP 占用端口
|
||||
/// </summary>
|
||||
//public int RedirectorTCPPort = 2800;
|
||||
public int RedirectorTCPPort = 3901;
|
||||
|
||||
/// <summary>
|
||||
/// HTTP 和 Socks5 本地代理地址
|
||||
@@ -153,5 +158,30 @@ namespace Netch.Models
|
||||
/// STUN测试服务器
|
||||
/// </summary>
|
||||
public int STUN_Server_Port = 3478;
|
||||
|
||||
/// <summary>
|
||||
/// 是否启用启动后延迟测试
|
||||
/// </summary>
|
||||
public bool StartedTcping = false;
|
||||
|
||||
/// <summary>
|
||||
/// 启动后延迟测试间隔/秒
|
||||
/// </summary>
|
||||
public int StartedTcping_Interval = 3;
|
||||
|
||||
/// <summary>
|
||||
/// ACL规则
|
||||
/// </summary>
|
||||
public string ACL = "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/banAD.acl";
|
||||
|
||||
/// <summary>
|
||||
/// 是否使用DLL启动Shadowsocks
|
||||
/// </summary>
|
||||
public bool BootShadowsocksFromDLL = false;
|
||||
|
||||
/// <summary>
|
||||
/// 语言设置
|
||||
/// </summary>
|
||||
public string Language = "System";
|
||||
}
|
||||
}
|
||||
|
||||
76
Netch/Models/Trojan.cs
Normal file
@@ -0,0 +1,76 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Netch.Models
|
||||
{
|
||||
public class Trojan
|
||||
{
|
||||
/// <summary>
|
||||
/// 启动类型
|
||||
/// </summary>
|
||||
public string run_type = "client";
|
||||
|
||||
/// <summary>
|
||||
/// 监听地址
|
||||
/// </summary>
|
||||
public string local_addr = "127.0.0.1";
|
||||
|
||||
/// <summary>
|
||||
/// 监听端口
|
||||
/// </summary>
|
||||
public int local_port = 2801;
|
||||
|
||||
/// <summary>
|
||||
/// 远端地址
|
||||
/// </summary>
|
||||
public string remote_addr;
|
||||
|
||||
/// <summary>
|
||||
/// 远端端口
|
||||
/// </summary>
|
||||
public int remote_port;
|
||||
|
||||
/// <summary>
|
||||
/// 密码
|
||||
/// </summary>
|
||||
public List<string> password;
|
||||
|
||||
/// <summary>
|
||||
/// 日志级别
|
||||
/// </summary>
|
||||
public int log_level = 1;
|
||||
|
||||
public TrojanSSL ssl = new TrojanSSL();
|
||||
public TrojanTCP tcp = new TrojanTCP();
|
||||
}
|
||||
|
||||
public class TrojanSSL
|
||||
{
|
||||
public bool verify = false;
|
||||
public bool verify_hostname = false;
|
||||
public string cert;
|
||||
public string cipher = "ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA:AES128-SHA:AES256-SHA:DES-CBC3-SHA";
|
||||
public string cipher_tls13 = "TLS_AES_128_GCM_SHA256:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_256_GCM_SHA384";
|
||||
public string sni;
|
||||
public List<string> alpn = new List<string>()
|
||||
{
|
||||
"h2",
|
||||
"http/1.1"
|
||||
};
|
||||
public bool reuse_session = true;
|
||||
public bool session_ticket = true;
|
||||
public string curves = "";
|
||||
}
|
||||
|
||||
public class TrojanTCP
|
||||
{
|
||||
public bool no_delay = false;
|
||||
public bool keep_alive = true;
|
||||
public bool reuse_port = false;
|
||||
public bool fast_open = true;
|
||||
public int fast_open_qlen = 20;
|
||||
}
|
||||
}
|
||||
@@ -63,5 +63,15 @@ namespace Netch
|
||||
/// <returns>是否成功</returns>
|
||||
[DllImport("bin\\sysproxy", CallingConvention = CallingConvention.Cdecl)]
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,49 +49,48 @@ namespace Netch
|
||||
}
|
||||
}
|
||||
|
||||
// 得到当前线程语言代码
|
||||
var culture = CultureInfo.CurrentCulture.Name;
|
||||
// 加载配置
|
||||
Utils.Configuration.Load();
|
||||
|
||||
// 如果命令行参数只有一个,且传入有效语言代码,那么覆盖掉已得到的语言代码
|
||||
if (args.Length == 1)
|
||||
// 加载系统语言
|
||||
if (Global.Settings.Language.Equals("System"))
|
||||
{
|
||||
try
|
||||
// 得到当前线程语言代码
|
||||
var culture = CultureInfo.CurrentCulture.Name;
|
||||
|
||||
// 尝试加载内置中文语言
|
||||
if (culture == "zh-CN")
|
||||
{
|
||||
culture = CultureInfo.GetCultureInfo(args[0]).Name;
|
||||
// 加载语言
|
||||
Utils.i18N.Load(Encoding.UTF8.GetString(Properties.Resources.zh_CN));
|
||||
}
|
||||
catch (CultureNotFoundException)
|
||||
|
||||
// 从外置文件中加载语言
|
||||
if (File.Exists($"i18n\\{culture}"))
|
||||
{
|
||||
// 跳过
|
||||
// 加载语言
|
||||
Utils.i18N.Load(File.ReadAllText($"i18n\\{culture}"));
|
||||
}
|
||||
}
|
||||
|
||||
if (Global.Settings.Language.Equals("zh-CN"))
|
||||
{
|
||||
// 加载内置中文
|
||||
Utils.i18N.Load(Encoding.UTF8.GetString(Properties.Resources.zh_CN));
|
||||
}
|
||||
else if (Global.Settings.Language.Equals("en-US"))
|
||||
{
|
||||
// 加载内置英文
|
||||
Utils.i18N.Load(Global.Settings.Language);
|
||||
}
|
||||
else if (File.Exists($"i18n\\{Global.Settings.Language}"))
|
||||
{
|
||||
// 从外置文件中加载语言
|
||||
Utils.i18N.Load(File.ReadAllText($"i18n\\{Global.Settings.Language}"));
|
||||
}
|
||||
|
||||
// 记录当前系统语言
|
||||
Utils.Logging.Info($"当前系统语言:{culture}");
|
||||
|
||||
// 尝试加载内置中文语言
|
||||
if (culture == "zh-CN")
|
||||
{
|
||||
// 加载语言
|
||||
Utils.i18N.Load(Encoding.UTF8.GetString(Properties.Resources.zh_CN));
|
||||
|
||||
// 记录当前程序语言
|
||||
Utils.Logging.Info($"当前程序语言:{culture}");
|
||||
}
|
||||
|
||||
// 从外置文件中加载语言
|
||||
if (File.Exists($"i18n\\{culture}"))
|
||||
{
|
||||
// 加载语言
|
||||
Utils.i18N.Load(File.ReadAllText($"i18n\\{culture}"));
|
||||
|
||||
// 记录当前程序语言
|
||||
Utils.Logging.Info($"当前程序语言:{culture}");
|
||||
}
|
||||
else
|
||||
{
|
||||
// 记录日志
|
||||
Utils.Logging.Info("当前程序语言:en_US");
|
||||
}
|
||||
Utils.Logging.Info($"当前语言:{Global.Settings.Language}");
|
||||
|
||||
// 检查是否已经运行
|
||||
if (!mutex.WaitOne(0, false))
|
||||
@@ -129,8 +128,11 @@ namespace Netch
|
||||
|
||||
public static void Application_OnException(object sender, ThreadExceptionEventArgs e)
|
||||
{
|
||||
MessageBox.Show(e.Exception.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
Application.Exit();
|
||||
if (!e.Exception.ToString().Contains("ComboBox"))
|
||||
{
|
||||
MessageBox.Show(e.Exception.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
//Application.Exit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,9 +9,10 @@
|
||||
<StartupObject>Netch.Netch</StartupObject>
|
||||
<ApplicationManifest>App.manifest</ApplicationManifest>
|
||||
<ApplicationIcon>Netch.ico</ApplicationIcon>
|
||||
<Platforms>x86;x64</Platforms>
|
||||
<Platforms>x64</Platforms>
|
||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<PackageProjectUrl>https://github.com/NetchX/Netch</PackageProjectUrl>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
@@ -23,23 +24,6 @@
|
||||
<NoWarn />
|
||||
</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'">
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<NoWarn />
|
||||
@@ -65,14 +49,18 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="DNS" Version="5.0.0" />
|
||||
<PackageReference Include="DnsClient" Version="1.2.0" />
|
||||
<PackageReference Include="ini-parser" Version="2.5.2" />
|
||||
<PackageReference Include="MaxMind.GeoIP2" Version="3.2.0" />
|
||||
<PackageReference Include="Microsoft.Diagnostics.Tracing.TraceEvent" Version="2.0.56" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||
<PackageReference Include="System.Buffers" Version="4.5.0" />
|
||||
<PackageReference Include="System.Buffers" Version="4.5.1" />
|
||||
<PackageReference Include="WindowsAPICodePack-Shell" Version="1.1.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\NetchLib\NetchLib.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.ServiceProcess" />
|
||||
@@ -80,6 +68,9 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="Forms\Server\Trojan.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Update="Properties\Resources.Designer.cs">
|
||||
<DesignTime>True</DesignTime>
|
||||
<AutoGen>True</AutoGen>
|
||||
@@ -105,7 +96,8 @@
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<Target Condition="'$(VisualStudioDir)' != ''" Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||
<Exec Command="@ECHO OFF
RD /S /Q $(TargetDir)bin > NUL 2>&1
RD /S /Q $(TargetDir)i18n > NUL 2>&1
RD /S /Q $(TargetDir)mode > NUL 2>&1

MKDIR $(TargetDir)bin > NUL 2>&1
MKDIR $(TargetDir)i18n > NUL 2>&1
MKDIR $(TargetDir)mode > NUL 2>&1

COPY /Y $(SolutionDir)binaries\$(PlatformName)\* $(TargetDir)bin > NUL 2>&1
COPY /Y $(SolutionDir)binaries\* $(TargetDir)bin > NUL 2>&1
MOVE /Y $(TargetDir)bin\nfapinet.dll $(TargetDir)nfapinet.dll > NUL 2>&1
COPY /Y $(SolutionDir)translations\i18n\* $(TargetDir)i18n > NUL 2>&1
COPY /Y $(SolutionDir)modes\mode\*.txt $(TargetDir)mode > NUL 2>&1
MKDIR $(TargetDir)bin\tap-driver > NUL 2>&1
COPY /Y $(SolutionDir)binaries\$(PlatformName)\tap-driver\* $(TargetDir)bin\tap-driver > NUL 2>&1" />
|
||||
<ProjectExtensions><VisualStudio><UserProperties /></VisualStudio></ProjectExtensions>
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||
<Exec Command="@ECHO OFF
RD /S /Q $(TargetDir)bin > NUL 2>&1
RD /S /Q $(TargetDir)i18n > NUL 2>&1
RD /S /Q $(TargetDir)mode > NUL 2>&1

MKDIR $(TargetDir)bin > NUL 2>&1
MKDIR $(TargetDir)i18n > NUL 2>&1
MKDIR $(TargetDir)mode > NUL 2>&1

COPY /Y $(SolutionDir)binaries\* $(TargetDir)bin > NUL 2>&1
COPY /Y $(SolutionDir)translations\i18n\* $(TargetDir)i18n > NUL 2>&1
COPY /Y $(SolutionDir)modes\mode\* $(TargetDir)mode > NUL 2>&1
MKDIR $(TargetDir)bin\tap-driver > NUL 2>&1
COPY /Y $(SolutionDir)binaries\tap-driver\* $(TargetDir)bin\tap-driver > NUL 2>&1

DEL / f $(TargetDir)\*.config
DEL / f $(TargetDir)\*.pdb
RD /s /Q $(TargetDir)\x86" />
|
||||
</Target>
|
||||
</Project>
|
||||
|
||||
@@ -8,8 +8,8 @@ namespace Netch.Override
|
||||
protected override WebRequest GetWebRequest(Uri address)
|
||||
{
|
||||
var request = base.GetWebRequest(address);
|
||||
request.Timeout = 4000;
|
||||
((HttpWebRequest)request).ReadWriteTimeout = 4000;
|
||||
request.Timeout = 10000;
|
||||
((HttpWebRequest)request).ReadWriteTimeout = 10000;
|
||||
|
||||
return request;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Reflection;
|
||||
using Netch.Controllers;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using Netch.Controllers;
|
||||
|
||||
// 有关程序集的一般信息由以下
|
||||
// 控制。更改这些特性值可修改
|
||||
|
||||
20
Netch/Properties/Resources.Designer.cs
generated
@@ -110,16 +110,6 @@ namespace Netch.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap N3RO {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("N3RO", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||
/// </summary>
|
||||
@@ -140,6 +130,16 @@ namespace Netch.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap Sponsor {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("Sponsor", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找 System.Byte[] 类型的本地化资源。
|
||||
/// </summary>
|
||||
|
||||
@@ -139,8 +139,8 @@
|
||||
<data name="Netch" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Netch.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="N3RO" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\N3RO.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
<data name="Sponsor" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Sponsor.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="CopyLink" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\CopyLink.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
using DNS.Protocol;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Netch
|
||||
{
|
||||
public class Resolver : DNS.Client.RequestResolver.IRequestResolver
|
||||
{
|
||||
public Task<IResponse> Resolve(IRequest request)
|
||||
{
|
||||
IResponse response = Response.FromRequest(request);
|
||||
|
||||
foreach (var question in response.Questions)
|
||||
{
|
||||
if (question.Type == RecordType.A)
|
||||
{
|
||||
var client = new DnsClient.LookupClient(DnsClient.NameServer.GooglePublicDns);
|
||||
client.UseTcpOnly = true;
|
||||
client.UseCache = true;
|
||||
|
||||
try
|
||||
{
|
||||
var result = client.Query(question.Name.ToString(), DnsClient.QueryType.A);
|
||||
foreach (var item in result.Answers.ARecords())
|
||||
{
|
||||
response.AnswerRecords.Add(new DNS.Protocol.ResourceRecords.IPAddressResourceRecord(question.Name, item.Address));
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
// 跳过
|
||||
}
|
||||
}
|
||||
else if (question.Type == RecordType.AAAA)
|
||||
{
|
||||
var client = new DnsClient.LookupClient(DnsClient.NameServer.GooglePublicDns);
|
||||
client.UseTcpOnly = true;
|
||||
client.UseCache = true;
|
||||
|
||||
try
|
||||
{
|
||||
var result = client.Query(question.Name.ToString(), DnsClient.QueryType.AAAA);
|
||||
foreach (var item in result.Answers.AaaaRecords())
|
||||
{
|
||||
response.AnswerRecords.Add(new DNS.Protocol.ResourceRecords.IPAddressResourceRecord(question.Name, item.Address));
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
// 跳过
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Task.FromResult(response);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 37 KiB |
@@ -12,23 +12,27 @@
|
||||
"Stop": "停止",
|
||||
"Waiting for command": "等待命令中",
|
||||
"Starting": "正在启动中",
|
||||
"Start failed": "启动失败",
|
||||
"Start failed": "启动失败,请打开软件目录logging文件夹查看日志",
|
||||
"Started": "已启动",
|
||||
"Stopping": "正在停止中",
|
||||
"Stopped": "已停止",
|
||||
"Starting Shadowsocks": "正在启动Shadowsocks",
|
||||
"Starting ShadowsocksR": "正在启动ShadowsocksR",
|
||||
"Starting V2ray": "正在启动V2ray",
|
||||
"Starting Tap": "正在启动Tap",
|
||||
"Starting NatTester": "正在启动Nat测试",
|
||||
"Starting LocalDns service": "正在启动本地DNS服务",
|
||||
"Starting Redirector": "正在启动Redirector",
|
||||
"Starting netfilter2 Service": "正在启动netfilter2服务",
|
||||
"Starting dns2tcp Service": "正在启动dns2tcp服务",
|
||||
"Starting Shadowsocks": "正在启动 Shadowsocks",
|
||||
"Starting ShadowsocksR": "正在启动 ShadowsocksR",
|
||||
"Starting V2ray": "正在启动 V2Ray",
|
||||
"Starting Trojan": "正在启动 Trojan",
|
||||
"Starting Tap": "正在启动 TUN/TAP",
|
||||
"Starting NatTester": "正在启动 NAT 测试",
|
||||
"Starting LocalDns service": "正在启动本地 DNS 服务",
|
||||
"Starting Redirector": "正在启动 Redirector",
|
||||
"ReStarting Redirector": "正常启动失败,正在尝试重新启动 Redirector",
|
||||
"Starting netfilter2 Service": "正在启动 netfilter2 服务",
|
||||
"Starting dns Service": "正在启动 DNS 服务",
|
||||
"SetupBypass": "设置绕行规则",
|
||||
"Test failed": "测试失败",
|
||||
"Starting update subscription": "正在更新订阅",
|
||||
"Starting update ACL": "正在更新 ACL",
|
||||
"Subscription updated": "订阅更新完毕",
|
||||
"Register driver": "正在注册驱动",
|
||||
|
||||
"Server": "服务器",
|
||||
"Import Servers From Clipboard": "从剪贴板导入服务器",
|
||||
@@ -37,6 +41,7 @@
|
||||
"Add [Shadowsocks] Server": "添加 [Shadowsocks] 服务器",
|
||||
"Add [ShadowsocksR] Server": "添加 [ShadowsocksR] 服务器",
|
||||
"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 将会跳转",
|
||||
"Netch is now minimized to the notification bar, double click this icon to restore.": "Netch 已最小化至通知栏,双击此图标恢复窗口。",
|
||||
"New version available": "发现新版本",
|
||||
@@ -86,6 +91,14 @@
|
||||
"Modes have been reload": "模式已重载",
|
||||
"Clean DNS Cache": "清理 DNS 缓存",
|
||||
"DNS cache cleanup succeeded": "DNS 缓存清理成功",
|
||||
"Update ACL": "更新 ACL 规则",
|
||||
"Update ACL with proxy": "使用代理更新 ACL 规则",
|
||||
"ACL updated successfully": "ACL 更新成功",
|
||||
"ACL update failed": "ACL 更新失败",
|
||||
"Reinstall TUN/TAP driver": "重新安装 TUN/TAP 驱动",
|
||||
"Reinstall TUN/TAP driver successfully": "重装 TUN/TAP 驱动成功",
|
||||
"Reinstall TUN/TAP driver failed": "重装 TUN/TAP 驱动失败",
|
||||
"Reinstalling TUN/TAP driver": "正在重装 TUN/TAP 驱动",
|
||||
|
||||
"About": "关于",
|
||||
"Telegram Channel": "Telegram 频道",
|
||||
@@ -96,6 +109,8 @@
|
||||
"Please press Stop button first": "请先点击停止按钮",
|
||||
"Please select a server first": "请先选择一个服务器",
|
||||
"Please select an mode first": "请先选择一个模式",
|
||||
"Please enter a profile name first": "请先为该配置设置一个名称",
|
||||
"No saved profile here. Save a profile first by Ctrl+Click on the button": "当前按钮下没有保存配置,请先使用 CTRL + 左键 点击该按钮保存一个配置",
|
||||
|
||||
"Used": "已使用",
|
||||
"Status": "状态",
|
||||
@@ -110,6 +125,7 @@
|
||||
"Add": "添加",
|
||||
"Scan": "扫描",
|
||||
"Save": "保存",
|
||||
"Add / Modify": "保存/修改",
|
||||
"Select a folder": "选择一个目录",
|
||||
"Please enter an process name (xxx.exe)": "请输入一个进程名(xxx.exe)",
|
||||
"Scan completed": "扫描完成",
|
||||
@@ -129,6 +145,7 @@
|
||||
"Link can not be empty": "链接不可为空",
|
||||
"Link must start with http:// or https://": "链接必须以 http:// 或 https:// 开头",
|
||||
"Successfully saved": "保存成功",
|
||||
"Please fill in alterID": "请填写额外ID",
|
||||
|
||||
"Settings": "设置",
|
||||
"Start when opened": "打开软件时启动加速",
|
||||
@@ -139,22 +156,43 @@
|
||||
"Netmask": "子网掩码",
|
||||
"Gateway": "网关",
|
||||
"Use Custom DNS": "使用自定义 DNS",
|
||||
"Proxy DNS in Mode 2": "在模式2下代理DNS",
|
||||
"Proxy DNS in Mode 2": "在模式 2 下代理 DNS",
|
||||
"Use Fake DNS": "使用 Fake DNS",
|
||||
"Behavior": "行为",
|
||||
"Exit when closed": "关闭时退出",
|
||||
"Stop when exited": "退出时停止",
|
||||
"Global Bypass IPs": "全局直连 IP",
|
||||
"Port value illegal. Try again.": "端口值非法。请重试。",
|
||||
"Check update when opened": "打开软件时检查更新",
|
||||
"Start Shadowsocks from DLL (No support for ACL)": "SS DLL(推荐使用,不支持 ACL)",
|
||||
"ProfileCount": "快捷配置数量(重启软件生效)",
|
||||
"ProfileCount value illegal. Try again.": "快捷配置数值非法。请重试。",
|
||||
"STUN_ServerPort value illegal. Try again.": "STUN端口数值非法。请重试。",
|
||||
"TUN/TAP driver is not detected. Is it installed now?": "未检测到TUN/TAP驱动,是否现在安装?",
|
||||
"STUN_ServerPort value illegal. Try again.": "STUN 端口数值非法。请重试。",
|
||||
"Detection interval value illegal. Try again.": "检测间隔值非法。请重试。",
|
||||
"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 官网下载依赖程序?",
|
||||
"Experimental function": "实验性功能",
|
||||
"Delay test after start": "启动后延迟测试",
|
||||
"Enable": "启用",
|
||||
"Detection interval(sec)": "检测间隔(秒)",
|
||||
"STUN Server": "STUN 服务器",
|
||||
"STUN Server Port": "STUN 服务器端口",
|
||||
"Custom ACL": "自定义 ACL 规则",
|
||||
"Language": "语言",
|
||||
"Saved. Modify some settings need to restart the software": "保存成功,修改部分设置需重启软件",
|
||||
|
||||
"Profile": "配置名",
|
||||
"Profiles": "配置",
|
||||
"None": "无",
|
||||
|
||||
"Show": "显示",
|
||||
"Exit": "退出"
|
||||
"Exit": "退出",
|
||||
"Unable to start? Click me to download": "无法启动?点我下载依赖",
|
||||
|
||||
"Bypass LAN": "[网页代理] 绕过局域网",
|
||||
"Bypass LAN (Non System Proxy)": "[网页代理] 绕过局域网(不设置系统代理)",
|
||||
"Bypass LAN (TUN/TAP)": "[TUN/TAP] 绕过局域网",
|
||||
"Bypass LAN and China": "[网页代理] 绕过局域网和中国大陆",
|
||||
"Bypass LAN and China (Non System Proxy)": "[网页代理] 绕过局域网和中国大陆 (不设置系统代理)",
|
||||
"Bypass LAN and China (TUN/TAP)": "[TUN/TAP] 绕过局域网和中国大陆"
|
||||
}
|
||||
@@ -1,7 +1,20 @@
|
||||
namespace Netch.Utils
|
||||
using Microsoft.Diagnostics.Tracing.Parsers;
|
||||
using Microsoft.Diagnostics.Tracing.Session;
|
||||
using Netch.Controllers;
|
||||
using Netch.Forms;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Netch.Utils
|
||||
{
|
||||
public static class Bandwidth
|
||||
{
|
||||
public static int received = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 计算流量
|
||||
/// </summary>
|
||||
@@ -18,7 +31,105 @@
|
||||
i++;
|
||||
} while ((result /= 1024) > 1024);
|
||||
|
||||
if (result < 0)
|
||||
{
|
||||
result = 0;
|
||||
}
|
||||
|
||||
return string.Format("{0} {1}", System.Math.Round(result, 2), units[i]);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据程序名统计流量
|
||||
/// </summary>
|
||||
/// <param name="ProcessName"></param>
|
||||
public static void NetTraffic(Models.Server server, Models.Mode mode, MainController mainController)
|
||||
{
|
||||
var counterLock = new object();
|
||||
//int sent = 0;
|
||||
|
||||
//var processList = Process.GetProcessesByName(ProcessName).Select(p => p.Id).ToHashSet();
|
||||
List<int> processList = new List<int>();
|
||||
|
||||
if (server.Type.Equals("Socks5") && mainController.pHTTPController != null)
|
||||
{
|
||||
processList.Add(mainController.pHTTPController.pPrivoxyController.Instance.Id);
|
||||
}
|
||||
else if (server.Type.Equals("SS") && Global.Settings.BootShadowsocksFromDLL)
|
||||
{
|
||||
processList.Add(Process.GetCurrentProcess().Id);
|
||||
}
|
||||
else if (server.Type.Equals("SS") && mainController.pSSController != null)
|
||||
{
|
||||
processList.Add(mainController.pSSController.Instance.Id);
|
||||
}
|
||||
else if (server.Type.Equals("SSR") && mainController.pSSRController != null)
|
||||
{
|
||||
processList.Add(mainController.pSSRController.Instance.Id);
|
||||
}
|
||||
else if (server.Type.Equals("VMess") && mainController.pVMessController != null)
|
||||
{
|
||||
processList.Add(mainController.pVMessController.Instance.Id);
|
||||
}
|
||||
else if (server.Type.Equals("TR") && mainController.pTrojanController != null)
|
||||
{
|
||||
processList.Add(mainController.pTrojanController.Instance.Id);
|
||||
}
|
||||
else if (mainController.pTUNTAPController != null)
|
||||
{
|
||||
processList.Add(mainController.pTUNTAPController.Instance.Id);
|
||||
}
|
||||
else if (mainController.pNFController != null)
|
||||
{
|
||||
processList.Add(mainController.pNFController.Instance.Id);
|
||||
}
|
||||
Logging.Info("启动流量统计 PID:" + string.Join(",", processList.ToArray()));
|
||||
|
||||
Task.Run(() =>
|
||||
{
|
||||
using (var session = new TraceEventSession("KernelAndClrEventsSession"))
|
||||
{
|
||||
session.EnableKernelProvider(KernelTraceEventParser.Keywords.NetworkTCPIP);
|
||||
|
||||
//这玩意儿上传和下载得到的data是一样的:)
|
||||
//所以暂时没办法区分上传下载流量
|
||||
session.Source.Kernel.TcpIpRecv += data =>
|
||||
{
|
||||
if (processList.Contains(data.ProcessID))
|
||||
{
|
||||
lock (counterLock)
|
||||
received += data.size;
|
||||
//Logging.Info($"TcpIpRecv: {Compute(data.size)}");
|
||||
}
|
||||
};
|
||||
session.Source.Kernel.UdpIpRecv += data =>
|
||||
{
|
||||
if (processList.Contains(data.ProcessID))
|
||||
{
|
||||
lock (counterLock)
|
||||
received += data.size;
|
||||
//Logging.Info($"UdpIpRecv: {Compute(data.size)}");
|
||||
}
|
||||
};
|
||||
|
||||
session.Source.Process();
|
||||
}
|
||||
});
|
||||
|
||||
if ((Convert.ToInt32(MainForm.Instance.LastDownloadBandwidth) - Convert.ToInt32(received)) == 0)
|
||||
{
|
||||
MainForm.Instance.OnBandwidthUpdated(0);
|
||||
received = 0;
|
||||
}
|
||||
while (MainForm.Instance.State != Models.State.Stopped)
|
||||
{
|
||||
Task.Delay(1000).Wait();
|
||||
lock (counterLock)
|
||||
{
|
||||
MainForm.Instance.OnBandwidthUpdated(Convert.ToInt64(received));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.IO;
|
||||
using System.Net;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Net.Sockets;
|
||||
using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Netch.Utils
|
||||
@@ -25,49 +26,49 @@ namespace Netch.Utils
|
||||
/// </summary>
|
||||
public static void Load()
|
||||
{
|
||||
if (Directory.Exists(DATA_DIR))
|
||||
if (Directory.Exists(DATA_DIR) && File.Exists(SETTINGS_JSON))
|
||||
{
|
||||
if (File.Exists(SETTINGS_JSON))
|
||||
try
|
||||
{
|
||||
try
|
||||
Global.Settings = Newtonsoft.Json.JsonConvert.DeserializeObject<Models.Setting>(File.ReadAllText(SETTINGS_JSON));
|
||||
if (Global.Settings.Server != null && Global.Settings.Server.Count > 0)
|
||||
{
|
||||
Global.Settings = Newtonsoft.Json.JsonConvert.DeserializeObject<Models.Setting>(File.ReadAllText(SETTINGS_JSON));
|
||||
if (Global.Settings.Server != null && Global.Settings.Server.Count > 0)
|
||||
// 如果是旧版 Server 类,使用旧版 Server 类进行读取
|
||||
if (Global.Settings.Server[0].Hostname == null)
|
||||
{
|
||||
// 如果是旧版 Server 类,使用旧版 Server 类进行读取
|
||||
if (Global.Settings.Server[0].Hostname == null)
|
||||
var LegacySettingConfig = Newtonsoft.Json.JsonConvert.DeserializeObject<Models.LegacySetting>(File.ReadAllText(SETTINGS_JSON));
|
||||
for (var i = 0; i < LegacySettingConfig.Server.Count; i++)
|
||||
{
|
||||
var LegacySettingConfig = Newtonsoft.Json.JsonConvert.DeserializeObject<Models.LegacySetting>(File.ReadAllText(SETTINGS_JSON));
|
||||
for (var i = 0; i < LegacySettingConfig.Server.Count; i++)
|
||||
Global.Settings.Server[i].Hostname = LegacySettingConfig.Server[i].Address;
|
||||
if (Global.Settings.Server[i].Type == "Shadowsocks")
|
||||
{
|
||||
Global.Settings.Server[i].Hostname = LegacySettingConfig.Server[i].Address;
|
||||
if (Global.Settings.Server[i].Type == "Shadowsocks")
|
||||
{
|
||||
Global.Settings.Server[i].Type = "SS";
|
||||
Global.Settings.Server[i].Plugin = LegacySettingConfig.Server[i].OBFS;
|
||||
Global.Settings.Server[i].PluginOption = LegacySettingConfig.Server[i].OBFSParam;
|
||||
}
|
||||
else if (Global.Settings.Server[i].Type == "ShadowsocksR")
|
||||
{
|
||||
Global.Settings.Server[i].Type = "SSR";
|
||||
}
|
||||
else if (Global.Settings.Server[i].Type == "VMess")
|
||||
{
|
||||
Global.Settings.Server[i].QUICSecure = LegacySettingConfig.Server[i].QUICSecurity;
|
||||
}
|
||||
Global.Settings.Server[i].Type = "SS";
|
||||
Global.Settings.Server[i].Plugin = LegacySettingConfig.Server[i].OBFS;
|
||||
Global.Settings.Server[i].PluginOption = LegacySettingConfig.Server[i].OBFSParam;
|
||||
}
|
||||
else if (Global.Settings.Server[i].Type == "ShadowsocksR")
|
||||
{
|
||||
Global.Settings.Server[i].Type = "SSR";
|
||||
}
|
||||
else if (Global.Settings.Server[i].Type == "VMess")
|
||||
{
|
||||
Global.Settings.Server[i].QUICSecure = LegacySettingConfig.Server[i].QUICSecurity;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
catch (Newtonsoft.Json.JsonException)
|
||||
{
|
||||
catch (Newtonsoft.Json.JsonException)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 弹出提示
|
||||
MessageBox.Show("如果你是第一次使用本软件\n请务必前往http://netch.org 安装程序所需依赖,\n否则程序将无法正常运行!", i18N.Translate("注意!"), MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
|
||||
// 创建 data 文件夹并保存默认设置
|
||||
Save();
|
||||
}
|
||||
@@ -160,19 +161,16 @@ namespace Netch.Utils
|
||||
Global.TUNTAP.ComponentID = TUNTAP.GetComponentID();
|
||||
if (string.IsNullOrEmpty(Global.TUNTAP.ComponentID))
|
||||
{
|
||||
Logging.Info("未找到可用 TUN/TAP 适配器");
|
||||
if (MessageBox.Show(i18N.Translate("TUN/TAP driver is not detected. Is it installed now?"), i18N.Translate("Information"), MessageBoxButtons.OKCancel, MessageBoxIcon.Information) == DialogResult.OK)
|
||||
{
|
||||
//安装Tap Driver
|
||||
Process installProcess = new Process();
|
||||
installProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
|
||||
installProcess.StartInfo.FileName = Path.Combine("bin/tap-driver", "install.bat");
|
||||
installProcess.Start();
|
||||
installProcess.WaitForExit();
|
||||
installProcess.Close();
|
||||
|
||||
addtap();
|
||||
//给点时间,不然立马安装完毕就查找适配器可能会导致找不到适配器ID
|
||||
Thread.Sleep(1000);
|
||||
Global.TUNTAP.ComponentID = TUNTAP.GetComponentID();
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
//MessageBox.Show(i18N.Translate("Please install TAP-Windows and create an TUN/TAP adapter manually"), i18N.Translate("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
@@ -195,5 +193,32 @@ namespace Netch.Utils
|
||||
Logging.Info("无法找到出口");
|
||||
return false;
|
||||
}
|
||||
/// <summary>
|
||||
/// 安装tap网卡
|
||||
/// </summary>
|
||||
public static void addtap()
|
||||
{
|
||||
Logging.Info("正在安装 TUN/TAP 适配器");
|
||||
//安装Tap Driver
|
||||
Process installProcess = new Process();
|
||||
installProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
|
||||
installProcess.StartInfo.FileName = Path.Combine("bin/tap-driver", "addtap.bat");
|
||||
installProcess.Start();
|
||||
installProcess.WaitForExit();
|
||||
installProcess.Close();
|
||||
}
|
||||
/// <summary>
|
||||
/// 卸载tap网卡
|
||||
/// </summary>
|
||||
public static void deltapall()
|
||||
{
|
||||
Logging.Info("正在卸载 TUN/TAP 适配器");
|
||||
Process installProcess = new Process();
|
||||
installProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
|
||||
installProcess.StartInfo.FileName = Path.Combine("bin/tap-driver", "deltapall.bat");
|
||||
installProcess.Start();
|
||||
installProcess.WaitForExit();
|
||||
installProcess.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
using System;
|
||||
using Netch.Models;
|
||||
using Netch.Models.SS;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Web;
|
||||
using Netch.Models;
|
||||
using Netch.Models.SS;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Netch.Utils
|
||||
{
|
||||
@@ -28,7 +28,7 @@ namespace Netch.Utils
|
||||
/// <returns>加密后的字符串</returns>
|
||||
public static string URLSafeBase64Encode(string text)
|
||||
{
|
||||
return Convert.ToBase64String(Encoding.UTF8.GetBytes(text)).Replace("-", "+").Replace("_", "/").PadRight(text.Length + (4 - text.Length % 4) % 4, '=');
|
||||
return Convert.ToBase64String(Encoding.UTF8.GetBytes(text)).Replace("+", "-").Replace("/", "_").Replace("=", "");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -290,80 +290,88 @@ namespace Netch.Utils
|
||||
}
|
||||
else if (text.StartsWith("ssr://"))
|
||||
{
|
||||
var data = new Server();
|
||||
data.Type = "SSR";
|
||||
|
||||
text = text.Substring(6);
|
||||
list.Add(SsrServerFromLink(text));
|
||||
|
||||
var parser = new Regex(@"^(?<server>.+):(?<port>(-?\d+?)):(?<protocol>.+?):(?<method>.+?):(?<obfs>.+?):(?<password>.+?)/\?(?<info>.*)$");
|
||||
var match = parser.Match(URLSafeBase64Decode(text));
|
||||
/* var data = new Server();
|
||||
data.Type = "SSR";
|
||||
|
||||
if (match.Success)
|
||||
{
|
||||
data.Hostname = match.Groups["server"].Value;
|
||||
data.Port = int.Parse(match.Groups["port"].Value);
|
||||
if (data.Port < 0)
|
||||
{
|
||||
data.Port += 65536;
|
||||
}
|
||||
data.Password = URLSafeBase64Decode(match.Groups["password"].Value);
|
||||
text = text.Substring(6);
|
||||
|
||||
data.EncryptMethod = match.Groups["method"].Value;
|
||||
if (!Global.EncryptMethods.SSR.Contains(data.EncryptMethod))
|
||||
{
|
||||
Logging.Info(string.Format("不支持的 SSR 加密方式:{0}", data.EncryptMethod));
|
||||
return null;
|
||||
}
|
||||
var parser = new Regex(@"^(?<server>.+):(?<port>(-?\d+?)):(?<protocol>.+?):(?<method>.+?):(?<obfs>.+?):(?<password>.+?)/\?(?<info>.*)$");
|
||||
var parser2 = new Regex(@"^(?<server>.+):(?<port>(-?\d+?)):(?<protocol>.+?):(?<method>.+?):(?<obfs>.+?):(?<password>.+?)/$");
|
||||
var match = parser2.Match(URLSafeBase64Decode(text));
|
||||
if (!match.Success)
|
||||
{
|
||||
match = parser2.Match(UnBase64String(text));
|
||||
}
|
||||
|
||||
data.Protocol = match.Groups["protocol"].Value;
|
||||
if (!Global.Protocols.Contains(data.Protocol))
|
||||
{
|
||||
Logging.Info(string.Format("不支持的 SSR 协议:{0}", data.Protocol));
|
||||
return null;
|
||||
}
|
||||
if (match.Success)
|
||||
{
|
||||
data.Hostname = match.Groups["server"].Value;
|
||||
data.Port = int.Parse(match.Groups["port"].Value);
|
||||
if (data.Port < 0)
|
||||
{
|
||||
data.Port += 65536;
|
||||
}
|
||||
data.Password = URLSafeBase64Decode(match.Groups["password"].Value);
|
||||
|
||||
data.OBFS = match.Groups["obfs"].Value;
|
||||
if (data.OBFS == @"tls1.2_ticket_fastauth")
|
||||
{
|
||||
data.OBFS = @"tls1.2_ticket_auth";
|
||||
}
|
||||
if (!Global.OBFSs.Contains(data.OBFS))
|
||||
{
|
||||
Logging.Info(string.Format("不支持的 SSR 混淆:{0}", data.OBFS));
|
||||
return null;
|
||||
}
|
||||
data.EncryptMethod = match.Groups["method"].Value;
|
||||
if (!Global.EncryptMethods.SSR.Contains(data.EncryptMethod))
|
||||
{
|
||||
Logging.Info(string.Format("不支持的 SSR 加密方式:{0}", data.EncryptMethod));
|
||||
return null;
|
||||
}
|
||||
|
||||
var info = match.Groups["info"].Value;
|
||||
var dict = new Dictionary<string, string>();
|
||||
foreach (var str in info.Split('&'))
|
||||
{
|
||||
var splited = str.Split('=');
|
||||
dict.Add(splited[0], splited[1]);
|
||||
}
|
||||
data.Protocol = match.Groups["protocol"].Value;
|
||||
if (!Global.Protocols.Contains(data.Protocol))
|
||||
{
|
||||
Logging.Info(string.Format("不支持的 SSR 协议:{0}", data.Protocol));
|
||||
return null;
|
||||
}
|
||||
|
||||
if (dict.ContainsKey("remarks"))
|
||||
{
|
||||
data.Remark = URLSafeBase64Decode(dict["remarks"]);
|
||||
}
|
||||
data.OBFS = match.Groups["obfs"].Value;
|
||||
if (data.OBFS == @"tls1.2_ticket_fastauth")
|
||||
{
|
||||
data.OBFS = @"tls1.2_ticket_auth";
|
||||
}
|
||||
if (!Global.OBFSs.Contains(data.OBFS))
|
||||
{
|
||||
Logging.Info(string.Format("不支持的 SSR 混淆:{0}", data.OBFS));
|
||||
return null;
|
||||
}
|
||||
|
||||
if (dict.ContainsKey("protoparam"))
|
||||
{
|
||||
data.ProtocolParam = URLSafeBase64Decode(dict["protoparam"]);
|
||||
}
|
||||
var info = match.Groups["info"].Value;
|
||||
var dict = new Dictionary<string, string>();
|
||||
foreach (var str in info.Split('&'))
|
||||
{
|
||||
var splited = str.Split('=');
|
||||
dict.Add(splited[0], splited[1]);
|
||||
}
|
||||
|
||||
if (dict.ContainsKey("obfsparam"))
|
||||
{
|
||||
data.OBFSParam = URLSafeBase64Decode(dict["obfsparam"]);
|
||||
}
|
||||
if (dict.ContainsKey("remarks"))
|
||||
{
|
||||
data.Remark = URLSafeBase64Decode(dict["remarks"]);
|
||||
}
|
||||
|
||||
if (Global.EncryptMethods.SS.Contains(data.EncryptMethod) && data.Protocol == "origin" && data.OBFS == "plain")
|
||||
{
|
||||
data.OBFS = "";
|
||||
data.Type = "SS";
|
||||
}
|
||||
}
|
||||
if (dict.ContainsKey("protoparam"))
|
||||
{
|
||||
data.ProtocolParam = URLSafeBase64Decode(dict["protoparam"]);
|
||||
}
|
||||
|
||||
if (dict.ContainsKey("obfsparam"))
|
||||
{
|
||||
data.OBFSParam = URLSafeBase64Decode(dict["obfsparam"]);
|
||||
}
|
||||
|
||||
if (Global.EncryptMethods.SS.Contains(data.EncryptMethod) && data.Protocol == "origin" && data.OBFS == "plain")
|
||||
{
|
||||
data.OBFS = "";
|
||||
data.Type = "SS";
|
||||
}
|
||||
list.Add(data);
|
||||
}*/
|
||||
|
||||
list.Add(data);
|
||||
}
|
||||
else if (text.StartsWith("vmess://"))
|
||||
{
|
||||
@@ -387,7 +395,7 @@ namespace Netch.Utils
|
||||
}
|
||||
|
||||
data.FakeType = vmess.type;
|
||||
if (!Global.FakeTypes.Contains(data.FakeType))
|
||||
if (data.FakeType.Length != 0 && !Global.FakeTypes.Contains(data.FakeType))
|
||||
{
|
||||
Logging.Info(string.Format("不支持的 VMess 伪装类型:{0}", data.FakeType));
|
||||
return null;
|
||||
@@ -508,6 +516,56 @@ namespace Netch.Utils
|
||||
}
|
||||
list.Add(NetchLink);
|
||||
}
|
||||
else if (text.StartsWith("trojan://"))
|
||||
{
|
||||
var data = new Server();
|
||||
data.Type = "Trojan";
|
||||
|
||||
text = text.Replace("/?", "?");
|
||||
try
|
||||
{
|
||||
if (text.Contains("#"))
|
||||
{
|
||||
data.Remark = HttpUtility.UrlDecode(text.Split('#')[1]);
|
||||
text = text.Split('#')[0];
|
||||
}
|
||||
if (text.Contains("?"))
|
||||
{
|
||||
var reg = new Regex(@"^(?<data>.+?)\?(.+)$");
|
||||
var regmatch = reg.Match(text);
|
||||
|
||||
if (regmatch.Success)
|
||||
{
|
||||
var peer = HttpUtility.UrlDecode(HttpUtility.ParseQueryString(new Uri(text).Query).Get("peer"));
|
||||
|
||||
if (peer != null)
|
||||
data.Host = peer;
|
||||
|
||||
text = regmatch.Groups["data"].Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new FormatException();
|
||||
}
|
||||
}
|
||||
var finder = new Regex(@"^trojan://(?<psk>.+?)@(?<server>.+):(?<port>\d+)");
|
||||
var match = finder.Match(text);
|
||||
if (!match.Success)
|
||||
{
|
||||
throw new FormatException();
|
||||
}
|
||||
|
||||
data.Password = match.Groups["psk"].Value;
|
||||
data.Hostname = match.Groups["server"].Value;
|
||||
data.Port = int.Parse(match.Groups["port"].Value);
|
||||
|
||||
list.Add(data);
|
||||
}
|
||||
catch (FormatException)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -515,7 +573,135 @@ namespace Netch.Utils
|
||||
return null;
|
||||
}
|
||||
|
||||
byte[] emoji_bytes = { 240, 159 };
|
||||
foreach (Server node in list)
|
||||
{
|
||||
var remark = Encoding.UTF8.GetBytes(node.Remark);
|
||||
int start_index = 0;
|
||||
while (remark.Length > start_index + 1 && remark[start_index] == emoji_bytes[0] && remark[start_index + 1] == emoji_bytes[1])
|
||||
start_index += 4;
|
||||
node.Remark = Encoding.UTF8.GetString(remark.Skip(start_index).ToArray()).Trim();
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
public static string UnBase64String(string value)
|
||||
{
|
||||
if (value == null || value == "")
|
||||
{
|
||||
return "";
|
||||
}
|
||||
byte[] bytes = Convert.FromBase64String(value);
|
||||
return Encoding.UTF8.GetString(bytes);
|
||||
}
|
||||
public static string ToBase64String(string value)
|
||||
{
|
||||
if (value == null || value == "")
|
||||
{
|
||||
return "";
|
||||
}
|
||||
byte[] bytes = Encoding.UTF8.GetBytes(value);
|
||||
return Convert.ToBase64String(bytes);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SSR链接解析器
|
||||
/// Copy From https://github.com/HMBSbige/ShadowsocksR-Windows/blob/d9dc8d032a6e04c14b9dc6c8f673c9cc5aa9f607/shadowsocks-csharp/Model/Server.cs#L428
|
||||
/// Thx :D
|
||||
/// </summary>
|
||||
/// <param name="ssrUrl"></param>
|
||||
/// <returns></returns>
|
||||
public static Server SsrServerFromLink(string ssrUrl)
|
||||
{
|
||||
// ssr://host:port:protocol:method:obfs:base64pass/?obfsparam=base64&remarks=base64&group=base64&udpport=0&uot=1
|
||||
var ssr = Regex.Match(ssrUrl, "ssr://([A-Za-z0-9_-]+)", RegexOptions.IgnoreCase);
|
||||
if (!ssr.Success)
|
||||
throw new FormatException();
|
||||
|
||||
var data = URLSafeBase64Decode(ssr.Groups[1].Value);
|
||||
var params_dict = new Dictionary<string, string>();
|
||||
|
||||
var param_start_pos = data.IndexOf("?", StringComparison.Ordinal);
|
||||
if (param_start_pos > 0)
|
||||
{
|
||||
params_dict = ParseParam(data.Substring(param_start_pos + 1));
|
||||
data = data.Substring(0, param_start_pos);
|
||||
}
|
||||
if (data.IndexOf("/", StringComparison.Ordinal) >= 0)
|
||||
{
|
||||
data = data.Substring(0, data.LastIndexOf("/", StringComparison.Ordinal));
|
||||
}
|
||||
|
||||
var UrlFinder = new Regex("^(.+):([^:]+):([^:]*):([^:]+):([^:]*):([^:]+)");
|
||||
var match = UrlFinder.Match(data);
|
||||
|
||||
if (match == null || !match.Success)
|
||||
throw new FormatException();
|
||||
|
||||
var serverAddr = match.Groups[1].Value;
|
||||
var Server_Port = ushort.Parse(match.Groups[2].Value);
|
||||
var Protocol = match.Groups[3].Value.Length == 0 ? "origin" : match.Groups[3].Value;
|
||||
Protocol = Protocol.Replace("_compatible", "");
|
||||
var Method = match.Groups[4].Value;
|
||||
var obfs = match.Groups[5].Value.Length == 0 ? "plain" : match.Groups[5].Value;
|
||||
obfs = obfs.Replace("_compatible", "");
|
||||
var Password = URLSafeBase64Decode(match.Groups[6].Value);
|
||||
var ProtocolParam = "";
|
||||
var ObfsParam = "";
|
||||
var Remarks = "";
|
||||
var Group = "";
|
||||
|
||||
if (params_dict.ContainsKey("protoparam"))
|
||||
{
|
||||
ProtocolParam = URLSafeBase64Decode(params_dict["protoparam"]);
|
||||
}
|
||||
if (params_dict.ContainsKey("obfsparam"))
|
||||
{
|
||||
ObfsParam = URLSafeBase64Decode(params_dict["obfsparam"]);
|
||||
}
|
||||
if (params_dict.ContainsKey("remarks"))
|
||||
{
|
||||
Remarks = URLSafeBase64Decode(params_dict["remarks"]);
|
||||
}
|
||||
Group = params_dict.ContainsKey("group") ? URLSafeBase64Decode(params_dict["group"]) : string.Empty;
|
||||
|
||||
/*if (params_dict.ContainsKey("uot"))
|
||||
{
|
||||
UdpOverTcp = int.Parse(params_dict["uot"]) != 0;
|
||||
}
|
||||
if (params_dict.ContainsKey("udpport"))
|
||||
{
|
||||
Server_Udp_Port = ushort.Parse(params_dict["udpport"]);
|
||||
}*/
|
||||
Server server = new Server();
|
||||
server.Type = "SSR";
|
||||
server.Hostname = serverAddr;
|
||||
server.Port = Server_Port;
|
||||
server.Protocol = Protocol;
|
||||
server.EncryptMethod = Method;
|
||||
server.OBFS = obfs;
|
||||
server.Password = Password;
|
||||
server.ProtocolParam = ProtocolParam;
|
||||
server.OBFSParam = ObfsParam;
|
||||
server.Remark = Remarks;
|
||||
server.Group = Group;
|
||||
return server;
|
||||
}
|
||||
private static Dictionary<string, string> ParseParam(string paramStr)
|
||||
{
|
||||
var paramsDict = new Dictionary<string, string>();
|
||||
var obfsParams = paramStr.Split('&');
|
||||
foreach (var p in obfsParams)
|
||||
{
|
||||
if (p.IndexOf('=') > 0)
|
||||
{
|
||||
var index = p.IndexOf('=');
|
||||
var key = p.Substring(0, index);
|
||||
var val = p.Substring(index + 1);
|
||||
paramsDict[key] = val;
|
||||
}
|
||||
}
|
||||
return paramsDict;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
using System.Diagnostics;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Netch.Utils
|
||||
{
|
||||
@@ -40,5 +45,24 @@ namespace Netch.Utils
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static async Task<int> TCPingAsync(IPAddress ip, int port, int timeout = 1000, CancellationToken ct = default)
|
||||
{
|
||||
using var client = new TcpClient(ip.AddressFamily);
|
||||
var task = client.ConnectAsync(ip, port);
|
||||
|
||||
var stopwatch = new Stopwatch();
|
||||
stopwatch.Start();
|
||||
|
||||
var resTask = await Task.WhenAny(Task.Delay(timeout, ct), task);
|
||||
|
||||
stopwatch.Stop();
|
||||
if (resTask == task && client.Connected)
|
||||
{
|
||||
var t = Convert.ToInt32(stopwatch.Elapsed.TotalMilliseconds);
|
||||
return t;
|
||||
}
|
||||
return timeout;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
|
||||
namespace Netch.Utils
|
||||
{
|
||||
@@ -16,6 +18,11 @@ namespace Netch.Utils
|
||||
/// <param name="text">语言文件</param>
|
||||
public static void Load(string text)
|
||||
{
|
||||
if (text.Equals("en-US"))
|
||||
{
|
||||
Data.Clear();
|
||||
return;
|
||||
}
|
||||
var data = Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<string, string>>(text);
|
||||
|
||||
if (data != null)
|
||||
@@ -42,5 +49,26 @@ namespace Netch.Utils
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取可使用的语言
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static List<string> GetTranslateList()
|
||||
{
|
||||
List<string> TranslateFile = new List<string>();
|
||||
TranslateFile.Add("System");
|
||||
TranslateFile.Add("zh-CN");
|
||||
TranslateFile.Add("en-US");
|
||||
|
||||
if (Directory.Exists("i18n"))
|
||||
{
|
||||
foreach (var fileName in Directory.GetFiles("i18n", "*"))
|
||||
{
|
||||
TranslateFile.Add(fileName.Substring(5));
|
||||
}
|
||||
}
|
||||
return TranslateFile;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
3
NetchLib/.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
/bin
|
||||
/obj
|
||||
/NetchLib.csproj.user
|
||||
67
NetchLib/NetchLib.csproj
Normal file
@@ -0,0 +1,67 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Platforms>x86;x64</Platforms>
|
||||
<ProjectGuid>{A8715AF4-ACC6-43F9-9381-4294C5360623}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>NetchLib</RootNamespace>
|
||||
<AssemblyName>NetchLib</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<Deterministic>true</Deterministic>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<OutputPath>bin\x64\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
|
||||
<WarningsAsErrors />
|
||||
<NoWarn />
|
||||
</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'">
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<NoWarn />
|
||||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
|
||||
<WarningsAsErrors />
|
||||
<OutputPath>bin\x64\Release\</OutputPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="SearchComboBox.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
36
NetchLib/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("NetchLib")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("NetchLib")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2020")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("a8715af4-acc6-43f9-9381-4294c5360623")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
@@ -82,69 +82,76 @@ namespace System.Windows.Forms
|
||||
private object[] newList;
|
||||
private void ReevaluateCompletionList()
|
||||
{
|
||||
var currentSearchTerm = Text.ToLowerInvariant();
|
||||
if (currentSearchTerm == _previousSearchTerm) return;
|
||||
|
||||
_previousSearchTerm = currentSearchTerm;
|
||||
try
|
||||
{
|
||||
SuspendLayout();
|
||||
|
||||
var originalList = (object[])Tag;
|
||||
if (originalList == null)
|
||||
{
|
||||
Tag = originalList = Items.Cast<object>().ToArray();
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(currentSearchTerm))
|
||||
{
|
||||
if (Items.Count == originalList.Length) return;
|
||||
|
||||
newList = originalList;
|
||||
}
|
||||
else
|
||||
{
|
||||
newList = originalList.Where(x => x.ToString().ToLowerInvariant().Contains(currentSearchTerm)).ToArray();
|
||||
}
|
||||
var currentSearchTerm = Text.ToLowerInvariant();
|
||||
if (currentSearchTerm == _previousSearchTerm) return;
|
||||
|
||||
_previousSearchTerm = currentSearchTerm;
|
||||
try
|
||||
{
|
||||
while (Items.Count > 0)
|
||||
SuspendLayout();
|
||||
|
||||
var originalList = (object[])Tag;
|
||||
if (originalList == null)
|
||||
{
|
||||
Items.RemoveAt(0);
|
||||
Tag = originalList = Items.Cast<object>().ToArray();
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
if (string.IsNullOrEmpty(currentSearchTerm))
|
||||
{
|
||||
if (Items.Count == originalList.Length) return;
|
||||
|
||||
newList = originalList;
|
||||
}
|
||||
else
|
||||
{
|
||||
newList = originalList.Where(x => x.ToString().ToLowerInvariant().Contains(currentSearchTerm)).ToArray();
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
Items.Clear();
|
||||
while (Items.Count > 0)
|
||||
{
|
||||
Items.RemoveAt(0);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
// ignored
|
||||
try
|
||||
{
|
||||
Items.Clear();
|
||||
}
|
||||
catch
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Items.AddRange(newList.ToArray());
|
||||
Items.AddRange(newList.ToArray());
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (currentSearchTerm.Length >= 2 && !DroppedDown)
|
||||
{
|
||||
DroppedDown = true;
|
||||
Cursor.Current = Cursors.Default;
|
||||
Text = currentSearchTerm;
|
||||
Select(currentSearchTerm.Length, 0);
|
||||
}
|
||||
|
||||
if (Items.Count > 0)
|
||||
{
|
||||
DroppedDown = false;
|
||||
DroppedDown = true;
|
||||
}
|
||||
|
||||
ResumeLayout(true);
|
||||
}
|
||||
}
|
||||
finally
|
||||
catch
|
||||
{
|
||||
if (currentSearchTerm.Length >= 2 && !DroppedDown)
|
||||
{
|
||||
DroppedDown = true;
|
||||
Cursor.Current = Cursors.Default;
|
||||
Text = currentSearchTerm;
|
||||
Select(currentSearchTerm.Length, 0);
|
||||
}
|
||||
|
||||
if (Items.Count > 0)
|
||||
{
|
||||
DroppedDown = false;
|
||||
DroppedDown = true;
|
||||
}
|
||||
|
||||
ResumeLayout(true);
|
||||
// ignored
|
||||
}
|
||||
}
|
||||
}
|
||||
45
README.md
@@ -1,15 +1,23 @@
|
||||
# Netch
|
||||
[](https://t.me/Netch) [](https://t.me/Netch_Discuss_Group) 
|
||||
|
||||
Game accelerator
|
||||
[](https://github.com/NetchX/Netch)
|
||||
[](https://github.com/NetchX/Netch/releases)
|
||||
[](https://github.com/NetchX/Netch/releases)
|
||||
[](https://github.com/NetchX/Netch/actions)
|
||||
[](LICENSE)
|
||||
[](https://t.me/Netch) [](https://t.me/Netch_Discuss_Group)
|
||||
[](https://netch.org/)
|
||||
|
||||
[简体中文](docs/README.zh-CN.md) (此版本内容更丰富)
|
||||
[中文说明](/docs/README.zh-CN.md)
|
||||
|
||||
[FAQ/常见问题](https://netch.org/#/docs/zh-CN/faq)
|
||||
|
||||
Game accelerator
|
||||
|
||||
## TOC
|
||||
- [Netch](#netch)
|
||||
- [TOC](#toc)
|
||||
- [Description](#description)
|
||||
- [Sponsor](#sponsor)
|
||||
- [Donate](#donate)
|
||||
- [Screenshots](#screenshots)
|
||||
- [Requirements](#requirements)
|
||||
|
||||
@@ -19,21 +27,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.
|
||||
|
||||
## Sponsor
|
||||
开发不易,以下为恰饭时间
|
||||
|
||||
[](https://nyancat.info)
|
||||
|
||||
NyanCAT Network,全中转高质量节点,多条低倍率节点保证流量无忧,节点极低延迟涵盖五大洲。Netflix 视频党,游戏党,海外回国党必备,无需年付,月付 19 元起。[测速图](https://t.me/BGP2020/935)
|
||||
[加入 Telegram 群组](https://t.me/NyanCaaaat)
|
||||
|
||||
[](https://www.mansora.net/cart.php)
|
||||
## Donate
|
||||
- XMR *48ju3ELNZEa6wwPBMexCJ9G218BGY2XwhH6B6bmkFuJ3QgM4hPw2Pra35jPtuBZSc7SLNWeBpiWJZWjQeMAiLnTx2tH2Efx*
|
||||
|
||||
## Screenshots
|
||||
|
||||

|
||||
|
||||
## Requirements
|
||||
|
||||
- Microsoft Visual C++ Runtime
|
||||
- [.NET Framework 4.8](https://dotnet.microsoft.com/download/dotnet-framework/net48)
|
||||
|
||||
## Quote
|
||||
- [go-tun2socks](https://github.com/eycorsican/go-tun2socks)
|
||||
- [shadowsocks-libev](https://github.com/shadowsocks/shadowsocks-libev)
|
||||
- [shadowsocksr-libev](https://github.com/shadowsocksrr/shadowsocksr-libev)
|
||||
- [v2ray-core](https://github.com/v2ray/v2ray-core)
|
||||
- [trojan](https://github.com/trojan-gfw/trojan)
|
||||
- [ACL4SSR](https://github.com/ACL4SSR/ACL4SSR)
|
||||
- [dnsmasq-china-list](https://github.com/felixonmars/dnsmasq-china-list)
|
||||
- [unbound](https://github.com/NLnetLabs/unbound)
|
||||
- [tap-windows6](https://github.com/OpenVPN/tap-windows6)
|
||||
- [Privoxy](https://www.privoxy.org/)
|
||||
- [NatTypeTester](https://github.com/HMBSbige/NatTypeTester)
|
||||
- [NetFilter SDK](https://netfiltersdk.com/)
|
||||
|
||||
2
binaries
69
build.ps1
@@ -1,69 +0,0 @@
|
||||
# REM The reason we don't use dotnet build is that dotnet build doesn't support COM references yet https://github.com/microsoft/msbuild/issues/3986
|
||||
param([string]$buildtfm = 'all')
|
||||
|
||||
Write-Host 'dotnet SDK version'
|
||||
dotnet --version
|
||||
|
||||
$exe = 'Netch.exe'
|
||||
$mainDir = (Get-Item -Path ".\").FullName
|
||||
$net_baseoutput = "$mainDir\Netch\bin\$configuration"
|
||||
|
||||
Write-Host $mainDir
|
||||
Write-Host $net_baseoutput
|
||||
|
||||
function Build-NetFrameworkx64
|
||||
{
|
||||
Write-Host 'Building .NET Framework x64'
|
||||
|
||||
$outdir = "$net_baseoutput\x64"
|
||||
|
||||
msbuild -v:m -m -t:Build /p:Configuration="Release" /p:Platform="x64" /p:TargetFramework=net48 /p:Runtimeidentifier=win-x64 /restore
|
||||
if ($LASTEXITCODE) { cd $mainDir ; exit $LASTEXITCODE }
|
||||
|
||||
Write-Host 'Build x64 Complete ,Started Copy bin,mode,i18n file'
|
||||
|
||||
Copy-Item "$mainDir\binaries\x64\*" "$net_baseoutput\x64\Release\win-x64\bin"
|
||||
Copy-Item "$mainDir\binaries\x64\tap-driver" "$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'
|
||||
|
||||
}
|
||||
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'
|
||||
|
||||
Copy-Item "$mainDir\binaries\x86\*" "$net_baseoutput\x86\Release\win-x86\bin"
|
||||
Copy-Item "$mainDir\binaries\x86\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
|
||||
|
||||
Build-NetFrameworkx64
|
||||
Build-NetFrameworkx86
|
||||
|
||||
cd $mainDir
|
||||
221
docs/Advanced_Usage.zh-CN.md
Normal file
@@ -0,0 +1,221 @@
|
||||
# Netch 模式
|
||||
|
||||
用于存储 Netch 模式文件的仓库
|
||||
|
||||
|
||||
|
||||
## 目录
|
||||
|
||||
1. [模式介绍](#模式介绍)
|
||||
- 1.1 [模式 1 进程代理模式](#模式-1-进程代理模式)
|
||||
- 1.2 [模式 2(需要自己新建模式文件) TUN/TAP IP 黑名单代理模式](#模式-2需要自己新建模式文件-tuntap-ip-黑名单代理模式)
|
||||
- 1.3 [模式 3 TUN/TAP (IP 白名单)全局代理模式](#模式-3-tuntap-ip-白名单全局代理模式)
|
||||
- 1.4 [模式 4 HTTP 系统代理](#模式-4-http-系统代理)
|
||||
- 1.5 [模式 5 本地 Socks5 代理](#模式-5-本地-socks5-代理)
|
||||
- 1.6 [模式 6 本地 Socks5 和 HTTP 代理](#模式-6-本地-socks5-和-http-代理)
|
||||
2. [Socks 5 代理中转](#socks-5-代理中转)
|
||||
3. [新建进程代理模式](#新建进程代理模式)
|
||||
- 3.1 [模式](#模式)
|
||||
- 3.2 [扫描](#扫描)
|
||||
- 3.3 [启动](#启动)
|
||||
|
||||
## 模式介绍
|
||||
|
||||
目前 Netch 所有模式文件都在 `mode` 文件夹下。模式号即模式菜单中最左边中括号内数字
|
||||
|
||||
内置的模式中,如果模式名中有 Bypass China 的部分,即该模式会绕过中国 IP 段
|
||||
|
||||
模式 1 和模式 2 里面除了第一行格式不同,其他内容和 [SSTap-Rule](https://github.com/FQrabbit/SSTap-Rule) 相同。是否绕过中国的功能依赖于 [CNIP 文件](https://github.com/NetchX/Netch/blob/master/Netch/Resources/CNIP)
|
||||
|
||||
模式 3 到模式 5 的是否绕过中国的功能依赖于 [acl 文件](https://github.com/NetchX/Netch/blob/master/binaries/default.acl)
|
||||
|
||||
第一行格式均为如下样式,不同模式之间第一行的具体区别可以参照后面的内容
|
||||
|
||||
```Python
|
||||
# 备注, 类型(是主项目 USAGE.zh-CN.md 里提到的模式类型的值减一), 是否绕过中国(1 为是, 0 为否)
|
||||
```
|
||||
|
||||
### 模式 1 进程代理模式
|
||||
|
||||
- 根据进程名进行代理
|
||||
- 底层依赖于 [NetFilter SDK](https://netfiltersdk.com) 和 Redirector.exe(未开源)等
|
||||
- 对于第一次使用 Netch 的用户而言,不需要做多余的事情
|
||||
- 若 [NetFilter SDK](https://netfiltersdk.com) 的驱动不存在,会自动安装
|
||||
- 自动安装驱动时不会判断旧驱动是否需要更新
|
||||
- 对于老用户而言,版本更新日志里如果提到要更新驱动,或者你发现无法使用本模式时,可以通过运行 `DriverUpdater.exe` 的方式强制覆盖旧驱动
|
||||
- 相关代码 [NFController.cs](..\Netch\Controllers\NFController.cs)
|
||||
|
||||
范例文件
|
||||
|
||||
在这个模式里,第一行只有备注是有用的
|
||||
|
||||
```
|
||||
# 备注
|
||||
进程名 1(会被代理)
|
||||
进程名 2
|
||||
...
|
||||
```
|
||||
|
||||
### 模式 2(需要自己新建模式文件) TUN/TAP IP 黑名单代理模式
|
||||
|
||||
- 黑名单代理指的是,除了名单内的 IP 走代理,其他连接都不走代理
|
||||
- 需要自己新建模式文件,第一行写法同模式 3,只是需要把 2 改成 1
|
||||
- 后续内容的格式同 [SSTap-rules](https://github.com/FQrabbit/SSTap-Rule),任何规则问题建议到那边去提
|
||||
- 可以通过左下角的`设置`来配置 IP 地址,子网掩码,网关,DNS
|
||||
- 该模式下直连 IP 段无效,暂时没有代码实现
|
||||
- 底层依赖于 [Tap-Windows](https://github.com/OpenVPN/tap-windows) 适配器等
|
||||
- 如果 Netch 提示没有该适配器,可以直接安装 [Tap-Windows](https://build.openvpn.net/downloads/releases/latest/tap-windows-latest-stable.exe) 或者通过安装 [OpenVPN](https://openvpn.net/community-downloads/),[SSTap](https://github.com/mayunbaba2/SSTap-beta-setup) 的方式获得该适配器
|
||||
|
||||
范例文件
|
||||
|
||||
在这个模式里,是否绕过中国的值是无效的
|
||||
|
||||
```
|
||||
# 备注, 1
|
||||
无类别域间路由写法 1(目的 IP 在这个子网内的网络请求都会被代理)
|
||||
无类别域间路由写法 2
|
||||
...
|
||||
```
|
||||
|
||||
### 模式 3 TUN/TAP (IP 白名单)全局代理模式
|
||||
|
||||
- 白名单代理指的是,除了名单内的 IP 不走代理,其他连接都走代理
|
||||
- 可以通过左下角的`设置`来配置 IP 地址,子网掩码,网关,DNS,直连 IP 段
|
||||
- 底层依赖于 [Tap-Windows](https://github.com/OpenVPN/tap-windows) 适配器,tun2socks 等
|
||||
- 如果 Netch 提示没有该适配器,可以直接安装 [Tap-Windows](https://build.openvpn.net/downloads/releases/latest/tap-windows-latest-stable.exe) 或者通过安装 [OpenVPN](https://openvpn.net/community-downloads/),[SSTap](https://github.com/mayunbaba2/SSTap-beta-setup) 的方式获得该适配器
|
||||
|
||||
范例文件
|
||||
|
||||
```
|
||||
# 备注, 2, 是否绕过中国(1 为是, 0 为否)
|
||||
无类别域间路由写法 1(目的 IP 只有在这个子网内的网络请求不会被代理,其他的都会被代理)
|
||||
无类别域间路由写法 2
|
||||
...
|
||||
```
|
||||
|
||||
### 模式 4 HTTP 系统代理
|
||||
|
||||
- 默认地址和端口为 127.0.0.1:2802
|
||||
- 端口可以在左下角设置里面更改
|
||||
- 会被设置为系统代理
|
||||
|
||||
范例文件
|
||||
|
||||
```
|
||||
# 备注, 3, 是否绕过中国(1 为是, 0 为否)
|
||||
(目前只有第一行是有效的)
|
||||
```
|
||||
|
||||
### 模式 5 本地 Socks5 代理
|
||||
|
||||
- 默认地址和端口为 127.0.0.1:2801
|
||||
- 端口可以在左下角设置里面更改
|
||||
- 不会被设置为系统代理,对于 Chrome 之类使用系统代理的浏览器需要设置使用插件 SwitchyOmega 之后才能被正常代理
|
||||
- 注意如果是使用 Firefox 的网络设置,请仅设置 Socks5 代理,清除其他代理配置,并取消勾选`为所有协议使用相同的代理服务器`
|
||||
- 其他模式均含 Socks5 代理,本模式可以理解为仅 Socks5 代理\
|
||||
|
||||
范例文件
|
||||
|
||||
```
|
||||
# 备注, 4, 是否绕过中国(1 为是, 0 为否)
|
||||
(目前只有第一行是有效的)
|
||||
```
|
||||
|
||||
### 模式 6 本地 Socks5 和 HTTP 代理
|
||||
|
||||
- Socks5 代理的默认地址和端口为 127.0.0.1:2801
|
||||
- HTTP 代理的默认地址和端口为 127.0.0.1:2802
|
||||
- 端口可以在左下角设置里面更改
|
||||
- 不会被设置为系统代理
|
||||
|
||||
范例文件
|
||||
|
||||
```
|
||||
# 备注, 5, 是否绕过中国(1 为是, 0 为否)
|
||||
(目前只有第一行是有效的)
|
||||
```
|
||||
|
||||
## Socks 5 代理中转
|
||||
|
||||
说明一下,Netch 并非是以网页代理为目的开发的程序,如果需要网络代理为目的的程序,需要 PAC,规则分流,订阅管理等功能的,请参考使用以下软件而非 Netch(均为 Windows 平台)
|
||||
|
||||
ShadowsocksR
|
||||
|
||||
- [HMBSbige/ShadowsocksR-Windows](https://github.com/HMBSbige/ShadowsocksR-Windows/releases)
|
||||
|
||||
Shadowsocks
|
||||
|
||||
- [Clash for Windows](https://github.com/Fndroid/clash_for_windows_pkg/releases)
|
||||
|
||||
V2Ray
|
||||
|
||||
- [V2RayN](https://github.com/2dust/v2rayN/releases)
|
||||
|
||||
如果你想使用的代理工具目前 Netch 还不支持,或者需要一些 Netch 目前没有的功能,如 V2Ray 自定义配置,Socks5 本地代理规则分流的,可以在 Netch 里添加对应工具的本地 Socks5 代理端口后使用,注意如果你用的是模式 3 TUN/TAP (IP 白名单)全局代理模式,记得在`设置 - 全局直连 IP`中添加你的服务器 IP 地址,否则会产生代理回环
|
||||
|
||||
## 新建进程代理模式
|
||||
|
||||
- 现在软件还处在早期开发阶段,可能后续版本会发生很大变化,操作仅供参考
|
||||
|
||||
当前版本已添加配置编辑功能,根据自己的情况,使用订阅或者别的方法添加代理配置,我这里使用的是剪贴板导入
|
||||
|
||||

|
||||
|
||||
如果你发现你的程序没我截图的看起来清晰,可以右键 `Netch.exe - 属性 - 兼容性 - 更改高 DPI 设置 - 替代高 DPI 缩放执行 - 系统(增强)`
|
||||
|
||||
### 模式
|
||||
|
||||
如果你的游戏的模式已经被收录,也可以考虑在模式菜单中,选择使用已收录的模式。所有模式的文件,都在 `./mode/` 文件夹下,如果你需要多个模式的合并文件,可以使用记事本将其打开,将多个文件合并
|
||||
|
||||
ping 的值未必准确,因为这只是你本地到代理服务器而非游戏服务器的延迟
|
||||
|
||||
如果你的游戏的模式没被收录,可以看接下来的扫描步骤来手动创建模式
|
||||
|
||||
接着点击菜单栏上的`模式 - 创建进程模式`
|
||||
|
||||

|
||||
|
||||
### 扫描
|
||||
|
||||
在弹出的窗口中点击`扫描`
|
||||
|
||||

|
||||
|
||||
选择你要加速的游戏的安装路径,根据游戏不同,可能需要选择多个不同的目录进行扫描,参见[萌鹰的 Netch 教程](https://www.eaglemoe.com/archives/142)(包括 GTAOL 和 R6S 的配置方法)
|
||||
|
||||
>4. 选定 GTA5 游戏目录,点击确定,软件会自动扫描目录下的 exe 程式并填写进去
|
||||
>5. 再次点击扫描,选择 SocialClub 的安装地址(一般为 C:\Program Files\Rockstar Games\Social Club),点击确定,点击保存
|
||||
>
|
||||
>注意:加入游戏时请不要忘记加入社交组件,比如说 GTA 不要忘记 SocialClub ,彩虹六号不要忘记 Uplay
|
||||
|
||||
这里以战争雷霆为例,只需添加战争雷霆游戏根目录即可
|
||||
|
||||

|
||||
|
||||
扫描时可能需要稍等片刻,扫描后记得填写备注
|
||||
|
||||
如果需要添加单个程序,也可以在添加按钮左侧的编辑栏中手动输入并添加
|
||||
|
||||
之后点保存进行`保存`
|
||||
|
||||

|
||||
|
||||
### 启动
|
||||
|
||||
最后确认服务器一栏和模式一栏均为之前自己添加并需要使用的,没问题后点击`启动`即可
|
||||
|
||||

|
||||
|
||||
启动后,你再去游戏根目录或者别的启动器如 Steam,Uplay 启动游戏即可。此时游戏就已经被代理了
|
||||
|
||||
如果在 Netch 启动前就启动了游戏,建议重启游戏
|
||||
|
||||
如果需要 Steam,Uplay 等启动器也被代理,参照前面的方式对 Steam,Uplay 根目录也进行扫描即可
|
||||
|
||||
如果出现了启动失败,或者无法代理成功的情况,请先尝试`选项 - 重启服务`或`选项 - 卸载服务`,或者在退出 Netch 以后,点击运行在 Netch 根目录下的 `DriverUpdater.exe` 程序进行驱动更新
|
||||
|
||||
|
||||
|
||||
## 语言支持
|
||||
|
||||
Netch 支持多种语言,在启动时会根据系统语言选择自身语言。如果需要手动切换语言,可以在启动时加入命令行参数,命令行参数为目前支持的语言代码,可以去 [NetchTranslation/i18n](https://github.com/NetchX/NetchTranslation/tree/master/i18n) 文件夹下查看外部支持的语言代码文件。Netch 目前内置 en-US,zh-CN,外置 zh-TW。欢迎大家为 [NetchTranslation](https://github.com/NetchX/NetchTranslation) 提供其他语言的翻译
|
||||
@@ -1,42 +0,0 @@
|
||||
# 新手入门
|
||||
**Version : 1.3.7**
|
||||
|
||||
[下载地址](https://github.com/NetchX/Netch/releases)
|
||||
|
||||
## 主界面
|
||||
|
||||

|
||||
|
||||
## 添加服务器
|
||||
|
||||
> Netch 目前仅支持以下代理协议:Shadowsocks,VMess,Socks5,ShadowsockR。
|
||||
|
||||
首先,点击`服务器`增加所需服务器
|
||||
|
||||
<img width="50%" height="50%" src="screenshots/Add-server.png">
|
||||
|
||||
可手动添加单个服务器,或者通过剪切板链接添加单个服务器。也可通过订阅链接批量添加。
|
||||
|
||||
点击 `订阅` ` 管理订阅链接` 进入以下界面。
|
||||
|
||||
<img width="50%" height="50%" src="screenshots/Add-link.jpg">
|
||||
|
||||
填写备注与链接,点击添加,然后保存。保存后点击 `订阅` ` 从订阅链接更新服务器`。完成服务器添加。添加完服务器后可对服务器进行修改,删除和测速。
|
||||
|
||||
## 选择模式
|
||||
|
||||
> 此处需要会一点英语,比如你应该知道`吃鸡`的英文名称是`PlayerUnknown's Battlegrounds`
|
||||
|
||||
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) 来获得该适配器
|
||||
|
||||
关于更多的模式说明,详见[进阶用法](https://github.com/NormanBB/NetchMode/blob/master/docs/README.zh-CN.md)。
|
||||
|
||||
选择完模式后,点击启用,游戏已被代理。这一步需在开启游戏前完成。
|
||||
|
||||
## 配置说明
|
||||
|
||||
目前,netch支持自定义四个配置,填入配置名,选择相应的服务器和游戏模式,按下`Ctrl`与鼠标左键,即可保存当前配置。下次使用时,点击配置名即可快速启用。
|
||||
|
||||
~~如果你还觉得不会用,可以去用SStap (逃~~
|
||||
42
docs/Quickstart.zh-CN.md
Normal file
@@ -0,0 +1,42 @@
|
||||
# 新手入门
|
||||
**Version : 1.4.10**
|
||||
|
||||
[下载地址](https://github.com/NetchX/Netch/releases)
|
||||
|
||||
## 主界面
|
||||
|
||||

|
||||
|
||||
## 添加服务器
|
||||
|
||||
> Netch 目前仅支持以下代理协议:Shadowsocks,VMess,Socks5,ShadowsockR,Trojan。
|
||||
|
||||
首先,点击`服务器`增加所需服务器
|
||||
|
||||
<img width="50%" height="50%" src="screenshots/addServer.zh-CN.png">
|
||||
|
||||
可手动添加单个服务器,或者通过剪切板链接添加单个服务器。也可通过订阅链接批量添加。
|
||||
|
||||
点击 `订阅` ` 管理订阅链接` 进入以下界面。
|
||||
|
||||
<img width="50%" height="50%" src="screenshots/addLink.zh-CN.png">
|
||||
|
||||
填写备注与链接,点击添加,然后保存。保存后点击 `订阅` ` 从订阅链接更新服务器`。完成服务器添加。添加完服务器后可对服务器进行修改,删除和测速。
|
||||
|
||||
## 选择模式
|
||||
|
||||
> 此处需要会一点英语,比如你应该知道 `吃鸡` 的英文名称是 `PlayerUnknown's Battlegrounds`
|
||||
|
||||
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) 来获得该适配器
|
||||
|
||||
关于更多的模式说明,详见 [进阶用法](https://github.com/NormanBB/NetchMode/blob/master/docs/README.zh-CN.md)。
|
||||
|
||||
选择完模式后,点击启用,游戏已被代理。这一步需在开启游戏前完成。
|
||||
|
||||
## 配置说明
|
||||
|
||||
目前,Netch 支持自定义四个配置,填入配置名,选择相应的服务器和游戏模式,按下 `Ctrl` 与鼠标左键,即可保存当前配置。下次使用时,点击配置名即可快速启用。
|
||||
|
||||
~~ 如果你还觉得不会用,可以去用 SSTap (逃~~
|
||||
@@ -1,48 +1,54 @@
|
||||
# Netch
|
||||
[](https://t.me/Netch)
|
||||
> ~~issue已关,有问题可进tele群问,不保证回答,不保证解决,咕~~
|
||||
[](https://t.me/Netch) [](https://t.me/Netch_Discuss_Group) 
|
||||
|
||||
游戏加速工具
|
||||
|
||||
[网站](https://netch.org/)
|
||||
|
||||
## TOC
|
||||
- [Netch](#netch)
|
||||
- [TOC](#toc)
|
||||
- [简介](#%e7%ae%80%e4%bb%8b)
|
||||
- [赞助商](#%e8%b5%9e%e5%8a%a9%e5%95%86)
|
||||
- [新手入门](Basic-usage.md)
|
||||
- [进阶用法](https://github.com/NormanBB/NetchMode/blob/master/docs/README.zh-CN.md)
|
||||
- [依赖](#%e4%be%9d%e8%b5%96)
|
||||
- [Netch](#Netch)
|
||||
- [TOC](#TOC)
|
||||
- [简介](#简介)
|
||||
- [捐赠](#捐赠)
|
||||
- [新手入门](Quickstart.zh-CN.md)
|
||||
- [进阶用法](Advanced_Usage.zh-CN.md)
|
||||
- [依赖](#依赖)
|
||||
- [语言支持](#语言支持)
|
||||
|
||||
## 简介
|
||||
|
||||
Netch 是一款 Windows 平台的开源游戏加速工具,Netch 可以实现类似 SocksCap64 那样的进程代理,也可以实现 SSTap 那样的全局 TUN/TAP 代理,和 Shadowsocks-Windows 那样的本地 Socks5,HTTP 和系统代理。至于连接至远程服务器的代理协议,目前 Netch 支持以下代理协议:Shadowsocks,VMess,Socks5,ShadowsocksR
|
||||
|
||||
与此同时 Netch 避免了 SSTap 的 NAT 问题 ,检查 NAT 类型即可知道是否有 NAT 问题。使用 SSTap 加速部分 P2P 联机,对 NAT 类型有要求的游戏时,可能会因为 NAT 类型严格遇到无法加入联机,或者其他影响游戏体验的情况
|
||||
|
||||
## 赞助商
|
||||
开发不易,以下为恰饭时间
|
||||
|
||||
[](https://nyancat.info)
|
||||
需要更多特性请移步魔改仓库 [Netch-ForOwnUse](https://github.com/AmazingDM/Netch-ForOwnUse),
|
||||
|
||||
NyanCAT Network,全中转高质量节点,多条低倍率节点保证流量无忧,节点极低延迟涵盖五大洲。Netflix 视频党,游戏党,海外回国党必备,无需年付,月付 19 元起。[测速图](https://t.me/BGP2020/935)
|
||||
[加入 Telegram 群组](https://t.me/NyanCaaaat)
|
||||
|
||||
[](https://www.mansora.net/cart.php)
|
||||
## 捐赠
|
||||
- XMR *48ju3ELNZEa6wwPBMexCJ9G218BGY2XwhH6B6bmkFuJ3QgM4hPw2Pra35jPtuBZSc7SLNWeBpiWJZWjQeMAiLnTx2tH2Efx*
|
||||
|
||||
## 新手入门
|
||||
|
||||
[新手入门教程](Basic-usage.md)
|
||||
[新手入门教程](Quickstart.zh-CN.md)
|
||||
|
||||
## 进阶用法
|
||||
[进阶教程](https://github.com/NormanBB/NetchMode/blob/master/docs/README.zh-CN.md)
|
||||
[进阶教程](Advanced_Usage.zh-CN.md)
|
||||
## 依赖
|
||||
- [Visual C++ 运行库合集](https://www.google.com/search?q=Visual+C%2B%2B+%E8%BF%90%E8%A1%8C%E5%BA%93%E5%90%88%E9%9B%86)
|
||||
- [.NET Framework 4.8](https://dotnet.microsoft.com/download/dotnet-framework/thank-you/net48-offline-installer)
|
||||
- [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-US,zh-CN,外置 zh-TW。欢迎大家为 [NetchTranslation](https://github.com/NetchX/NetchTranslation) 提供其他语言的翻译
|
||||
|
||||
|
||||
## 引用
|
||||
- [go-tun2socks](https://github.com/eycorsican/go-tun2socks)
|
||||
- [shadowsocks-libev](https://github.com/shadowsocks/shadowsocks-libev)
|
||||
- [shadowsocksr-libev](https://github.com/shadowsocksrr/shadowsocksr-libev)
|
||||
- [v2ray-core](https://github.com/v2ray/v2ray-core)
|
||||
- [trojan](https://github.com/trojan-gfw/trojan)
|
||||
- [ACL4SSR](https://github.com/ACL4SSR/ACL4SSR)
|
||||
- [dnsmasq-china-list](https://github.com/felixonmars/dnsmasq-china-list)
|
||||
- [unbound](https://github.com/NLnetLabs/unbound)
|
||||
- [tap-windows6](https://github.com/OpenVPN/tap-windows6)
|
||||
- [Privoxy](https://www.privoxy.org/)
|
||||
- [NatTypeTester](https://github.com/HMBSbige/NatTypeTester)
|
||||
- [NetFilter SDK](https://netfiltersdk.com/)
|
||||
|
||||
|
Before Width: | Height: | Size: 85 KiB |
|
Before Width: | Height: | Size: 33 KiB |
BIN
docs/screenshots/addLink.zh-CN.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
docs/screenshots/addServer.zh-CN.png
Normal file
|
After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 18 KiB |