Showing preview only (2,676K chars total). Download the full file or copy to clipboard to get everything.
Repository: netchx/netch
Branch: main
Commit: 9d99eb1c5a2a
Files: 336
Total size: 2.5 MB
Directory structure:
gitextract_az4fg7zz/
├── .github/
│ ├── ISSUE_TEMPLATE/
│ │ ├── bug_report.yml
│ │ ├── bug_report.zh-CN.yml
│ │ ├── config.yml
│ │ ├── feature_request.yml
│ │ └── feature_request.zh-CN.yml
│ ├── dependabot.yml
│ └── workflows/
│ ├── build.yml
│ ├── release.yml
│ └── stale.yml
├── .gitignore
├── LICENSE
├── Netch/
│ ├── .gitignore
│ ├── App.manifest
│ ├── Constants.cs
│ ├── Controllers/
│ │ ├── DNSController.cs
│ │ ├── Guard.cs
│ │ ├── MainController.cs
│ │ ├── NFController.cs
│ │ ├── PcapController.cs
│ │ ├── TUNController.cs
│ │ └── UpdateChecker.cs
│ ├── Enums/
│ │ ├── LogLevel.cs
│ │ └── State.cs
│ ├── Flags.cs
│ ├── FodyWeavers.xml
│ ├── Forms/
│ │ ├── AboutForm.Designer.cs
│ │ ├── AboutForm.cs
│ │ ├── AboutForm.resx
│ │ ├── BindingForm.cs
│ │ ├── GlobalBypassIPForm.Designer.cs
│ │ ├── GlobalBypassIPForm.cs
│ │ ├── LogForm.Designer.cs
│ │ ├── LogForm.cs
│ │ ├── LogForm.resx
│ │ ├── MainForm.Designer.cs
│ │ ├── MainForm.cs
│ │ ├── MainForm.resx
│ │ ├── MessageBoxX.cs
│ │ ├── ModeForms/
│ │ │ ├── ModeEditorUtils.cs
│ │ │ ├── ProcessForm.Designer.cs
│ │ │ ├── ProcessForm.cs
│ │ │ ├── ProcessForm.resx
│ │ │ ├── RouteForm.Designer.cs
│ │ │ ├── RouteForm.cs
│ │ │ └── RouteForm.resx
│ │ ├── ServerForm.cs
│ │ ├── SettingForm.Designer.cs
│ │ ├── SettingForm.cs
│ │ ├── SettingForm.resx
│ │ ├── SubscriptionForm.Designer.cs
│ │ ├── SubscriptionForm.cs
│ │ ├── SubscriptionForm.resx
│ │ └── SyncGlobalCheckBox.cs
│ ├── Global.cs
│ ├── Interfaces/
│ │ ├── IController.cs
│ │ ├── IModeController.cs
│ │ ├── IServerController.cs
│ │ └── IServerUtil.cs
│ ├── Interops/
│ │ ├── AioDNS.cs
│ │ ├── Redirector.cs
│ │ ├── RouteHelper.cs
│ │ └── tun2socks.cs
│ ├── JsonConverter/
│ │ ├── ModeConverterWithTypeDiscriminator.cs
│ │ └── ServerConverterWithTypeDiscriminator.cs
│ ├── Models/
│ │ ├── Arguments.cs
│ │ ├── GitHubRelease/
│ │ │ ├── Asset.cs
│ │ │ ├── GitHubRelease.cs
│ │ │ ├── GitHubUser.cs
│ │ │ ├── Release.cs
│ │ │ ├── SuffixVersion.cs
│ │ │ └── VersionUtil.cs
│ │ ├── MessageException.cs
│ │ ├── Modes/
│ │ │ ├── Mode.cs
│ │ │ ├── ModeFeature.cs
│ │ │ ├── ModeType.cs
│ │ │ ├── ProcessMode/
│ │ │ │ └── ProcessMode.cs
│ │ │ ├── ShareMode/
│ │ │ │ └── ShareMode.cs
│ │ │ └── TunMode/
│ │ │ └── TunMode.cs
│ │ ├── NatTypeTestResult.cs
│ │ ├── NetRoute.cs
│ │ ├── NumberRange.cs
│ │ ├── Profile.cs
│ │ ├── Server.cs
│ │ ├── Settings/
│ │ │ ├── AioDNSConfig.cs
│ │ │ ├── KcpConfig.cs
│ │ │ ├── RedirectorConfig.cs
│ │ │ ├── Setting.cs
│ │ │ ├── TUNConfig.cs
│ │ │ └── V2rayConfig.cs
│ │ ├── StatusText.cs
│ │ ├── Subscription.cs
│ │ └── TagItem.cs
│ ├── NOTICE.txt
│ ├── NativeMethods.cs
│ ├── NativeMethods.txt
│ ├── Netch.csproj
│ ├── Program.cs
│ ├── Properties/
│ │ ├── AssemblyInfo.cs
│ │ ├── Resources.Designer.cs
│ │ └── Resources.resx
│ ├── Resources/
│ │ └── zh-CN
│ ├── Servers/
│ │ ├── SSH/
│ │ │ ├── SSHForm.cs
│ │ │ ├── SSHServer.cs
│ │ │ └── SSHUtil.cs
│ │ ├── Shadowsocks/
│ │ │ ├── ShadowsocksController.cs
│ │ │ ├── ShadowsocksForm.cs
│ │ │ ├── ShadowsocksServer.cs
│ │ │ ├── ShadowsocksUtil.cs
│ │ │ └── ShareModels/
│ │ │ ├── SSDJObject.cs
│ │ │ ├── SSDServerJObject.cs
│ │ │ └── ShadowsocksConfig.cs
│ │ ├── ShadowsocksR/
│ │ │ ├── ShadowsocksRController.cs
│ │ │ ├── ShadowsocksRForm.cs
│ │ │ ├── ShadowsocksRServer.cs
│ │ │ └── ShadowsocksRUtil.cs
│ │ ├── Socks5/
│ │ │ ├── Socks5Controller.cs
│ │ │ ├── Socks5Form.cs
│ │ │ ├── Socks5Server.cs
│ │ │ └── Socks5Util.cs
│ │ ├── Trojan/
│ │ │ ├── TrojanConfig.cs
│ │ │ ├── TrojanController.cs
│ │ │ ├── TrojanForm.cs
│ │ │ ├── TrojanServer.cs
│ │ │ └── TrojanUtil.cs
│ │ ├── V2ray/
│ │ │ ├── ShareModels/
│ │ │ │ └── V2rayNJObject.cs
│ │ │ ├── V2rayConfig.cs
│ │ │ ├── V2rayConfigUtils.cs
│ │ │ ├── V2rayController.cs
│ │ │ └── V2rayUtils.cs
│ │ ├── VLESS/
│ │ │ ├── VLESSForm.cs
│ │ │ ├── VLESSServer.cs
│ │ │ └── VLESSUtil.cs
│ │ ├── VMess/
│ │ │ ├── VMessForm.cs
│ │ │ ├── VMessServer.cs
│ │ │ └── VMessUtil.cs
│ │ └── WireGuard/
│ │ ├── WireGuardForm.cs
│ │ ├── WireGuardServer.cs
│ │ └── WireGuardUtil.cs
│ ├── Services/
│ │ ├── ModeService.cs
│ │ └── Updater.cs
│ ├── Utils/
│ │ ├── Bandwidth.cs
│ │ ├── Configuration.cs
│ │ ├── DelayTestHelper.cs
│ │ ├── DnsUtils.cs
│ │ ├── Firewall.cs
│ │ ├── ModeHelper.cs
│ │ ├── NetworkInterfaceUtils.cs
│ │ ├── PortHelper.cs
│ │ ├── RouteUtils.cs
│ │ ├── ServerHelper.cs
│ │ ├── ShareLink.cs
│ │ ├── Socks5ServerTestUtils.cs
│ │ ├── StringExtension.cs
│ │ ├── SubscriptionUtil.cs
│ │ ├── SystemInfo.cs
│ │ ├── Utils.cs
│ │ ├── WebUtil.cs
│ │ └── i18N.cs
│ └── runtimeconfig.template.json
├── Netch.sln
├── Other/
│ ├── .gitignore
│ ├── .must_build
│ ├── _Archive/
│ │ ├── build.ps1
│ │ ├── chnip/
│ │ │ └── build.ps1
│ │ ├── chnsite/
│ │ │ └── build.ps1
│ │ ├── cloak/
│ │ │ └── build.ps1
│ │ ├── dnsproxy/
│ │ │ └── build.ps1
│ │ ├── geoip/
│ │ │ └── build.ps1
│ │ ├── geosite/
│ │ │ └── build.ps1
│ │ ├── tun2socks/
│ │ │ └── build.ps1
│ │ ├── v2ray-core/
│ │ │ └── build.ps1
│ │ └── v2ray-plugin/
│ │ └── build.ps1
│ ├── aiodns/
│ │ ├── build.ps1
│ │ ├── deps.ps1
│ │ ├── go.mod
│ │ ├── go.sum
│ │ └── main.go
│ ├── build.ps1
│ ├── clean.ps1
│ ├── deps.ps1
│ ├── pcap2socks/
│ │ └── build.ps1
│ ├── v2ray-sn/
│ │ ├── README.md
│ │ └── build.ps1
│ └── wintun/
│ └── build.ps1
├── README.md
├── Redirector/
│ ├── .gitignore
│ ├── .must_build
│ ├── Based.cpp
│ ├── Based.h
│ ├── DNSHandler.cpp
│ ├── DNSHandler.h
│ ├── EventHandler.cpp
│ ├── EventHandler.h
│ ├── IPEventHandler.cpp
│ ├── IPEventHandler.h
│ ├── README.md
│ ├── Redirector.cpp
│ ├── Redirector.vcxproj
│ ├── Redirector.vcxproj.filters
│ ├── SocksHelper.cpp
│ ├── SocksHelper.h
│ ├── TCPHandler.cpp
│ ├── TCPHandler.h
│ ├── Utils.cpp
│ ├── Utils.h
│ ├── include/
│ │ ├── nfapi.h
│ │ ├── nfdriver.h
│ │ └── nfevents.h
│ └── lib/
│ └── nfapi.lib
├── RedirectorTester/
│ ├── .gitignore
│ ├── App.config
│ ├── App.manifest
│ ├── Properties/
│ │ └── AssemblyInfo.cs
│ ├── RedirectorTester.cs
│ └── RedirectorTester.csproj
├── RouteHelper/
│ ├── .gitignore
│ ├── .must_build
│ ├── Based.h
│ ├── README.md
│ ├── RouteHelper.cpp
│ ├── RouteHelper.vcxproj
│ ├── RouteHelper.vcxproj.filters
│ ├── WaitGroup.cpp
│ └── WaitGroup.h
├── Storage/
│ ├── README.md
│ ├── aiodns.conf
│ ├── i18n/
│ │ ├── fa-IR
│ │ ├── ja-JP
│ │ └── zh-TW
│ ├── mode/
│ │ ├── Battlenet.txt
│ │ ├── Bypass LAN and China.txt
│ │ ├── Bypass LAN and Vivox.txt
│ │ ├── Bypass LAN.txt
│ │ ├── Discord (with Steam Apps).txt
│ │ ├── Discord.txt
│ │ ├── EA Desktop Games (with EA Desktop).txt
│ │ ├── EA Desktop Games.txt
│ │ ├── EA Desktop.txt
│ │ ├── Game/
│ │ │ ├── Age of Empires IV.json
│ │ │ ├── COD18.json
│ │ │ ├── Cube 2 Sauerbraten.txt
│ │ │ ├── CyberDuck.txt
│ │ │ ├── DLsite PlayDRM.txt
│ │ │ ├── EVE Online.txt
│ │ │ ├── Escape From Tarkov.txt
│ │ │ ├── Etterna.txt
│ │ │ ├── Faceit AC.txt
│ │ │ ├── ForzaHorizon 4.txt
│ │ │ ├── Grand Theft Auto V.txt
│ │ │ ├── Halo The Master Chief Collection.txt
│ │ │ ├── League of Legends (Japan) (with Riot Games).txt
│ │ │ ├── League of Legends (Taiwan) (with Garena).txt
│ │ │ ├── League of Legends (US).txt
│ │ │ ├── Minecraft (Java).txt
│ │ │ ├── Minecraft Bedrock (Win10 UWP).txt
│ │ │ ├── Multi Theft Auto (MTA).txt
│ │ │ ├── OSU.txt
│ │ │ ├── PVZ Battle for Neighborville.json
│ │ │ ├── PlayerUnknown's Battlegrounds Lite.txt
│ │ │ ├── RAGE Multiplayer.txt
│ │ │ ├── RayCity (Thailand) (Dark RayCity).txt
│ │ │ ├── RayCity (Thailand) (Rebirth RayCity).txt
│ │ │ ├── San Andreas Multiplayer (SA-MP).txt
│ │ │ ├── Tom Clancy's Rainbow Six Siege.txt
│ │ │ ├── VRChat.txt
│ │ │ ├── Valorant.txt
│ │ │ ├── Warframe.txt
│ │ │ └── World of Warships.txt
│ │ ├── Global.json
│ │ ├── NatTypeTester.txt
│ │ ├── Nexon Games.txt
│ │ ├── Nexon.txt
│ │ ├── Origin Games.txt
│ │ ├── Origin.txt
│ │ ├── Other/
│ │ │ ├── AMD Radeon.txt
│ │ │ ├── Adobe Creative Cloud (No Apps).txt
│ │ │ ├── Geforce Experience.txt
│ │ │ ├── Git.txt
│ │ │ ├── Google Drive Backup and Sync.txt
│ │ │ ├── JetBrains ToolBox.txt
│ │ │ ├── NVIDIA Corporation.json
│ │ │ ├── NodeJS With NVM.txt
│ │ │ ├── Unity Asset Store for Unity.txt
│ │ │ ├── Unity Hub.txt
│ │ │ ├── VMware.txt
│ │ │ ├── Visual Studio Code.txt
│ │ │ ├── Xftp 6.txt
│ │ │ ├── Xshell 6.txt
│ │ │ └── qBittorrent.txt
│ │ ├── Rockstar Games Launcher.txt
│ │ ├── Steam Games (with Steam).txt
│ │ ├── Steam Games.txt
│ │ ├── Steam.txt
│ │ ├── TUNTAP/
│ │ │ ├── ARK Survival Evolved (Asia) - Tencent.txt
│ │ │ ├── ARK Survival Evolved (US) - Tencent.txt
│ │ │ ├── Among Us - UU.txt
│ │ │ ├── Battlefield V - Tencent.txt
│ │ │ ├── Black Desert (Taiwan) - Tencent.txt
│ │ │ ├── Black Desert (US) - Tencent.txt
│ │ │ ├── Counter-Strike Global Offensive -UU-.txt
│ │ │ ├── DOOM Eternal.txt
│ │ │ ├── Dead by Daylight - Tencent.txt
│ │ │ ├── Destiny 2 - Tencent.txt
│ │ │ ├── Destiny 2 - UU.txt
│ │ │ ├── EVE Online - Tencent.txt
│ │ │ ├── Escape From Tarkov (HK) - UU.txt
│ │ │ ├── Fall Guys Ultimate Knockout - UU.txt
│ │ │ ├── Fastly.txt
│ │ │ ├── Forza Horizon 4 - Tencent.txt
│ │ │ ├── Forza Motorsport 7 - Tencent.txt
│ │ │ ├── Grand Theft Auto V - Tencent.txt
│ │ │ ├── Grand Theft Auto V - UU.txt
│ │ │ ├── Insurgency Sandstorm - Tencent.txt
│ │ │ ├── Maple Story (Taiwan) - UU.txt
│ │ │ ├── NBA 2K21 - UU.txt
│ │ │ ├── Phasmophobia - UU.txt
│ │ │ ├── PlayerUnknown's Battlegrounds - Tencent.txt
│ │ │ ├── PlayerUnknown's Battlegrounds - UU.txt
│ │ │ ├── Scum - Tencent.txt
│ │ │ ├── Scum - UU.txt
│ │ │ ├── Sea of Thieves - Tencent.txt
│ │ │ ├── Sea of Thieves - UU.txt
│ │ │ └── Tom Clancy's Rainbow Six Siege - UU.txt
│ │ ├── Ubisoft Connect.txt
│ │ ├── pcap2socks-Tencent.txt
│ │ └── pcap2socks-UU.txt
│ ├── nfdriver.sys
│ └── stun.txt
├── Tests/
│ ├── .gitignore
│ ├── Global.cs
│ └── Tests.csproj
├── build.ps1
├── clean.ps1
├── common.props
├── global.json
└── sha256.ps1
================================================
FILE CONTENTS
================================================
================================================
FILE: .github/ISSUE_TEMPLATE/bug_report.yml
================================================
name: Bug report
description: Create a report to help us improve
labels: bug
body:
- type: textarea
id: error
attributes:
label: Describe the bug
description: A clear and concise description of what the bug is.
validations:
required: true
- type: textarea
id: reproduce
attributes:
label: To Reproduce
placeholder: |
1. Open Netch
2. ...
validations:
required: true
- type: textarea
id: log
attributes:
label: Log
description: Attaching any log files in the folder `logging` is strongly recommended.
validations:
required: true
- type: textarea
id: environment
attributes:
label: Environment
render: txt
placeholder: |
- OS: [e.g. Windows 10 x64 Professional Workstation 20H2 19042.928]
- Netch Version: [e.g. 1.0.0]
validations:
required: true
- type: textarea
id: info
attributes:
label: Additional information
description: >
If you have any additional information for us, use the field below.
================================================
FILE: .github/ISSUE_TEMPLATE/bug_report.zh-CN.yml
================================================
name: 错误报告
description: 创建错误报告以帮助我们改进
labels: bug
body:
- type: textarea
id: error
attributes:
label: 错误描述
description: 对错误的清晰简洁描述
validations:
required: true
- type: textarea
id: reproduce
attributes:
label: 复现步骤
placeholder: |
1. 打开 Netch 软件
2. ...
validations:
required: true
- type: textarea
id: log
attributes:
label: 日志
description: 强烈建议附上任何在 `logging` 文件夹下面的日志
validations:
required: true
- type: textarea
id: environment
attributes:
label: 操作环境
render: txt
placeholder: |
操作系统:[Windows 10 x64 Professional Workstation 20H2 19042.928]
软件版本:[1.0.0]
validations:
required: true
- type: textarea
id: info
attributes:
label: 额外信息
description: >
下面的文本框中你可以附上跟 issue 相关的截图、文件
================================================
FILE: .github/ISSUE_TEMPLATE/config.yml
================================================
blank_issues_enabled: false
contact_links:
- name: Telegram Channel
url: https://t.me/netch_channel
about: Telegram Channel
- name: Telegram Group
url: https://t.me/netch_group
about: Telegram Group
================================================
FILE: .github/ISSUE_TEMPLATE/feature_request.yml
================================================
name: Feature request
description: Suggest an idea for this project
labels: enhancement
body:
- type: textarea
id: description
attributes:
label: Describe the feature you want
description: A clear and concise description of what you want to happen.
validations:
required: true
================================================
FILE: .github/ISSUE_TEMPLATE/feature_request.zh-CN.yml
================================================
name: 功能请求
description: 建议这个项目的想法
labels: enhancement
body:
- type: textarea
id: description
attributes:
label: 功能描述
description: 简明扼要地描述需要的功能
validations:
required: true
================================================
FILE: .github/dependabot.yml
================================================
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
time: "00:00"
timezone: "Asia/Shanghai"
- package-ecosystem: "nuget"
directory: "/"
schedule:
interval: "daily"
time: "00:00"
timezone: "Asia/Shanghai"
labels:
- "automatic"
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "daily"
time: "00:00"
timezone: "Asia/Shanghai"
labels:
- "automatic"
================================================
FILE: .github/workflows/build.yml
================================================
name: Netch Build CI
on: [push, pull_request]
jobs:
build:
name: Build
runs-on: windows-2022
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Checksum
shell: pwsh
run: |
echo "SOURCE_NETCH_SHA256=$(.\sha256.ps1 .\Netch)" | Out-File -Append -Encoding UTF8 -FilePath $Env:GITHUB_ENV
echo "SOURCE_OTHER_SHA256=$(.\sha256.ps1 .\Other)" | Out-File -Append -Encoding UTF8 -FilePath $Env:GITHUB_ENV
echo "SOURCE_REDIRECTOR_SHA256=$(.\sha256.ps1 .\Redirector)" | Out-File -Append -Encoding UTF8 -FilePath $Env:GITHUB_ENV
echo "SOURCE_ROUTEHELPER_SHA256=$(.\sha256.ps1 .\RouteHelper)" | Out-File -Append -Encoding UTF8 -FilePath $Env:GITHUB_ENV
- name: Cache Netch
uses: actions/cache@v3
with:
key: Netch-${{ runner.os }}-Netch-${{ env.SOURCE_NETCH_SHA256 }}
path: |
.\Netch\bin
- name: Cache Other
uses: actions/cache@v3
with:
key: Netch-${{ runner.os }}-Other-${{ env.SOURCE_OTHER_SHA256 }}
path: |
.\Other\release
- name: Cache Redirector
uses: actions/cache@v3
with:
key: Netch-${{ runner.os }}-Redirector-${{ env.SOURCE_REDIRECTOR_SHA256 }}
path: |
.\Redirector\bin
- name: Cache RouteHelper
uses: actions/cache@v3
with:
key: Netch-${{ runner.os }}-RouteHelper-${{ env.SOURCE_ROUTEHELPER_SHA256 }}
path: |
.\RouteHelper\bin
- name: Check Other
id: check_other
uses: andstor/file-existence-action@v2
with:
files: .\other\release\aiodns.bin
- name: Setup Go
uses: actions/setup-go@v3
if: steps.check_other.outputs.files_exists == 'false'
with:
go-version: stable
- name: Setup C++
uses: msys2/setup-msys2@v2
if: steps.check_other.outputs.files_exists == 'false'
with:
update: true
release: true
install: base-devel git mingw-w64-x86_64-gcc mingw-w64-x86_64-cmake mingw-w64-x86_64-libevent mingw-w64-x86_64-pcre2 mingw-w64-x86_64-freetype mingw-w64-x86_64-libpng mingw-w64-x86_64-bzip2 mingw-w64-x86_64-openssl mingw-w64-x86_64-mbedtls mingw-w64-x86_64-libsodium mingw-w64-x86_64-c-ares mingw-w64-x86_64-boost mingw-w64-x86_64-libmariadbclient unzip p7zip autoconf automake libtool
- name: Setup Rust
uses: actions-rs/toolchain@v1
if: steps.check_other.outputs.files_exists == 'false'
with:
toolchain: nightly
profile: minimal
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v1.3.1
with:
vs-prerelease: true
- name: Build
shell: pwsh
run: |
.\build.ps1 -Configuration Release -OutputPath release
- name: Upload
uses: actions/upload-artifact@v3
with:
name: release
path: release
================================================
FILE: .github/workflows/release.yml
================================================
name: Netch Release CI
on:
push:
tags:
- '*.*.*'
jobs:
build:
name: Build
runs-on: windows-2022
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Checksum
shell: pwsh
run: |
echo "SOURCE_NETCH_SHA256=$(.\sha256.ps1 .\Netch)" | Out-File -Append -Encoding UTF8 -FilePath $Env:GITHUB_ENV
echo "SOURCE_OTHER_SHA256=$(.\sha256.ps1 .\Other)" | Out-File -Append -Encoding UTF8 -FilePath $Env:GITHUB_ENV
echo "SOURCE_REDIRECTOR_SHA256=$(.\sha256.ps1 .\Redirector)" | Out-File -Append -Encoding UTF8 -FilePath $Env:GITHUB_ENV
echo "SOURCE_ROUTEHELPER_SHA256=$(.\sha256.ps1 .\RouteHelper)" | Out-File -Append -Encoding UTF8 -FilePath $Env:GITHUB_ENV
- name: Cache Netch
uses: actions/cache@v3
with:
key: Netch-${{ runner.os }}-Netch-${{ env.SOURCE_NETCH_SHA256 }}
path: |
.\Netch\bin
- name: Cache Redirector
uses: actions/cache@v3
with:
key: Netch-${{ runner.os }}-Redirector-${{ env.SOURCE_REDIRECTOR_SHA256 }}
path: |
.\Redirector\bin
- name: Cache RouteHelper
uses: actions/cache@v3
with:
key: Netch-${{ runner.os }}-RouteHelper-${{ env.SOURCE_ROUTEHELPER_SHA256 }}
path: |
.\RouteHelper\bin
- name: Check Other
id: check_other
uses: andstor/file-existence-action@v2
with:
files: .\other\release\aiodns.bin
- name: Setup Go
uses: actions/setup-go@v3
if: steps.check_other.outputs.files_exists == 'false'
with:
go-version: stable
- name: Setup C++
uses: msys2/setup-msys2@v2
if: steps.check_other.outputs.files_exists == 'false'
with:
update: true
release: true
install: base-devel git mingw-w64-x86_64-gcc mingw-w64-x86_64-cmake mingw-w64-x86_64-libevent mingw-w64-x86_64-pcre2 mingw-w64-x86_64-freetype mingw-w64-x86_64-libpng mingw-w64-x86_64-bzip2 mingw-w64-x86_64-openssl mingw-w64-x86_64-mbedtls mingw-w64-x86_64-libsodium mingw-w64-x86_64-c-ares mingw-w64-x86_64-boost mingw-w64-x86_64-libmariadbclient unzip p7zip autoconf automake libtool
- name: Setup Rust
uses: actions-rs/toolchain@v1
if: steps.check_other.outputs.files_exists == 'false'
with:
toolchain: nightly
profile: minimal
- name: Build
shell: pwsh
run: |
.\build.ps1 -Configuration Release -OutputPath release
- name: Package
shell: pwsh
run: |
7z a -mx9 Netch.7z release
7z rn Netch.7z release Netch
- name: Checksum
shell: pwsh
run: |
$hash=(Get-FileHash Netch.7z -Algorithm SHA256).Hash.ToLower()
echo "NETCH_SHA256=$hash" | Out-File -Append -Encoding UTF8 -FilePath $Env:GITHUB_ENV
- name: Release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
prerelease: ${{ contains(github.ref, '-') }}
draft: false
files: |
Netch.7z
body: |
[](https://t.me/netch_channel) [](https://t.me/netch_group)
## Changelogs
* This is an automated deployment of GitHub Actions, the change log should be updated manually soon
## 更新日志
* 这是 GitHub Actions 自动化部署,更新日志应该很快会手动更新
## 校验和
| 文件名 | SHA256 |
| :- | :- |
| Netch.7z | ${{ env.Netch_SHA256 }} |
================================================
FILE: .github/workflows/stale.yml
================================================
name: Close stale issues and PRs
on:
schedule:
- cron: "0 0 * * *"
jobs:
close-issues:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- uses: actions/stale@v7
with:
days-before-issue-stale: 30
days-before-issue-close: 14
days-before-pr-stale: 30
days-before-pr-close: 14
stale-issue-message: "This issue is stale because it has been open for 30 days with no activity."
close-issue-message: "This issue was closed because it has been inactive for 14 days since being marked as stale."
================================================
FILE: .gitignore
================================================
/.vs
/.idea
/release
/packages
/TestResults
================================================
FILE: LICENSE
================================================
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.
================================================
FILE: Netch/.gitignore
================================================
/bin
/obj
/*.csproj.user
FodyWeavers.xsd
================================================
FILE: Netch/App.manifest
================================================
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
</requestedPrivileges>
</security>
</trustInfo>
<asmv3:application>
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
</asmv3:windowsSettings>
</asmv3:application>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- Windows 7 -->
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />
<!-- Windows 8 -->
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />
<!-- Windows 8.1 -->
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />
<!-- Windows 10 -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
</application>
</compatibility>
</assembly>
================================================
FILE: Netch/Constants.cs
================================================
namespace Netch;
public static class Constants
{
public const string TempConfig = "data\\last.json";
public const string TempRouteFile = "data\\route.txt";
public const string AioDnsRuleFile = "bin\\aiodns.conf";
public const string NFDriver = "bin\\nfdriver.sys";
public const string STUNServersFile = "bin\\stun.txt";
public const string LogFile = "logging\\application.log";
public const string OutputTemplate = @"[{Timestamp:yyyy-MM-dd HH:mm:ss}][{Level}] {Message:lj}{NewLine}{Exception}";
public const string EOF = "\r\n";
public const string DefaultGroup = "NONE";
public static class Parameter
{
public const string Show = "-show";
public const string ForceUpdate = "-forceUpdate";
}
public const string WintunDllFile = "bin\\wintun.dll";
public const string DisableModeDirectoryFileName = "disabled";
public const string DefaultPrimaryDNS = "1.1.1.1";
public const string DefaultCNPrimaryDNS = "223.5.5.5";
}
================================================
FILE: Netch/Controllers/DNSController.cs
================================================
using Netch.Interfaces;
using Netch.Models;
using static Netch.Interops.AioDNS;
namespace Netch.Controllers;
public class DNSController : IController
{
public string Name => "DNS Service";
public async Task StartAsync()
{
var aioDnsConfig = Global.Settings.AioDNS;
Dial(NameList.TYPE_REST, "");
Dial(NameList.TYPE_LIST, Path.GetFullPath(Constants.AioDnsRuleFile));
// TODO remove ListenPort setting
Dial(NameList.TYPE_LISN, $"127.0.0.1:{aioDnsConfig.ListenPort}");
Dial(NameList.TYPE_CDNS, $"{aioDnsConfig.ChinaDNS}");
Dial(NameList.TYPE_ODNS, $"{aioDnsConfig.OtherDNS}");
if (!await InitAsync())
throw new MessageException("AioDNS start failed.");
}
public Task StopAsync()
{
return FreeAsync();
}
}
================================================
FILE: Netch/Controllers/Guard.cs
================================================
using System.Diagnostics;
using System.Text;
using Microsoft.VisualStudio.Threading;
using Netch.Enums;
using Netch.Models;
using Netch.Utils;
namespace Netch.Controllers;
public abstract class Guard
{
private FileStream? _logFileStream;
private StreamWriter? _logStreamWriter;
/// <param name="mainFile">application path relative of Netch\bin</param>
/// <param name="redirectOutput"></param>
/// <param name="encoding">application output encode</param>
protected Guard(string mainFile, bool redirectOutput = true, Encoding? encoding = null)
{
RedirectOutput = redirectOutput;
var fileName = Path.GetFullPath($"bin\\{mainFile}");
if (!File.Exists(fileName))
throw new MessageException(i18N.Translate($"bin\\{mainFile} file not found!"));
Instance = new Process
{
StartInfo =
{
FileName = fileName,
WorkingDirectory = $"{Global.NetchDir}\\bin",
CreateNoWindow = true,
UseShellExecute = !RedirectOutput,
RedirectStandardOutput = RedirectOutput,
StandardOutputEncoding = RedirectOutput ? encoding : null,
RedirectStandardError = RedirectOutput,
StandardErrorEncoding = RedirectOutput ? encoding : null,
WindowStyle = ProcessWindowStyle.Hidden
}
};
}
protected string LogPath => Path.Combine(Global.NetchDir, $"logging\\{Name}.log");
protected virtual IEnumerable<string> StartedKeywords { get; } = new List<string>();
protected virtual IEnumerable<string> FailedKeywords { get; } = new List<string>();
public abstract string Name { get; }
private State State { get; set; } = State.Waiting;
private bool RedirectOutput { get; }
public Process Instance { get; }
protected async Task StartGuardAsync(string argument, ProcessPriorityClass priority = ProcessPriorityClass.Normal)
{
State = State.Starting;
_logFileStream = new FileStream(LogPath, FileMode.Create, FileAccess.Write, FileShare.Read, 4096, true);
_logStreamWriter = new StreamWriter(_logFileStream) { AutoFlush = true };
Instance.StartInfo.Arguments = argument;
Instance.Start();
Global.Job.AddProcess(Instance);
if (priority != ProcessPriorityClass.Normal)
Instance.PriorityClass = priority;
if (RedirectOutput)
{
ReadOutputAsync(Instance.StandardOutput).Forget();
ReadOutputAsync(Instance.StandardError).Forget();
if (!StartedKeywords.Any())
{
// Skip, No started keyword
State = State.Started;
return;
}
// wait ReadOutput change State
for (var i = 0; i < 1000; i++)
{
await Task.Delay(50);
switch (State)
{
case State.Started:
OnStarted();
return;
case State.Stopped:
await StopGuardAsync();
OnStartFailed();
throw new MessageException($"{Name} 控制器启动失败");
}
}
await StopGuardAsync();
throw new MessageException($"{Name} 控制器启动超时");
}
}
private async Task ReadOutputAsync(TextReader reader)
{
string? line;
while ((line = await reader.ReadLineAsync()) != null)
{
await _logStreamWriter!.WriteLineAsync(line);
OnReadNewLine(line);
if (State == State.Starting)
{
if (StartedKeywords.Any(s => line.Contains(s)))
State = State.Started;
else if (FailedKeywords.Any(s => line.Contains(s)))
{
OnStartFailed();
State = State.Stopped;
}
}
}
}
public virtual Task StopAsync()
{
return StopGuardAsync();
}
protected async Task StopGuardAsync()
{
try
{
if (Instance is { HasExited: false })
{
Instance.Kill();
await Instance.WaitForExitAsync();
}
}
catch (Exception e)
{
Log.Error(e, "Stop {Name} failed", Instance.ProcessName);
}
finally
{
if (_logStreamWriter != null)
await _logStreamWriter.DisposeAsync();
if (_logFileStream != null)
await _logFileStream.DisposeAsync();
Instance.Dispose();
State = State.Stopped;
}
}
protected virtual void OnStarted()
{
}
protected virtual void OnReadNewLine(string line)
{
}
protected virtual void OnStartFailed()
{
Utils.Utils.Open(LogPath);
}
}
================================================
FILE: Netch/Controllers/MainController.cs
================================================
using System.Diagnostics;
using Microsoft.VisualStudio.Threading;
using Netch.Interfaces;
using Netch.Models;
using Netch.Models.Modes;
using Netch.Servers;
using Netch.Services;
using Netch.Utils;
namespace Netch.Controllers;
public static class MainController
{
public static Socks5Server? Socks5Server { get; private set; }
public static Server? Server { get; private set; }
public static Mode? Mode { get; private set; }
public static IServerController? ServerController { get; private set; }
public static IModeController? ModeController { get; private set; }
private static readonly AsyncSemaphore Lock = new(1);
public static async Task StartAsync(Server server, Mode mode)
{
using var releaser = await Lock.EnterAsync();
Log.Information("Start MainController: {Server} {Mode}", $"{server.Type}", $"[{(int)mode.Type}]{mode.i18NRemark}");
if (await DnsUtils.LookupAsync(server.Hostname) == null)
throw new MessageException(i18N.Translate("Lookup Server hostname failed"));
// TODO Disable NAT Type Test setting
// cache STUN Server ip to prevent "Wrong STUN Server"
DnsUtils.LookupAsync(Global.Settings.STUN_Server).Forget();
Server = server;
Mode = mode;
await Task.WhenAll(Task.Run(NativeMethods.RefreshDNSCache), Task.Run(Firewall.AddNetchFwRules));
try
{
ModeController = ModeService.GetModeControllerByType(mode.Type, out var modePort, out var portName);
if (modePort != null)
TryReleaseTcpPort((ushort)modePort, portName);
if (Server is Socks5Server socks5 && (!socks5.Auth() || ModeController.Features.HasFlag(ModeFeature.SupportSocks5Auth)))
{
Socks5Server = socks5;
}
else
{
// Start Server Controller to get a local socks5 server
Log.Debug("Server Information: {Data}", $"{server.Type} {server.MaskedData()}");
ServerController = new V2rayController();
Global.MainForm.StatusText(i18N.TranslateFormat("Starting {0}", ServerController.Name));
TryReleaseTcpPort(ServerController.Socks5LocalPort(), "Socks5");
Socks5Server = await ServerController.StartAsync(server);
StatusPortInfoText.Socks5Port = Socks5Server.Port;
StatusPortInfoText.UpdateShareLan();
}
// Start Mode Controller
Global.MainForm.StatusText(i18N.TranslateFormat("Starting {0}", ModeController.Name));
await ModeController.StartAsync(Socks5Server, mode);
}
catch (Exception e)
{
releaser.Dispose();
await StopAsync();
switch (e)
{
case DllNotFoundException:
case FileNotFoundException:
throw new Exception(e.Message + "\n\n" + i18N.Translate("Missing File or runtime components"));
case MessageException:
throw;
default:
Log.Error(e, "Unhandled Exception When Start MainController");
Utils.Utils.Open(Constants.LogFile);
throw new MessageException($"{i18N.Translate("Unhandled Exception")}\n{e.Message}");
}
}
}
public static async Task StopAsync()
{
if (Lock.CurrentCount == 0)
{
(await Lock.EnterAsync()).Dispose();
if (ServerController == null && ModeController == null)
// stopped
return;
// else begin stop
}
using var _ = await Lock.EnterAsync();
if (ServerController == null && ModeController == null)
return;
Log.Information("Stop Main Controller");
StatusPortInfoText.Reset();
var tasks = new[]
{
ServerController?.StopAsync() ?? Task.CompletedTask,
ModeController?.StopAsync() ?? Task.CompletedTask
};
try
{
await Task.WhenAll(tasks);
}
catch (Exception e)
{
Log.Error(e, "MainController Stop Error");
}
ServerController = null;
ModeController = null;
}
public static void PortCheck(ushort port, string portName, PortType portType = PortType.Both)
{
try
{
PortHelper.CheckPort(port, portType);
}
catch (PortInUseException)
{
throw new MessageException(i18N.TranslateFormat("The {0} port is in use.", $"{portName} ({port})"));
}
catch (PortReservedException)
{
throw new MessageException(i18N.TranslateFormat("The {0} port is reserved by system.", $"{portName} ({port})"));
}
}
public static void TryReleaseTcpPort(ushort port, string portName)
{
foreach (var p in PortHelper.GetProcessByUsedTcpPort(port))
{
var fileName = p.MainModule?.FileName;
if (fileName == null)
continue;
if (fileName.StartsWith(Global.NetchDir))
{
p.Kill();
p.WaitForExit();
}
else
{
throw new MessageException(i18N.TranslateFormat("The {0} port is used by {1}.", $"{portName} ({port})", $"({p.Id}){fileName}"));
}
}
PortCheck(port, portName, PortType.TCP);
}
public static Task<NatTypeTestResult> DiscoveryNatTypeAsync(CancellationToken ctx = default)
{
Debug.Assert(Socks5Server != null, nameof(Socks5Server) + " != null");
return Socks5ServerTestUtils.DiscoveryNatTypeAsync(Socks5Server, ctx);
}
public static Task<int?> HttpConnectAsync(CancellationToken ctx = default)
{
Debug.Assert(Socks5Server != null, nameof(Socks5Server) + " != null");
try
{
return Socks5ServerTestUtils.HttpConnectAsync(Socks5Server, ctx);
}
catch (OperationCanceledException)
{
// ignored
}
catch (Exception e)
{
Log.Warning(e, "Unhandled Socks5ServerTestUtils.HttpConnectAsync Exception");
}
return Task.FromResult<int?>(null);
}
}
================================================
FILE: Netch/Controllers/NFController.cs
================================================
using System.Net;
using System.ServiceProcess;
using Netch.Interfaces;
using Netch.Models;
using Netch.Models.Modes;
using Netch.Models.Modes.ProcessMode;
using Netch.Servers;
using Netch.Utils;
using static Netch.Interops.Redirector;
namespace Netch.Controllers;
public class NFController : IModeController
{
private Server? _server;
private Redirector _mode = null!;
private RedirectorConfig _rdrConfig = null!;
private static readonly ServiceController NFService = new("netfilter2");
private static readonly string SystemDriver = $"{Environment.SystemDirectory}\\drivers\\netfilter2.sys";
public string Name => "Redirector";
public ModeFeature Features => ModeFeature.SupportIPv6 | ModeFeature.SupportSocks5Auth;
public async Task StartAsync(Socks5Server server, Mode mode)
{
if (mode is not Redirector processMode)
throw new InvalidOperationException();
_server = server;
_mode = processMode;
_rdrConfig = Global.Settings.Redirector;
CheckDriver();
Dial(NameList.AIO_FILTERLOOPBACK, _mode.FilterLoopback);
Dial(NameList.AIO_FILTERINTRANET, _mode.FilterIntranet);
Dial(NameList.AIO_FILTERPARENT, _mode.FilterParent ?? _rdrConfig.FilterParent);
Dial(NameList.AIO_FILTERICMP, _mode.FilterICMP ?? _rdrConfig.FilterICMP);
if (_mode.FilterICMP ?? _rdrConfig.FilterICMP)
Dial(NameList.AIO_ICMPING, (_mode.FilterICMP != null ? _mode.ICMPDelay ?? 10 : _rdrConfig.ICMPDelay).ToString());
Dial(NameList.AIO_FILTERTCP, _mode.FilterTCP ?? _rdrConfig.FilterTCP);
Dial(NameList.AIO_FILTERUDP, _mode.FilterUDP ?? _rdrConfig.FilterUDP);
// DNS
Dial(NameList.AIO_FILTERDNS, _mode.FilterDNS ?? _rdrConfig.FilterDNS);
Dial(NameList.AIO_DNSONLY, _mode.HandleOnlyDNS ?? _rdrConfig.HandleOnlyDNS);
Dial(NameList.AIO_DNSPROX, _mode.DNSProxy ?? _rdrConfig.DNSProxy);
if (_mode.FilterDNS ?? _rdrConfig.FilterDNS)
{
var dnsStr = _mode.FilterDNS != null ? _mode.DNSHost : _rdrConfig.DNSHost;
dnsStr = dnsStr.ValueOrDefault() ?? $"{Constants.DefaultPrimaryDNS}:53";
var dns = IPEndPoint.Parse(dnsStr);
if (dns.Port == 0)
dns.Port = 53;
Dial(NameList.AIO_DNSHOST, dns.Address.ToString());
Dial(NameList.AIO_DNSPORT, dns.Port.ToString());
}
// Server
Dial(NameList.AIO_TGTHOST, await server.AutoResolveHostnameAsync());
Dial(NameList.AIO_TGTPORT, server.Port.ToString());
Dial(NameList.AIO_TGTUSER, server.Username ?? string.Empty);
Dial(NameList.AIO_TGTPASS, server.Password ?? string.Empty);
// Mode Rule
DialRule();
if (!await InitAsync())
throw new MessageException("Redirector start failed.");
}
public Task StopAsync()
{
return FreeAsync();
}
#region CheckRule
/// <summary>
/// </summary>
/// <param name="r"></param>
/// <param name="clear"></param>
/// <returns>No Problem true</returns>
private static bool CheckCppRegex(string r, bool clear = true)
{
try
{
if (r.StartsWith("!"))
return Dial(NameList.AIO_ADDNAME, r.Substring(1));
return Dial(NameList.AIO_ADDNAME, r);
}
finally
{
if (clear)
Dial(NameList.AIO_CLRNAME, "");
}
}
/// <summary>
/// </summary>
/// <param name="rules"></param>
/// <param name="results"></param>
/// <returns>No Problem true</returns>
public static bool CheckRules(IEnumerable<string> rules, out IEnumerable<string> results)
{
results = rules.Where(r => !CheckCppRegex(r, false));
Dial(NameList.AIO_CLRNAME, "");
return !results.Any();
}
public static string GenerateInvalidRulesMessage(IEnumerable<string> rules)
{
return $"{string.Join("\n", rules)}\n" + i18N.Translate("Above rules does not conform to C++ regular expression syntax");
}
#endregion
private void DialRule()
{
Dial(NameList.AIO_CLRNAME, "");
var invalidList = new List<string>();
foreach (var s in _mode.Bypass)
{
if (!Dial(NameList.AIO_BYPNAME, s))
invalidList.Add(s);
}
foreach (var s in _mode.Handle)
{
if (!Dial(NameList.AIO_ADDNAME, s))
invalidList.Add(s);
}
if (invalidList.Any())
throw new MessageException(GenerateInvalidRulesMessage(invalidList));
// Bypass Self
Dial(NameList.AIO_BYPNAME, "^" + Global.NetchDir.ToRegexString());
}
#region DriverUtil
private static void CheckDriver()
{
var binFileVersion = Utils.Utils.GetFileVersion(Constants.NFDriver);
var systemFileVersion = Utils.Utils.GetFileVersion(SystemDriver);
Log.Information("Built-in netfilter2 driver version: {Name}", binFileVersion);
Log.Information("Installed netfilter2 driver version: {Name}", systemFileVersion);
if (!File.Exists(SystemDriver))
{
// Install
InstallDriver();
return;
}
var reinstall = false;
if (Version.TryParse(binFileVersion, out var binResult) && Version.TryParse(systemFileVersion, out var systemResult))
{
if (binResult.CompareTo(systemResult) > 0)
// Update
reinstall = true;
else if (systemResult.Major != binResult.Major)
// Downgrade when Major version different (may have breaking changes)
reinstall = true;
}
else
{
// Parse File versionName to Version failed
if (!systemFileVersion.Equals(binFileVersion))
// versionNames are different, Reinstall
reinstall = true;
}
if (!reinstall)
return;
Log.Information("Update netfilter2 driver");
UninstallDriver();
InstallDriver();
}
/// <summary>
/// 安装 NF 驱动
/// </summary>
/// <returns>驱动是否安装成功</returns>
private static void InstallDriver()
{
Log.Information("Install netfilter2 driver");
Global.MainForm.StatusText(i18N.Translate("Installing netfilter2 driver"));
if (!File.Exists(Constants.NFDriver))
throw new MessageException(i18N.Translate("builtin driver files missing, can't install NF driver"));
try
{
File.Copy(Constants.NFDriver, SystemDriver);
}
catch (Exception e)
{
Log.Error(e, "Copy netfilter2.sys failed\n");
throw new MessageException($"Copy netfilter2.sys failed\n{e.Message}");
}
// 注册驱动文件
if (Interops.Redirector.aio_register("netfilter2"))
{
Log.Information("Install netfilter2 driver finished");
}
else
{
Log.Error("Register netfilter2 failed");
}
}
/// <summary>
/// 卸载 NF 驱动
/// </summary>
/// <returns>是否成功卸载</returns>
public static bool UninstallDriver()
{
Log.Information("Uninstall netfilter2");
try
{
if (NFService.Status == ServiceControllerStatus.Running)
{
NFService.Stop();
NFService.WaitForStatus(ServiceControllerStatus.Stopped);
}
}
catch (Exception)
{
// ignored
}
if (!File.Exists(SystemDriver))
return true;
Interops.Redirector.aio_unregister("netfilter2");
File.Delete(SystemDriver);
return true;
}
#endregion
}
================================================
FILE: Netch/Controllers/PcapController.cs
================================================
using System.Text;
using Microsoft.VisualStudio.Threading;
using Netch.Forms;
using Netch.Interfaces;
using Netch.Models;
using Netch.Models.Modes;
using Netch.Models.Modes.ShareMode;
using Netch.Servers;
using Netch.Utils;
namespace Netch.Controllers;
public class PcapController : Guard, IModeController
{
private readonly LogForm _form;
private ShareMode _mode = null!;
private Socks5Server _server = null!;
public PcapController() : base("pcap2socks.exe", encoding: Encoding.UTF8)
{
_form = new LogForm(Global.MainForm);
_form.CreateControl();
}
protected override IEnumerable<string> StartedKeywords { get; } = new[] { "└" };
public override string Name => "pcap2socks";
public ModeFeature Features => ModeFeature.SupportSocks5Auth;
public async Task StartAsync(Socks5Server server, Mode mode)
{
if (mode is not ShareMode shareMode)
throw new InvalidOperationException();
_server = server;
_mode = shareMode;
var outboundNetworkInterface = NetworkInterfaceUtils.GetBest();
var arguments = new List<object?>
{
"--interface", $@"\Device\NPF_{outboundNetworkInterface.Id}",
"--destination", $"{await _server.AutoResolveHostnameAsync()}:{_server.Port}",
_mode.Argument, SpecialArgument.Flag
};
if (_server.Auth())
arguments.AddRange(new[]
{
"--username", server.Username,
"--password", server.Password
});
await StartGuardAsync(Arguments.Format(arguments));
}
public override async Task StopAsync()
{
Global.MainForm.Invoke(() => { _form.Close(); });
await StopGuardAsync();
}
~PcapController()
{
_form.Dispose();
}
protected override void OnReadNewLine(string line)
{
Global.MainForm.BeginInvoke(() =>
{
if (!_form.IsDisposed)
_form.richTextBox1.AppendText(line + "\n");
});
}
protected override void OnStarted()
{
Global.MainForm.BeginInvoke(() => _form.Show());
}
protected override void OnStartFailed()
{
if (new FileInfo(LogPath).Length == 0)
{
Task.Run(() =>
{
Thread.Sleep(1000);
Utils.Utils.Open("https://github.com/zhxie/pcap2socks#dependencies");
})
.Forget();
throw new MessageException("Pleases install pcap2socks's dependency");
}
Utils.Utils.Open(LogPath);
}
}
================================================
FILE: Netch/Controllers/TUNController.cs
================================================
using System.Net;
using System.Net.NetworkInformation;
using System.Net.Sockets;
using Netch.Interfaces;
using Netch.Interops;
using Netch.Models;
using Netch.Models.Modes;
using Netch.Models.Modes.TunMode;
using Netch.Servers;
using Netch.Utils;
using static Netch.Interops.tun2socks;
namespace Netch.Controllers
{
public class TUNController : IModeController
{
private readonly DNSController _aioDnsController = new();
private TunMode _mode = null!;
private IPAddress? _serverRemoteAddress;
private TUNConfig _tunConfig = null!;
private NetRoute _tun;
private NetRoute _outbound;
public string Name => "tun2socks";
public string interfaceName => "netch";
public ModeFeature Features => ModeFeature.SupportSocks5Auth;
public async Task StartAsync(Socks5Server server, Mode mode)
{
if (mode is not TunMode tunMode)
throw new InvalidOperationException();
_mode = tunMode;
_tunConfig = Global.Settings.TUNTAP;
if (server.RemoteHostname.ValueOrDefault() != null)
_serverRemoteAddress = await DnsUtils.LookupAsync(server.RemoteHostname!);
else
_serverRemoteAddress = await DnsUtils.LookupAsync(server.Hostname);
if (_serverRemoteAddress != null && IPAddress.IsLoopback(_serverRemoteAddress))
_serverRemoteAddress = null;
_outbound = NetRoute.GetBestRouteTemplate();
CheckDriver();
// Wait for adapter to be created
for (var i = 0; i < 20; i++)
{
await Task.Delay(300);
try
{
_tun.InterfaceIndex = NetworkInterfaceUtils.Get(ni => ni.Name.StartsWith(interfaceName)).GetIndex();
break;
}
catch
{
// ignored
}
}
Dial(NameList.TYPE_ADAPMTU, "1500");
Dial(NameList.TYPE_BYPBIND, _outbound.Gateway);
Dial(NameList.TYPE_BYPLIST, "disabled");
#region Server
Dial(NameList.TYPE_TCPREST, "");
Dial(NameList.TYPE_TCPTYPE, "Socks5");
Dial(NameList.TYPE_UDPREST, "");
Dial(NameList.TYPE_UDPTYPE, "Socks5");
Dial(NameList.TYPE_TCPHOST, $"{await server.AutoResolveHostnameAsync()}:{server.Port}");
Dial(NameList.TYPE_UDPHOST, $"{await server.AutoResolveHostnameAsync()}:{server.Port}");
if (server.Auth())
{
Dial(NameList.TYPE_TCPUSER, server.Username!);
Dial(NameList.TYPE_TCPPASS, server.Password!);
Dial(NameList.TYPE_UDPUSER, server.Username!);
Dial(NameList.TYPE_UDPPASS, server.Password!);
}
#endregion
#region DNS
if (_tunConfig.UseCustomDNS)
{
Dial(NameList.TYPE_DNSADDR, DnsUtils.AppendPort(_tunConfig.DNS));
}
else
{
await _aioDnsController.StartAsync();
Dial(NameList.TYPE_DNSADDR, $"127.0.0.1:{Global.Settings.AioDNS.ListenPort}");
}
#endregion
if (!Init())
throw new MessageException("tun2socks start failed.");
var tunIndex = (int)RouteHelper.ConvertLuidToIndex(tun_luid());
_tun = NetRoute.TemplateBuilder(_tunConfig.Gateway, tunIndex);
RouteHelper.CreateUnicastIP(AddressFamily.InterNetwork,
_tunConfig.Address,
(byte)Utils.Utils.SubnetToCidr(_tunConfig.Netmask),
(ulong)tunIndex);
SetupRouteTable();
}
public async Task StopAsync()
{
var tasks = new[]
{
FreeAsync(),
Task.Run(ClearRouteTable),
_aioDnsController.StopAsync()
};
await Task.WhenAll(tasks);
}
private void CheckDriver()
{
string binDriver = Path.Combine(Global.NetchDir, Constants.WintunDllFile);
string sysDriver = $@"{Environment.SystemDirectory}\wintun.dll";
var binHash = Utils.Utils.Sha256CheckSumAsync(binDriver).Result;
var sysHash = Utils.Utils.Sha256CheckSumAsync(sysDriver).Result;
Log.Information("Built-in wintun.dll Hash: {Hash}", binHash);
Log.Information("Installed wintun.dll Hash: {Hash}", sysHash);
if (binHash == sysHash)
return;
try
{
Log.Information("Copy wintun.dll to System Directory");
File.Copy(binDriver, sysDriver, true);
}
catch (Exception e)
{
Log.Error(e, "Copy wintun.dll failed");
throw new MessageException($"Failed to copy wintun.dll to system directory: {e.Message}");
}
}
#region Route
private void SetupRouteTable()
{
Global.MainForm.StatusText(i18N.Translate("Setup Route Table Rule"));
var tunNetworkInterface = NetworkInterfaceUtils.Get(_tun.InterfaceIndex);
// Server Address
if (_serverRemoteAddress != null)
RouteUtils.CreateRoute(_outbound.FillTemplate(_serverRemoteAddress.ToString(), 32));
// Global Bypass IPs
RouteUtils.CreateRouteFill(_outbound, _tunConfig.BypassIPs);
// rule
RouteUtils.CreateRouteFill(_tun, _mode.Handle);
RouteUtils.CreateRouteFill(_outbound, _mode.Bypass);
// dns
if (_tunConfig.UseCustomDNS)
{
if (_tunConfig.ProxyDNS)
{
// NOTICE: DNS metric is network interface metric
RouteUtils.CreateRoute(_tun.FillTemplate(_tunConfig.DNS, 32));
}
tunNetworkInterface.SetDns(_tunConfig.DNS);
}
else
{
RouteUtils.CreateRoute(_outbound.FillTemplate(Utils.Utils.GetHostFromUri(Global.Settings.AioDNS.ChinaDNS), 32));
RouteUtils.CreateRoute(_tun.FillTemplate(Utils.Utils.GetHostFromUri(Global.Settings.AioDNS.OtherDNS), 32));
}
NetworkInterfaceUtils.SetInterfaceMetric(_tun.InterfaceIndex, 0);
}
private void ClearRouteTable()
{
if (_serverRemoteAddress != null)
RouteUtils.DeleteRoute(_outbound.FillTemplate(_serverRemoteAddress.ToString(), 32));
if (_outbound.Gateway != null)
{
RouteUtils.DeleteRouteFill(_outbound, Global.Settings.TUNTAP.BypassIPs);
RouteUtils.DeleteRoute(_outbound.FillTemplate(Utils.Utils.GetHostFromUri(Global.Settings.AioDNS.ChinaDNS), 32));
NetworkInterfaceUtils.SetInterfaceMetric(_outbound.InterfaceIndex);
}
if (_mode != null)
RouteUtils.DeleteRouteFill(_outbound, _mode.Bypass);
}
#endregion
}
}
================================================
FILE: Netch/Controllers/UpdateChecker.cs
================================================
using System.Net;
using System.Text;
using System.Text.Json;
using System.Text.RegularExpressions;
using Netch.Models.GitHubRelease;
using Netch.Utils;
namespace Netch.Controllers;
public static class UpdateChecker
{
public const string Owner = @"NetchX";
public const string Repo = @"Netch";
public const string Name = @"Netch";
public const string Copyright = @"Copyright © 2019 - 2022";
public const string AssemblyVersion = @"1.9.7";
private const string Suffix = @"";
public static readonly string Version = $"{AssemblyVersion}{(string.IsNullOrEmpty(Suffix) ? "" : $"-{Suffix}")}";
public static Release LatestRelease = null!;
public static string LatestVersionNumber => LatestRelease.tag_name;
public static string LatestVersionUrl => LatestRelease.html_url;
public static event EventHandler? NewVersionFound;
public static event EventHandler? NewVersionFoundFailed;
public static event EventHandler? NewVersionNotFound;
public static async Task CheckAsync(bool isPreRelease)
{
try
{
var updater = new GitHubRelease(Owner, Repo);
var url = updater.AllReleaseUrl;
var (_, json) = await WebUtil.DownloadStringAsync(WebUtil.CreateRequest(url));
var releases = JsonSerializer.Deserialize<List<Release>>(json)!;
LatestRelease = GetLatestRelease(releases, isPreRelease);
Log.Information("Github latest release: {Version}", LatestRelease.tag_name);
if (VersionUtil.CompareVersion(LatestRelease.tag_name, Version) > 0)
{
Log.Information("Found newer version");
NewVersionFound?.Invoke(null, EventArgs.Empty);
}
else
{
Log.Information("Already the latest version");
NewVersionNotFound?.Invoke(null, EventArgs.Empty);
}
}
catch (Exception e)
{
if (e is WebException)
Log.Warning(e, "Get releases failed");
else
Log.Error(e, "Get releases error");
NewVersionFoundFailed?.Invoke(null, EventArgs.Empty);
}
}
public static (string fileName, string sha256) GetLatestUpdateFileNameAndHash(string? keyword = null)
{
var matches = Regex.Matches(LatestRelease.body, @"^\| (?<filename>.*) \| (?<sha256>.*) \|\r?$", RegexOptions.Multiline).Skip(2);
/*
Skip(2)
| 文件名 | SHA256 |
| :- | :- |
*/
Match match = keyword == null ? matches.First() : matches.First(m => m.Groups["filename"].Value.Contains(keyword));
return (match.Groups["filename"].Value, match.Groups["sha256"].Value);
}
public static string GetLatestReleaseContent()
{
var sb = new StringBuilder();
foreach (string l in LatestRelease.body.GetLines(false).SkipWhile(l => l.FirstOrDefault() != '#'))
{
if (l.Contains("校验和"))
break;
sb.AppendLine(l);
}
return sb.ToString();
}
private static Release GetLatestRelease(IEnumerable<Release> releases, bool isPreRelease)
{
if (!isPreRelease)
releases = releases.Where(release => !release.prerelease);
var ordered = releases.OrderByDescending(release => release.tag_name, new VersionUtil.VersionComparer());
return ordered.ElementAt(0);
}
}
================================================
FILE: Netch/Enums/LogLevel.cs
================================================
namespace Netch.Enums;
public enum LogLevel
{
INFO,
WARNING,
ERROR
}
================================================
FILE: Netch/Enums/State.cs
================================================
namespace Netch.Enums;
/// <summary>
/// 状态
/// </summary>
public enum State
{
/// <summary>
/// 等待命令中
/// </summary>
Waiting,
/// <summary>
/// 正在启动中
/// </summary>
Starting,
/// <summary>
/// 已启动
/// </summary>
Started,
/// <summary>
/// 正在停止中
/// </summary>
Stopping,
/// <summary>
/// 已停止
/// </summary>
Stopped,
/// <summary>
/// 退出中
/// </summary>
Terminating
}
public static class StateExtension
{
public static string GetStatusString(State state)
{
if (state == State.Waiting)
return "Waiting for command";
return state.ToString();
}
}
================================================
FILE: Netch/Flags.cs
================================================
namespace Netch;
public static class Flags
{
public static readonly bool IsWindows10Upper = Environment.OSVersion.Version.Major >= 10;
public static bool AlwaysShowNewVersionFound { get; set; }
public static bool NoSupport { get; set; }
}
================================================
FILE: Netch/FodyWeavers.xml
================================================
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<ConfigureAwait />
</Weavers>
================================================
FILE: Netch/Forms/AboutForm.Designer.cs
================================================
namespace Netch.Forms
{
partial class AboutForm
{
/// <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()
{
this.ChannelLabel = new System.Windows.Forms.LinkLabel();
this.NetchPictureBox = new System.Windows.Forms.PictureBox();
((System.ComponentModel.ISupportInitialize)(this.NetchPictureBox)).BeginInit();
this.SuspendLayout();
//
// ChannelLabel
//
this.ChannelLabel.AutoSize = true;
this.ChannelLabel.Location = new System.Drawing.Point(116, 215);
this.ChannelLabel.Name = "ChannelLabel";
this.ChannelLabel.Size = new System.Drawing.Size(113, 17);
this.ChannelLabel.TabIndex = 5;
this.ChannelLabel.TabStop = true;
this.ChannelLabel.Text = "Telegram Channel";
this.ChannelLabel.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.ChannelLabel_LinkClicked);
//
// NetchPictureBox
//
this.NetchPictureBox.Cursor = System.Windows.Forms.Cursors.Hand;
this.NetchPictureBox.Image = global::Netch.Properties.Resources.Netch;
this.NetchPictureBox.Location = new System.Drawing.Point(72, 12);
this.NetchPictureBox.Name = "NetchPictureBox";
this.NetchPictureBox.Size = new System.Drawing.Size(200, 200);
this.NetchPictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.NetchPictureBox.TabIndex = 0;
this.NetchPictureBox.TabStop = false;
this.NetchPictureBox.Click += new System.EventHandler(this.NetchPictureBox_Click);
//
// AboutForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.ClientSize = new System.Drawing.Size(338, 244);
this.Controls.Add(this.ChannelLabel);
this.Controls.Add(this.NetchPictureBox);
this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.MaximizeBox = false;
this.Name = "AboutForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "About";
this.Load += new System.EventHandler(this.AboutForm_Load);
((System.ComponentModel.ISupportInitialize)(this.NetchPictureBox)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.PictureBox NetchPictureBox;
private System.Windows.Forms.LinkLabel ChannelLabel;
}
}
================================================
FILE: Netch/Forms/AboutForm.cs
================================================
using Netch.Properties;
using Netch.Utils;
namespace Netch.Forms;
[Fody.ConfigureAwait(true)]
public partial class AboutForm : Form
{
public AboutForm()
{
InitializeComponent();
Icon = Resources.icon;
}
private void AboutForm_Load(object sender, EventArgs e)
{
i18N.TranslateForm(this);
}
private void NetchPictureBox_Click(object sender, EventArgs e)
{
Utils.Utils.Open("https://github.com/NetchX/Netch");
}
private void ChannelLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
Utils.Utils.Open("https://t.me/Netch");
}
private void SponsorPictureBox_Click(object sender, EventArgs e)
{
Utils.Utils.Open("https://www.mansora.co");
}
}
================================================
FILE: Netch/Forms/AboutForm.resx
================================================
<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
================================================
FILE: Netch/Forms/BindingForm.cs
================================================
using Netch.Models;
namespace Netch.Forms;
[Fody.ConfigureAwait(true)]
public class BindingForm : Form
{
// validation actions
private readonly Dictionary<Control, Func<string, bool>> _checkActions = new();
private readonly Dictionary<Control, Action<Control>> _saveActions = new();
protected void BindTextBox(TextBoxBase control, Func<string, bool> check, Action<string> save, object value)
{
BindTextBox<string>(control, check, save, value);
}
protected virtual void BindTextBox<T>(TextBoxBase control, Func<T, bool> check, Action<T> save, object value)
{
control.Text = value.ToString();
_checkActions.Add(control,
s =>
{
try
{
return check((T)Convert.ChangeType(s, typeof(T)));
}
catch
{
return false;
}
});
_saveActions.Add(control, c => save((T)Convert.ChangeType(((TextBoxBase)c).Text, typeof(T))));
}
protected void BindCheckBox(CheckBox control, Action<bool> save, bool value)
{
control.Checked = value;
_saveActions.Add(control, c => save(((CheckBox)c).Checked));
}
protected void BindSyncGlobalCheckBox(SyncGlobalCheckBox control, Action<bool?> save, bool? value, bool globalValue)
{
control.Value = value;
control.GlobalValue = globalValue;
_saveActions.Add(control, c => save(((SyncGlobalCheckBox)c).Value));
}
protected void BindRadioBox(RadioButton control, Action<bool> save, bool value)
{
control.Checked = value;
_saveActions.Add(control, c => save(((RadioButton)c).Checked));
}
protected void BindListComboBox<T>(ComboBox comboBox, Action<T> save, IEnumerable<T> values, T value) where T : notnull
{
if (comboBox.DropDownStyle != ComboBoxStyle.DropDownList)
throw new ArgumentOutOfRangeException();
var tagItems = values.Select(o => new TagItem<T>(o, o.ToString()!)).ToArray();
comboBox.Items.AddRange(tagItems.Cast<object>().ToArray());
comboBox.ValueMember = nameof(TagItem<T>.Value);
comboBox.DisplayMember = nameof(TagItem<T>.Text);
_saveActions.Add(comboBox, c => save(((TagItem<T>)((ComboBox)c).SelectedItem).Value));
Load += (_, _) => { comboBox.SelectedItem = tagItems.SingleOrDefault(t => t.Value.Equals(value)); };
}
protected void BindComboBox(ComboBox control, Func<string, bool> check, Action<string> save, string value, object[]? values = null)
{
if (values != null)
control.Items.AddRange(values);
_checkActions.Add(control, check);
_saveActions.Add(control, c => save(((ComboBox)c).Text));
Load += (_, _) => { control.Text = value; };
}
protected List<Control> GetInvalidateValueControls()
{
return _checkActions.Keys.Where(c => !Validate(c)).ToList();
}
protected bool Validate(Control c)
{
if (!_checkActions.ContainsKey(c))
throw new ArgumentException();
return _checkActions[c](c.Text);
}
protected void SaveBinds()
{
foreach (var pair in _saveActions)
pair.Value(pair.Key);
}
}
================================================
FILE: Netch/Forms/GlobalBypassIPForm.Designer.cs
================================================
namespace Netch.Forms
{
partial class GlobalBypassIPForm
{
/// <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(GlobalBypassIPForm));
this.IPGroupBox = new System.Windows.Forms.GroupBox();
this.AddButton = new System.Windows.Forms.Button();
this.DeleteButton = new System.Windows.Forms.Button();
this.PrefixComboBox = new System.Windows.Forms.ComboBox();
this.IPTextBox = new System.Windows.Forms.TextBox();
this.IPListBox = new System.Windows.Forms.ListBox();
this.ControlButton = new System.Windows.Forms.Button();
this.IPGroupBox.SuspendLayout();
this.SuspendLayout();
//
// IPGroupBox
//
this.IPGroupBox.Controls.Add(this.AddButton);
this.IPGroupBox.Controls.Add(this.DeleteButton);
this.IPGroupBox.Controls.Add(this.PrefixComboBox);
this.IPGroupBox.Controls.Add(this.IPTextBox);
this.IPGroupBox.Controls.Add(this.IPListBox);
this.IPGroupBox.Location = new System.Drawing.Point(12, 12);
this.IPGroupBox.Name = "IPGroupBox";
this.IPGroupBox.Size = new System.Drawing.Size(316, 295);
this.IPGroupBox.TabIndex = 0;
this.IPGroupBox.TabStop = false;
this.IPGroupBox.Text = "IPs";
//
// AddButton
//
this.AddButton.Location = new System.Drawing.Point(198, 266);
this.AddButton.Name = "AddButton";
this.AddButton.Size = new System.Drawing.Size(53, 23);
this.AddButton.TabIndex = 4;
this.AddButton.Text = "Add";
this.AddButton.UseVisualStyleBackColor = true;
this.AddButton.Click += new System.EventHandler(this.AddButton_Click);
//
// DeleteButton
//
this.DeleteButton.Location = new System.Drawing.Point(257, 266);
this.DeleteButton.Name = "DeleteButton";
this.DeleteButton.Size = new System.Drawing.Size(53, 23);
this.DeleteButton.TabIndex = 3;
this.DeleteButton.Text = "Delete";
this.DeleteButton.UseVisualStyleBackColor = true;
this.DeleteButton.Click += new System.EventHandler(this.DeleteButton_Click);
//
// PrefixComboBox
//
this.PrefixComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.PrefixComboBox.FormattingEnabled = true;
this.PrefixComboBox.IntegralHeight = false;
this.PrefixComboBox.Location = new System.Drawing.Point(271, 235);
this.PrefixComboBox.MaxDropDownItems = 4;
this.PrefixComboBox.Name = "PrefixComboBox";
this.PrefixComboBox.Size = new System.Drawing.Size(39, 25);
this.PrefixComboBox.TabIndex = 2;
//
// IPTextBox
//
this.IPTextBox.Location = new System.Drawing.Point(6, 236);
this.IPTextBox.Name = "IPTextBox";
this.IPTextBox.Size = new System.Drawing.Size(259, 23);
this.IPTextBox.TabIndex = 1;
//
// IPListBox
//
this.IPListBox.FormattingEnabled = true;
this.IPListBox.ItemHeight = 17;
this.IPListBox.Location = new System.Drawing.Point(6, 22);
this.IPListBox.Name = "IPListBox";
this.IPListBox.Size = new System.Drawing.Size(304, 208);
this.IPListBox.TabIndex = 0;
//
// ControlButton
//
this.ControlButton.Location = new System.Drawing.Point(253, 313);
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);
//
// GlobalBypassIPForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.ClientSize = new System.Drawing.Size(340, 348);
this.Controls.Add(this.ControlButton);
this.Controls.Add(this.IPGroupBox);
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.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.MaximizeBox = false;
this.Name = "GlobalBypassIPForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Global Bypass IPs";
this.Load += new System.EventHandler(this.GlobalBypassIPForm_Load);
this.IPGroupBox.ResumeLayout(false);
this.IPGroupBox.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.GroupBox IPGroupBox;
private System.Windows.Forms.ListBox IPListBox;
private System.Windows.Forms.ComboBox PrefixComboBox;
private System.Windows.Forms.TextBox IPTextBox;
private System.Windows.Forms.Button DeleteButton;
private System.Windows.Forms.Button AddButton;
private System.Windows.Forms.Button ControlButton;
}
}
================================================
FILE: Netch/Forms/GlobalBypassIPForm.cs
================================================
using System.Net;
using Netch.Properties;
using Netch.Utils;
namespace Netch.Forms;
[Fody.ConfigureAwait(true)]
public partial class GlobalBypassIPForm : Form
{
public GlobalBypassIPForm()
{
InitializeComponent();
Icon = Resources.icon;
}
private void GlobalBypassIPForm_Load(object sender, EventArgs e)
{
i18N.TranslateForm(this);
IPListBox.Items.AddRange(Global.Settings.TUNTAP.BypassIPs.Cast<object>().ToArray());
for (var i = 32; i >= 1; i--)
PrefixComboBox.Items.Add(i);
PrefixComboBox.SelectedIndex = 0;
}
private void AddButton_Click(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(IPTextBox.Text))
{
if (IPAddress.TryParse(IPTextBox.Text, out var address))
IPListBox.Items.Add($"{address}/{PrefixComboBox.SelectedItem}");
else
MessageBoxX.Show(i18N.Translate("Please enter a correct IP address"));
}
else
{
MessageBoxX.Show(i18N.Translate("Please enter an IP"));
}
}
private void DeleteButton_Click(object sender, EventArgs e)
{
if (IPListBox.SelectedIndex != -1)
IPListBox.Items.RemoveAt(IPListBox.SelectedIndex);
else
MessageBoxX.Show(i18N.Translate("Please select an IP"));
}
private async void ControlButton_Click(object sender, EventArgs e)
{
Global.Settings.TUNTAP.BypassIPs.Clear();
foreach (var ip in IPListBox.Items)
Global.Settings.TUNTAP.BypassIPs.Add((string)ip);
await Configuration.SaveAsync();
MessageBoxX.Show(i18N.Translate("Saved"));
Close();
}
}
================================================
FILE: Netch/Forms/LogForm.Designer.cs
================================================
using System.ComponentModel;
namespace Netch.Forms
{
partial class LogForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private 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()
{
this.richTextBox1 = new System.Windows.Forms.RichTextBox();
this.checkBox1 = new System.Windows.Forms.CheckBox();
this.SuspendLayout();
//
// richTextBox1
//
this.richTextBox1.BackColor = System.Drawing.SystemColors.Control;
this.richTextBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.richTextBox1.Dock = System.Windows.Forms.DockStyle.Top;
this.richTextBox1.Font = new System.Drawing.Font("Courier New", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.richTextBox1.Location = new System.Drawing.Point(0, 0);
this.richTextBox1.Name = "richTextBox1";
this.richTextBox1.ReadOnly = true;
this.richTextBox1.Size = new System.Drawing.Size(454, 288);
this.richTextBox1.TabIndex = 0;
this.richTextBox1.Text = "";
this.richTextBox1.TextChanged += new System.EventHandler(this.richTextBox1_TextChanged);
//
// checkBox1
//
this.checkBox1.AutoSize = true;
this.checkBox1.Location = new System.Drawing.Point(12, 297);
this.checkBox1.Name = "checkBox1";
this.checkBox1.Size = new System.Drawing.Size(101, 21);
this.checkBox1.TabIndex = 1;
this.checkBox1.Text = "Scroll to End";
this.checkBox1.UseVisualStyleBackColor = true;
//
// LogForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(454, 318);
this.ControlBox = false;
this.Controls.Add(this.checkBox1);
this.Controls.Add(this.richTextBox1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "LogForm";
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.Text = "LogForm";
this.Load += new System.EventHandler(this.LogForm_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.CheckBox checkBox1;
public System.Windows.Forms.RichTextBox richTextBox1;
}
}
================================================
FILE: Netch/Forms/LogForm.cs
================================================
using System.ComponentModel;
using Windows.Win32.Foundation;
using Windows.Win32.UI.WindowsAndMessaging;
using static Windows.Win32.PInvoke;
namespace Netch.Forms;
[Fody.ConfigureAwait(true)]
public partial class LogForm : Form
{
private readonly Form _parent;
public LogForm(Form parent)
{
InitializeComponent();
_parent = parent;
}
protected override void OnLoad(EventArgs? e)
{
base.OnLoad(e);
Parent_Move(null!, null!);
}
private void Parent_Move(object? sender, EventArgs? e)
{
var cl = Location;
var fl = _parent.Location;
cl.X = fl.X + _parent.Width;
cl.Y = fl.Y;
Location = cl;
}
private void Parent_Activated(object? sender, EventArgs? e)
{
SetWindowPos(new HWND(Handle),
new HWND(-1),
0,
0,
0,
0,
SET_WINDOW_POS_FLAGS.SWP_NOACTIVATE | SET_WINDOW_POS_FLAGS.SWP_NOMOVE | SET_WINDOW_POS_FLAGS.SWP_NOSIZE | SET_WINDOW_POS_FLAGS.SWP_SHOWWINDOW);
SetWindowPos(new HWND(Handle),
new HWND(-2),
0,
0,
0,
0,
SET_WINDOW_POS_FLAGS.SWP_NOACTIVATE | SET_WINDOW_POS_FLAGS.SWP_NOMOVE | SET_WINDOW_POS_FLAGS.SWP_NOSIZE | SET_WINDOW_POS_FLAGS.SWP_SHOWWINDOW);
}
private void richTextBox1_TextChanged(object? sender, EventArgs? e)
{
if (!checkBox1.Checked)
return;
richTextBox1.SelectionStart = richTextBox1.Text.Length;
richTextBox1.ScrollToCaret();
}
private void LogForm_Load(object? sender, EventArgs? e)
{
_parent.LocationChanged += Parent_Move;
_parent.SizeChanged += Parent_Move;
_parent.Activated += Parent_Activated;
_parent.VisibleChanged += Parent_VisibleChanged;
}
private void Parent_VisibleChanged(object? sender, EventArgs e)
{
Visible = _parent.Visible;
}
protected override void OnClosing(CancelEventArgs? e)
{
_parent.LocationChanged -= Parent_Move;
_parent.SizeChanged -= Parent_Move;
_parent.Activated -= Parent_Activated;
_parent.VisibleChanged -= Parent_VisibleChanged;
base.OnClosing(e!);
}
}
================================================
FILE: Netch/Forms/LogForm.resx
================================================
<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
================================================
FILE: Netch/Forms/MainForm.Designer.cs
================================================
namespace Netch.Forms
{
partial class MainForm
{
/// <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()
{
this.components = new System.ComponentModel.Container();
this.MenuStrip = new System.Windows.Forms.MenuStrip();
this.ServerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.ImportServersFromClipboardToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.ModeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.CreateProcessModeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.CreateRouteTableRuleToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.ReloadModesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.SubscriptionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.ManageSubscriptionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.UpdateServersToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.OptionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.OpenDirectoryToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.ShowHideConsoleToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.CleanDNSCacheToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.UninstallServiceToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.RemoveNetchFirewallRulesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.HelpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.CheckForUpdateToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.FAQToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.ForceExitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.AboutToolStripButton = new System.Windows.Forms.ToolStripButton();
this.NewVersionLabel = new System.Windows.Forms.ToolStripLabel();
this.VersionLabel = new System.Windows.Forms.ToolStripLabel();
this.ConfigurationGroupBox = new System.Windows.Forms.GroupBox();
this.configLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
this.ProfileLabel = new System.Windows.Forms.Label();
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.ComboBox();
this.ServerComboBox = new System.Windows.Forms.ComboBox();
this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
this.EditServerPictureBox = new System.Windows.Forms.PictureBox();
this.CopyLinkPictureBox = new System.Windows.Forms.PictureBox();
this.DeleteServerPictureBox = 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.blankToolStripStatusLabel = new System.Windows.Forms.ToolStripStatusLabel();
this.HttpStatusLabel = new System.Windows.Forms.ToolStripStatusLabel();
this.NatTypeStatusLabel = new System.Windows.Forms.ToolStripStatusLabel();
this.NatTypeStatusLightLabel = 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);
this.ShowMainFormToolStripButton = new System.Windows.Forms.ToolStripMenuItem();
this.ExitToolStripButton = new System.Windows.Forms.ToolStripMenuItem();
this.SettingsButton = new System.Windows.Forms.Button();
this.ProfileGroupBox = new System.Windows.Forms.GroupBox();
this.ProfileTable = new System.Windows.Forms.TableLayoutPanel();
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
this.ButtomControlContainerControl = new System.Windows.Forms.ContainerControl();
this.MenuStrip.SuspendLayout();
this.ConfigurationGroupBox.SuspendLayout();
this.configLayoutPanel.SuspendLayout();
this.tableLayoutPanel2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.EditServerPictureBox)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.CopyLinkPictureBox)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.DeleteServerPictureBox)).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();
this.flowLayoutPanel1.SuspendLayout();
this.ButtomControlContainerControl.SuspendLayout();
this.SuspendLayout();
//
// MenuStrip
//
this.MenuStrip.BackColor = System.Drawing.SystemColors.Control;
this.MenuStrip.ImageScalingSize = new System.Drawing.Size(20, 20);
this.MenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.ServerToolStripMenuItem,
this.ModeToolStripMenuItem,
this.SubscriptionToolStripMenuItem,
this.OptionsToolStripMenuItem,
this.HelpToolStripMenuItem,
this.ForceExitToolStripMenuItem,
this.AboutToolStripButton,
this.NewVersionLabel,
this.VersionLabel});
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(740, 26);
this.MenuStrip.TabIndex = 0;
//
// ServerToolStripMenuItem
//
this.ServerToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.ImportServersFromClipboardToolStripMenuItem});
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);
this.ServerToolStripMenuItem.Text = "Server";
//
// ImportServersFromClipboardToolStripMenuItem
//
this.ImportServersFromClipboardToolStripMenuItem.Name = "ImportServersFromClipboardToolStripMenuItem";
this.ImportServersFromClipboardToolStripMenuItem.Size = new System.Drawing.Size(259, 22);
this.ImportServersFromClipboardToolStripMenuItem.Text = "Import Servers From Clipboard";
this.ImportServersFromClipboardToolStripMenuItem.Click += new System.EventHandler(this.ImportServersFromClipboardToolStripMenuItem_Click);
//
// ModeToolStripMenuItem
//
this.ModeToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.CreateProcessModeToolStripMenuItem,
this.CreateRouteTableRuleToolStripMenuItem,
this.ReloadModesToolStripMenuItem});
this.ModeToolStripMenuItem.Margin = new System.Windows.Forms.Padding(0, 0, 0, 1);
this.ModeToolStripMenuItem.Name = "ModeToolStripMenuItem";
this.ModeToolStripMenuItem.Size = new System.Drawing.Size(55, 21);
this.ModeToolStripMenuItem.Text = "Mode";
//
// CreateProcessModeToolStripMenuItem
//
this.CreateProcessModeToolStripMenuItem.Name = "CreateProcessModeToolStripMenuItem";
this.CreateProcessModeToolStripMenuItem.Size = new System.Drawing.Size(217, 22);
this.CreateProcessModeToolStripMenuItem.Text = "Create Process Mode";
this.CreateProcessModeToolStripMenuItem.Click += new System.EventHandler(this.CreateProcessModeToolStripButton_Click);
//
// CreateRouteTableRuleToolStripMenuItem
//
this.CreateRouteTableRuleToolStripMenuItem.Name = "CreateRouteTableRuleToolStripMenuItem";
this.CreateRouteTableRuleToolStripMenuItem.Size = new System.Drawing.Size(217, 22);
this.CreateRouteTableRuleToolStripMenuItem.Text = "Create Route Table Rule";
this.CreateRouteTableRuleToolStripMenuItem.Click += new System.EventHandler(this.createRouteTableModeToolStripMenuItem_Click);
//
// ReloadModesToolStripMenuItem
//
this.ReloadModesToolStripMenuItem.Name = "ReloadModesToolStripMenuItem";
this.ReloadModesToolStripMenuItem.Size = new System.Drawing.Size(217, 22);
this.ReloadModesToolStripMenuItem.Text = "Reload Modes";
this.ReloadModesToolStripMenuItem.Click += new System.EventHandler(this.ReloadModesToolStripMenuItem_Click);
//
// SubscriptionToolStripMenuItem
//
this.SubscriptionToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.ManageSubscriptionsToolStripMenuItem,
this.UpdateServersToolStripMenuItem});
this.SubscriptionToolStripMenuItem.Margin = new System.Windows.Forms.Padding(0, 0, 0, 1);
this.SubscriptionToolStripMenuItem.Name = "SubscriptionToolStripMenuItem";
this.SubscriptionToolStripMenuItem.Size = new System.Drawing.Size(92, 21);
this.SubscriptionToolStripMenuItem.Text = "Subscription";
//
// ManageSubscriptionsToolStripMenuItem
//
this.ManageSubscriptionsToolStripMenuItem.Name = "ManageSubscriptionsToolStripMenuItem";
this.ManageSubscriptionsToolStripMenuItem.Size = new System.Drawing.Size(206, 22);
this.ManageSubscriptionsToolStripMenuItem.Text = "Manage Subscriptions";
this.ManageSubscriptionsToolStripMenuItem.Click += new System.EventHandler(this.ManageSubscriptionLinksToolStripMenuItem_Click);
//
// UpdateServersToolStripMenuItem
//
this.UpdateServersToolStripMenuItem.Name = "UpdateServersToolStripMenuItem";
this.UpdateServersToolStripMenuItem.Size = new System.Drawing.Size(206, 22);
this.UpdateServersToolStripMenuItem.Text = "Update Servers";
this.UpdateServersToolStripMenuItem.Click += new System.EventHandler(this.UpdateServersFromSubscriptionLinksToolStripMenuItem_Click);
//
// OptionsToolStripMenuItem
//
this.OptionsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.OpenDirectoryToolStripMenuItem,
this.ShowHideConsoleToolStripMenuItem,
this.CleanDNSCacheToolStripMenuItem,
this.UninstallServiceToolStripMenuItem,
this.RemoveNetchFirewallRulesToolStripMenuItem});
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);
this.OptionsToolStripMenuItem.Text = "Options";
//
// OpenDirectoryToolStripMenuItem
//
this.OpenDirectoryToolStripMenuItem.Name = "OpenDirectoryToolStripMenuItem";
this.OpenDirectoryToolStripMenuItem.Size = new System.Drawing.Size(243, 22);
this.OpenDirectoryToolStripMenuItem.Text = "Open Directory";
this.OpenDirectoryToolStripMenuItem.Click += new System.EventHandler(this.OpenDirectoryToolStripMenuItem_Click);
//
// ShowHideConsoleToolStripMenuItem
//
this.ShowHideConsoleToolStripMenuItem.Name = "ShowHideConsoleToolStripMenuItem";
this.ShowHideConsoleToolStripMenuItem.Size = new System.Drawing.Size(243, 22);
this.ShowHideConsoleToolStripMenuItem.Text = "Show/Hide Console";
this.ShowHideConsoleToolStripMenuItem.Click += new System.EventHandler(this.ShowHideConsoleToolStripMenuItem_Click);
//
// CleanDNSCacheToolStripMenuItem
//
this.CleanDNSCacheToolStripMenuItem.Name = "CleanDNSCacheToolStripMenuItem";
this.CleanDNSCacheToolStripMenuItem.Size = new System.Drawing.Size(243, 22);
this.CleanDNSCacheToolStripMenuItem.Text = "Clean DNS Cache";
this.CleanDNSCacheToolStripMenuItem.Click += new System.EventHandler(this.CleanDNSCacheToolStripMenuItem_Click);
//
// UninstallServiceToolStripMenuItem
//
this.UninstallServiceToolStripMenuItem.Name = "UninstallServiceToolStripMenuItem";
this.UninstallServiceToolStripMenuItem.Size = new System.Drawing.Size(243, 22);
this.UninstallServiceToolStripMenuItem.Text = "Uninstall NF Service";
this.UninstallServiceToolStripMenuItem.Click += new System.EventHandler(this.UninstallServiceToolStripMenuItem_Click);
//
// RemoveNetchFirewallRulesToolStripMenuItem
//
this.RemoveNetchFirewallRulesToolStripMenuItem.Name = "RemoveNetchFirewallRulesToolStripMenuItem";
this.RemoveNetchFirewallRulesToolStripMenuItem.Size = new System.Drawing.Size(243, 22);
this.RemoveNetchFirewallRulesToolStripMenuItem.Text = "Remove Netch Firewall Rules";
this.RemoveNetchFirewallRulesToolStripMenuItem.Click += new System.EventHandler(this.RemoveNetchFirewallRulesToolStripMenuItem_Click);
//
// HelpToolStripMenuItem
//
this.HelpToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.CheckForUpdateToolStripMenuItem,
this.FAQToolStripMenuItem});
this.HelpToolStripMenuItem.Margin = new System.Windows.Forms.Padding(0, 0, 0, 1);
this.HelpToolStripMenuItem.Name = "HelpToolStripMenuItem";
this.HelpToolStripMenuItem.Size = new System.Drawing.Size(47, 21);
this.HelpToolStripMenuItem.Text = "Help";
//
// CheckForUpdateToolStripMenuItem
//
this.CheckForUpdateToolStripMenuItem.Name = "CheckForUpdateToolStripMenuItem";
this.CheckForUpdateToolStripMenuItem.Size = new System.Drawing.Size(177, 22);
this.CheckForUpdateToolStripMenuItem.Text = "Check for update";
this.CheckForUpdateToolStripMenuItem.Click += new System.EventHandler(this.CheckForUpdatesToolStripMenuItem_Click);
//
// FAQToolStripMenuItem
//
this.FAQToolStripMenuItem.Name = "FAQToolStripMenuItem";
this.FAQToolStripMenuItem.Size = new System.Drawing.Size(177, 22);
this.FAQToolStripMenuItem.Text = "FAQ";
this.FAQToolStripMenuItem.Click += new System.EventHandler(this.fAQToolStripMenuItem_Click);
//
// ForceExitToolStripMenuItem
//
this.ForceExitToolStripMenuItem.Name = "ForceExitToolStripMenuItem";
this.ForceExitToolStripMenuItem.Size = new System.Drawing.Size(40, 22);
this.ForceExitToolStripMenuItem.Text = "Exit";
this.ForceExitToolStripMenuItem.Click += new System.EventHandler(this.ForceExitToolStripMenuItem_Click);
//
// AboutToolStripButton
//
this.AboutToolStripButton.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right;
this.AboutToolStripButton.AutoToolTip = false;
this.AboutToolStripButton.Margin = new System.Windows.Forms.Padding(0, 0, 3, 1);
this.AboutToolStripButton.Name = "AboutToolStripButton";
this.AboutToolStripButton.Size = new System.Drawing.Size(47, 21);
this.AboutToolStripButton.Text = "About";
this.AboutToolStripButton.Click += new System.EventHandler(this.AboutToolStripButton_Click);
//
// NewVersionLabel
//
this.NewVersionLabel.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right;
this.NewVersionLabel.BackColor = System.Drawing.Color.Transparent;
this.NewVersionLabel.ForeColor = System.Drawing.Color.Red;
this.NewVersionLabel.IsLink = true;
this.NewVersionLabel.LinkBehavior = System.Windows.Forms.LinkBehavior.NeverUnderline;
this.NewVersionLabel.LinkColor = System.Drawing.Color.Red;
this.NewVersionLabel.Name = "NewVersionLabel";
this.NewVersionLabel.Size = new System.Drawing.Size(135, 19);
this.NewVersionLabel.Text = "New version available";
this.NewVersionLabel.Visible = false;
this.NewVersionLabel.Click += new System.EventHandler(this.NewVersionLabel_Click);
//
// VersionLabel
//
this.VersionLabel.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right;
this.VersionLabel.BackColor = System.Drawing.Color.Transparent;
this.VersionLabel.ForeColor = System.Drawing.Color.Red;
this.VersionLabel.IsLink = true;
this.VersionLabel.LinkBehavior = System.Windows.Forms.LinkBehavior.NeverUnderline;
this.VersionLabel.Name = "VersionLabel";
this.VersionLabel.Size = new System.Drawing.Size(26, 19);
this.VersionLabel.Text = "xxx";
this.VersionLabel.Click += new System.EventHandler(this.VersionLabel_Click);
//
// ConfigurationGroupBox
//
this.ConfigurationGroupBox.Controls.Add(this.configLayoutPanel);
this.ConfigurationGroupBox.Location = new System.Drawing.Point(3, 3);
this.ConfigurationGroupBox.Name = "ConfigurationGroupBox";
this.ConfigurationGroupBox.Size = new System.Drawing.Size(709, 115);
this.ConfigurationGroupBox.TabIndex = 1;
this.ConfigurationGroupBox.TabStop = false;
this.ConfigurationGroupBox.Text = "Configuration";
//
// configLayoutPanel
//
this.configLayoutPanel.AutoSize = true;
this.configLayoutPanel.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.configLayoutPanel.ColumnCount = 3;
this.configLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.configLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
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());
this.configLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.configLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle());
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, 68);
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, 36);
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, 6);
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, 63);
this.ProfileNameText.Name = "ProfileNameText";
this.ProfileNameText.Size = new System.Drawing.Size(546, 23);
this.ProfileNameText.TabIndex = 11;
//
// ModeComboBox
//
this.ModeComboBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.ModeComboBox.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
this.ModeComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.ModeComboBox.FormattingEnabled = true;
this.ModeComboBox.IntegralHeight = false;
this.ModeComboBox.Location = new System.Drawing.Point(54, 33);
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);
this.ModeComboBox.SelectionChangeCommitted += new System.EventHandler(this.ModeComboBox_SelectionChangeCommitted);
//
// 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);
this.ServerComboBox.SelectionChangeCommitted += new System.EventHandler(this.ServerComboBox_SelectionChangeCommitted);
//
// 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.EditServerPictureBox, 0, 0);
this.tableLayoutPanel2.Controls.Add(this.CopyLinkPictureBox, 3, 0);
this.tableLayoutPanel2.Controls.Add(this.DeleteServerPictureBox, 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;
//
// EditServerPictureBox
//
this.EditServerPictureBox.BackColor = System.Drawing.SystemColors.Control;
this.EditServerPictureBox.Cursor = System.Windows.Forms.Cursors.Hand;
this.EditServerPictureBox.Image = global::Netch.Properties.Resources.edit;
this.EditServerPictureBox.Location = new System.Drawing.Point(3, 3);
this.EditServerPictureBox.Name = "EditServerPictureBox";
this.EditServerPictureBox.Size = new System.Drawing.Size(16, 16);
this.EditServerPictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.EditServerPictureBox.TabIndex = 7;
this.EditServerPictureBox.TabStop = false;
this.EditServerPictureBox.Click += new System.EventHandler(this.EditServerPictureBox_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(72, 3);
this.CopyLinkPictureBox.Name = "CopyLinkPictureBox";
this.CopyLinkPictureBox.Size = new System.Drawing.Size(18, 18);
this.CopyLinkPictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.CopyLinkPictureBox.TabIndex = 14;
this.CopyLinkPictureBox.TabStop = false;
this.CopyLinkPictureBox.Click += new System.EventHandler(this.CopyLinkPictureBox_Click);
//
// DeleteServerPictureBox
//
this.DeleteServerPictureBox.Cursor = System.Windows.Forms.Cursors.Hand;
this.DeleteServerPictureBox.Image = global::Netch.Properties.Resources.delete;
this.DeleteServerPictureBox.Location = new System.Drawing.Point(26, 3);
this.DeleteServerPictureBox.Name = "DeleteServerPictureBox";
this.DeleteServerPictureBox.Size = new System.Drawing.Size(16, 16);
this.DeleteServerPictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.DeleteServerPictureBox.TabIndex = 8;
this.DeleteServerPictureBox.TabStop = false;
this.DeleteServerPictureBox.Click += new System.EventHandler(this.DeleteServerPictureBox_Click);
//
// SpeedPictureBox
//
this.SpeedPictureBox.Cursor = System.Windows.Forms.Cursors.Hand;
this.SpeedPictureBox.Image = global::Netch.Properties.Resources.speed;
this.SpeedPictureBox.Location = new System.Drawing.Point(49, 3);
this.SpeedPictureBox.Name = "SpeedPictureBox";
this.SpeedPictureBox.Size = new System.Drawing.Size(16, 16);
this.SpeedPictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
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, 33);
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
//
this.EditModePictureBox.Cursor = System.Windows.Forms.Cursors.Hand;
this.EditModePictureBox.Image = global::Netch.Properties.Resources.edit;
this.EditModePictureBox.Location = new System.Drawing.Point(3, 3);
this.EditModePictureBox.Name = "EditModePictureBox";
this.EditModePictureBox.Size = new System.Drawing.Size(16, 16);
this.EditModePictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.EditModePictureBox.TabIndex = 12;
this.EditModePictureBox.TabStop = false;
this.EditModePictureBox.Click += new System.EventHandler(this.EditModePictureBox_Click);
//
// DeleteModePictureBox
//
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.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.DeleteModePictureBox.TabIndex = 13;
this.DeleteModePictureBox.TabStop = false;
this.DeleteModePictureBox.Click += new System.EventHandler(this.DeleteModePictureBox_Click);
//
// StatusStrip
//
this.StatusStrip.ImageScalingSize = new System.Drawing.Size(20, 20);
this.StatusStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.StatusLabel,
this.UsedBandwidthLabel,
this.DownloadSpeedLabel,
this.UploadSpeedLabel,
this.blankToolStripStatusLabel,
this.HttpStatusLabel,
this.NatTypeStatusLabel,
this.NatTypeStatusLightLabel});
this.StatusStrip.Location = new System.Drawing.Point(0, 272);
this.StatusStrip.Name = "StatusStrip";
this.StatusStrip.Size = new System.Drawing.Size(740, 22);
this.StatusStrip.SizingGrip = false;
this.StatusStrip.TabIndex = 2;
//
// StatusLabel
//
this.StatusLabel.BackColor = System.Drawing.Color.Transparent;
this.StatusLabel.Name = "StatusLabel";
this.StatusLabel.Size = new System.Drawing.Size(177, 17);
this.StatusLabel.Text = "Status: Waiting for command";
//
// UsedBandwidthLabel
//
this.UsedBandwidthLabel.Name = "UsedBandwidthLabel";
this.UsedBandwidthLabel.Size = new System.Drawing.Size(72, 17);
this.UsedBandwidthLabel.Text = "Used: 0 KB";
this.UsedBandwidthLabel.Visible = false;
//
// DownloadSpeedLabel
//
this.DownloadSpeedLabel.Name = "DownloadSpeedLabel";
this.DownloadSpeedLabel.Size = new System.Drawing.Size(59, 17);
this.DownloadSpeedLabel.Text = "↓: 0 KB/s";
this.DownloadSpeedLabel.Visible = false;
//
// UploadSpeedLabel
//
this.UploadSpeedLabel.Name = "UploadSpeedLabel";
this.UploadSpeedLabel.Size = new System.Drawing.Size(59, 17);
this.UploadSpeedLabel.Text = "↑: 0 KB/s";
this.UploadSpeedLabel.Visible = false;
//
// blankToolStripStatusLabel
//
this.blankToolStripStatusLabel.Name = "blankToolStripStatusLabel";
this.blankToolStripStatusLabel.Size = new System.Drawing.Size(494, 17);
this.blankToolStripStatusLabel.Spring = true;
//
// HttpStatusLabel
//
this.HttpStatusLabel.Name = "HttpStatusLabel";
this.HttpStatusLabel.Size = new System.Drawing.Size(41, 17);
this.HttpStatusLabel.Text = "HTTP:";
this.HttpStatusLabel.TextAlign = System.Drawing.ContentAlignment.BottomLeft;
this.HttpStatusLabel.Visible = false;
this.HttpStatusLabel.Click += new System.EventHandler(this.TcpStatusLabel_Click);
//
// NatTypeStatusLabel
//
this.NatTypeStatusLabel.Name = "NatTypeStatusLabel";
this.NatTypeStatusLabel.Size = new System.Drawing.Size(36, 17);
this.NatTypeStatusLabel.Text = "NAT:";
this.NatTypeStatusLabel.TextAlign = System.Drawing.ContentAlignment.BottomLeft;
this.NatTypeStatusLabel.Click += new System.EventHandler(this.NatTypeStatusLabel_Click);
//
// NatTypeStatusLightLabel
//
this.NatTypeStatusLightLabel.ActiveLinkColor = System.Drawing.Color.Red;
this.NatTypeStatusLightLabel.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
this.NatTypeStatusLightLabel.ForeColor = System.Drawing.Color.Red;
this.NatTypeStatusLightLabel.Margin = new System.Windows.Forms.Padding(0, 0, 0, 1);
this.NatTypeStatusLightLabel.Name = "NatTypeStatusLightLabel";
this.NatTypeStatusLightLabel.Size = new System.Drawing.Size(18, 21);
this.NatTypeStatusLightLabel.Text = "⬤";
this.NatTypeStatusLightLabel.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
this.NatTypeStatusLightLabel.Click += new System.EventHandler(this.NatTypeStatusLabel_Click);
//
// ControlButton
//
this.ControlButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.ControlButton.Location = new System.Drawing.Point(631, 3);
this.ControlButton.Name = "ControlButton";
this.ControlButton.Size = new System.Drawing.Size(75, 27);
this.ControlButton.TabIndex = 3;
this.ControlButton.Text = "Start";
this.ControlButton.UseVisualStyleBackColor = true;
this.ControlButton.Click += new System.EventHandler(this.ControlButton_Click);
//
// NotifyIcon
//
this.NotifyIcon.ContextMenuStrip = this.NotifyMenu;
this.NotifyIcon.Text = "Netch";
this.NotifyIcon.Visible = true;
this.NotifyIcon.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.NotifyIcon_MouseDoubleClick);
//
// NotifyMenu
//
this.NotifyMenu.ImageScalingSize = new System.Drawing.Size(20, 20);
this.NotifyMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.ShowMainFormToolStripButton,
this.ExitToolStripButton});
this.NotifyMenu.Name = "NotifyMenu";
this.NotifyMenu.ShowItemToolTips = false;
this.NotifyMenu.Size = new System.Drawing.Size(108, 48);
//
// ShowMainFormToolStripButton
//
this.ShowMainFormToolStripButton.Name = "ShowMainFormToolStripButton";
this.ShowMainFormToolStripButton.Size = new System.Drawing.Size(107, 22);
this.ShowMainFormToolStripButton.Text = "Show";
this.ShowMainFormToolStripButton.Click += new System.EventHandler(this.ShowMainFormToolStripButton_Click);
//
// ExitToolStripButton
//
this.ExitToolStripButton.Name = "ExitToolStripButton";
this.ExitToolStripButton.Size = new System.Drawing.Size(107, 22);
this.ExitToolStripButton.Text = "Exit";
this.ExitToolStripButton.Click += new System.EventHandler(this.ExitToolStripButton_Click);
//
// SettingsButton
//
this.SettingsButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.SettingsButton.Location = new System.Drawing.Point(1, 3);
this.SettingsButton.Name = "SettingsButton";
this.SettingsButton.Size = new System.Drawing.Size(72, 27);
this.SettingsButton.TabIndex = 4;
this.SettingsButton.Text = "Settings";
this.SettingsButton.UseVisualStyleBackColor = true;
this.SettingsButton.Click += new System.EventHandler(this.SettingsButton_Click);
//
// ProfileGroupBox
//
this.ProfileGroupBox.Controls.Add(this.ProfileTable);
this.ProfileGroupBox.Location = new System.Drawing.Point(3, 124);
this.ProfileGroupBox.Name = "ProfileGroupBox";
this.ProfileGroupBox.Size = new System.Drawing.Size(709, 65);
this.ProfileGroupBox.TabIndex = 13;
this.ProfileGroupBox.TabStop = false;
this.ProfileGroupBox.Text = "Profiles";
//
// ProfileTable
//
this.ProfileTable.AutoSize = true;
this.ProfileTable.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.ProfileTable.ColumnCount = 2;
this.ProfileTable.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.ProfileTable.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.ProfileTable.Dock = System.Windows.Forms.DockStyle.Fill;
this.ProfileTable.Location = new System.Drawing.Point(3, 19);
this.ProfileTable.Name = "ProfileTable";
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(703, 43);
this.ProfileTable.TabIndex = 0;
//
// flowLayoutPanel1
//
this.flowLayoutPanel1.AutoSize = true;
this.flowLayoutPanel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.flowLayoutPanel1.Controls.Add(this.ConfigurationGroupBox);
this.flowLayoutPanel1.Controls.Add(this.ProfileGroupBox);
this.flowLayoutPanel1.Controls.Add(this.ButtomControlContainerControl);
this.flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
this.flowLayoutPanel1.Location = new System.Drawing.Point(12, 29);
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
this.flowLayoutPanel1.Size = new System.Drawing.Size(715, 256);
this.flowLayoutPanel1.TabIndex = 14;
//
// ButtomControlContainerControl
//
this.ButtomControlContainerControl.Controls.Add(this.ControlButton);
this.ButtomControlContainerControl.Controls.Add(this.SettingsButton);
this.ButtomControlContainerControl.Location = new System.Drawing.Point(3, 195);
this.ButtomControlContainerControl.Name = "ButtomControlContainerControl";
this.ButtomControlContainerControl.Size = new System.Drawing.Size(706, 58);
this.ButtomControlContainerControl.TabIndex = 14;
this.ButtomControlContainerControl.TabStop = false;
this.ButtomControlContainerControl.Text = "groupBox1";
//
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.AutoSize = true;
this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.ClientSize = new System.Drawing.Size(740, 294);
this.Controls.Add(this.MenuStrip);
this.Controls.Add(this.StatusStrip);
this.Controls.Add(this.flowLayoutPanel1);
this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.MaximizeBox = false;
this.Name = "MainForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Netch";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MainForm_FormClosing);
this.Load += new System.EventHandler(this.MainForm_Load);
this.MenuStrip.ResumeLayout(false);
this.MenuStrip.PerformLayout();
this.ConfigurationGroupBox.ResumeLayout(false);
this.ConfigurationGroupBox.PerformLayout();
this.configLayoutPanel.ResumeLayout(false);
this.configLayoutPanel.PerformLayout();
this.tableLayoutPanel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.EditServerPictureBox)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.CopyLinkPictureBox)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.DeleteServerPictureBox)).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);
this.ProfileGroupBox.ResumeLayout(false);
this.ProfileGroupBox.PerformLayout();
this.flowLayoutPanel1.ResumeLayout(false);
this.ButtomControlContainerControl.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
}
private System.Windows.Forms.ToolStripMenuItem CreateRouteTableRuleToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem RemoveNetchFirewallRulesToolStripMenuItem;
private System.Windows.Forms.ToolStripButton AboutToolStripButton;
private System.Windows.Forms.ToolStripMenuItem CleanDNSCacheToolStripMenuItem;
private System.Windows.Forms.TableLayoutPanel configLayoutPanel;
private System.Windows.Forms.GroupBox ConfigurationGroupBox;
private System.Windows.Forms.Button ControlButton;
private System.Windows.Forms.PictureBox CopyLinkPictureBox;
private System.Windows.Forms.ToolStripMenuItem CreateProcessModeToolStripMenuItem;
private System.Windows.Forms.PictureBox DeleteModePictureBox;
private System.Windows.Forms.PictureBox DeleteServerPictureBox;
private System.Windows.Forms.ToolStripStatusLabel DownloadSpeedLabel;
private System.Windows.Forms.PictureBox EditModePictureBox;
private System.Windows.Forms.PictureBox EditServerPictureBox;
private System.Windows.Forms.ToolStripMenuItem ExitToolStripButton;
private System.Windows.Forms.ToolStripMenuItem ForceExitToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem ImportServersFromClipboardToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem ManageSubscriptionsToolStripMenuItem;
private System.Windows.Forms.MenuStrip MenuStrip;
public System.Windows.Forms.ComboBox ModeComboBox;
private System.Windows.Forms.Label ModeLabel;
private System.Windows.Forms.ToolStripMenuItem ModeToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem HelpToolStripMenuItem;
private System.Windows.Forms.ToolStripStatusLabel NatTypeStatusLabel;
private System.Windows.Forms.NotifyIcon NotifyIcon;
private System.Windows.Forms.ContextMenuStrip NotifyMenu;
private System.Windows.Forms.ToolStripMenuItem OpenDirectoryToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem OptionsToolStripMenuItem;
private System.Windows.Forms.GroupBox ProfileGroupBox;
private System.Windows.Forms.Label ProfileLabel;
private System.Windows.Forms.TextBox ProfileNameText;
private System.Windows.Forms.TableLayoutPanel ProfileTable;
private System.Windows.Forms.ToolStripMenuItem CheckForUpdateToolStripMenuItem;
private System.Windows.Forms.ComboBox ServerComboBox;
private System.Windows.Forms.Label ServerLabel;
private System.Windows.Forms.ToolStripMenuItem ServerToolStripMenuItem;
private System.Windows.Forms.Button SettingsButton;
private System.Windows.Forms.ToolStripMenuItem ShowMainFormToolStripButton;
private System.Windows.Forms.PictureBox SpeedPictureBox;
private System.Windows.Forms.ToolStripStatusLabel StatusLabel;
private System.Windows.Forms.StatusStrip StatusStrip;
private System.Windows.Forms.ToolStripMenuItem SubscriptionToolStripMenuItem;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel3;
private System.Windows.Forms.ToolStripMenuItem UninstallServiceToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem UpdateServersToolStripMenuItem;
private System.Windows.Forms.ToolStripStatusLabel UploadSpeedLabel;
private System.Windows.Forms.ToolStripStatusLabel UsedBandwidthLabel;
private System.Windows.Forms.ToolStripLabel NewVersionLabel;
private System.Windows.Forms.ToolStripLabel VersionLabel;
private System.Windows.Forms.ToolStripStatusLabel NatTypeStatusLightLabel;
private System.Windows.Forms.ToolStripStatusLabel blankToolStripStatusLabel;
private System.Windows.Forms.ToolStripMenuItem FAQToolStripMenuItem;
#endregion
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
private System.Windows.Forms.ContainerControl ButtomControlContainerControl;
private System.Windows.Forms.ToolStripMenuItem ShowHideConsoleToolStripMenuItem;
private System.Windows.Forms.ToolStripStatusLabel HttpStatusLabel;
private System.Windows.Forms.ToolStripMenuItem ReloadModesToolStripMenuItem;
}
}
================================================
FILE: Netch/Forms/MainForm.cs
================================================
using System.ComponentModel;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using Windows.Win32;
using Windows.Win32.Foundation;
using Windows.Win32.UI.WindowsAndMessaging;
using Microsoft.VisualStudio.Threading;
using Microsoft.Win32;
using Netch.Controllers;
using Netch.Enums;
using Netch.Forms.ModeForms;
using Netch.Interfaces;
using Netch.Models;
using Netch.Models.Modes;
using Netch.Properties;
using Netch.Services;
using Netch.Utils;
namespace Netch.Forms;
[Fody.ConfigureAwait(true)]
public partial class MainForm : Form
{
#region Start
private readonly Dictionary<string, object> _mainFormText = new();
private bool _textRecorded;
public MainForm()
{
InitializeComponent();
NotifyIcon.Icon = Icon = Resources.icon;
AddAddServerToolStripMenuItems();
#region i18N Translations
if (Flags.NoSupport)
_mainFormText.Add(Name, new[] { "{0} ({1})", "Netch", "No Support" });
_mainFormText.Add(UninstallServiceToolStripMenuItem.Name, new[] { "Uninstall {0}", "NF Service" });
#endregion
// 监听电源事件
SystemEvents.PowerModeChanged += SystemEvents_PowerModeChanged;
}
private void AddAddServerToolStripMenuItems()
{
foreach (var serversUtil in ServerHelper.ServerUtilDictionary.Values.OrderBy(i => i.Priority).Where(i => !string.IsNullOrEmpty(i.FullName)))
{
var fullName = serversUtil.FullName;
var control = new ToolStripMenuItem
{
Name = $"Add{fullName}ServerToolStripMenuItem",
Size = new Size(259, 22),
Text = i18N.TranslateFormat("Add [{0}] Server", fullName),
Tag = serversUtil
};
_mainFormText.Add(control.Name, new[] { "Add [{0}] Server", fullName });
control.Click += AddServerToolStripMenuItem_Click;
ServerToolStripMenuItem.DropDownItems.Add(control);
}
}
private void MainForm_Load(object sender, EventArgs e)
{
// 计算 ComboBox绘制 目标宽度
RecordSize();
LoadServers();
SelectLastServer();
DelayTestHelper.UpdateTick(true);
ModeService.Instance.Load();
// 加载翻译
TranslateControls();
// 隐藏 ConnectivityStatusLabel
ConnectivityStatusVisible(false);
// 加载快速配置
LoadProfiles();
// 检查更新
if (Global.Settings.CheckUpdateWhenOpened)
CheckUpdateAsync().Forget();
// 检查订阅更新
if (Global.Settings.UpdateServersWhenOpened)
UpdateServersFromSubscriptionAsync().Forget();
// 打开软件时启动加速,产生开始按钮点击事件
if (Global.Settings.StartWhenOpened)
ControlButton.PerformClick();
Program.SingleInstance.StartListenServer();
}
private void RecordSize()
{
_numberBoxWidth = ServerComboBox.Width / 10;
_numberBoxX = _numberBoxWidth * 9;
_numberBoxWrap = _numberBoxWidth / 30;
_configurationGroupBoxHeight = ConfigurationGroupBox.Height;
_profileConfigurationHeight = ConfigurationGroupBox.Controls[0].Height / 3; // 因为 AutoSize, 所以得到的是Controls的总高度
_profileGroupBoxPaddingHeight = ProfileGroupBox.Height - ProfileTable.Height;
_profileTableHeight = ProfileTable.Height;
}
private void TranslateControls()
{
#region Record English
if (!_textRecorded)
{
void RecordText(Component component)
{
try
{
switch (component)
{
case TextBoxBase:
case ListControl:
break;
case Control c:
_mainFormText.Add(c.Name, c.Text);
break;
case ToolStripItem c:
_mainFormText.Add(c.Name, c.Text);
break;
}
}
catch (ArgumentException)
{
// ignored
}
}
Utils.Utils.ComponentIterator(this, RecordText);
Utils.Utils.ComponentIterator(NotifyMenu, RecordText);
_textRecorded = true;
}
#endregion
#region Translate
void TranslateText(Component component)
{
switch (component)
{
case TextBoxBase:
case ListControl:
break;
case Control c:
if (_mainFormText.ContainsKey(c.Name))
c.Text = ControlText(c.Name);
break;
case ToolStripItem c:
if (_mainFormText.ContainsKey(c.Name))
c.Text = ControlText(c.Name);
break;
}
string ControlText(string name)
{
var value = _mainFormText[name];
if (value.Equals(string.Empty))
return string.Empty;
if (value is object[] values)
return i18N.TranslateFormat((string)values.First(), values.Skip(1).ToArray());
return i18N.Translate(value);
}
}
Utils.Utils.ComponentIterator(this, TranslateText);
Utils.Utils.ComponentIterator(NotifyMenu, TranslateText);
#endregion
UsedBandwidthLabel.Text = $@"{i18N.Translate("Used", ": ")}0 KB";
State = State;
VersionLabel.Text = UpdateChecker.Version;
}
#endregion
#region Controls
#region MenuStrip
#region Server
private async void ImportServersFromClipboardToolStripMenuItem_Click(object sender, EventArgs e)
{
var texts = Clipboard.GetText();
if (string.IsNullOrWhiteSpace(texts))
return;
var servers = ShareLink.ParseText(texts);
foreach (var server in servers)
server.Group = Constants.DefaultGroup;
Global.Settings.Server.AddRange(servers);
NotifyTip(i18N.TranslateFormat("Import {0} server(s) form Clipboard", servers.Count));
LoadServers();
await Configuration.SaveAsync();
}
private async void AddServerToolStripMenuItem_Click([NotNull] object? sender, EventArgs? e)
{
if (sender == null)
throw new ArgumentNullException(nameof(sender));
var util = (IServerUtil)((ToolStripMenuItem)sender).Tag;
Hide();
util.Create();
LoadServers();
await Configuration.SaveAsync();
Show();
}
#endregion
#region Mode
private void CreateProcessModeToolStripButton_Click(object sender, EventArgs e)
{
Hide();
new ProcessForm().ShowDialog();
Show();
}
private void createRouteTableModeToolStripMenuItem_Click(object sender, EventArgs e)
{
Hide();
new RouteForm().ShowDialog();
Show();
}
private void ReloadModesToolStripMenuItem_Click(object sender, EventArgs e)
{
Enabled = false;
try
{
ModeService.Instance.Load();
}
finally
{
Enabled = true;
}
}
#endregion
#region Subscription
private void ManageSubscriptionLinksToolStripMenuItem_Click(object sender, EventArgs e)
{
Hide();
new SubscriptionForm().ShowDialog();
LoadServers();
Show();
}
private async void UpdateServersFromSubscriptionLinksToolStripMenuItem_Click(object sender, EventArgs e)
{
await UpdateServersFromSubscriptionAsync();
}
private async Task UpdateServersFromSubscriptionAsync()
{
void DisableItems(bool v)
{
MenuStrip.Enabled = ConfigurationGroupBox.Enabled = ProfileGroupBox.Enabled = ControlButton.Enabled = v;
}
if (Global.Settings.Subscription.Count <= 0)
{
MessageBoxX.Show(i18N.Translate("No subscription link"));
return;
}
StatusText(i18N.Translate("Updating servers"));
DisableItems(false);
try
{
await SubscriptionUtil.UpdateServersAsync();
LoadServers();
await Configuration.SaveAsync();
StatusText(i18N.Translate("Servers updated"));
}
catch (Exception e)
{
NotifyTip(i18N.Translate("Unhandled update servers error") + "\n" + e.Message, info: false);
Log.Error(e, "Unhandled Update servers error");
}
finally
{
DisableItems(true);
}
}
#endregion
#region Options
private async void CheckForUpdatesToolStripMenuItem_Click(object sender, EventArgs e)
{
void OnNewVersionNotFound(object? o, EventArgs? args)
{
NotifyTip(i18N.Translate("Already latest version"));
}
void OnNewVersionFoundFailed(object? o, EventArgs? args)
{
NotifyTip(i18N.Translate("Check for update failed"), info: false);
}
try
{
UpdateChecker.NewVersionNotFound += OnNewVersionNotFound;
UpdateChecker.NewVersionFoundFailed += OnNewVersionFoundFailed;
await CheckUpdateAsync();
}
finally
{
UpdateChecker.NewVersionNotFound -= OnNewVersionNotFound;
UpdateChecker.NewVersionFoundFailed -= OnNewVersionFoundFailed;
}
}
private void OpenDirectoryToolStripMenuItem_Click(object sender, EventArgs e)
{
Utils.Utils.Open(".\\");
}
private async void CleanDNSCacheToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
await Task.Run(() =>
{
NativeMethods.RefreshDNSCache();
DnsUtils.ClearCache();
});
NotifyTip(i18N.Translate("DNS cache cleanup succeeded"));
}
catch (Exception)
{
// ignored
}
finally
{
StatusText();
}
}
private async void UninstallServiceToolStripMenuItem_Click(object sender, EventArgs e)
{
Enabled = false;
StatusText(i18N.TranslateFormat("Uninstalling {0}", "NF Service"));
try
{
var task = Task.Run(NFController.UninstallDriver);
if (await task)
NotifyTip(i18N.TranslateFormat("{0} has been uninstalled", "NF Service"));
}
finally
{
StatusText();
Enabled = true;
}
}
private void RemoveNetchFirewallRulesToolStripMenuItem_Click(object sender, EventArgs e)
{
Firewall.RemoveNetchFwRules();
}
private void ShowHideConsoleToolStripMenuItem_Click(object sender, EventArgs e)
{
var windowStyles = (WINDOW_STYLE)PInvoke.GetWindowLong(new HWND(Program.ConsoleHwnd), WINDOW_LONG_PTR_INDEX.GWL_STYLE);
var visible = windowStyles.HasFlag(WINDOW_STYLE.WS_VISIBLE);
PInvoke.ShowWindow(Program.ConsoleHwnd, visible ? SHOW_WINDOW_CMD.SW_HIDE : SHOW_WINDOW_CMD.SW_SHOWNOACTIVATE);
}
#endregion
/// <summary>
/// 菜单栏强制退出
/// </summary>
private void ForceExitToolStripMenuItem_Click(object sender, EventArgs e)
{
Exit(true);
}
private void VersionLabel_Click(object sender, EventArgs e)
{
Utils.Utils.Open($"https://github.com/{UpdateChecker.Owner}/{UpdateChecker.Repo}/releases");
}
private async void NewVersionLabel_Click(object sender, EventArgs e)
{
if (ModifierKeys == Keys.Control || !UpdateChecker.LatestRelease!.assets.Any())
{
Utils.Utils.Open(UpdateChecker.LatestVersionUrl!);
return;
}
if (MessageBoxX.Show(i18N.Translate($"Download and install now?\n\n{UpdateChecker.GetLatestReleaseContent()}"), confirm: true) !=
DialogResult.OK)
return;
NotifyTip(i18N.Translate("Start downloading new version"));
NewVersionLabel.Enabled = false;
NewVersionLabel.Text = "...";
try
{
var progress = new Progress<int>();
progress.ProgressChanged += (_, percentage) => { NewVersionLabel.Text = $"{percentage}%"; };
string downloadDirectory = Path.Combine(Global.NetchDir, "data");
var (updateFileName, sha256) = UpdateChecker.GetLatestUpdateFileNameAndHash();
var updateFileUrl = UpdateChecker.LatestRelease.assets[0].browser_download_url!;
var updateFileFullName = Path.Combine(downloadDirectory, updateFileName);
var updater = new Updater(updateFileFullName, Global.NetchDir);
var downloaded = false;
if (File.Exists(updateFileFullName))
{
var fileHash = await Utils.Utils.Sha256CheckSumAsync(updateFileFullName);
if (fileHash == sha256)
downloaded = true;
else
File.Delete(updateFileFullName);
}
if (!downloaded)
{
try
{
await WebUtil.DownloadFileAsync(updateFileUrl, updateFileFullName, progress);
}
catch (Exception e1)
{
Log.Warning(e1, "Download Update File Failed");
throw new MessageException($"Download Update File Failed: {e1.Message}");
}
var fileHash = await Utils.Utils.Sha256CheckSumAsync(updateFileFullName);
if (fileHash != sha256)
throw new MessageException(i18N.Translate("The downloaded file has the wrong hash"));
}
await StopAsync();
await Configuration.SaveAsync();
// Update
await Task.Run(updater.ApplyUpdate);
// release mutex, exit
Program.SingleInstance.Dispose();
Process.Start(Global.NetchExecutable);
Environment.Exit(0);
}
catch (MessageException exception)
{
NotifyTip(exception.Message, info: false);
}
catch (Exception exception)
{
Log.Error(exception, "Unhandled Update error");
NotifyTip(exception.Message, info: false);
}
finally
{
NewVersionLabel.Visible = false;
NewVersionLabel.Enabled = true;
}
}
private void AboutToolStripButton_Click(object sender, EventArgs e)
{
Hide();
new AboutForm().ShowDialog();
Show();
}
private void fAQToolStripMenuItem_Click(object sender, EventArgs e)
{
Utils.Utils.Open("https://docs.netch.org");
}
#endregion
#region ControlButton
private async void ControlButton_Click(object? sender, EventArgs? e)
{
if (!IsWaiting())
{
await StopCoreAsync();
return;
}
Configuration.SaveAsync().Forget();
// 服务器、模式 需选择
if (ServerComboBox.SelectedItem is not Server server)
{
MessageBoxX.Show(i18N.Translate("Please select a server first"));
return;
}
if (ModeComboBox.SelectedItem is not Mode mode)
{
MessageBoxX.Show(i18N.Translate("Please select a mode first"));
return;
}
State = State.Starting;
try
{
await MainController.StartAsync(server, mode);
}
catch (Exception exception)
{
State = State.Stopped;
StatusText(i18N.Translate("Start failed"));
MessageBoxX.Show(exception.Message, LogLevel.ERROR);
return;
}
State = State.Started;
Task.Run(Bandwidth.NetTraffic).Forget();
DiscoveryNatTypeAsync().Forget();
HttpConnectAsync().Forget();
if (Global.Settings.MinimizeWhenStarted)
Minimize();
// 自动检测延迟
async Task StartedPingAsync()
{
while (State == State.Started)
{
if (Global.Settings.StartedPingInterval >= 0)
{
await server.PingAsync();
ServerComboBox.Refresh();
await Task.Delay(Global.Settings.StartedPingInterval * 1000);
}
else
{
await Task.Delay(5000);
}
}
}
StartedPingAsync().Forget();
}
#endregion
#region SettingsButton
private void SettingsButton_Click(object sender, EventArgs e)
{
var oldSettings = Global.Settings.ShallowCopy();
Hide();
new SettingForm().ShowDialog();
if (oldSettings.Language != Global.Settings.Language)
{
i18N.Load(Global.Settings.Language);
TranslateControls();
LoadModes();
LoadProfiles();
}
if (oldSettings.DetectionTick != Global.Settings.DetectionTick)
DelayTestHelper.UpdateTick(true);
if (oldSettings.ProfileCount != Global.Settings.ProfileCount)
LoadProfiles();
Show();
}
#endregion
#region Server
private void LoadServers()
{
ServerComboBox.Items.Clear();
ServerComboBox.Items.AddRange(Global.Settings.Server.Cast<object>().ToArray());
SelectLastServer();
}
private void SelectLastServer()
{
// 如果值合法,选中该位置
if (Global.Settings.ServerComboBoxSelectedIndex > 0 && Global.Settings.ServerComboBoxSelectedIndex < ServerComboBox.Items.Count)
ServerComboBox.SelectedIndex = Global.Settings.ServerComboBoxSelectedIndex;
// 如果值非法,且当前 ServerComboBox 中有元素,选择第一个位置
else if (ServerComboBox.Items.Count > 0)
ServerComboBox.SelectedIndex = 0;
// 如果当前 ServerComboBox 中没元素,不做处理
}
private void ServerComboBox_SelectionChangeCommitted(object sender, EventArgs o)
{
Global.Settings.ServerComboBoxSelectedIndex = ServerComboBox.SelectedIndex;
}
private async void EditServerPictureBox_Click(object sender, EventArgs e)
{
// 当前ServerComboBox中至少有一项
if (!(ServerComboBox.SelectedItem is Server server))
{
MessageBoxX.Show(i18N.Translate("Please select a server first"));
return;
}
Hide();
ServerHelper.GetUtilByTypeName(server.Type).Edit(server);
LoadServers();
await Configuration.SaveAsync();
Show();
}
private async void SpeedPictureBox_Click(object sender, EventArgs e)
{
void Enable()
{
ServerComboBox.Refresh();
Enabled = true;
StatusText();
}
Enabled = false;
StatusText(i18N.Translate("Testing"));
if (!IsWaiting() || ModifierKeys == Keys.Control)
{
(ServerComboBox.SelectedItem as Server)?.PingAsync();
Enable();
}
else
{
await DelayTestHelper.PerformTestAsync(true);
Enable();
}
}
private void CopyLinkPictureBox_Click(object sender, EventArgs e)
{
// 当前ServerComboBox中至少有一项
if (!(ServerComboBox.SelectedItem is Server server))
{
MessageBoxX.Show(i18N.Translate("Please select a server first"));
return;
}
try
{
//听说巨硬BUG经常会炸,所以Catch一下 :D
string text;
if (ModifierKeys == Keys.Control)
text = ShareLink.GetNetchLink(server);
else
text = ShareLink.GetShareLink(server);
Clipboard.SetText(text);
}
catch (Exception)
{
// ignored
}
}
private void DeleteServerPictureBox_Click(object sender, EventArgs e)
{
// 当前 ServerComboBox 中至少有一项
if (!(ServerComboBox.SelectedItem is Server server))
{
MessageBoxX.Show(i18N.Translate("Please select a server first"));
return;
}
Global.Settings.Server.Remove(server);
LoadServers();
}
#endregion
#region Mode
public void LoadModes()
{
if (InvokeRequired)
{
Invoke(LoadModes);
return;
}
ModeComboBox.Items.Clear();
ModeComboBox.Items.AddRange(Global.Modes.Cast<object>().ToArray());
ModeComboBox.Tag = null;
SelectLastMode();
}
private void SelectLastMode()
{
// 如果值合法,选中该位置
if (Global.Settings.ModeComboBoxSelectedIndex > 0 && Global.Settings.ModeComboBoxSelectedIndex < ModeComboBox.Items.Count)
ModeComboBox.SelectedIndex = Global.Settings.ModeComboBoxSelectedIndex;
// 如果值非法,且当前 ModeComboBox 中有元素,选择第一个位置
else if (ModeComboBox.Items.Count > 0)
ModeComboBox.SelectedIndex = 0;
// 如果当前 ModeComboBox 中没元素,不做处理
}
private void ModeComboBox_SelectionChangeCommitted(object sender, EventArgs o)
{
try
{
Global.Settings.ModeComboBoxSelectedIndex = Global.Modes.IndexOf((Mode)ModeComboBox.SelectedItem);
}
catch
{
Global.Settings.ModeComboBoxSelectedIndex = 0;
}
}
private void EditModePictureBox_Click(object sender, EventArgs e)
{
// 当前ModeComboBox中至少有一项
if (ModeComboBox.SelectedIndex == -1)
{
MessageBoxX.Show(i18N.Translate("Please select a mode first"));
return;
}
var mode = (Mode)ModeComboBox.SelectedItem;
if (ModifierKeys == Keys.Control)
{
Utils.Utils.Open(mode.FullName);
return;
}
switch (mode.Type)
{
case ModeType.ProcessMode:
Hide();
new ProcessForm(mode).ShowDialog();
Show();
break;
case ModeType.TunMode:
Hide();
new RouteForm(mode).ShowDialog();
Show();
break;
case ModeType.ShareMode:
// throw new NotImplementedException();
default:
Utils.Utils.Open(mode.FullName);
break;
}
}
private void DeleteModePictureBox_Click(object sender, EventArgs e)
{
// 当前ModeComboBox中至少有一项
if (ModeComboBox.Items.Count <= 0 || ModeComboBox.SelectedIndex == -1)
{
MessageBoxX.Show(i18N.Translate("Please select a mode first"));
return;
}
ModeService.Delete((Mode)ModeComboBox.SelectedItem);
SelectLastMode();
}
#endregion
#region Profile
private int _configurationGroupBoxHeight;
private int _profileConfigurationHeight;
private int _profileGroupBoxPaddingHeight;
private int _profileTableHeight;
private void LoadProfiles()
{
// Clear
foreach (var button in ProfileTable.Controls)
((Button)button).Dispose();
ProfileTable.Controls.Clear();
ProfileTable.ColumnStyles.Clear();
ProfileTable.RowStyles.Clear();
var profileCount = Global.Settings.ProfileCount;
if (profileCount == 0)
{
// Hide Profile GroupBox, Change window size
configLayoutPanel.RowStyles[2].SizeType = SizeType.Percent;
configLayoutPanel.RowStyles[2].Height = 0;
ProfileGroupBox.Visible = false;
ConfigurationGroupBox.Height = _configurationGroupBoxHeight - _profileConfigurationHeight;
}
else
{
// Load Profiles
if (Global.Settings.ProfileTableColumnCount == 0)
Global.Settings.ProfileTableColumnCount = 5;
var columnCount = Global.Settings.ProfileTableColumnCount;
ProfileTable.ColumnCount = profileCount >= columnCount ? columnCount : profileCount;
ProfileTable.RowCount = (int)Math.Ceiling(profileCount / (float)columnCount);
for (var i = 0; i < profileCount; ++i)
{
var profile = Global.Settings.Profiles.SingleOrDefault(p => p.Index == i);
var b = new Button
{
Dock = DockStyle.Fill,
Text = profile?.ProfileName ?? i18N.Translate("None"),
Tag = profile
};
b.Click += ProfileButton_Click;
ProfileTable.Controls.Add(b, i % columnCount, i / columnCount);
}
// equal column
for (var i = 1; i <= ProfileTable.RowCount; i++)
ProfileTable.RowStyles.Add(new RowStyle(SizeType.Percent, 1));
for (var i = 1; i <= ProfileTable.ColumnCount; i++)
ProfileTable.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 1));
configLayoutPanel.RowStyles[2].SizeType = SizeType.AutoSize;
ProfileGroupBox.Visible = true;
ProfileGroupBox.Height = ProfileTable.RowCount * _profileTableHeight + _profileGroupBoxPaddingHeight;
ConfigurationGroupBox.Height = _configurationGroupBoxHeight;
}
}
private async void ProfileButton_Click([NotNull] object? sender, EventArgs? e)
{
if (sender == null)
throw new InvalidOperationException();
var button = (Button)sender;
var profile = (Profile?)button.Tag;
var index = ProfileTable.Controls.IndexOf(button);
switch (ModifierKeys)
{
case Keys.Control:
// Save Profile
if (ServerComboBox.SelectedItem is not Server server)
{
MessageBoxX.Show(i18N.Translate("Please select a server first"));
return;
}
if (ModeComboBox.SelectedItem is not Mode mode)
{
MessageBoxX.Show(i18N.Translate("Please select a mode first"));
return;
}
var name = ProfileNameText.Text;
Global.Settings.Profiles.RemoveAll(p => p.Index == index);
profile = new Profile(server, mode, name, index);
Global.Settings.Profiles.Add(profile);
button.Tag = profile;
button.Text = profile.ProfileName;
ProfileNameText.Clear();
return;
case Keys.Shift:
// Delete Profile
if (profile == null)
return;
Global.Settings.Profiles.Remove(profile);
button.Tag = null;
button.Text = i18N.Translate("None");
return;
}
// Activate Profile
if (profile == null)
{
MessageBoxX.Show(i18N.Translate("No saved profile here. Save a profile first by Ctrl+Click on the button"));
return;
}
try
{
ProfileNameText.Text = profile.ProfileName;
var server = ServerComboBox.Items.Cast<Server>().FirstOrDefault(s => s.Remark.Equals(profile.ServerRemark));
var mode = ModeComboBox.Items.Cast<Mode>().FirstOrDefault(m => m.Remark.Any(s => s.Value.Equals(profile.ModeRemark)));
if (server == null)
throw new MessageException("Server not found.");
if (mode == null)
throw new MessageException("Mode not found.");
// set active server and mode
ServerComboBox.SelectedItem = server;
ModeComboBox.SelectedItem = mode;
}
catch (MessageException exception)
{
MessageBoxX.Show(exception.Message, LogLevel.ERROR);
return;
}
await StopAsync();
ControlButton.PerformClick();
}
#endregion
#region State
private State _state = State.Waiting;
/// <summary>
/// 当前状态
/// </summary>
public State State
{
get => _state;
private set
{
void StartDisableItems(bool enabled)
{
ServerComboBox.Enabled = ModeComboBox.Enabled = EditModePictureBox.Enabled =
EditServerPictureBox.Enabled = DeleteModePictureBox.Enabled = DeleteServerPictureBox.Enabled = enabled;
// 启动需要禁用的控件
ServerToolStripMenuItem.Enabled = ModeToolStripMenuItem.Enabled =
SubscriptionToolStripMenuItem.Enabled = UninstallServiceToolStripMenuItem.Enabled = enabled;
}
_state = value;
DelayTestHelper.Enabled = IsWaiting(_state);
StatusText();
switch (value)
{
case State.Waiting:
ControlButton.Enabled = true;
ControlButton.Text = i18N.Translate("Start");
break;
case State.Starting:
ControlButton.Enabled = false;
ControlButton.Text = "...";
ProfileGroupBox.Enabled = false;
StartDisableItems(false);
break;
case State.Started:
ControlButton.Enabled = true;
ControlButton.Text = i18N.Translate("Stop");
ProfileGroupBox.Enabled = true;
break;
case State.Stopping:
ControlButton.Enabled = false;
ControlButton.Text = "...";
ProfileGroupBox.Enabled = false;
BandwidthState(false);
ConnectivityStatusVisible(false);
break;
case State.Stopped:
ControlButton.Enabled = true;
ControlButton.Text = i18N.Translate("Start");
LastUploadBandwidth = 0;
LastDownloadBandwidth = 0;
Bandwidth.Stop();
ProfileGroupBox.Enabled = true;
StartDisableItems(true);
break;
}
}
}
public async Task StopAsync()
{
if (IsWaiting())
return;
await StopCoreAsync();
}
private async Task StopCoreAsync()
{
State = State.Stopping;
_discoveryNatCts?.Cancel();
_httpConnectCts?.Cancel();
await MainController.StopAsync();
State = State.Stopped;
}
private bool IsWaiting() => IsWaiting(_state);
private static bool IsWaiting(State state)
{
return state is State.Waiting or State.Stopped;
}
/// <summary>
/// 更新状态栏文本
/// </summary>
/// <param name="text"></param>
public void StatusText(string? text = null)
{
if (InvokeRequired)
{
BeginInvoke(() => StatusText(text));
return;
}
text ??= i18N.Translate(StateExtension.GetStatusString(State));
if (_state == State.Started)
text += StatusPortInfoText.Value;
StatusLabel.Text = i18N.Translate("Status", ": ") + text;
}
public void BandwidthState(bool state)
{
if (InvokeRequired)
{
BeginInvoke(() => BandwidthState(state));
return;
}
if (IsWaiting())
return;
UsedBandwidthLabel.Visible /*= UploadSpeedLabel.Visible*/ = DownloadSpeedLabel.Visible = state;
}
private void UpdateNatTypeStatusLabelText(string? text, string? country = null)
{
if (!string.IsNullOrEmpty(text))
{
if (country == null)
NatTypeStatusLabel.Text = $"NAT{i18N.Translate(": ")}{text} ";
else
NatTypeStatusLabel.Text = $"NAT{i18N.Translate(": ")}{text} [{country}]";
UpdateNatTypeLight(int.TryParse(text, out var natType) ? natType : -1);
}
else
{
NatTypeStatusLabel.Text = $@"NAT{i18N.Translate(": ", "Test failed")}";
}
NatTypeStatusLabel.Visible = true;
}
private void ConnectivityStatusVisible(bool visible)
{
if (!visible)
HttpStatusLabel.Text = NatTypeStatusLabel.Text = "";
HttpStatusLabel.Visible = NatTypeStatusLabel.Visible = NatTypeStatusLightLabel.Visible = visible;
}
/// <summary>
/// 更新 NAT指示灯颜色
/// </summary>
/// <param name="natType">NAT Type. keep default(-1) to Hide Light</param>
private void UpdateNatTypeLight(int natType = -1)
{
if (natType > 0 && natType < 5)
{
NatTypeStatusLightLabel.Visible = Flags.IsWindows10Upper;
var c = natType switch
{
1 => Color.LimeGreen,
2 => Color.Yellow,
3 => Color.Red,
4 => Color.Black,
_ => throw new ArgumentOutOfRangeException(nameof(natType), natType, null)
};
NatTypeStatusLightLabel.ForeColor = c;
}
else
{
NatTypeStatusLightLabel.Visible = false;
}
}
private async void TcpStatusLabel_Click(object sender, EventArgs e)
{
await HttpConnectAsync();
}
private async void NatTypeStatusLabel_Click(object sender, EventArgs e)
{
await DiscoveryNatTypeAsync();
}
private CancellationTokenSource? _discoveryNatCts;
private async Task DiscoveryNatTypeAsync()
{
NatTypeStatusLabel.Enabled = false;
UpdateNatTypeStatusLabelText(i18N.Translate("Testing NAT Type"));
_discoveryNatCts = new CancellationTokenSource();
try
{
var res = await MainController.DiscoveryNatTypeAsync(_discoveryNatCts.Token);
if (_discoveryNatCts.IsCancellationRequested)
return;
if (!string.IsNullOrEmpty(res.PublicEnd))
{
var country = await Utils
gitextract_az4fg7zz/ ├── .github/ │ ├── ISSUE_TEMPLATE/ │ │ ├── bug_report.yml │ │ ├── bug_report.zh-CN.yml │ │ ├── config.yml │ │ ├── feature_request.yml │ │ └── feature_request.zh-CN.yml │ ├── dependabot.yml │ └── workflows/ │ ├── build.yml │ ├── release.yml │ └── stale.yml ├── .gitignore ├── LICENSE ├── Netch/ │ ├── .gitignore │ ├── App.manifest │ ├── Constants.cs │ ├── Controllers/ │ │ ├── DNSController.cs │ │ ├── Guard.cs │ │ ├── MainController.cs │ │ ├── NFController.cs │ │ ├── PcapController.cs │ │ ├── TUNController.cs │ │ └── UpdateChecker.cs │ ├── Enums/ │ │ ├── LogLevel.cs │ │ └── State.cs │ ├── Flags.cs │ ├── FodyWeavers.xml │ ├── Forms/ │ │ ├── AboutForm.Designer.cs │ │ ├── AboutForm.cs │ │ ├── AboutForm.resx │ │ ├── BindingForm.cs │ │ ├── GlobalBypassIPForm.Designer.cs │ │ ├── GlobalBypassIPForm.cs │ │ ├── LogForm.Designer.cs │ │ ├── LogForm.cs │ │ ├── LogForm.resx │ │ ├── MainForm.Designer.cs │ │ ├── MainForm.cs │ │ ├── MainForm.resx │ │ ├── MessageBoxX.cs │ │ ├── ModeForms/ │ │ │ ├── ModeEditorUtils.cs │ │ │ ├── ProcessForm.Designer.cs │ │ │ ├── ProcessForm.cs │ │ │ ├── ProcessForm.resx │ │ │ ├── RouteForm.Designer.cs │ │ │ ├── RouteForm.cs │ │ │ └── RouteForm.resx │ │ ├── ServerForm.cs │ │ ├── SettingForm.Designer.cs │ │ ├── SettingForm.cs │ │ ├── SettingForm.resx │ │ ├── SubscriptionForm.Designer.cs │ │ ├── SubscriptionForm.cs │ │ ├── SubscriptionForm.resx │ │ └── SyncGlobalCheckBox.cs │ ├── Global.cs │ ├── Interfaces/ │ │ ├── IController.cs │ │ ├── IModeController.cs │ │ ├── IServerController.cs │ │ └── IServerUtil.cs │ ├── Interops/ │ │ ├── AioDNS.cs │ │ ├── Redirector.cs │ │ ├── RouteHelper.cs │ │ └── tun2socks.cs │ ├── JsonConverter/ │ │ ├── ModeConverterWithTypeDiscriminator.cs │ │ └── ServerConverterWithTypeDiscriminator.cs │ ├── Models/ │ │ ├── Arguments.cs │ │ ├── GitHubRelease/ │ │ │ ├── Asset.cs │ │ │ ├── GitHubRelease.cs │ │ │ ├── GitHubUser.cs │ │ │ ├── Release.cs │ │ │ ├── SuffixVersion.cs │ │ │ └── VersionUtil.cs │ │ ├── MessageException.cs │ │ ├── Modes/ │ │ │ ├── Mode.cs │ │ │ ├── ModeFeature.cs │ │ │ ├── ModeType.cs │ │ │ ├── ProcessMode/ │ │ │ │ └── ProcessMode.cs │ │ │ ├── ShareMode/ │ │ │ │ └── ShareMode.cs │ │ │ └── TunMode/ │ │ │ └── TunMode.cs │ │ ├── NatTypeTestResult.cs │ │ ├── NetRoute.cs │ │ ├── NumberRange.cs │ │ ├── Profile.cs │ │ ├── Server.cs │ │ ├── Settings/ │ │ │ ├── AioDNSConfig.cs │ │ │ ├── KcpConfig.cs │ │ │ ├── RedirectorConfig.cs │ │ │ ├── Setting.cs │ │ │ ├── TUNConfig.cs │ │ │ └── V2rayConfig.cs │ │ ├── StatusText.cs │ │ ├── Subscription.cs │ │ └── TagItem.cs │ ├── NOTICE.txt │ ├── NativeMethods.cs │ ├── NativeMethods.txt │ ├── Netch.csproj │ ├── Program.cs │ ├── Properties/ │ │ ├── AssemblyInfo.cs │ │ ├── Resources.Designer.cs │ │ └── Resources.resx │ ├── Resources/ │ │ └── zh-CN │ ├── Servers/ │ │ ├── SSH/ │ │ │ ├── SSHForm.cs │ │ │ ├── SSHServer.cs │ │ │ └── SSHUtil.cs │ │ ├── Shadowsocks/ │ │ │ ├── ShadowsocksController.cs │ │ │ ├── ShadowsocksForm.cs │ │ │ ├── ShadowsocksServer.cs │ │ │ ├── ShadowsocksUtil.cs │ │ │ └── ShareModels/ │ │ │ ├── SSDJObject.cs │ │ │ ├── SSDServerJObject.cs │ │ │ └── ShadowsocksConfig.cs │ │ ├── ShadowsocksR/ │ │ │ ├── ShadowsocksRController.cs │ │ │ ├── ShadowsocksRForm.cs │ │ │ ├── ShadowsocksRServer.cs │ │ │ └── ShadowsocksRUtil.cs │ │ ├── Socks5/ │ │ │ ├── Socks5Controller.cs │ │ │ ├── Socks5Form.cs │ │ │ ├── Socks5Server.cs │ │ │ └── Socks5Util.cs │ │ ├── Trojan/ │ │ │ ├── TrojanConfig.cs │ │ │ ├── TrojanController.cs │ │ │ ├── TrojanForm.cs │ │ │ ├── TrojanServer.cs │ │ │ └── TrojanUtil.cs │ │ ├── V2ray/ │ │ │ ├── ShareModels/ │ │ │ │ └── V2rayNJObject.cs │ │ │ ├── V2rayConfig.cs │ │ │ ├── V2rayConfigUtils.cs │ │ │ ├── V2rayController.cs │ │ │ └── V2rayUtils.cs │ │ ├── VLESS/ │ │ │ ├── VLESSForm.cs │ │ │ ├── VLESSServer.cs │ │ │ └── VLESSUtil.cs │ │ ├── VMess/ │ │ │ ├── VMessForm.cs │ │ │ ├── VMessServer.cs │ │ │ └── VMessUtil.cs │ │ └── WireGuard/ │ │ ├── WireGuardForm.cs │ │ ├── WireGuardServer.cs │ │ └── WireGuardUtil.cs │ ├── Services/ │ │ ├── ModeService.cs │ │ └── Updater.cs │ ├── Utils/ │ │ ├── Bandwidth.cs │ │ ├── Configuration.cs │ │ ├── DelayTestHelper.cs │ │ ├── DnsUtils.cs │ │ ├── Firewall.cs │ │ ├── ModeHelper.cs │ │ ├── NetworkInterfaceUtils.cs │ │ ├── PortHelper.cs │ │ ├── RouteUtils.cs │ │ ├── ServerHelper.cs │ │ ├── ShareLink.cs │ │ ├── Socks5ServerTestUtils.cs │ │ ├── StringExtension.cs │ │ ├── SubscriptionUtil.cs │ │ ├── SystemInfo.cs │ │ ├── Utils.cs │ │ ├── WebUtil.cs │ │ └── i18N.cs │ └── runtimeconfig.template.json ├── Netch.sln ├── Other/ │ ├── .gitignore │ ├── .must_build │ ├── _Archive/ │ │ ├── build.ps1 │ │ ├── chnip/ │ │ │ └── build.ps1 │ │ ├── chnsite/ │ │ │ └── build.ps1 │ │ ├── cloak/ │ │ │ └── build.ps1 │ │ ├── dnsproxy/ │ │ │ └── build.ps1 │ │ ├── geoip/ │ │ │ └── build.ps1 │ │ ├── geosite/ │ │ │ └── build.ps1 │ │ ├── tun2socks/ │ │ │ └── build.ps1 │ │ ├── v2ray-core/ │ │ │ └── build.ps1 │ │ └── v2ray-plugin/ │ │ └── build.ps1 │ ├── aiodns/ │ │ ├── build.ps1 │ │ ├── deps.ps1 │ │ ├── go.mod │ │ ├── go.sum │ │ └── main.go │ ├── build.ps1 │ ├── clean.ps1 │ ├── deps.ps1 │ ├── pcap2socks/ │ │ └── build.ps1 │ ├── v2ray-sn/ │ │ ├── README.md │ │ └── build.ps1 │ └── wintun/ │ └── build.ps1 ├── README.md ├── Redirector/ │ ├── .gitignore │ ├── .must_build │ ├── Based.cpp │ ├── Based.h │ ├── DNSHandler.cpp │ ├── DNSHandler.h │ ├── EventHandler.cpp │ ├── EventHandler.h │ ├── IPEventHandler.cpp │ ├── IPEventHandler.h │ ├── README.md │ ├── Redirector.cpp │ ├── Redirector.vcxproj │ ├── Redirector.vcxproj.filters │ ├── SocksHelper.cpp │ ├── SocksHelper.h │ ├── TCPHandler.cpp │ ├── TCPHandler.h │ ├── Utils.cpp │ ├── Utils.h │ ├── include/ │ │ ├── nfapi.h │ │ ├── nfdriver.h │ │ └── nfevents.h │ └── lib/ │ └── nfapi.lib ├── RedirectorTester/ │ ├── .gitignore │ ├── App.config │ ├── App.manifest │ ├── Properties/ │ │ └── AssemblyInfo.cs │ ├── RedirectorTester.cs │ └── RedirectorTester.csproj ├── RouteHelper/ │ ├── .gitignore │ ├── .must_build │ ├── Based.h │ ├── README.md │ ├── RouteHelper.cpp │ ├── RouteHelper.vcxproj │ ├── RouteHelper.vcxproj.filters │ ├── WaitGroup.cpp │ └── WaitGroup.h ├── Storage/ │ ├── README.md │ ├── aiodns.conf │ ├── i18n/ │ │ ├── fa-IR │ │ ├── ja-JP │ │ └── zh-TW │ ├── mode/ │ │ ├── Battlenet.txt │ │ ├── Bypass LAN and China.txt │ │ ├── Bypass LAN and Vivox.txt │ │ ├── Bypass LAN.txt │ │ ├── Discord (with Steam Apps).txt │ │ ├── Discord.txt │ │ ├── EA Desktop Games (with EA Desktop).txt │ │ ├── EA Desktop Games.txt │ │ ├── EA Desktop.txt │ │ ├── Game/ │ │ │ ├── Age of Empires IV.json │ │ │ ├── COD18.json │ │ │ ├── Cube 2 Sauerbraten.txt │ │ │ ├── CyberDuck.txt │ │ │ ├── DLsite PlayDRM.txt │ │ │ ├── EVE Online.txt │ │ │ ├── Escape From Tarkov.txt │ │ │ ├── Etterna.txt │ │ │ ├── Faceit AC.txt │ │ │ ├── ForzaHorizon 4.txt │ │ │ ├── Grand Theft Auto V.txt │ │ │ ├── Halo The Master Chief Collection.txt │ │ │ ├── League of Legends (Japan) (with Riot Games).txt │ │ │ ├── League of Legends (Taiwan) (with Garena).txt │ │ │ ├── League of Legends (US).txt │ │ │ ├── Minecraft (Java).txt │ │ │ ├── Minecraft Bedrock (Win10 UWP).txt │ │ │ ├── Multi Theft Auto (MTA).txt │ │ │ ├── OSU.txt │ │ │ ├── PVZ Battle for Neighborville.json │ │ │ ├── PlayerUnknown's Battlegrounds Lite.txt │ │ │ ├── RAGE Multiplayer.txt │ │ │ ├── RayCity (Thailand) (Dark RayCity).txt │ │ │ ├── RayCity (Thailand) (Rebirth RayCity).txt │ │ │ ├── San Andreas Multiplayer (SA-MP).txt │ │ │ ├── Tom Clancy's Rainbow Six Siege.txt │ │ │ ├── VRChat.txt │ │ │ ├── Valorant.txt │ │ │ ├── Warframe.txt │ │ │ └── World of Warships.txt │ │ ├── Global.json │ │ ├── NatTypeTester.txt │ │ ├── Nexon Games.txt │ │ ├── Nexon.txt │ │ ├── Origin Games.txt │ │ ├── Origin.txt │ │ ├── Other/ │ │ │ ├── AMD Radeon.txt │ │ │ ├── Adobe Creative Cloud (No Apps).txt │ │ │ ├── Geforce Experience.txt │ │ │ ├── Git.txt │ │ │ ├── Google Drive Backup and Sync.txt │ │ │ ├── JetBrains ToolBox.txt │ │ │ ├── NVIDIA Corporation.json │ │ │ ├── NodeJS With NVM.txt │ │ │ ├── Unity Asset Store for Unity.txt │ │ │ ├── Unity Hub.txt │ │ │ ├── VMware.txt │ │ │ ├── Visual Studio Code.txt │ │ │ ├── Xftp 6.txt │ │ │ ├── Xshell 6.txt │ │ │ └── qBittorrent.txt │ │ ├── Rockstar Games Launcher.txt │ │ ├── Steam Games (with Steam).txt │ │ ├── Steam Games.txt │ │ ├── Steam.txt │ │ ├── TUNTAP/ │ │ │ ├── ARK Survival Evolved (Asia) - Tencent.txt │ │ │ ├── ARK Survival Evolved (US) - Tencent.txt │ │ │ ├── Among Us - UU.txt │ │ │ ├── Battlefield V - Tencent.txt │ │ │ ├── Black Desert (Taiwan) - Tencent.txt │ │ │ ├── Black Desert (US) - Tencent.txt │ │ │ ├── Counter-Strike Global Offensive -UU-.txt │ │ │ ├── DOOM Eternal.txt │ │ │ ├── Dead by Daylight - Tencent.txt │ │ │ ├── Destiny 2 - Tencent.txt │ │ │ ├── Destiny 2 - UU.txt │ │ │ ├── EVE Online - Tencent.txt │ │ │ ├── Escape From Tarkov (HK) - UU.txt │ │ │ ├── Fall Guys Ultimate Knockout - UU.txt │ │ │ ├── Fastly.txt │ │ │ ├── Forza Horizon 4 - Tencent.txt │ │ │ ├── Forza Motorsport 7 - Tencent.txt │ │ │ ├── Grand Theft Auto V - Tencent.txt │ │ │ ├── Grand Theft Auto V - UU.txt │ │ │ ├── Insurgency Sandstorm - Tencent.txt │ │ │ ├── Maple Story (Taiwan) - UU.txt │ │ │ ├── NBA 2K21 - UU.txt │ │ │ ├── Phasmophobia - UU.txt │ │ │ ├── PlayerUnknown's Battlegrounds - Tencent.txt │ │ │ ├── PlayerUnknown's Battlegrounds - UU.txt │ │ │ ├── Scum - Tencent.txt │ │ │ ├── Scum - UU.txt │ │ │ ├── Sea of Thieves - Tencent.txt │ │ │ ├── Sea of Thieves - UU.txt │ │ │ └── Tom Clancy's Rainbow Six Siege - UU.txt │ │ ├── Ubisoft Connect.txt │ │ ├── pcap2socks-Tencent.txt │ │ └── pcap2socks-UU.txt │ ├── nfdriver.sys │ └── stun.txt ├── Tests/ │ ├── .gitignore │ ├── Global.cs │ └── Tests.csproj ├── build.ps1 ├── clean.ps1 ├── common.props ├── global.json └── sha256.ps1
SYMBOL INDEX (771 symbols across 149 files)
FILE: Netch/Constants.cs
class Constants (line 3) | public static class Constants
class Parameter (line 19) | public static class Parameter
FILE: Netch/Controllers/DNSController.cs
class DNSController (line 7) | public class DNSController : IController
method StartAsync (line 11) | public async Task StartAsync()
method StopAsync (line 26) | public Task StopAsync()
FILE: Netch/Controllers/Guard.cs
class Guard (line 10) | public abstract class Guard
method Guard (line 18) | protected Guard(string mainFile, bool redirectOutput = true, Encoding?...
method StartGuardAsync (line 58) | protected async Task StartGuardAsync(string argument, ProcessPriorityC...
method ReadOutputAsync (line 105) | private async Task ReadOutputAsync(TextReader reader)
method StopAsync (line 126) | public virtual Task StopAsync()
method StopGuardAsync (line 131) | protected async Task StopGuardAsync()
method OnStarted (line 159) | protected virtual void OnStarted()
method OnReadNewLine (line 163) | protected virtual void OnReadNewLine(string line)
method OnStartFailed (line 167) | protected virtual void OnStartFailed()
FILE: Netch/Controllers/MainController.cs
class MainController (line 12) | public static class MainController
method StartAsync (line 26) | public static async Task StartAsync(Server server, Mode mode)
method StopAsync (line 95) | public static async Task StopAsync()
method PortCheck (line 134) | public static void PortCheck(ushort port, string portName, PortType po...
method TryReleaseTcpPort (line 150) | public static void TryReleaseTcpPort(ushort port, string portName)
method DiscoveryNatTypeAsync (line 172) | public static Task<NatTypeTestResult> DiscoveryNatTypeAsync(Cancellati...
method HttpConnectAsync (line 178) | public static Task<int?> HttpConnectAsync(CancellationToken ctx = defa...
FILE: Netch/Controllers/NFController.cs
class NFController (line 13) | public class NFController : IModeController
method StartAsync (line 27) | public async Task StartAsync(Socks5Server server, Mode mode)
method StopAsync (line 79) | public Task StopAsync()
method CheckCppRegex (line 91) | private static bool CheckCppRegex(string r, bool clear = true)
method CheckRules (line 112) | public static bool CheckRules(IEnumerable<string> rules, out IEnumerab...
method GenerateInvalidRulesMessage (line 119) | public static string GenerateInvalidRulesMessage(IEnumerable<string> r...
method DialRule (line 126) | private void DialRule()
method CheckDriver (line 151) | private static void CheckDriver()
method InstallDriver (line 196) | private static void InstallDriver()
method UninstallDriver (line 229) | public static bool UninstallDriver()
FILE: Netch/Controllers/PcapController.cs
class PcapController (line 13) | public class PcapController : Guard, IModeController
method PcapController (line 19) | public PcapController() : base("pcap2socks.exe", encoding: Encoding.UTF8)
method StartAsync (line 31) | public async Task StartAsync(Socks5Server server, Mode mode)
method StopAsync (line 58) | public override async Task StopAsync()
method OnReadNewLine (line 69) | protected override void OnReadNewLine(string line)
method OnStarted (line 78) | protected override void OnStarted()
method OnStartFailed (line 83) | protected override void OnStartFailed()
FILE: Netch/Controllers/TUNController.cs
class TUNController (line 15) | public class TUNController : IModeController
method StartAsync (line 31) | public async Task StartAsync(Socks5Server server, Mode mode)
method StopAsync (line 120) | public async Task StopAsync()
method CheckDriver (line 132) | private void CheckDriver()
method SetupRouteTable (line 158) | private void SetupRouteTable()
method ClearRouteTable (line 195) | private void ClearRouteTable()
FILE: Netch/Controllers/UpdateChecker.cs
class UpdateChecker (line 10) | public static class UpdateChecker
method CheckAsync (line 35) | public static async Task CheckAsync(bool isPreRelease)
method GetLatestUpdateFileNameAndHash (line 69) | public static (string fileName, string sha256) GetLatestUpdateFileName...
method GetLatestReleaseContent (line 84) | public static string GetLatestReleaseContent()
method GetLatestRelease (line 98) | private static Release GetLatestRelease(IEnumerable<Release> releases,...
FILE: Netch/Enums/LogLevel.cs
type LogLevel (line 3) | public enum LogLevel
FILE: Netch/Enums/State.cs
type State (line 6) | public enum State
class StateExtension (line 39) | public static class StateExtension
method GetStatusString (line 41) | public static string GetStatusString(State state)
FILE: Netch/Flags.cs
class Flags (line 3) | public static class Flags
FILE: Netch/Forms/AboutForm.Designer.cs
class AboutForm (line 3) | partial class AboutForm
method Dispose (line 14) | protected override void Dispose(bool disposing)
method InitializeComponent (line 29) | private void InitializeComponent()
FILE: Netch/Forms/AboutForm.cs
class AboutForm (line 6) | [Fody.ConfigureAwait(true)]
method AboutForm (line 9) | public AboutForm()
method AboutForm_Load (line 15) | private void AboutForm_Load(object sender, EventArgs e)
method NetchPictureBox_Click (line 20) | private void NetchPictureBox_Click(object sender, EventArgs e)
method ChannelLabel_LinkClicked (line 25) | private void ChannelLabel_LinkClicked(object sender, LinkLabelLinkClic...
method SponsorPictureBox_Click (line 30) | private void SponsorPictureBox_Click(object sender, EventArgs e)
FILE: Netch/Forms/BindingForm.cs
class BindingForm (line 5) | [Fody.ConfigureAwait(true)]
method BindTextBox (line 12) | protected void BindTextBox(TextBoxBase control, Func<string, bool> che...
method BindTextBox (line 17) | protected virtual void BindTextBox<T>(TextBoxBase control, Func<T, boo...
method BindCheckBox (line 36) | protected void BindCheckBox(CheckBox control, Action<bool> save, bool ...
method BindSyncGlobalCheckBox (line 42) | protected void BindSyncGlobalCheckBox(SyncGlobalCheckBox control, Acti...
method BindRadioBox (line 49) | protected void BindRadioBox(RadioButton control, Action<bool> save, bo...
method BindListComboBox (line 55) | protected void BindListComboBox<T>(ComboBox comboBox, Action<T> save, ...
method BindComboBox (line 70) | protected void BindComboBox(ComboBox control, Func<string, bool> check...
method GetInvalidateValueControls (line 81) | protected List<Control> GetInvalidateValueControls()
method Validate (line 86) | protected bool Validate(Control c)
method SaveBinds (line 94) | protected void SaveBinds()
FILE: Netch/Forms/GlobalBypassIPForm.Designer.cs
class GlobalBypassIPForm (line 3) | partial class GlobalBypassIPForm
method Dispose (line 14) | protected override void Dispose(bool disposing)
method InitializeComponent (line 29) | private void InitializeComponent()
FILE: Netch/Forms/GlobalBypassIPForm.cs
class GlobalBypassIPForm (line 7) | [Fody.ConfigureAwait(true)]
method GlobalBypassIPForm (line 10) | public GlobalBypassIPForm()
method GlobalBypassIPForm_Load (line 16) | private void GlobalBypassIPForm_Load(object sender, EventArgs e)
method AddButton_Click (line 28) | private void AddButton_Click(object sender, EventArgs e)
method DeleteButton_Click (line 43) | private void DeleteButton_Click(object sender, EventArgs e)
method ControlButton_Click (line 51) | private async void ControlButton_Click(object sender, EventArgs e)
FILE: Netch/Forms/LogForm.Designer.cs
class LogForm (line 5) | partial class LogForm
method Dispose (line 16) | protected override void Dispose(bool disposing)
method InitializeComponent (line 32) | private void InitializeComponent()
FILE: Netch/Forms/LogForm.cs
class LogForm (line 8) | [Fody.ConfigureAwait(true)]
method LogForm (line 13) | public LogForm(Form parent)
method OnLoad (line 19) | protected override void OnLoad(EventArgs? e)
method Parent_Move (line 25) | private void Parent_Move(object? sender, EventArgs? e)
method Parent_Activated (line 35) | private void Parent_Activated(object? sender, EventArgs? e)
method richTextBox1_TextChanged (line 54) | private void richTextBox1_TextChanged(object? sender, EventArgs? e)
method LogForm_Load (line 63) | private void LogForm_Load(object? sender, EventArgs? e)
method Parent_VisibleChanged (line 71) | private void Parent_VisibleChanged(object? sender, EventArgs e)
method OnClosing (line 76) | protected override void OnClosing(CancelEventArgs? e)
FILE: Netch/Forms/MainForm.Designer.cs
class MainForm (line 3) | partial class MainForm
method Dispose (line 14) | protected override void Dispose(bool disposing)
method InitializeComponent (line 29) | private void InitializeComponent()
FILE: Netch/Forms/MainForm.cs
class MainForm (line 21) | [Fody.ConfigureAwait(true)]
method MainForm (line 30) | public MainForm()
method AddAddServerToolStripMenuItems (line 50) | private void AddAddServerToolStripMenuItems()
method MainForm_Load (line 69) | private void MainForm_Load(object sender, EventArgs e)
method RecordSize (line 104) | private void RecordSize()
method TranslateControls (line 116) | private void TranslateControls()
method ImportServersFromClipboardToolStripMenuItem_Click (line 204) | private async void ImportServersFromClipboardToolStripMenuItem_Click(o...
method AddServerToolStripMenuItem_Click (line 221) | private async void AddServerToolStripMenuItem_Click([NotNull] object? ...
method CreateProcessModeToolStripButton_Click (line 240) | private void CreateProcessModeToolStripButton_Click(object sender, Eve...
method createRouteTableModeToolStripMenuItem_Click (line 247) | private void createRouteTableModeToolStripMenuItem_Click(object sender...
method ReloadModesToolStripMenuItem_Click (line 254) | private void ReloadModesToolStripMenuItem_Click(object sender, EventAr...
method ManageSubscriptionLinksToolStripMenuItem_Click (line 271) | private void ManageSubscriptionLinksToolStripMenuItem_Click(object sen...
method UpdateServersFromSubscriptionLinksToolStripMenuItem_Click (line 279) | private async void UpdateServersFromSubscriptionLinksToolStripMenuItem...
method UpdateServersFromSubscriptionAsync (line 284) | private async Task UpdateServersFromSubscriptionAsync()
method CheckForUpdatesToolStripMenuItem_Click (line 323) | private async void CheckForUpdatesToolStripMenuItem_Click(object sende...
method OpenDirectoryToolStripMenuItem_Click (line 348) | private void OpenDirectoryToolStripMenuItem_Click(object sender, Event...
method CleanDNSCacheToolStripMenuItem_Click (line 353) | private async void CleanDNSCacheToolStripMenuItem_Click(object sender,...
method UninstallServiceToolStripMenuItem_Click (line 375) | private async void UninstallServiceToolStripMenuItem_Click(object send...
method RemoveNetchFirewallRulesToolStripMenuItem_Click (line 393) | private void RemoveNetchFirewallRulesToolStripMenuItem_Click(object se...
method ShowHideConsoleToolStripMenuItem_Click (line 398) | private void ShowHideConsoleToolStripMenuItem_Click(object sender, Eve...
method ForceExitToolStripMenuItem_Click (line 410) | private void ForceExitToolStripMenuItem_Click(object sender, EventArgs e)
method VersionLabel_Click (line 415) | private void VersionLabel_Click(object sender, EventArgs e)
method NewVersionLabel_Click (line 420) | private async void NewVersionLabel_Click(object sender, EventArgs e)
method AboutToolStripButton_Click (line 503) | private void AboutToolStripButton_Click(object sender, EventArgs e)
method fAQToolStripMenuItem_Click (line 510) | private void fAQToolStripMenuItem_Click(object sender, EventArgs e)
method ControlButton_Click (line 519) | private async void ControlButton_Click(object? sender, EventArgs? e)
method SettingsButton_Click (line 591) | private void SettingsButton_Click(object sender, EventArgs e)
method LoadServers (line 619) | private void LoadServers()
method SelectLastServer (line 626) | private void SelectLastServer()
method ServerComboBox_SelectionChangeCommitted (line 638) | private void ServerComboBox_SelectionChangeCommitted(object sender, Ev...
method EditServerPictureBox_Click (line 643) | private async void EditServerPictureBox_Click(object sender, EventArgs e)
method SpeedPictureBox_Click (line 659) | private async void SpeedPictureBox_Click(object sender, EventArgs e)
method CopyLinkPictureBox_Click (line 683) | private void CopyLinkPictureBox_Click(object sender, EventArgs e)
method DeleteServerPictureBox_Click (line 709) | private void DeleteServerPictureBox_Click(object sender, EventArgs e)
method LoadModes (line 726) | public void LoadModes()
method SelectLastMode (line 740) | private void SelectLastMode()
method ModeComboBox_SelectionChangeCommitted (line 752) | private void ModeComboBox_SelectionChangeCommitted(object sender, Even...
method EditModePictureBox_Click (line 764) | private void EditModePictureBox_Click(object sender, EventArgs e)
method DeleteModePictureBox_Click (line 800) | private void DeleteModePictureBox_Click(object sender, EventArgs e)
method LoadProfiles (line 822) | private void LoadProfiles()
method ProfileButton_Click (line 882) | private async void ProfileButton_Click([NotNull] object? sender, Event...
method StopAsync (line 1036) | public async Task StopAsync()
method StopCoreAsync (line 1044) | private async Task StopCoreAsync()
method IsWaiting (line 1053) | private bool IsWaiting() => IsWaiting(_state);
method IsWaiting (line 1055) | private static bool IsWaiting(State state)
method StatusText (line 1064) | public void StatusText(string? text = null)
method BandwidthState (line 1079) | public void BandwidthState(bool state)
method UpdateNatTypeStatusLabelText (line 1093) | private void UpdateNatTypeStatusLabelText(string? text, string? countr...
method ConnectivityStatusVisible (line 1112) | private void ConnectivityStatusVisible(bool visible)
method UpdateNatTypeLight (line 1124) | private void UpdateNatTypeLight(int natType = -1)
method TcpStatusLabel_Click (line 1146) | private async void TcpStatusLabel_Click(object sender, EventArgs e)
method NatTypeStatusLabel_Click (line 1151) | private async void NatTypeStatusLabel_Click(object sender, EventArgs e)
method DiscoveryNatTypeAsync (line 1158) | private async Task DiscoveryNatTypeAsync()
method HttpConnectAsync (line 1197) | private async Task HttpConnectAsync()
method SystemEvents_PowerModeChanged (line 1234) | private async void SystemEvents_PowerModeChanged(object sender, PowerM...
method Minimize (line 1261) | private void Minimize()
method Exit (line 1276) | public async void Exit(bool forceExit = false, bool saveConfiguration ...
method MainForm_FormClosing (line 1307) | private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
method CheckUpdateAsync (line 1327) | private async Task CheckUpdateAsync()
method OnBandwidthUpdated (line 1364) | public void OnBandwidthUpdated(ulong download)
method ShowMainFormToolStripButton_Click (line 1392) | private void ShowMainFormToolStripButton_Click(object sender, EventArg...
method ExitToolStripButton_Click (line 1400) | private void ExitToolStripButton_Click(object sender, EventArgs e)
method NotifyIcon_MouseDoubleClick (line 1405) | private void NotifyIcon_MouseDoubleClick(object? sender, MouseEventArg...
method NotifyTip (line 1410) | public void NotifyTip(string text, int timeout = 0, bool info = true)
method ComboBox_DrawItem (line 1425) | private void ComboBox_DrawItem(object sender, DrawItemEventArgs e)
FILE: Netch/Forms/MessageBoxX.cs
class MessageBoxX (line 6) | public static class MessageBoxX
method Show (line 15) | public static DialogResult Show(string text,
FILE: Netch/Forms/ModeForms/ModeEditorUtils.cs
class ModeEditorUtils (line 5) | public static class ModeEditorUtils
method ToSafeFileName (line 7) | public static string ToSafeFileName(string text)
method GetCustomModeRelativePath (line 16) | public static string GetCustomModeRelativePath(string name)
FILE: Netch/Forms/ModeForms/ProcessForm.Designer.cs
class ProcessForm (line 6) | partial class ProcessForm
method Dispose (line 17) | protected override void Dispose(bool disposing)
method InitializeComponent (line 32) | private void InitializeComponent()
FILE: Netch/Forms/ModeForms/ProcessForm.cs
class ProcessForm (line 12) | [Fody.ConfigureAwait(true)]
method ProcessForm (line 23) | public ProcessForm(Mode? mode = null)
method InitBindings (line 62) | private void InitBindings()
method ModeForm_Load (line 70) | public void ModeForm_Load(object sender, EventArgs e)
method SelectButton_Click (line 87) | private void SelectButton_Click(object sender, EventArgs e)
method AppendText (line 111) | private static void AppendText(Control ruleTextBox, string value)
method ControlButton_Click (line 119) | public void ControlButton_Click(object sender, EventArgs e)
method RemarkTextBox_TextChanged (line 153) | private void RemarkTextBox_TextChanged(object? sender, EventArgs? e)
method ScanButton_Click (line 164) | private void ScanButton_Click(object sender, EventArgs e)
method ScanDirectory (line 199) | private void ScanDirectory(string directory, List<string> list, uint m...
method ValidationButton_Click (line 211) | private void ValidationButton_Click(object sender, EventArgs e)
FILE: Netch/Forms/ModeForms/RouteForm.Designer.cs
class RouteForm (line 6) | partial class RouteForm
method Dispose (line 17) | protected override void Dispose(bool disposing)
method InitializeComponent (line 33) | private void InitializeComponent()
FILE: Netch/Forms/ModeForms/RouteForm.cs
class RouteForm (line 9) | [Fody.ConfigureAwait(true)]
method RouteForm (line 16) | public RouteForm(Mode? mode = null)
method Route_Load (line 43) | private void Route_Load(object sender, EventArgs e)
method ControlButton_Click (line 60) | private void ControlButton_Click(object sender, EventArgs e)
method RemarkTextBox_TextChanged (line 94) | private void RemarkTextBox_TextChanged(object? sender, EventArgs? e)
FILE: Netch/Forms/ServerForm.cs
class ServerForm (line 9) | [DesignerCategory(@"Code")]
method ServerForm (line 32) | protected ServerForm()
method ShowDialog (line 50) | public new void ShowDialog()
method Show (line 56) | public new void Show()
method AfterFactor (line 62) | private void AfterFactor()
method CreateTextBox (line 81) | protected (Label,TextBox) CreateTextBox(string name,
method CreateComboBox (line 118) | protected void CreateComboBox(string name, string remark, List<string>...
method CreateCheckBox (line 150) | protected void CreateCheckBox(string name, string remark, Action<bool>...
method AddSaveButton (line 170) | private void AddSaveButton()
method ControlButton_Click (line 186) | private void ControlButton_Click(object sender, EventArgs e)
method Dispose (line 219) | protected override void Dispose(bool disposing)
method InitializeComponent (line 227) | private void InitializeComponent()
FILE: Netch/Forms/SettingForm.Designer.cs
class SettingForm (line 5) | partial class SettingForm
method Dispose (line 16) | protected override void Dispose(bool disposing)
method InitializeComponent (line 32) | private void InitializeComponent()
FILE: Netch/Forms/SettingForm.cs
class SettingForm (line 7) | [Fody.ConfigureAwait(true)]
method SettingForm (line 10) | public SettingForm()
method SettingForm_Load (line 191) | private void SettingForm_Load(object sender, EventArgs e)
method BindTextBox (line 196) | protected override void BindTextBox<T>(TextBoxBase control, Func<T, bo...
method BindComboBox (line 212) | protected new void BindComboBox(ComboBox control, Func<string, bool> c...
method TUNTAPUseCustomDNSCheckBox_CheckedChanged (line 229) | private void TUNTAPUseCustomDNSCheckBox_CheckedChanged(object? sender,...
method GlobalBypassIPsButton_Click (line 237) | private void GlobalBypassIPsButton_Click(object sender, EventArgs e)
method ControlButton_Click (line 244) | private async void ControlButton_Click(object sender, EventArgs e)
FILE: Netch/Forms/SubscriptionForm.Designer.cs
class SubscriptionForm (line 3) | partial class SubscriptionForm
method Dispose (line 14) | protected override void Dispose(bool disposing)
method InitializeComponent (line 29) | private void InitializeComponent()
FILE: Netch/Forms/SubscriptionForm.cs
class SubscriptionForm (line 7) | [Fody.ConfigureAwait(true)]
method SubscriptionForm (line 10) | public SubscriptionForm()
method SubscriptionLinkListView_MouseUp (line 34) | private void SubscriptionLinkListView_MouseUp(object sender, MouseEven...
method SubscriptionLinkListView_SelectedIndexChanged (line 44) | private void SubscriptionLinkListView_SelectedIndexChanged(object send...
method SubscriptionLinkListView_ItemChecked (line 52) | private void SubscriptionLinkListView_ItemChecked(object sender, ItemC...
method SubscriptionForm_FormClosing (line 58) | private async void SubscriptionForm_FormClosing(object sender, FormClo...
method UnselectButton_Click (line 67) | private void UnselectButton_Click(object sender, EventArgs e)
method AddButton_Click (line 72) | private void AddButton_Click(object sender, EventArgs e)
method DeleteToolStripMenuItem_Click (line 126) | private void DeleteToolStripMenuItem_Click(object sender, EventArgs e)
method DeleteServersToolStripMenuItem_Click (line 139) | private void DeleteServersToolStripMenuItem_Click(object sender, Event...
method CopyLinkToolStripMenuItem_Click (line 147) | private void CopyLinkToolStripMenuItem_Click(object sender, EventArgs e)
method DeleteServers (line 156) | private static void DeleteServers(string group)
method RenameServers (line 161) | private static void RenameServers(string oldGroup, string newGroup)
method LoadSubscriptionLinks (line 167) | private void LoadSubscriptionLinks()
method ResetEditingGroup (line 186) | private void ResetEditingGroup()
method SetEditingGroup (line 194) | private void SetEditingGroup(int index)
FILE: Netch/Forms/SyncGlobalCheckBox.cs
class SyncGlobalCheckBox (line 3) | public class SyncGlobalCheckBox : CheckBox
method SyncGlobalCheckBox (line 5) | public SyncGlobalCheckBox()
method OnClick (line 44) | protected override void OnClick(EventArgs e)
method OnSyncGlobalChanged (line 74) | private void OnSyncGlobalChanged()
FILE: Netch/Global.cs
class Global (line 11) | public static class Global
method Global (line 33) | static Global()
method NewCustomJsonSerializerOptions (line 44) | public static JsonSerializerOptions NewCustomJsonSerializerOptions() =...
FILE: Netch/Interfaces/IController.cs
type IController (line 3) | public interface IController
method StopAsync (line 7) | public Task StopAsync();
FILE: Netch/Interfaces/IModeController.cs
type IModeController (line 6) | public interface IModeController : IController
method StartAsync (line 10) | public Task StartAsync(Socks5Server server, Mode mode);
FILE: Netch/Interfaces/IServerController.cs
type IServerController (line 6) | public interface IServerController : IController
method StartAsync (line 12) | public Task<Socks5Server> StartAsync(Server s);
class ServerControllerExtension (line 15) | public static class ServerControllerExtension
method Socks5LocalPort (line 17) | public static ushort Socks5LocalPort(this IServerController controller)
method LocalAddress (line 22) | public static string LocalAddress(this IServerController controller)
FILE: Netch/Interfaces/IServerUtil.cs
type IServerUtil (line 5) | public interface IServerUtil
method Edit (line 31) | public void Edit(Server s);
method Create (line 33) | public void Create();
method GetShareLink (line 35) | string GetShareLink(Server s);
method GetController (line 37) | public IServerController GetController();
method ParseUri (line 39) | public IEnumerable<Server> ParseUri(string text);
method CheckServer (line 41) | bool CheckServer(Server s);
FILE: Netch/Interops/AioDNS.cs
class AioDNS (line 6) | public static class AioDNS
method Dial (line 10) | public static bool Dial(NameList name, string value)
method InitAsync (line 16) | public static Task<bool> InitAsync()
method FreeAsync (line 21) | public static Task FreeAsync()
method aiodns_dial (line 26) | [DllImport(aiodns_bin, CallingConvention = CallingConvention.Cdecl)]
method Init (line 29) | [DllImport(aiodns_bin, EntryPoint = "aiodns_init", CallingConvention =...
method Free (line 32) | [DllImport(aiodns_bin, EntryPoint = "aiodns_free", CallingConvention =...
type NameList (line 35) | public enum NameList
FILE: Netch/Interops/Redirector.cs
class Redirector (line 5) | public static class Redirector
type NameList (line 7) | public enum NameList
method Dial (line 34) | public static bool Dial(NameList name, bool value)
method Dial (line 40) | public static bool Dial(NameList name, string value)
method InitAsync (line 46) | public static Task<bool> InitAsync()
method FreeAsync (line 51) | public static Task<bool> FreeAsync()
method aio_register (line 58) | [DllImport(Redirector_bin, CallingConvention = CallingConvention.Cdecl)]
method aio_unregister (line 61) | [DllImport(Redirector_bin, CallingConvention = CallingConvention.Cdecl)]
method aio_dial (line 64) | [DllImport(Redirector_bin, CallingConvention = CallingConvention.Cdecl)]
method aio_init (line 67) | [DllImport(Redirector_bin, CallingConvention = CallingConvention.Cdecl)]
method aio_free (line 70) | [DllImport(Redirector_bin, CallingConvention = CallingConvention.Cdecl)]
method aio_getUP (line 73) | [DllImport(Redirector_bin, CallingConvention = CallingConvention.Cdecl)]
method aio_getDL (line 76) | [DllImport(Redirector_bin, CallingConvention = CallingConvention.Cdecl)]
FILE: Netch/Interops/RouteHelper.cs
class RouteHelper (line 10) | public static unsafe class RouteHelper
method ConvertLuidToIndex (line 12) | [DllImport("RouteHelper.bin", CallingConvention = CallingConvention.Cd...
method CreateIPv4 (line 15) | [DllImport("RouteHelper.bin", CallingConvention = CallingConvention.Cd...
method CreateUnicastIP (line 18) | [DllImport("RouteHelper.bin", CallingConvention = CallingConvention.Cd...
method CreateUnicastIPCS (line 21) | public static bool CreateUnicastIPCS(AddressFamily inet, string addres...
method RefreshIPTable (line 102) | [DllImport("RouteHelper.bin", CallingConvention = CallingConvention.Cd...
method CreateRoute (line 105) | [DllImport("RouteHelper.bin", CallingConvention = CallingConvention.Cd...
method DeleteRoute (line 108) | [DllImport("RouteHelper.bin", CallingConvention = CallingConvention.Cd...
FILE: Netch/Interops/tun2socks.cs
class tun2socks (line 8) | public static class tun2socks
type NameList (line 10) | public enum NameList
method Dial (line 38) | public static bool Dial(NameList name, string value)
method Init (line 44) | public static bool Init()
method FreeAsync (line 50) | public static async Task<bool> FreeAsync()
method tun_dial (line 57) | [DllImport(tun2socks_bin, CallingConvention = CallingConvention.Cdecl)]
method tun_init (line 60) | [DllImport(tun2socks_bin, CallingConvention = CallingConvention.Cdecl)]
method tun_free (line 63) | [DllImport(tun2socks_bin, CallingConvention = CallingConvention.Cdecl)]
method tun_luid (line 66) | [DllImport(tun2socks_bin, CallingConvention = CallingConvention.Cdecl)]
method tun_getUP (line 69) | [DllImport(tun2socks_bin, CallingConvention = CallingConvention.Cdecl)]
method tun_getDL (line 72) | [DllImport(tun2socks_bin, CallingConvention = CallingConvention.Cdecl)]
FILE: Netch/JsonConverter/ModeConverterWithTypeDiscriminator.cs
class ModeConverterWithTypeDiscriminator (line 10) | public class ModeConverterWithTypeDiscriminator : JsonConverter<Mode>
method Read (line 12) | public override Mode? Read(ref Utf8JsonReader reader, Type typeToConve...
method Write (line 38) | public override void Write(Utf8JsonWriter writer, Mode value, JsonSeri...
FILE: Netch/JsonConverter/ServerConverterWithTypeDiscriminator.cs
class ServerConverterWithTypeDiscriminator (line 8) | public class ServerConverterWithTypeDiscriminator : JsonConverter<Server>
method Read (line 10) | public override Server Read(ref Utf8JsonReader reader, Type typeToConv...
method Write (line 17) | public override void Write(Utf8JsonWriter writer, Server value, JsonSe...
FILE: Netch/Models/Arguments.cs
class Arguments (line 5) | public static class Arguments
method Format (line 7) | public static string Format(IEnumerable<object?> a)
type SpecialArgument (line 42) | public enum SpecialArgument
FILE: Netch/Models/GitHubRelease/Asset.cs
class Asset (line 4) | public class Asset
FILE: Netch/Models/GitHubRelease/GitHubRelease.cs
class GitHubRelease (line 3) | public class GitHubRelease
method GitHubRelease (line 8) | public GitHubRelease(string owner, string repo)
FILE: Netch/Models/GitHubRelease/GitHubUser.cs
class GitHubUser (line 4) | public class GitHubUser
FILE: Netch/Models/GitHubRelease/Release.cs
class Release (line 4) | public class Release
FILE: Netch/Models/GitHubRelease/SuffixVersion.cs
type SuffixVersion (line 5) | [Serializable]
method SuffixVersion (line 14) | private SuffixVersion(Version version)
method SuffixVersion (line 21) | private SuffixVersion(Version version, string suffix, int suffixNum)
method Parse (line 28) | public static SuffixVersion Parse(string? value)
method TryParse (line 54) | public static bool TryParse(string? input, out SuffixVersion result)
method CompareTo (line 68) | public int CompareTo(object? obj)
method CompareTo (line 82) | public int CompareTo(SuffixVersion other)
method ToString (line 99) | public override string ToString()
FILE: Netch/Models/GitHubRelease/VersionUtil.cs
class VersionUtil (line 3) | public static class VersionUtil
method CompareVersion (line 7) | public static int CompareVersion(string x, string y)
class VersionComparer (line 12) | public class VersionComparer : IComparer<string>
method Compare (line 20) | public int Compare(string? x, string? y)
FILE: Netch/Models/MessageException.cs
class MessageException (line 3) | public class MessageException : Exception
method MessageException (line 5) | public MessageException()
method MessageException (line 9) | public MessageException(string message) : base(message)
FILE: Netch/Models/Modes/Mode.cs
class Mode (line 6) | public abstract class Mode
method ToString (line 18) | public override string ToString() => $"[{(int)Type + 1}] {i18NRemark}";
FILE: Netch/Models/Modes/ModeFeature.cs
type ModeFeature (line 3) | [Flags]
FILE: Netch/Models/Modes/ModeType.cs
type ModeType (line 3) | public enum ModeType
FILE: Netch/Models/Modes/ProcessMode/ProcessMode.cs
class Redirector (line 3) | public class Redirector : Mode
FILE: Netch/Models/Modes/ShareMode/ShareMode.cs
class ShareMode (line 3) | public class ShareMode : Mode
FILE: Netch/Models/Modes/TunMode/TunMode.cs
class TunMode (line 3) | public class TunMode : Mode
FILE: Netch/Models/NatTypeTestResult.cs
type NatTypeTestResult (line 3) | public struct NatTypeTestResult
FILE: Netch/Models/NetRoute.cs
type NetRoute (line 6) | public struct NetRoute
method TemplateBuilder (line 8) | public static NetRoute TemplateBuilder(string gateway, int interfaceIn...
method GetBestRouteTemplate (line 18) | public static NetRoute GetBestRouteTemplate()
method FillTemplate (line 37) | public NetRoute FillTemplate(string network, byte cidr, int? metric = ...
FILE: Netch/Models/NumberRange.cs
type NumberRange (line 3) | public readonly struct NumberRange
method NumberRange (line 9) | public NumberRange(int start, int end)
method InRange (line 15) | public bool InRange(int num)
FILE: Netch/Models/Profile.cs
class Profile (line 5) | public class Profile
method Profile (line 15) | public Profile(Server server, Mode mode, string name, int index)
method Profile (line 23) | public Profile()
FILE: Netch/Models/Server.cs
class Server (line 7) | public abstract class Server : ICloneable
method Clone (line 46) | public object Clone()
method ToString (line 55) | public override string ToString()
method MaskedData (line 64) | public abstract string MaskedData();
method PingAsync (line 70) | public async Task<int> PingAsync()
class ServerExtension (line 107) | public static class ServerExtension
method AutoResolveHostnameAsync (line 109) | public static async Task<string> AutoResolveHostnameAsync(this Server ...
method IsInGroup (line 115) | public static bool IsInGroup(this Server server)
FILE: Netch/Models/Settings/AioDNSConfig.cs
class AioDNSConfig (line 5) | public class AioDNSConfig
FILE: Netch/Models/Settings/KcpConfig.cs
class KcpConfig (line 3) | public class KcpConfig
FILE: Netch/Models/Settings/RedirectorConfig.cs
class RedirectorConfig (line 3) | public class RedirectorConfig
FILE: Netch/Models/Settings/Setting.cs
class Setting (line 8) | public class Setting
method ShallowCopy (line 162) | public Setting ShallowCopy()
method Set (line 167) | public void Set(Setting value)
FILE: Netch/Models/Settings/TUNConfig.cs
class TUNConfig (line 6) | public class TUNConfig
FILE: Netch/Models/Settings/V2rayConfig.cs
class V2rayConfig (line 3) | public class V2rayConfig
FILE: Netch/Models/StatusText.cs
class StatusPortInfoText (line 5) | public static class StatusPortInfoText
method UpdateShareLan (line 40) | public static void UpdateShareLan()
method Reset (line 45) | public static void Reset()
FILE: Netch/Models/Subscription.cs
class Subscription (line 3) | public class Subscription
FILE: Netch/Models/TagItem.cs
class TagItem (line 5) | internal class TagItem<T>
method TagItem (line 9) | public TagItem(T value, string text)
FILE: Netch/NativeMethods.cs
class NativeMethods (line 5) | public static class NativeMethods
method RefreshDNSCache (line 7) | [DllImport("dnsapi", EntryPoint = "DnsFlushResolverCache")]
FILE: Netch/Program.cs
class Program (line 20) | public static class Program
method Main (line 30) | [STAThread]
method LogEnvironmentAsync (line 112) | private static async Task LogEnvironmentAsync()
method CheckClr (line 129) | private static void CheckClr()
method CheckOS (line 152) | private static void CheckOS()
method InitConsole (line 165) | private static void InitConsole()
method CreateLogger (line 176) | public static void CreateLogger()
method Application_OnException (line 193) | private static void Application_OnException(object sender, ThreadExcep...
method Application_OnExit (line 198) | private static void Application_OnExit(object? sender, EventArgs event...
method SingleInstance_ArgumentsReceived (line 203) | private static void SingleInstance_ArgumentsReceived((string, Action<s...
FILE: Netch/Properties/Resources.Designer.cs
class Resources (line 22) | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resource...
method Resources (line 31) | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Mic...
FILE: Netch/Servers/SSH/SSHForm.cs
class SSHForm (line 5) | [Fody.ConfigureAwait(true)]
method SSHForm (line 8) | public SSHForm(SSHServer? server = default)
FILE: Netch/Servers/SSH/SSHServer.cs
class SSHServer (line 5) | public class SSHServer : Server
method MaskedData (line 9) | public override string MaskedData()
FILE: Netch/Servers/SSH/SSHUtil.cs
class SSHUtil (line 10) | public class SSHUtil : IServerUtil
method Edit (line 24) | public void Edit(Server s)
method Create (line 29) | public void Create()
method GetShareLink (line 34) | public string GetShareLink(Server s)
method GetController (line 39) | public IServerController GetController()
method ParseUri (line 44) | public IEnumerable<Server> ParseUri(string text)
method CheckServer (line 49) | public bool CheckServer(Server s)
FILE: Netch/Servers/Shadowsocks/ShadowsocksController.cs
class ShadowsocksController (line 9) | public class ShadowsocksController : Guard, IServerController
method ShadowsocksController (line 11) | public ShadowsocksController() : base("Shadowsocks.exe", encoding: Enc...
method StartAsync (line 25) | public async Task<Socks5Server> StartAsync(Server s)
FILE: Netch/Servers/Shadowsocks/ShadowsocksForm.cs
class ShadowsocksForm (line 6) | [Fody.ConfigureAwait(true)]
method ShadowsocksForm (line 9) | public ShadowsocksForm(ShadowsocksServer? server = default)
FILE: Netch/Servers/Shadowsocks/ShadowsocksServer.cs
class ShadowsocksServer (line 5) | public class ShadowsocksServer : Server
method MaskedData (line 8) | public override string MaskedData()
method HasPlugin (line 33) | public bool HasPlugin()
class SSGlobal (line 39) | public static class SSGlobal
FILE: Netch/Servers/Shadowsocks/ShadowsocksUtil.cs
class ShadowsocksUtil (line 10) | public class ShadowsocksUtil : IServerUtil
method Edit (line 24) | public void Edit(Server s)
method Create (line 29) | public void Create()
method GetShareLink (line 34) | public string GetShareLink(Server s)
method GetController (line 42) | public IServerController GetController()
method ParseUri (line 47) | public IEnumerable<Server> ParseUri(string text)
method CheckServer (line 58) | public bool CheckServer(Server s)
method ParseSsdUri (line 70) | public IEnumerable<Server> ParseSsdUri(string s)
method ParseSsUri (line 89) | public ShadowsocksServer ParseSsUri(string text)
FILE: Netch/Servers/Shadowsocks/ShareModels/SSDJObject.cs
class SSDJObject (line 4) | public class SSDJObject
FILE: Netch/Servers/Shadowsocks/ShareModels/SSDServerJObject.cs
class SSDServerJObject (line 4) | public class SSDServerJObject
FILE: Netch/Servers/Shadowsocks/ShareModels/ShadowsocksConfig.cs
class ShadowsocksConfig (line 8) | public class ShadowsocksConfig
FILE: Netch/Servers/ShadowsocksR/ShadowsocksRController.cs
class ShadowsocksRController (line 8) | public class ShadowsocksRController : Guard, IServerController
method ShadowsocksRController (line 10) | public ShadowsocksRController() : base("ShadowsocksR.exe")
method StartAsync (line 24) | public async Task<Socks5Server> StartAsync(Server s)
FILE: Netch/Servers/ShadowsocksR/ShadowsocksRForm.cs
class ShadowsocksRForm (line 6) | [Fody.ConfigureAwait(true)]
method ShadowsocksRForm (line 9) | public ShadowsocksRForm(ShadowsocksRServer? server = default)
FILE: Netch/Servers/ShadowsocksR/ShadowsocksRServer.cs
class ShadowsocksRServer (line 5) | public class ShadowsocksRServer : Server
method MaskedData (line 8) | public override string MaskedData()
class SSRGlobal (line 44) | public class SSRGlobal
FILE: Netch/Servers/ShadowsocksR/ShadowsocksRUtil.cs
class ShadowsocksRUtil (line 8) | public class ShadowsocksRUtil : IServerUtil
method Edit (line 22) | public void Edit(Server s)
method Create (line 27) | public void Create()
method GetShareLink (line 32) | public string GetShareLink(Server s)
method GetController (line 46) | public IServerController GetController()
method ParseUri (line 59) | public IEnumerable<Server> ParseUri(string text)
method CheckServer (line 140) | public bool CheckServer(Server s)
FILE: Netch/Servers/Socks5/Socks5Controller.cs
class Socks5Controller (line 5) | public class Socks5Controller : V2rayController
method StartAsync (line 9) | public override Task<Socks5Server> StartAsync(Server s)
FILE: Netch/Servers/Socks5/Socks5Form.cs
class Socks5Form (line 6) | [Fody.ConfigureAwait(true)]
method Socks5Form (line 9) | public Socks5Form(Socks5Server? server = default)
method AddressTextBoxOnTextChanged (line 33) | private void AddressTextBoxOnTextChanged(object? sender, EventArgs e)
method IsPrivateAddress (line 38) | private bool IsPrivateAddress(string address)
FILE: Netch/Servers/Socks5/Socks5Server.cs
class Socks5Server (line 5) | public class Socks5Server : Server
method MaskedData (line 26) | public override string MaskedData()
method Socks5Server (line 31) | public Socks5Server()
method Socks5Server (line 35) | public Socks5Server(string hostname, ushort port)
method Socks5Server (line 41) | public Socks5Server(string hostname, ushort port, string username, str...
method Socks5Server (line 47) | public Socks5Server(string hostname, ushort port, string remoteHostnam...
method Auth (line 52) | public bool Auth()
class SOCKSGlobal (line 58) | public class SOCKSGlobal
FILE: Netch/Servers/Socks5/Socks5Util.cs
class Socks5Util (line 6) | public class Socks5Util : IServerUtil
method Edit (line 20) | public void Edit(Server s)
method Create (line 25) | public void Create()
method GetShareLink (line 30) | public string GetShareLink(Server s)
method GetController (line 39) | public IServerController GetController()
method ParseUri (line 44) | public IEnumerable<Server> ParseUri(string text)
method CheckServer (line 70) | public bool CheckServer(Server s)
FILE: Netch/Servers/Trojan/TrojanConfig.cs
class TrojanConfig (line 4) | public class TrojanConfig
class TrojanSSL (line 46) | public class TrojanSSL
class TrojanTCP (line 74) | public class TrojanTCP
FILE: Netch/Servers/Trojan/TrojanController.cs
class TrojanController (line 10) | public class TrojanController : Guard, IServerController
method TrojanController (line 12) | public TrojanController() : base("Trojan.exe")
method StartAsync (line 26) | public async Task<Socks5Server> StartAsync(Server s)
FILE: Netch/Servers/Trojan/TrojanForm.cs
class TrojanForm (line 5) | [Fody.ConfigureAwait(true)]
method TrojanForm (line 8) | public TrojanForm(TrojanServer? server = default)
FILE: Netch/Servers/Trojan/TrojanServer.cs
class TrojanServer (line 5) | public class TrojanServer : Server
method MaskedData (line 11) | public override string MaskedData()
FILE: Netch/Servers/Trojan/TrojanUtil.cs
class TrojanUtil (line 8) | public class TrojanUtil : IServerUtil
method Edit (line 22) | public void Edit(Server s)
method Create (line 27) | public void Create()
method GetShareLink (line 32) | public string GetShareLink(Server s)
method GetController (line 38) | public IServerController GetController()
method ParseUri (line 43) | public IEnumerable<Server> ParseUri(string text)
method CheckServer (line 87) | public bool CheckServer(Server s)
FILE: Netch/Servers/V2ray/ShareModels/V2rayNJObject.cs
class V2rayNJObject (line 3) | public class V2rayNJObject
FILE: Netch/Servers/V2ray/V2rayConfig.cs
type V2rayConfig (line 6) | public struct V2rayConfig
class User (line 13) | public class User
class Outbound (line 26) | public class Outbound
class OutboundConfiguration (line 37) | public class OutboundConfiguration
class VnextItem (line 74) | public class VnextItem
class ShadowsocksServerItem (line 83) | public class ShadowsocksServerItem
class Mux (line 96) | public class Mux
class StreamSettings (line 105) | public class StreamSettings
class TlsSettings (line 132) | public class TlsSettings
class TcpSettings (line 139) | public class TcpSettings
class WsSettings (line 144) | public class WsSettings
class KcpSettings (line 151) | public class KcpSettings
class HttpSettings (line 172) | public class HttpSettings
class QuicSettings (line 179) | public class QuicSettings
class GrpcSettings (line 188) | public class GrpcSettings
class Sockopt (line 195) | public class Sockopt
FILE: Netch/Servers/V2ray/V2rayConfigUtils.cs
class V2rayConfigUtils (line 8) | public static class V2rayConfigUtils
method GenerateClientConfigAsync (line 10) | public static async Task<V2rayConfig> GenerateClientConfigAsync(Server...
method outbound (line 35) | private static async Task<Outbound> outbound(Server server)
method boundStreamSettings (line 297) | private static StreamSettings boundStreamSettings(VMessServer server)
method getUUID (line 429) | public static string getUUID(string uuid)
FILE: Netch/Servers/V2ray/V2rayController.cs
class V2rayController (line 9) | public class V2rayController : Guard, IServerController
method V2rayController (line 11) | public V2rayController() : base("v2ray-sn.exe")
method StartAsync (line 27) | public virtual async Task<Socks5Server> StartAsync(Server s)
FILE: Netch/Servers/V2ray/V2rayUtils.cs
class V2rayUtils (line 8) | public static class V2rayUtils
method ParseVUri (line 10) | public static IEnumerable<Server> ParseVUri(string text)
method GetVShareLink (line 73) | public static string GetVShareLink(Server s, string scheme = "vmess")
FILE: Netch/Servers/VLESS/VLESSForm.cs
class VLESSForm (line 5) | [Fody.ConfigureAwait(true)]
method VLESSForm (line 8) | public VLESSForm(VLESSServer? server = default)
FILE: Netch/Servers/VLESS/VLESSServer.cs
class VLESSServer (line 3) | public class VLESSServer : VMessServer
class VLESSGlobal (line 23) | public class VLESSGlobal
FILE: Netch/Servers/VLESS/VLESSUtil.cs
class VLESSUtil (line 6) | public class VLESSUtil : IServerUtil
method Edit (line 20) | public void Edit(Server s)
method Create (line 25) | public void Create()
method GetShareLink (line 30) | public string GetShareLink(Server s)
method GetController (line 35) | public IServerController GetController()
method ParseUri (line 40) | public IEnumerable<Server> ParseUri(string text)
method CheckServer (line 45) | public bool CheckServer(Server s)
FILE: Netch/Servers/VMess/VMessForm.cs
class VMessForm (line 5) | [Fody.ConfigureAwait(true)]
method VMessForm (line 8) | public VMessForm(VMessServer? server = default)
FILE: Netch/Servers/VMess/VMessServer.cs
class VMessServer (line 5) | public class VMessServer : Server
method MaskedData (line 11) | public override string MaskedData()
class VMessGlobal (line 105) | public class VMessGlobal
FILE: Netch/Servers/VMess/VMessUtil.cs
class VMessUtil (line 10) | public class VMessUtil : IServerUtil
method Edit (line 24) | public void Edit(Server s)
method Create (line 29) | public void Create()
method GetShareLink (line 34) | public string GetShareLink(Server s)
method GetController (line 67) | public IServerController GetController()
method ParseUri (line 72) | public IEnumerable<Server> ParseUri(string text)
method CheckServer (line 115) | public bool CheckServer(Server s)
FILE: Netch/Servers/WireGuard/WireGuardForm.cs
class WireGuardForm (line 5) | [Fody.ConfigureAwait(true)]
method WireGuardForm (line 8) | public WireGuardForm(WireGuardServer? server = default)
FILE: Netch/Servers/WireGuard/WireGuardServer.cs
class WireGuardServer (line 5) | public class WireGuardServer : Server
method MaskedData (line 9) | public override string MaskedData()
FILE: Netch/Servers/WireGuard/WireGuardUtil.cs
class WireGuardUtil (line 10) | public class WireGuardUtil : IServerUtil
method Edit (line 24) | public void Edit(Server s)
method Create (line 29) | public void Create()
method GetShareLink (line 34) | public string GetShareLink(Server s)
method GetController (line 39) | public IServerController GetController()
method ParseUri (line 44) | public IEnumerable<Server> ParseUri(string text)
method CheckServer (line 49) | public bool CheckServer(Server s)
FILE: Netch/Services/ModeService.cs
class ModeService (line 9) | public class ModeService
method GetRelativePath (line 15) | public string GetRelativePath(string fullName)
method GetFullPath (line 24) | public string GetFullPath(string relativeName)
method Load (line 29) | public void Load()
method LoadCore (line 37) | private void LoadCore(string modeDirectory)
method SortCollection (line 63) | private static void SortCollection()
method Add (line 70) | public void Add(Mode mode)
method Sort (line 81) | public void Sort()
method Delete (line 87) | public static void Delete(Mode mode)
method GetModeControllerByType (line 99) | public static IModeController GetModeControllerByType(ModeType type, o...
FILE: Netch/Services/Updater.cs
class Updater (line 10) | public class Updater
method Updater (line 20) | internal Updater(string updateFile, string installDirectory)
method ApplyUpdate (line 31) | internal void ApplyUpdate()
method MarkFilesOld (line 55) | private void MarkFilesOld()
method Extract (line 79) | private int Extract(string destDirName)
method MoveFilesOver (line 97) | private static void MoveFilesOver(string source, string target)
method CleanOld (line 121) | public static void CleanOld(string targetPath)
FILE: Netch/Utils/Bandwidth.cs
class Bandwidth (line 10) | public static class Bandwidth
method Compute (line 22) | public static string Compute(ulong d)
method NetTraffic (line 43) | public static void NetTraffic()
method Stop (line 122) | public static void Stop()
FILE: Netch/Utils/Configuration.cs
class Configuration (line 9) | public static class Configuration
method Configuration (line 28) | static Configuration()
method LoadAsync (line 34) | public static async Task LoadAsync()
method LoadCoreAsync (line 59) | private static async ValueTask<bool> LoadCoreAsync(string filename)
method CheckSetting (line 81) | private static void CheckSetting(Setting settings)
method SaveAsync (line 96) | public static async Task SaveAsync()
method EnsureConfigFileExistsAsync (line 125) | private static async ValueTask EnsureConfigFileExistsAsync()
FILE: Netch/Utils/DelayTestHelper.cs
class DelayTestHelper (line 7) | public static class DelayTestHelper
method DelayTestHelper (line 19) | static DelayTestHelper()
method PerformTestAsync (line 41) | public static async Task PerformTestAsync(bool waitFinish = false)
method UpdateTick (line 71) | public static void UpdateTick(bool performTestAtOnce = false)
method UpdateTick (line 78) | private static void UpdateTick(int interval, bool performTestAtOnce = ...
FILE: Netch/Utils/DnsUtils.cs
class DnsUtils (line 8) | public static class DnsUtils
method LookupAsync (line 18) | public static async Task<IPAddress?> LookupAsync(string hostname, Addr...
method LookupNoCacheAsync (line 43) | private static async Task<IPAddress?> LookupNoCacheAsync(string hostna...
method ClearCache (line 74) | public static void ClearCache()
method AppendPort (line 80) | public static string AppendPort(string host, ushort port = 53)
FILE: Netch/Utils/Firewall.cs
class Firewall (line 6) | public static class Firewall
method AddNetchFwRules (line 13) | public static void AddNetchFwRules()
method RemoveNetchFwRules (line 44) | public static void RemoveNetchFwRules()
method AddFwRule (line 63) | private static void AddFwRule(string ruleName, string exeFullPath)
FILE: Netch/Utils/ModeHelper.cs
class ModeHelper (line 12) | public static class ModeHelper
method ModeHelper (line 16) | static ModeHelper()
method LoadMode (line 24) | public static Mode LoadMode(string file)
method LoadJsonMode (line 35) | private static Mode LoadJsonMode(string file)
method WriteFile (line 43) | public static void WriteFile(this Mode mode)
method ReadTxtMode (line 49) | private static Mode ReadTxtMode(string file)
FILE: Netch/Utils/NetworkInterfaceUtils.cs
class NetworkInterfaceUtils (line 11) | public static class NetworkInterfaceUtils
method GetBest (line 13) | public static NetworkInterface GetBest(AddressFamily addressFamily = A...
method Get (line 33) | public static NetworkInterface Get(int interfaceIndex)
method Get (line 38) | public static NetworkInterface Get(Func<NetworkInterface, bool> expres...
method SetInterfaceMetric (line 43) | public static void SetInterfaceMetric(int interfaceIndex, int? metric ...
class NetworkInterfaceExtension (line 57) | public static class NetworkInterfaceExtension
method GetIndex (line 59) | public static int GetIndex(this NetworkInterface ni)
method SetDns (line 71) | public static void SetDns(this NetworkInterface ni, string primaryDns,...
FILE: Netch/Utils/PortHelper.cs
class PortHelper (line 12) | public static class PortHelper
method PortHelper (line 18) | static PortHelper()
method GetProcessByUsedTcpPort (line 31) | internal static IEnumerable<Process> GetProcessByUsedTcpPort(ushort po...
method GetReservedPortRange (line 73) | private static void GetReservedPortRange(PortType portType, ref List<N...
method CheckPort (line 109) | public static void CheckPort(ushort port, PortType type = PortType.Both)
method CheckPortInUse (line 124) | private static void CheckPortInUse(ushort port, PortType type)
method CheckPortReserved (line 150) | private static void CheckPortReserved(ushort port, PortType type)
method GetAvailablePort (line 174) | public static ushort GetAvailablePort(PortType portType = PortType.Both)
type PortType (line 198) | [Flags]
class PortInUseException (line 206) | public class PortInUseException : Exception
method PortInUseException (line 208) | public PortInUseException(string message) : base(message)
method PortInUseException (line 212) | public PortInUseException()
class PortReservedException (line 217) | public class PortReservedException : Exception
method PortReservedException (line 219) | public PortReservedException(string message) : base(message)
method PortReservedException (line 223) | public PortReservedException()
FILE: Netch/Utils/RouteUtils.cs
class RouteUtils (line 9) | public static class RouteUtils
method CreateRouteFill (line 11) | public static void CreateRouteFill(NetRoute template, IEnumerable<stri...
method CreateRouteFill (line 17) | public static bool CreateRouteFill(NetRoute template, string rule, int...
method CreateRoute (line 28) | public static bool CreateRoute(NetRoute o)
method DeleteRouteFill (line 45) | public static void DeleteRouteFill(NetRoute template, IEnumerable<stri...
method DeleteRouteFill (line 51) | public static bool DeleteRouteFill(NetRoute template, string rule, int...
method DeleteRoute (line 62) | public static bool DeleteRoute(NetRoute o)
method TryParseIPNetwork (line 79) | public static bool TryParseIPNetwork(string ipNetwork, [NotNullWhen(tr...
FILE: Netch/Utils/ServerHelper.cs
class ServerHelper (line 6) | public static class ServerHelper
method ServerHelper (line 8) | static ServerHelper()
method GetUtilByTypeName (line 19) | public static IServerUtil GetUtilByTypeName(string typeName)
method GetUtilByUriScheme (line 24) | public static IServerUtil? GetUtilByUriScheme(string scheme)
method GetTypeByTypeName (line 29) | public static Type GetTypeByTypeName(string typeName)
FILE: Netch/Utils/ShareLink.cs
class ShareLink (line 9) | public static class ShareLink
method GetShareLink (line 11) | public static string GetShareLink(Server server)
method ParseText (line 16) | public static List<Server> ParseText(string text)
method ParseUri (line 64) | private static IEnumerable<Server> ParseUri(in string text)
method GetUriScheme (line 92) | public static string GetUriScheme(string text)
method ParseNetchUri (line 101) | private static Server ParseNetchUri(string text)
method GetNetchLink (line 120) | public static string GetNetchLink(Server s)
method URLSafeBase64Decode (line 134) | public static string URLSafeBase64Decode(string text)
method URLSafeBase64Encode (line 145) | public static string URLSafeBase64Encode(string text)
method RemoveEmoji (line 150) | private static string RemoveEmoji(string text)
method UnBase64String (line 161) | public static string UnBase64String(string value)
method ToBase64String (line 170) | public static string ToBase64String(string value)
method ParseParam (line 179) | public static Dictionary<string, string> ParseParam(string paramStr)
method GetLines (line 195) | public static IEnumerable<string> GetLines(this string str, bool remov...
FILE: Netch/Utils/Socks5ServerTestUtils.cs
class Socks5ServerTestUtils (line 13) | public static class Socks5ServerTestUtils
method DiscoveryNatTypeAsync (line 15) | public static async Task<NatTypeTestResult> DiscoveryNatTypeAsync(Sock...
method GetSimpleResult (line 62) | private static string GetSimpleResult(StunResult5389 res)
method HttpConnectAsync (line 83) | public static async Task<int?> HttpConnectAsync(Socks5Server socks5, C...
FILE: Netch/Utils/StringExtension.cs
class StringExtension (line 6) | public static class StringExtension
method IsNullOrEmpty (line 8) | public static bool IsNullOrEmpty(this string? value)
method IsNullOrWhiteSpace (line 13) | public static bool IsNullOrWhiteSpace(this string? value)
method BeginWithAny (line 18) | public static bool BeginWithAny(this string s, IEnumerable<char> chars)
method IsWhiteSpace (line 26) | public static bool IsWhiteSpace(this string value)
method NonWhiteSpaceLines (line 31) | public static IEnumerable<string> NonWhiteSpaceLines(this TextReader r...
method ToRegexString (line 43) | public static string ToRegexString(this string value)
method SplitRemoveEmptyEntriesAndTrimEntries (line 58) | public static string[] SplitRemoveEmptyEntriesAndTrimEntries(this stri...
method SplitTrimEntries (line 63) | public static string[] SplitTrimEntries(this string value, params char...
method SplitRemoveEmptyEntries (line 68) | public static string[] SplitRemoveEmptyEntries(this string value, para...
method ValueOrDefault (line 73) | public static string? ValueOrDefault(this string? value, string? defau...
method SplitOrDefault (line 78) | public static string[]? SplitOrDefault(this string? value)
method GenerateUUIDv5 (line 83) | public static string GenerateUUIDv5(this string str)
FILE: Netch/Utils/SubscriptionUtil.cs
class SubscriptionUtil (line 6) | public static class SubscriptionUtil
method UpdateServersAsync (line 10) | public static Task UpdateServersAsync(string? proxyServer = default)
method UpdateServerCoreAsync (line 15) | private static async Task UpdateServerCoreAsync(Subscription item, str...
FILE: Netch/Utils/SystemInfo.cs
class SystemInfo (line 6) | public static class SystemInfo
method SystemDrivers (line 8) | public static IEnumerable<string> SystemDrivers(bool allDriver)
method Processes (line 29) | public static IEnumerable<string> Processes(bool mask)
FILE: Netch/Utils/Utils.cs
class Utils (line 13) | public static class Utils
method Open (line 15) | public static void Open(string path)
method TCPingAsync (line 32) | public static async Task<int> TCPingAsync(IPAddress ip, int port, int ...
method ICMPingAsync (line 52) | public static async Task<int> ICMPingAsync(IPAddress ip, int timeout =...
method GetCityCodeAsync (line 62) | public static async Task<string> GetCityCodeAsync(string address)
method Sha256CheckSumAsync (line 95) | public static async Task<string> Sha256CheckSumAsync(string filePath)
method Sha256ComputeCoreAsync (line 112) | private static async Task<string> Sha256ComputeCoreAsync(Stream stream)
method GetFileVersion (line 119) | public static string GetFileVersion(string file)
method DrawCenterComboBox (line 127) | public static void DrawCenterComboBox(object sender, DrawItemEventArgs e)
method ComponentIterator (line 145) | public static void ComponentIterator(in Component component, in Action...
method RegisterNetchStartupItem (line 184) | public static void RegisterNetchStartupItem()
method ChangeControlForeColor (line 221) | public static void ChangeControlForeColor(Component component, Color c...
method SubnetToCidr (line 234) | public static int SubnetToCidr(string value)
method SubnetToCidr (line 240) | public static int SubnetToCidr(IPAddress subnet)
method GetHostFromUri (line 245) | public static string GetHostFromUri(string str)
method ActivateVisibleWindows (line 255) | public static void ActivateVisibleWindows()
FILE: Netch/Utils/WebUtil.cs
class WebUtil (line 7) | public static class WebUtil
method WebUtil (line 12) | static WebUtil()
method CreateRequest (line 19) | public static HttpWebRequest CreateRequest(string url, int? timeout = ...
method DownloadBytesAsync (line 31) | public static async Task<byte[]> DownloadBytesAsync(HttpWebRequest req)
method DownloadStringAsync (line 46) | public static async Task<(HttpStatusCode, string)> DownloadStringAsync...
method DownloadFileAsync (line 60) | public static Task DownloadFileAsync(string address, string fileFullPa...
method DownloadFileAsync (line 65) | public static async Task DownloadFileAsync(HttpWebRequest req, string ...
method ReportProgressAsync (line 85) | private static async Task ReportProgressAsync(long total, IAsyncResult...
FILE: Netch/Utils/i18N.cs
class i18N (line 9) | public static class i18N
method i18N (line 11) | static i18N()
method Load (line 27) | public static void Load(string value)
method GetLanguage (line 67) | private static string GetLanguage(string culture)
method Translate (line 80) | public static string Translate(params object[] text)
method TranslateFormat (line 92) | public static string TranslateFormat(string format, params object[] args)
method GetTranslateList (line 101) | public static List<string> GetTranslateList()
method TranslateForm (line 112) | public static void TranslateForm(in Control c)
FILE: Other/aiodns/main.go
constant TYPE_REST (line 17) | TYPE_REST = iota
constant TYPE_LIST (line 18) | TYPE_LIST
constant TYPE_LISN (line 19) | TYPE_LISN
constant TYPE_CDNS (line 20) | TYPE_CDNS
constant TYPE_ODNS (line 21) | TYPE_ODNS
function aiodns_dial (line 39) | func aiodns_dial(name int, value *C.char) bool {
function aiodns_init (line 92) | func aiodns_init() bool {
function aiodns_free (line 132) | func aiodns_free() {
function handleServerName (line 146) | func handleServerName(w dns.ResponseWriter, m *dns.Msg) {
function handleChinaDNS (line 163) | func handleChinaDNS(w dns.ResponseWriter, m *dns.Msg) {
function handleOtherDNS (line 172) | func handleOtherDNS(w dns.ResponseWriter, m *dns.Msg) {
function main (line 181) | func main() {
FILE: Redirector/Based.h
type AIO_TYPE (line 28) | typedef enum _AIO_TYPE {
FILE: Redirector/DNSHandler.cpp
function HandleClientDNS (line 11) | void HandleClientDNS(ENDPOINT_ID id, PSOCKADDR_IN6 target, char* packet,...
function HandleRemoteDNS (line 56) | void HandleRemoteDNS(ENDPOINT_ID id, PSOCKADDR_IN6 target, char* packet,...
FILE: Redirector/DNSHandler.h
function namespace (line 6) | namespace DNSHandler
FILE: Redirector/EventHandler.cpp
function wstring (line 26) | wstring ConvertIP(PSOCKADDR addr)
function wstring (line 43) | wstring GetProcessName(DWORD id)
function checkBypassName (line 73) | bool checkBypassName(DWORD id)
function checkHandleName (line 88) | bool checkHandleName(DWORD id)
function eh_init (line 142) | bool eh_init()
function eh_free (line 155) | void eh_free()
function threadStart (line 169) | void threadStart()
function threadEnd (line 174) | void threadEnd()
function tcpConnectRequest (line 179) | void tcpConnectRequest(ENDPOINT_ID id, PNF_TCP_CONN_INFO info)
function tcpConnected (line 244) | void tcpConnected(ENDPOINT_ID id, PNF_TCP_CONN_INFO info)
function tcpCanSend (line 249) | void tcpCanSend(ENDPOINT_ID id)
function tcpSend (line 254) | void tcpSend(ENDPOINT_ID id, const char* buffer, int length)
function tcpCanReceive (line 261) | void tcpCanReceive(ENDPOINT_ID id)
function tcpReceive (line 266) | void tcpReceive(ENDPOINT_ID id, const char* buffer, int length)
function tcpClosed (line 273) | void tcpClosed(ENDPOINT_ID id, PNF_TCP_CONN_INFO info)
function udpCreated (line 283) | void udpCreated(ENDPOINT_ID id, PNF_UDP_CONN_INFO info)
function udpConnectRequest (line 321) | void udpConnectRequest(ENDPOINT_ID id, PNF_UDP_CONN_REQUEST info)
function udpCanSend (line 327) | void udpCanSend(ENDPOINT_ID id)
function udpSend (line 332) | void udpSend(ENDPOINT_ID id, const unsigned char* target, const char* bu...
function udpCanReceive (line 382) | void udpCanReceive(ENDPOINT_ID id)
function udpReceive (line 387) | void udpReceive(ENDPOINT_ID id, const unsigned char* target, const char*...
function udpClosed (line 392) | void udpClosed(ENDPOINT_ID id, PNF_UDP_CONN_INFO info)
function udpReceiveHandler (line 407) | void udpReceiveHandler(ENDPOINT_ID id, SocksHelper::PUDP remote, PNF_UDP...
FILE: Redirector/IPEventHandler.cpp
function USHORT (line 5) | USHORT IPv4Checksum(PBYTE buffer, ULONG64 size)
function USHORT (line 26) | USHORT ICMPChecksum(PBYTE buffer, ULONG64 size)
function ipSend (line 45) | void ipSend(const char* buffer, int length, PNF_IP_PACKET_OPTIONS options)
function ipReceive (line 89) | void ipReceive(const char* buffer, int length, PNF_IP_PACKET_OPTIONS opt...
FILE: Redirector/Redirector.cpp
function BOOL (line 56) | BOOL APIENTRY DllMain(HMODULE hModule, DWORD dwReason, LPVOID lpReserved)
function BOOL (line 66) | __declspec(dllexport) BOOL __cdecl aio_register(LPWSTR value)
function BOOL (line 78) | __declspec(dllexport) BOOL __cdecl aio_unregister(LPWSTR value)
function BOOL (line 90) | __declspec(dllexport) BOOL __cdecl aio_dial(int name, LPWSTR value)
function BOOL (line 175) | __declspec(dllexport) BOOL __cdecl aio_init()
function aio_free (line 321) | __declspec(dllexport) void __cdecl aio_free()
function ULONG64 (line 331) | __declspec(dllexport) ULONG64 __cdecl aio_getUP()
function ULONG64 (line 336) | __declspec(dllexport) ULONG64 __cdecl aio_getDL()
FILE: Redirector/SocksHelper.cpp
function SOCKET (line 10) | SOCKET SocksHelper::Connect()
FILE: Redirector/SocksHelper.h
function namespace (line 6) | namespace SocksHelper
FILE: Redirector/TCPHandler.h
function namespace (line 7) | namespace TCPHandler
FILE: Redirector/Utils.cpp
function string (line 3) | string ws2s(wstring str)
function wstring (line 16) | wstring s2ws(string str)
FILE: Redirector/include/nfapi.h
type NF_FLAGS (line 44) | typedef enum _NF_FLAGS
FILE: Redirector/include/nfdriver.h
type NF_DATA_CODE (line 21) | typedef enum _NF_DATA_CODE
type NF_DIRECTION (line 63) | typedef enum _NF_DIRECTION
type NF_FILTERING_FLAG (line 70) | typedef enum _NF_FILTERING_FLAG
type NF_PORT_RANGE (line 144) | typedef struct _NF_PORT_RANGE
type ENDPOINT_ID (line 190) | typedef unsigned __int64 ENDPOINT_ID;
type NF_IP_FLAG (line 251) | typedef enum _NF_IP_FLAG
type NF_IP_PACKET_OPTIONS (line 261) | typedef struct _NF_IP_PACKET_OPTIONS
type NF_DRIVER_TYPE (line 357) | typedef enum _NF_DRIVER_TYPE
FILE: Redirector/include/nfevents.h
type NF_STATUS (line 19) | typedef enum _NF_STATUS
function class (line 46) | class NF_EventHandler
function class (line 191) | class NF_IPEventHandler
type NF_EventHandler (line 234) | typedef struct _NF_EventHandler
type NF_IPEventHandler (line 255) | typedef struct _NF_IPEventHandler
FILE: RedirectorTester/RedirectorTester.cs
class RedirectorTester (line 6) | public class RedirectorTester
type NameList (line 8) | public enum NameList : int
method aio_register (line 33) | [DllImport("Redirector.bin", CallingConvention = CallingConvention.Cde...
method aio_unregister (line 36) | [DllImport("Redirector.bin", CallingConvention = CallingConvention.Cde...
method aio_dial (line 39) | [DllImport("Redirector.bin", CallingConvention = CallingConvention.Cde...
method aio_init (line 42) | [DllImport("Redirector.bin", CallingConvention = CallingConvention.Cde...
method aio_free (line 45) | [DllImport("Redirector.bin", CallingConvention = CallingConvention.Cde...
method aio_getUP (line 48) | [DllImport("Redirector.bin", CallingConvention = CallingConvention.Cde...
method aio_getDL (line 51) | [DllImport("Redirector.bin", CallingConvention = CallingConvention.Cde...
method Main (line 54) | public static void Main(string[] args)
FILE: RouteHelper/RouteHelper.cpp
function BOOL (line 4) | BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID ...
function UnicastIPChangeCallback (line 14) | void UnicastIPChangeCallback(PVOID ctx, PMIB_UNICASTIPADDRESS_ROW row, M...
function make (line 23) | bool make(PMIB_IPFORWARD_ROW2 rule, USHORT inet, const char* address, UI...
function ULONG (line 71) | __declspec(dllexport) ULONG __cdecl ConvertLuidToIndex(ULONG64 id)
function WaitForUnicastIP (line 85) | __declspec(dllexport) void __cdecl WaitForUnicastIP()
function BOOL (line 97) | __declspec(dllexport) BOOL __cdecl CreateIPv4(const char* address, const...
function BOOL (line 116) | __declspec(dllexport) BOOL __cdecl CreateUnicastIP(USHORT inet, const ch...
function BOOL (line 148) | __declspec(dllexport) BOOL __cdecl CreateRoute(USHORT inet, const char* ...
function BOOL (line 161) | __declspec(dllexport) BOOL __cdecl DeleteRoute(USHORT inet, const char* ...
FILE: RouteHelper/WaitGroup.h
function class (line 6) | class WaitGroup {
FILE: Tests/Global.cs
class Global (line 10) | [TestClass]
method Test (line 13) | [TestMethod]
method VLESS_UUID5 (line 18) | [TestMethod]
Condensed preview — 336 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (2,805K chars).
[
{
"path": ".github/ISSUE_TEMPLATE/bug_report.yml",
"chars": 1135,
"preview": "name: Bug report\r\ndescription: Create a report to help us improve\r\nlabels: bug\r\nbody:\r\n - type: textarea\r\n id: error"
},
{
"path": ".github/ISSUE_TEMPLATE/bug_report.zh-CN.yml",
"chars": 916,
"preview": "name: 错误报告\r\ndescription: 创建错误报告以帮助我们改进\r\nlabels: bug\r\nbody:\r\n - type: textarea\r\n id: error\r\n attributes:\r\n la"
},
{
"path": ".github/ISSUE_TEMPLATE/config.yml",
"chars": 229,
"preview": "blank_issues_enabled: false\r\ncontact_links:\r\n - name: Telegram Channel\r\n url: https://t.me/netch_channel\r\n about:"
},
{
"path": ".github/ISSUE_TEMPLATE/feature_request.yml",
"chars": 320,
"preview": "name: Feature request\r\ndescription: Suggest an idea for this project\r\nlabels: enhancement\r\nbody:\r\n - type: textarea\r\n "
},
{
"path": ".github/ISSUE_TEMPLATE/feature_request.zh-CN.yml",
"chars": 214,
"preview": "name: 功能请求\r\ndescription: 建议这个项目的想法\r\nlabels: enhancement\r\nbody:\r\n - type: textarea\r\n id: description\r\n attributes:"
},
{
"path": ".github/dependabot.yml",
"chars": 541,
"preview": "version: 2\r\nupdates:\r\n - package-ecosystem: \"github-actions\"\r\n directory: \"/\"\r\n schedule:\r\n interval: \"daily"
},
{
"path": ".github/workflows/build.yml",
"chars": 3088,
"preview": "name: Netch Build CI\r\non: [push, pull_request]\r\n\r\njobs:\r\n build:\r\n name: Build\r\n runs-on: windows-2022\r\n steps"
},
{
"path": ".github/workflows/release.yml",
"chars": 3859,
"preview": "name: Netch Release CI\r\non:\r\n push:\r\n tags:\r\n - '*.*.*'\r\n\r\njobs:\r\n build:\r\n name: Build\r\n runs-on: windo"
},
{
"path": ".github/workflows/stale.yml",
"chars": 622,
"preview": "name: Close stale issues and PRs\non:\n schedule:\n - cron: \"0 0 * * *\"\n\njobs:\n close-issues:\n runs-on: ubuntu-late"
},
{
"path": ".gitignore",
"chars": 49,
"preview": "/.vs\r\n/.idea\r\n/release\r\n/packages\r\n/TestResults\r\n"
},
{
"path": "LICENSE",
"chars": 35148,
"preview": " GNU GENERAL PUBLIC LICENSE\n Version 3, 29 June 2007\n\n Copyright (C) 2007 Free "
},
{
"path": "Netch/.gitignore",
"chars": 40,
"preview": "/bin\n/obj\n/*.csproj.user\nFodyWeavers.xsd"
},
{
"path": "Netch/App.manifest",
"chars": 1179,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<assembly manifestVersion=\"1.0\" xmlns=\"urn:schemas-microsoft-com:asm.v1\" xmlns:"
},
{
"path": "Netch/Constants.cs",
"chars": 1006,
"preview": "namespace Netch;\n\npublic static class Constants\n{\n public const string TempConfig = \"data\\\\last.json\";\n public co"
},
{
"path": "Netch/Controllers/DNSController.cs",
"chars": 819,
"preview": "using Netch.Interfaces;\nusing Netch.Models;\nusing static Netch.Interops.AioDNS;\n\nnamespace Netch.Controllers;\n\npublic c"
},
{
"path": "Netch/Controllers/Guard.cs",
"chars": 5008,
"preview": "using System.Diagnostics;\nusing System.Text;\nusing Microsoft.VisualStudio.Threading;\nusing Netch.Enums;\nusing Netch.Mode"
},
{
"path": "Netch/Controllers/MainController.cs",
"chars": 6371,
"preview": "using System.Diagnostics;\nusing Microsoft.VisualStudio.Threading;\nusing Netch.Interfaces;\nusing Netch.Models;\nusing Netc"
},
{
"path": "Netch/Controllers/NFController.cs",
"chars": 7830,
"preview": "using System.Net;\nusing System.ServiceProcess;\nusing Netch.Interfaces;\nusing Netch.Models;\nusing Netch.Models.Modes;\nus"
},
{
"path": "Netch/Controllers/PcapController.cs",
"chars": 2635,
"preview": "using System.Text;\nusing Microsoft.VisualStudio.Threading;\nusing Netch.Forms;\nusing Netch.Interfaces;\nusing Netch.Model"
},
{
"path": "Netch/Controllers/TUNController.cs",
"chars": 7216,
"preview": "using System.Net;\nusing System.Net.NetworkInformation;\nusing System.Net.Sockets;\nusing Netch.Interfaces;\nusing Netch.In"
},
{
"path": "Netch/Controllers/UpdateChecker.cs",
"chars": 3473,
"preview": "using System.Net;\nusing System.Text;\nusing System.Text.Json;\nusing System.Text.RegularExpressions;\nusing Netch.Models.G"
},
{
"path": "Netch/Enums/LogLevel.cs",
"chars": 81,
"preview": "namespace Netch.Enums;\n\npublic enum LogLevel\n{\n INFO,\n WARNING,\n ERROR\n}"
},
{
"path": "Netch/Enums/State.cs",
"chars": 716,
"preview": "namespace Netch.Enums;\n\n/// <summary>\n/// 状态\n/// </summary>\npublic enum State\n{\n /// <summary>\n /// 等待命令中"
},
{
"path": "Netch/Flags.cs",
"chars": 254,
"preview": "namespace Netch;\n\npublic static class Flags\n{\n public static readonly bool IsWindows10Upper = Environment.OSVersion."
},
{
"path": "Netch/FodyWeavers.xml",
"chars": 144,
"preview": "<Weavers xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"FodyWeavers.xsd\">\n <Conf"
},
{
"path": "Netch/Forms/AboutForm.Designer.cs",
"chars": 3760,
"preview": "namespace Netch.Forms\n{\n partial class AboutForm\n {\n /// <summary>\n /// Required designer variable."
},
{
"path": "Netch/Forms/AboutForm.cs",
"chars": 768,
"preview": "using Netch.Properties;\nusing Netch.Utils;\n\nnamespace Netch.Forms;\n\n[Fody.ConfigureAwait(true)]\npublic partial class Ab"
},
{
"path": "Netch/Forms/AboutForm.resx",
"chars": 2755,
"preview": "<root>\n <xsd:schema id=\"root\" xmlns=\"\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:msdata=\"urn:schemas-microsof"
},
{
"path": "Netch/Forms/BindingForm.cs",
"chars": 3297,
"preview": "using Netch.Models;\n\nnamespace Netch.Forms;\n\n[Fody.ConfigureAwait(true)]\npublic class BindingForm : Form\n{\n // valid"
},
{
"path": "Netch/Forms/GlobalBypassIPForm.Designer.cs",
"chars": 6585,
"preview": "namespace Netch.Forms\n{\n partial class GlobalBypassIPForm\n {\n /// <summary>\n /// Required designer "
},
{
"path": "Netch/Forms/GlobalBypassIPForm.cs",
"chars": 1719,
"preview": "using System.Net;\nusing Netch.Properties;\nusing Netch.Utils;\n\nnamespace Netch.Forms;\n\n[Fody.ConfigureAwait(true)]\npubli"
},
{
"path": "Netch/Forms/LogForm.Designer.cs",
"chars": 3425,
"preview": "using System.ComponentModel;\n\nnamespace Netch.Forms\n{\n partial class LogForm\n {\n /// <summary>\n ///"
},
{
"path": "Netch/Forms/LogForm.cs",
"chars": 2268,
"preview": "using System.ComponentModel;\nusing Windows.Win32.Foundation;\nusing Windows.Win32.UI.WindowsAndMessaging;\nusing static W"
},
{
"path": "Netch/Forms/LogForm.resx",
"chars": 2755,
"preview": "<root>\n <xsd:schema id=\"root\" xmlns=\"\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:msdata=\"urn:schemas-microsof"
},
{
"path": "Netch/Forms/MainForm.Designer.cs",
"chars": 50592,
"preview": "namespace Netch.Forms\n{\n partial class MainForm\n {\n /// <summary>\n /// Required designer variable.\n"
},
{
"path": "Netch/Forms/MainForm.cs",
"chars": 42859,
"preview": "using System.ComponentModel;\nusing System.Diagnostics;\nusing System.Diagnostics.CodeAnalysis;\nusing Windows.Win32;\nusing"
},
{
"path": "Netch/Forms/MainForm.resx",
"chars": 3538,
"preview": "<root>\n <xsd:schema id=\"root\" xmlns=\"\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:msdata=\"urn:schemas-microsof"
},
{
"path": "Netch/Forms/MessageBoxX.cs",
"chars": 1384,
"preview": "using Netch.Enums;\nusing Netch.Utils;\n\nnamespace Netch.Forms;\n\npublic static class MessageBoxX\n{\n /// <summary>\n "
},
{
"path": "Netch/Forms/ModeForms/ModeEditorUtils.cs",
"chars": 622,
"preview": "using System.Text;\n\nnamespace Netch.Forms.ModeForms;\n\npublic static class ModeEditorUtils\n{\n public static string To"
},
{
"path": "Netch/Forms/ModeForms/ProcessForm.Designer.cs",
"chars": 37576,
"preview": "using System;\nusing System.Windows.Forms;\n\nnamespace Netch.Forms.ModeForms\n{\n partial class ProcessForm\n {\n "
},
{
"path": "Netch/Forms/ModeForms/ProcessForm.cs",
"chars": 7745,
"preview": "using System.Net;\nusing Netch.Controllers;\nusing Netch.Enums;\nusing Netch.Models.Modes;\nusing Netch.Models.Modes.Proces"
},
{
"path": "Netch/Forms/ModeForms/ProcessForm.resx",
"chars": 2755,
"preview": "<root>\n <xsd:schema id=\"root\" xmlns=\"\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:msdata=\"urn:schemas-microsof"
},
{
"path": "Netch/Forms/ModeForms/RouteForm.Designer.cs",
"chars": 21676,
"preview": "using System.ComponentModel;\nusing Netch.Properties;\n\nnamespace Netch.Forms.ModeForms\n{\n partial class RouteForm\n "
},
{
"path": "Netch/Forms/ModeForms/RouteForm.cs",
"chars": 3042,
"preview": "using Netch.Models.Modes;\nusing Netch.Models.Modes.TunMode;\nusing Netch.Properties;\nusing Netch.Services;\nusing Netch.U"
},
{
"path": "Netch/Forms/ModeForms/RouteForm.resx",
"chars": 2755,
"preview": "<root>\n <xsd:schema id=\"root\" xmlns=\"\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:msdata=\"urn:schemas-microsof"
},
{
"path": "Netch/Forms/ServerForm.cs",
"chars": 10254,
"preview": "#nullable disable\nusing System.ComponentModel;\nusing Netch.Models;\nusing Netch.Properties;\nusing Netch.Utils;\n\nnamespac"
},
{
"path": "Netch/Forms/SettingForm.Designer.cs",
"chars": 62217,
"preview": "using System.ComponentModel;\n\nnamespace Netch.Forms\n{\n partial class SettingForm\n {\n /// <summary>\n "
},
{
"path": "Netch/Forms/SettingForm.cs",
"chars": 11201,
"preview": "using System.Net;\nusing Netch.Properties;\nusing Netch.Utils;\n\nnamespace Netch.Forms;\n\n[Fody.ConfigureAwait(true)]\npublic"
},
{
"path": "Netch/Forms/SettingForm.resx",
"chars": 2953,
"preview": "<root>\n <xsd:schema id=\"root\" xmlns=\"\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:msdata=\"urn:schemas-microsof"
},
{
"path": "Netch/Forms/SubscriptionForm.Designer.cs",
"chars": 14588,
"preview": "namespace Netch.Forms\n{\n partial class SubscriptionForm\n {\n /// <summary>\n /// Required designer va"
},
{
"path": "Netch/Forms/SubscriptionForm.cs",
"chars": 6101,
"preview": "using Netch.Models;\nusing Netch.Properties;\nusing Netch.Utils;\n\nnamespace Netch.Forms;\n\n[Fody.ConfigureAwait(true)]\npub"
},
{
"path": "Netch/Forms/SubscriptionForm.resx",
"chars": 2957,
"preview": "<root>\n <xsd:schema id=\"root\" xmlns=\"\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:msdata=\"urn:schemas-microsof"
},
{
"path": "Netch/Forms/SyncGlobalCheckBox.cs",
"chars": 1657,
"preview": "namespace Netch.Forms;\n\npublic class SyncGlobalCheckBox : CheckBox\n{\n public SyncGlobalCheckBox()\n {\n Auto"
},
{
"path": "Netch/Global.cs",
"chars": 1242,
"preview": "using System.Text.Encodings.Web;\nusing System.Text.Json;\nusing System.Text.Json.Serialization;\nusing Netch.Forms;\nusing "
},
{
"path": "Netch/Interfaces/IController.cs",
"chars": 124,
"preview": "namespace Netch.Interfaces;\n\npublic interface IController\n{\n public string Name { get; }\n\n public Task StopAsync("
},
{
"path": "Netch/Interfaces/IModeController.cs",
"chars": 229,
"preview": "using Netch.Models.Modes;\nusing Netch.Servers;\n\nnamespace Netch.Interfaces;\n\npublic interface IModeController : IControl"
},
{
"path": "Netch/Interfaces/IServerController.cs",
"chars": 648,
"preview": "using Netch.Models;\nusing Netch.Servers;\n\nnamespace Netch.Interfaces;\n\npublic interface IServerController : IController"
},
{
"path": "Netch/Interfaces/IServerUtil.cs",
"chars": 761,
"preview": "using Netch.Models;\n\nnamespace Netch.Interfaces;\n\npublic interface IServerUtil\n{\n /// <summary>\n /// Collecti"
},
{
"path": "Netch/Interops/AioDNS.cs",
"chars": 1080,
"preview": "using System.Runtime.InteropServices;\nusing System.Text;\n\nnamespace Netch.Interops;\n\npublic static class AioDNS\n{\n pr"
},
{
"path": "Netch/Interops/Redirector.cs",
"chars": 2178,
"preview": "using System.Runtime.InteropServices;\n\nnamespace Netch.Interops;\n\npublic static class Redirector\n{\n public enum NameL"
},
{
"path": "Netch/Interops/RouteHelper.cs",
"chars": 3992,
"preview": "using System.Net.Sockets;\nusing System.Runtime.InteropServices;\nusing Windows.Win32.Foundation;\nusing Windows.Win32.Netw"
},
{
"path": "Netch/Interops/tun2socks.cs",
"chars": 2192,
"preview": "using System.Runtime.InteropServices;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Serilog;\n\nnamespace Netch.I"
},
{
"path": "Netch/JsonConverter/ModeConverterWithTypeDiscriminator.cs",
"chars": 1527,
"preview": "using System.Text.Json;\nusing System.Text.Json.Serialization;\nusing Netch.Models.Modes;\nusing Netch.Models.Modes.Proces"
},
{
"path": "Netch/JsonConverter/ServerConverterWithTypeDiscriminator.cs",
"chars": 743,
"preview": "using System.Text.Json;\nusing System.Text.Json.Serialization;\nusing Netch.Models;\nusing Netch.Utils;\n\nnamespace Netch.J"
},
{
"path": "Netch/Models/Arguments.cs",
"chars": 1143,
"preview": "using Netch.Utils;\n\nnamespace Netch.Models;\n\npublic static class Arguments\n{\n public static string Format(IEnumerable"
},
{
"path": "Netch/Models/GitHubRelease/Asset.cs",
"chars": 624,
"preview": "#nullable disable\nnamespace Netch.Models.GitHubRelease;\n\npublic class Asset\n{\n public string url { get; set; }\n\n "
},
{
"path": "Netch/Models/GitHubRelease/GitHubRelease.cs",
"chars": 348,
"preview": "namespace Netch.Models.GitHubRelease;\n\npublic class GitHubRelease\n{\n private readonly string _owner;\n private rea"
},
{
"path": "Netch/Models/GitHubRelease/GitHubUser.cs",
"chars": 869,
"preview": "#nullable disable\nnamespace Netch.Models.GitHubRelease;\n\npublic class GitHubUser\n{\n public string login { get; set; "
},
{
"path": "Netch/Models/GitHubRelease/Release.cs",
"chars": 838,
"preview": "#nullable disable\nnamespace Netch.Models.GitHubRelease;\n\npublic class Release\n{\n public string url { get; set; }\n\n "
},
{
"path": "Netch/Models/GitHubRelease/SuffixVersion.cs",
"chars": 2782,
"preview": "using System.Text.RegularExpressions;\n\nnamespace Netch.Models.GitHubRelease;\n\n[Serializable]\npublic struct SuffixVersio"
},
{
"path": "Netch/Models/GitHubRelease/VersionUtil.cs",
"chars": 888,
"preview": "namespace Netch.Models.GitHubRelease;\n\npublic static class VersionUtil\n{\n private static VersionComparer instance = "
},
{
"path": "Netch/Models/MessageException.cs",
"chars": 185,
"preview": "namespace Netch.Models;\n\npublic class MessageException : Exception\n{\n public MessageException()\n {\n }\n\n publ"
},
{
"path": "Netch/Models/Modes/Mode.cs",
"chars": 747,
"preview": "using System.Text.Json.Serialization;\nusing Netch.Utils;\n\nnamespace Netch.Models.Modes;\n\npublic abstract class Mode\n{\n "
},
{
"path": "Netch/Models/Modes/ModeFeature.cs",
"chars": 170,
"preview": "namespace Netch.Models.Modes;\n\n[Flags]\npublic enum ModeFeature\n{\n SupportSocks5 = 0,\n SupportIPv4 = 0,\n Suppor"
},
{
"path": "Netch/Models/Modes/ModeType.cs",
"chars": 264,
"preview": "namespace Netch.Models.Modes;\n\npublic enum ModeType\n{\n /// <summary>\n /// 进程代理\n /// </summary>\n Process"
},
{
"path": "Netch/Models/Modes/ProcessMode/ProcessMode.cs",
"chars": 774,
"preview": "namespace Netch.Models.Modes.ProcessMode;\n\npublic class Redirector : Mode\n{\n public override ModeType Type => ModeTy"
},
{
"path": "Netch/Models/Modes/ShareMode/ShareMode.cs",
"chars": 177,
"preview": "namespace Netch.Models.Modes.ShareMode;\n\npublic class ShareMode : Mode\n{\n public override ModeType Type => ModeType."
},
{
"path": "Netch/Models/Modes/TunMode/TunMode.cs",
"chars": 236,
"preview": "namespace Netch.Models.Modes.TunMode;\n\npublic class TunMode : Mode\n{\n public override ModeType Type => ModeType.TunM"
},
{
"path": "Netch/Models/NatTypeTestResult.cs",
"chars": 147,
"preview": "namespace Netch.Models;\n\npublic struct NatTypeTestResult\n{\n public string? Result;\n public string? LocalEnd;\n "
},
{
"path": "Netch/Models/NetRoute.cs",
"chars": 1286,
"preview": "using System.Net;\nusing Windows.Win32;\n\nnamespace Netch.Models;\n\npublic struct NetRoute\n{\n public static NetRoute Te"
},
{
"path": "Netch/Models/NumberRange.cs",
"chars": 309,
"preview": "namespace Netch.Models;\n\npublic readonly struct NumberRange\n{\n public int Start { get; }\n\n public int End { get; }"
},
{
"path": "Netch/Models/Profile.cs",
"chars": 617,
"preview": "using Netch.Models.Modes;\n\nnamespace Netch.Models;\n\npublic class Profile\n{\n public int Index { get; set; }\n\n publ"
},
{
"path": "Netch/Models/Server.cs",
"chars": 2881,
"preview": "using System.Net.Sockets;\nusing System.Text.Json.Serialization;\nusing Netch.Utils;\n\nnamespace Netch.Models;\n\npublic abs"
},
{
"path": "Netch/Models/Settings/AioDNSConfig.cs",
"chars": 336,
"preview": "using System.Text.Json.Serialization;\n\nnamespace Netch.Models;\n\npublic class AioDNSConfig\n{\n public string ChinaDNS "
},
{
"path": "Netch/Models/Settings/KcpConfig.cs",
"chars": 390,
"preview": "namespace Netch.Models;\n\npublic class KcpConfig\n{\n public bool congestion { get; set; } = false;\n\n public int dow"
},
{
"path": "Netch/Models/Settings/RedirectorConfig.cs",
"chars": 536,
"preview": "namespace Netch.Models;\n\npublic class RedirectorConfig\n{\n public bool FilterTCP { get; set; } = true;\n\n public bo"
},
{
"path": "Netch/Models/Settings/Setting.cs",
"chars": 3923,
"preview": "using System.Text.Json;\n\nnamespace Netch.Models;\n\n/// <summary>\n/// 用于读取和写入的配置的类\n/// </summary>\npublic class Settin"
},
{
"path": "Netch/Models/Settings/TUNConfig.cs",
"chars": 908,
"preview": "namespace Netch.Models;\n\n/// <summary>\n/// TUN/TAP 适配器配置类\n/// </summary>\npublic class TUNConfig\n{\n /// <summary>"
},
{
"path": "Netch/Models/Settings/V2rayConfig.cs",
"chars": 364,
"preview": "namespace Netch.Models;\n\npublic class V2rayConfig\n{\n public bool AllowInsecure { get; set; } = false;\n\n public Kc"
},
{
"path": "Netch/Models/StatusText.cs",
"chars": 1142,
"preview": "using Netch.Utils;\n\nnamespace Netch.Models;\n\npublic static class StatusPortInfoText\n{\n private static ushort? _socks5"
},
{
"path": "Netch/Models/Subscription.cs",
"chars": 487,
"preview": "namespace Netch.Models;\n\npublic class Subscription\n{\n /// <summary>\n /// 启用状态\n /// </summary>\n public b"
},
{
"path": "Netch/Models/TagItem.cs",
"chars": 287,
"preview": "using Netch.Utils;\n\nnamespace Netch.Models;\n\ninternal class TagItem<T>\n{\n private readonly string _text;\n\n public "
},
{
"path": "Netch/NOTICE.txt",
"chars": 2474,
"preview": "This program comes with ABSOLUTELY NO WARRANTY.\nThis is free software, and you are welcome to redistribute it under cert"
},
{
"path": "Netch/NativeMethods.cs",
"chars": 208,
"preview": "using System.Runtime.InteropServices;\n\nnamespace Netch;\n\npublic static class NativeMethods\n{\n [DllImport(\"dnsapi\", E"
},
{
"path": "Netch/NativeMethods.txt",
"chars": 422,
"preview": "// IpHlpApi.dll\nGetBestRoute\nGetExtendedTcpTable\nMIB_TCPTABLE_OWNER_PID\nADDRESS_FAMILY\nMIB_UNICASTIPADDRESS_ROW\nInitial"
},
{
"path": "Netch/Netch.csproj",
"chars": 4655,
"preview": "<Project Sdk=\"Microsoft.NET.Sdk\">\r\n\r\n <Import Project=\"..\\common.props\" />\r\n\r\n <PropertyGroup>\r\n <OutputType>WinEx"
},
{
"path": "Netch/Program.cs",
"chars": 7041,
"preview": "using System.Globalization;\nusing System.Reflection;\nusing System.Runtime.Versioning;\nusing Windows.Win32;\nusing Window"
},
{
"path": "Netch/Properties/AssemblyInfo.cs",
"chars": 1079,
"preview": "using System.Reflection;\nusing System.Runtime.InteropServices;\nusing Netch.Controllers;\n\n// 有关程序集的一般信息由以下\n// 控制。更改这些特性值"
},
{
"path": "Netch/Properties/Resources.Designer.cs",
"chars": 5060,
"preview": "//------------------------------------------------------------------------------\n// <auto-generated>\n// 此代码由工具生成。\n/"
},
{
"path": "Netch/Properties/Resources.resx",
"chars": 7776,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<root>\n <!-- \n Microsoft ResX Schema \n \n Version 2.0\n \n The prim"
},
{
"path": "Netch/Resources/zh-CN",
"chars": 6579,
"preview": "{\n \": \": \":\",\n \"Information\": \"信息\",\n \"Error\": \"错误\",\n\n \"Missing File or runtime components\": \"缺少文件或运行库\",\n "
},
{
"path": "Netch/Servers/SSH/SSHForm.cs",
"chars": 710,
"preview": "using Netch.Forms;\r\n\r\nnamespace Netch.Servers;\r\n\r\n[Fody.ConfigureAwait(true)]\r\npublic class SSHForm : ServerForm\r\n{\r\n "
},
{
"path": "Netch/Servers/SSH/SSHServer.cs",
"chars": 653,
"preview": "using Netch.Models;\r\n\r\nnamespace Netch.Servers;\r\n\r\npublic class SSHServer : Server\r\n{\r\n public override string Type {"
},
{
"path": "Netch/Servers/SSH/SSHUtil.cs",
"chars": 1114,
"preview": "using System.Text.Encodings.Web;\r\nusing System.Text.Json;\r\nusing System.Text.Json.Serialization;\r\nusing Netch.Interfaces"
},
{
"path": "Netch/Servers/Shadowsocks/ShadowsocksController.cs",
"chars": 1329,
"preview": "using System.Net;\nusing System.Text;\nusing Netch.Controllers;\nusing Netch.Interfaces;\nusing Netch.Models;\n\nnamespace Net"
},
{
"path": "Netch/Servers/Shadowsocks/ShadowsocksForm.cs",
"chars": 820,
"preview": "using Netch.Forms;\nusing Netch.Utils;\n\nnamespace Netch.Servers;\n\n[Fody.ConfigureAwait(true)]\npublic class ShadowsocksFo"
},
{
"path": "Netch/Servers/Shadowsocks/ShadowsocksServer.cs",
"chars": 2008,
"preview": "using Netch.Models;\n\nnamespace Netch.Servers;\n\npublic class ShadowsocksServer : Server\n{\n public override string Typ"
},
{
"path": "Netch/Servers/Shadowsocks/ShadowsocksUtil.cs",
"chars": 5780,
"preview": "using System.Text.Json;\nusing System.Text.RegularExpressions;\nusing System.Web;\nusing Netch.Interfaces;\nusing Netch.Mod"
},
{
"path": "Netch/Servers/Shadowsocks/ShareModels/SSDJObject.cs",
"chars": 662,
"preview": "#nullable disable\nnamespace Netch.Servers;\n\npublic class SSDJObject\n{\n /// <summary>\n /// 机场名\n /// </summa"
},
{
"path": "Netch/Servers/Shadowsocks/ShareModels/SSDServerJObject.cs",
"chars": 649,
"preview": "#nullable disable\nnamespace Netch.Servers;\n\npublic class SSDServerJObject\n{\n /// <summary>\n /// 加密方式\n /// "
},
{
"path": "Netch/Servers/Shadowsocks/ShareModels/ShadowsocksConfig.cs",
"chars": 505,
"preview": "#nullable disable\nnamespace Netch.Servers;\n\n/// <summary>\n/// Import Shadowsocks Server from Json Configuration\n/// "
},
{
"path": "Netch/Servers/ShadowsocksR/ShadowsocksRController.cs",
"chars": 1387,
"preview": "using System.Net;\nusing Netch.Controllers;\nusing Netch.Interfaces;\nusing Netch.Models;\n\nnamespace Netch.Servers;\n\npublic"
},
{
"path": "Netch/Servers/ShadowsocksR/ShadowsocksRForm.cs",
"chars": 1045,
"preview": "using Netch.Forms;\nusing Netch.Utils;\n\nnamespace Netch.Servers;\n\n[Fody.ConfigureAwait(true)]\npublic class ShadowsocksRF"
},
{
"path": "Netch/Servers/ShadowsocksR/ShadowsocksRServer.cs",
"chars": 1665,
"preview": "using Netch.Models;\n\nnamespace Netch.Servers;\n\npublic class ShadowsocksRServer : Server\n{\n public override string Ty"
},
{
"path": "Netch/Servers/ShadowsocksR/ShadowsocksRUtil.cs",
"chars": 5775,
"preview": "using System.Text.RegularExpressions;\nusing Netch.Interfaces;\nusing Netch.Models;\nusing Netch.Utils;\n\nnamespace Netch.S"
},
{
"path": "Netch/Servers/Socks5/Socks5Controller.cs",
"chars": 369,
"preview": "using Netch.Models;\n\nnamespace Netch.Servers;\n\npublic class Socks5Controller : V2rayController\n{\n public override str"
},
{
"path": "Netch/Servers/Socks5/Socks5Form.cs",
"chars": 1656,
"preview": "using Netch.Forms;\nusing Netch.Utils;\n\nnamespace Netch.Servers;\n\n[Fody.ConfigureAwait(true)]\npublic class Socks5Form : "
},
{
"path": "Netch/Servers/Socks5/Socks5Server.cs",
"chars": 1344,
"preview": "using Netch.Models;\n\nnamespace Netch.Servers;\n\npublic class Socks5Server : Server\n{\n public override string Type { g"
},
{
"path": "Netch/Servers/Socks5/Socks5Util.cs",
"chars": 1995,
"preview": "using Netch.Interfaces;\nusing Netch.Models;\n\nnamespace Netch.Servers;\n\npublic class Socks5Util : IServerUtil\n{\n publ"
},
{
"path": "Netch/Servers/Trojan/TrojanConfig.cs",
"chars": 2162,
"preview": "#nullable disable\nnamespace Netch.Servers;\n\npublic class TrojanConfig\n{\n /// <summary>\n /// 监听地址\n /// </su"
},
{
"path": "Netch/Servers/Trojan/TrojanController.cs",
"chars": 1630,
"preview": "using System.Net;\nusing System.Text.Json;\nusing Netch.Controllers;\nusing Netch.Interfaces;\nusing Netch.Models;\nusing Ne"
},
{
"path": "Netch/Servers/Trojan/TrojanForm.cs",
"chars": 619,
"preview": "using Netch.Forms;\n\nnamespace Netch.Servers;\n\n[Fody.ConfigureAwait(true)]\npublic class TrojanForm : ServerForm\n{\n pu"
},
{
"path": "Netch/Servers/Trojan/TrojanServer.cs",
"chars": 760,
"preview": "using Netch.Models;\n\nnamespace Netch.Servers;\n\npublic class TrojanServer : Server\n{\n private string _tlsSecureType = "
},
{
"path": "Netch/Servers/Trojan/TrojanUtil.cs",
"chars": 2444,
"preview": "using System.Text.RegularExpressions;\nusing System.Web;\nusing Netch.Interfaces;\nusing Netch.Models;\n\nnamespace Netch.Ser"
},
{
"path": "Netch/Servers/V2ray/ShareModels/V2rayNJObject.cs",
"chars": 1423,
"preview": "namespace Netch.Servers;\n\npublic class V2rayNJObject\n{\n /// <summary>\n /// 链接版本\n /// </summary>\n public"
},
{
"path": "Netch/Servers/V2ray/V2rayConfig.cs",
"chars": 3676,
"preview": "#nullable disable\n// ReSharper disable InconsistentNaming\n\nnamespace Netch.Servers;\n\npublic struct V2rayConfig\n{\n pu"
},
{
"path": "Netch/Servers/V2ray/V2rayConfigUtils.cs",
"chars": 15549,
"preview": "using Netch.Models;\nusing Netch.Utils;\n\n#pragma warning disable VSTHRD200\n\nnamespace Netch.Servers;\n\npublic static clas"
},
{
"path": "Netch/Servers/V2ray/V2rayController.cs",
"chars": 1283,
"preview": "using System.Net;\nusing System.Text.Json;\nusing Netch.Controllers;\nusing Netch.Interfaces;\nusing Netch.Models;\n\nnamespac"
},
{
"path": "Netch/Servers/V2ray/V2rayUtils.cs",
"chars": 5734,
"preview": "using System.Text.RegularExpressions;\nusing System.Web;\nusing Netch.Models;\nusing Netch.Utils;\n\nnamespace Netch.Servers;"
},
{
"path": "Netch/Servers/VLESS/VLESSForm.cs",
"chars": 2021,
"preview": "using Netch.Forms;\n\nnamespace Netch.Servers;\n\n[Fody.ConfigureAwait(true)]\ninternal class VLESSForm : ServerForm\n{\n pu"
},
{
"path": "Netch/Servers/VLESS/VLESSServer.cs",
"chars": 879,
"preview": "namespace Netch.Servers;\n\npublic class VLESSServer : VMessServer\n{\n public override string Type { get; } = \"VLESS\";\n\n"
},
{
"path": "Netch/Servers/VLESS/VLESSUtil.cs",
"chars": 965,
"preview": "using Netch.Interfaces;\nusing Netch.Models;\n\nnamespace Netch.Servers;\n\npublic class VLESSUtil : IServerUtil\n{\n public"
},
{
"path": "Netch/Servers/VMess/VMessForm.cs",
"chars": 2104,
"preview": "using Netch.Forms;\n\nnamespace Netch.Servers;\n\n[Fody.ConfigureAwait(true)]\npublic class VMessForm : ServerForm\n{\n pub"
},
{
"path": "Netch/Servers/VMess/VMessServer.cs",
"chars": 3628,
"preview": "using Netch.Models;\n\nnamespace Netch.Servers;\n\npublic class VMessServer : Server\n{\n private string _tlsSecureType = V"
},
{
"path": "Netch/Servers/VMess/VMessUtil.cs",
"chars": 3150,
"preview": "using System.Text.Encodings.Web;\nusing System.Text.Json;\nusing System.Text.Json.Serialization;\nusing Netch.Interfaces;\nu"
},
{
"path": "Netch/Servers/WireGuard/WireGuardForm.cs",
"chars": 926,
"preview": "using Netch.Forms;\r\n\r\nnamespace Netch.Servers;\r\n\r\n[Fody.ConfigureAwait(true)]\r\npublic class WireGuardForm : ServerForm\r\n"
},
{
"path": "Netch/Servers/WireGuard/WireGuardServer.cs",
"chars": 814,
"preview": "using Netch.Models;\r\n\r\nnamespace Netch.Servers;\r\n\r\npublic class WireGuardServer : Server\r\n{\r\n public override string "
},
{
"path": "Netch/Servers/WireGuard/WireGuardUtil.cs",
"chars": 1167,
"preview": "using System.Text.Encodings.Web;\r\nusing System.Text.Json;\r\nusing System.Text.Json.Serialization;\r\nusing Netch.Interfaces"
},
{
"path": "Netch/Services/ModeService.cs",
"chars": 3089,
"preview": "using Netch.Controllers;\nusing Netch.Interfaces;\nusing Netch.Models;\nusing Netch.Models.Modes;\nusing Netch.Utils;\n\nname"
},
{
"path": "Netch/Services/Updater.cs",
"chars": 4179,
"preview": "using System.Collections.Immutable;\nusing System.Diagnostics;\nusing System.Text;\nusing Netch.Models;\nusing Netch.Propert"
},
{
"path": "Netch/Utils/Bandwidth.cs",
"chars": 3537,
"preview": "using System.Diagnostics;\nusing Microsoft.Diagnostics.Tracing.Parsers;\nusing Microsoft.Diagnostics.Tracing.Session;\nusi"
},
{
"path": "Netch/Utils/Configuration.cs",
"chars": 4182,
"preview": "using System.Text.Json;\nusing System.Text.Json.Serialization;\nusing Microsoft.VisualStudio.Threading;\nusing Netch.JsonC"
},
{
"path": "Netch/Utils/DelayTestHelper.cs",
"chars": 2241,
"preview": "using Microsoft.VisualStudio.Threading;\nusing Netch.Models;\nusing Timer = System.Timers.Timer;\n\nnamespace Netch.Utils;\n"
},
{
"path": "Netch/Utils/DnsUtils.cs",
"chars": 2585,
"preview": "using System.Collections;\nusing System.Net;\nusing System.Net.Sockets;\nusing Microsoft.VisualStudio.Threading;\n\nnamespac"
},
{
"path": "Netch/Utils/Firewall.cs",
"chars": 2031,
"preview": "using WindowsFirewallHelper;\nusing WindowsFirewallHelper.FirewallRules;\n\nnamespace Netch.Utils;\n\npublic static class Fi"
},
{
"path": "Netch/Utils/ModeHelper.cs",
"chars": 4511,
"preview": "using System.Text.Json;\nusing System.Text.Json.Serialization;\nusing Netch.JsonConverter;\nusing Netch.Models.Modes;\nusing"
},
{
"path": "Netch/Utils/NetworkInterfaceUtils.cs",
"chars": 3116,
"preview": "using System.Diagnostics;\nusing System.Management;\nusing System.Net;\nusing System.Net.NetworkInformation;\nusing System."
},
{
"path": "Netch/Utils/PortHelper.cs",
"chars": 6614,
"preview": "using System.ComponentModel;\nusing System.Diagnostics;\nusing System.Net.NetworkInformation;\nusing System.Net.Sockets;\nu"
},
{
"path": "Netch/Utils/RouteUtils.cs",
"chars": 2717,
"preview": "using System.Diagnostics.CodeAnalysis;\nusing System.Net.Sockets;\nusing Netch.Interops;\nusing Netch.Models;\n\nnamespace N"
},
{
"path": "Netch/Utils/ServerHelper.cs",
"chars": 1077,
"preview": "using System.Reflection;\nusing Netch.Interfaces;\n\nnamespace Netch.Utils;\n\npublic static class ServerHelper\n{\n static "
},
{
"path": "Netch/Utils/ShareLink.cs",
"chars": 6201,
"preview": "using System.Text;\nusing System.Text.Json;\nusing Netch.JsonConverter;\nusing Netch.Models;\nusing Netch.Servers;\n\nnamespa"
},
{
"path": "Netch/Utils/Socks5ServerTestUtils.cs",
"chars": 3461,
"preview": "using System.Diagnostics;\nusing System.Net;\nusing Netch.Models;\nusing Netch.Servers;\nusing Socks5.Models;\nusing STUN.Cl"
},
{
"path": "Netch/Utils/StringExtension.cs",
"chars": 3256,
"preview": "using System.Security.Cryptography;\nusing System.Text;\n\nnamespace Netch.Utils;\n\npublic static class StringExtension\n{\n "
},
{
"path": "Netch/Utils/SubscriptionUtil.cs",
"chars": 1807,
"preview": "using System.Net;\nusing Netch.Models;\n\nnamespace Netch.Utils;\n\npublic static class SubscriptionUtil\n{\n private static"
},
{
"path": "Netch/Utils/SystemInfo.cs",
"chars": 2158,
"preview": "using System.Diagnostics;\nusing System.Management;\n\nnamespace Netch.Utils;\n\npublic static class SystemInfo\n{\n public"
},
{
"path": "Netch/Utils/Utils.cs",
"chars": 8141,
"preview": "using System.ComponentModel;\nusing System.Diagnostics;\nusing System.Net;\nusing System.Net.NetworkInformation;\nusing Syst"
},
{
"path": "Netch/Utils/WebUtil.cs",
"chars": 3482,
"preview": "using System.Net;\nusing System.Text;\nusing Microsoft.VisualStudio.Threading;\n\nnamespace Netch.Utils;\n\npublic static clas"
},
{
"path": "Netch/Utils/i18N.cs",
"chars": 3805,
"preview": "using System.Collections;\nusing System.Globalization;\nusing System.Text;\nusing System.Text.Json;\nusing Netch.Properties"
},
{
"path": "Netch/runtimeconfig.template.json",
"chars": 31,
"preview": "{\n \"rollForward\": \"Major\"\n}"
},
{
"path": "Netch.sln",
"chars": 3396,
"preview": "\r\nMicrosoft Visual Studio Solution File, Format Version 12.00\r\n# Visual Studio Version 17\r\nVisualStudioVersion = 17.0.3"
},
{
"path": "Other/.gitignore",
"chars": 10,
"preview": "/release\r\n"
},
{
"path": "Other/.must_build",
"chars": 1,
"preview": "3"
},
{
"path": "Other/_Archive/build.ps1",
"chars": 6,
"preview": "exit 0"
},
{
"path": "Other/_Archive/chnip/build.ps1",
"chars": 267,
"preview": "Set-Location (Split-Path $MyInvocation.MyCommand.Path -Parent)\n\ntry {\n Invoke-WebRequest `\n -Uri 'https://raw."
},
{
"path": "Other/_Archive/chnsite/build.ps1",
"chars": 600,
"preview": "Set-Location (Split-Path $MyInvocation.MyCommand.Path -Parent)\n\ntry {\n Invoke-WebRequest `\n -Uri 'https://raw."
},
{
"path": "Other/_Archive/cloak/build.ps1",
"chars": 394,
"preview": "Set-Location (Split-Path $MyInvocation.MyCommand.Path -Parent)\n\ngit clone https://github.com/cbeuw/Cloak -b 'v2.5.5' src"
},
{
"path": "Other/_Archive/dnsproxy/build.ps1",
"chars": 385,
"preview": "Set-Location (Split-Path $MyInvocation.MyCommand.Path -Parent)\n\ngit clone https://github.com/AdguardTeam/dnsproxy -b 'v0"
},
{
"path": "Other/_Archive/geoip/build.ps1",
"chars": 254,
"preview": "Set-Location (Split-Path $MyInvocation.MyCommand.Path -Parent)\n\ntry {\n Invoke-WebRequest `\n -Uri 'https://gith"
},
{
"path": "Other/_Archive/geosite/build.ps1",
"chars": 270,
"preview": "Set-Location (Split-Path $MyInvocation.MyCommand.Path -Parent)\n\ntry {\n Invoke-WebRequest `\n -Uri 'https://gith"
},
{
"path": "Other/_Archive/tun2socks/build.ps1",
"chars": 384,
"preview": "Set-Location (Split-Path $MyInvocation.MyCommand.Path -Parent)\n\ngit clone https://github.com/xjasonlyu/tun2socks -b 'v2."
},
{
"path": "Other/_Archive/v2ray-core/build.ps1",
"chars": 737,
"preview": "Set-Location (Split-Path $MyInvocation.MyCommand.Path -Parent)\n\ngit clone https://github.com/v2fly/v2ray-core -b 'v4.43."
},
{
"path": "Other/_Archive/v2ray-plugin/build.ps1",
"chars": 390,
"preview": "Set-Location (Split-Path $MyInvocation.MyCommand.Path -Parent)\n\ngit clone https://github.com/teddysun/v2ray-plugin -b 'v"
},
{
"path": "Other/aiodns/build.ps1",
"chars": 283,
"preview": "Set-Location (Split-Path $MyInvocation.MyCommand.Path -Parent)\r\n\r\n$Env:CGO_ENABLED='1'\r\n$Env:GOROOT_FINAL='/usr'\r\n\r\n$Env"
},
{
"path": "Other/aiodns/deps.ps1",
"chars": 152,
"preview": "Push-Location (Split-Path $MyInvocation.MyCommand.Path -Parent)\r\n\r\nrm -Force go.*\r\ngo mod init aiodns\r\ngo mod tidy\r\n\r\nPo"
},
{
"path": "Other/aiodns/go.mod",
"chars": 204,
"preview": "module aiodns\n\ngo 1.17\n\nrequire github.com/miekg/dns v1.1.43\n\nrequire (\n\tgolang.org/x/net v0.0.0-20210226172049-e18ecbb0"
},
{
"path": "Other/aiodns/go.sum",
"chars": 1188,
"preview": "github.com/miekg/dns v1.1.43 h1:JKfpVSCB84vrAmHzyrsxB5NAr5kLoMXZArPSw7Qlgyg=\ngithub.com/miekg/dns v1.1.43/go.mod h1:+evo"
},
{
"path": "Other/aiodns/main.go",
"chars": 3105,
"preview": "package main\n\nimport (\n\t\"bufio\"\n\t\"fmt\"\n\t\"net\"\n\t\"net/url\"\n\t\"os\"\n\t\"strings\"\n\n\t\"github.com/miekg/dns\"\n)\n\nimport \"C\"\n\nconst "
},
{
"path": "Other/build.ps1",
"chars": 1125,
"preview": "Push-Location (Split-Path $MyInvocation.MyCommand.Path -Parent)\r\n\r\n.\\clean.ps1\r\n\r\nSet-Location (Split-Path $MyInvocation"
},
{
"path": "Other/clean.ps1",
"chars": 387,
"preview": "Push-Location (Split-Path $MyInvocation.MyCommand.Path -Parent)\r\n\r\nif ( Test-Path 'build' ) {\r\n rm -Recurse -Force 'b"
},
{
"path": "Other/deps.ps1",
"chars": 407,
"preview": "Push-Location (Split-Path $MyInvocation.MyCommand.Path -Parent)\r\n\r\n.\\clean.ps1\r\n\r\nGet-ChildItem -Path '.' -Directory | F"
},
{
"path": "Other/pcap2socks/build.ps1",
"chars": 413,
"preview": "Set-Location (Split-Path $MyInvocation.MyCommand.Path -Parent)\n\ntry {\n Invoke-WebRequest `\n -Uri 'https://gith"
},
{
"path": "Other/v2ray-sn/README.md",
"chars": 1020,
"preview": "# Project V for SagerNet for Netch\nThis is not a joke. \nModified from [SagerNet/v2ray-core](https://github.com/SagerNet"
},
{
"path": "Other/v2ray-sn/build.ps1",
"chars": 1293,
"preview": "Set-Location (Split-Path $MyInvocation.MyCommand.Path -Parent)\n\ngit clone https://github.com/SagerNet/v2ray-core.git -b "
},
{
"path": "Other/wintun/build.ps1",
"chars": 417,
"preview": "Set-Location (Split-Path $MyInvocation.MyCommand.Path -Parent)\r\n\r\ntry {\r\n Invoke-WebRequest `\r\n -Uri 'https://"
},
{
"path": "README.md",
"chars": 1717,
"preview": "# `In preparation for 2.0, this repository will be cleared of all 1.0 related releases and code`\r\n<p align=\"center\"><img"
},
{
"path": "Redirector/.gitignore",
"chars": 29,
"preview": "/bin\r\n/obj\r\n/*.vcxproj.user\r\n"
},
{
"path": "Redirector/.must_build",
"chars": 1,
"preview": "1"
},
{
"path": "Redirector/Based.cpp",
"chars": 502,
"preview": "#include \"Based.h\"\r\n\r\nbool filterLoopback = false;\r\nbool filterIntranet = false;\r\nbool filterParent = false;\r\nbool filte"
},
{
"path": "Redirector/Based.h",
"chars": 809,
"preview": "#pragma once\r\n#ifndef BASED_H\r\n#define BASED_H\r\n#include <stdio.h>\r\n\r\n#include <map>\r\n#include <list>\r\n#include <queue>\r"
},
{
"path": "Redirector/DNSHandler.cpp",
"chars": 3333,
"preview": "#include \"DNSHandler.h\"\r\n\r\n#include \"SocksHelper.h\"\r\n\r\nextern bool dnsProx;\r\nextern string dnsHost;\r\nextern USHORT dnsPo"
},
{
"path": "Redirector/DNSHandler.h",
"chars": 290,
"preview": "#pragma once\r\n#ifndef DNSHANDLER_H\r\n#define DNSHANDLER_H\r\n#include \"Based.h\"\r\n\r\nnamespace DNSHandler\r\n{\r\n\tbool INIT();\r\n"
},
{
"path": "Redirector/EventHandler.cpp",
"chars": 9546,
"preview": "#include \"EventHandler.h\"\r\n\r\n#include \"DNSHandler.h\"\r\n#include \"TCPHandler.h\"\r\n\r\nextern bool filterParent;\r\nextern bool "
},
{
"path": "Redirector/EventHandler.h",
"chars": 1163,
"preview": "#pragma once\r\n#ifndef EVENTHANDLER_H\r\n#define EVENTHANDLER_H\r\n#include \"Based.h\"\r\n#include \"SocksHelper.h\"\r\n\r\nbool eh_in"
},
{
"path": "Redirector/IPEventHandler.cpp",
"chars": 2117,
"preview": "#include \"IPEventHandler.h\"\r\n\r\nextern DWORD icmping;\r\n\r\nUSHORT IPv4Checksum(PBYTE buffer, ULONG64 size)\r\n{\r\n\tUINT32 sum "
},
{
"path": "Redirector/IPEventHandler.h",
"chars": 255,
"preview": "#pragma once\r\n#ifndef IPEVENTHANDLER_H\r\n#define IPEVENTHANDLER_H\r\n#include \"Based.h\"\r\n\r\nvoid ipSend(const char* buffer, "
},
{
"path": "Redirector/README.md",
"chars": 2143,
"preview": "# Redirector\r\n```c++\r\ntypedef enum _AIO_TYPE {\r\n\tAIO_FILTERLOOPBACK,\r\n\tAIO_FILTERINTRANET,\r\n\tAIO_FILTERPARENT,\r\n\tAIO_FIL"
},
{
"path": "Redirector/Redirector.cpp",
"chars": 8293,
"preview": "#include \"Based.h\"\r\n#include \"EventHandler.h\"\r\n#include \"IPEventHandler.h\"\r\n#include \"Utils.h\"\r\n\r\nextern bool filterLoop"
},
{
"path": "Redirector/Redirector.vcxproj",
"chars": 6102,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/ms"
},
{
"path": "Redirector/Redirector.vcxproj.filters",
"chars": 1992,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbui"
},
{
"path": "Redirector/SocksHelper.cpp",
"chars": 11678,
"preview": "#include \"SocksHelper.h\"\r\n\r\n#include \"Utils.h\"\r\n\r\nextern wstring tgtHost;\r\nextern wstring tgtPort;\r\nextern string tgtUse"
}
]
// ... and 136 more files (download for full content)
About this extraction
This page contains the full source code of the netchx/netch GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 336 files (2.5 MB), approximately 670.9k tokens, and a symbol index with 771 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.