# Technical Documentation: netchx/netch

> ℹ️ **Provenance:** Multi-Tier Ingestion · [CodeWiki Reference](https://codewiki.google/github.com/netchx/netch)

### Overview (`README.md`)

# `In preparation for 2.0, this repository will be cleared of all 1.0 related releases and code`
<p align="center"><img src="https://github.com/NetchX/Netch/blob/main/Netch/Resources/Netch.png?raw=true" width="128" /></p>

<div align="center">

# Netch
A simple proxy client

[](https://t.me/netch_group)
[](https://t.me/netch_channel)
[](https://github.com/netchx/netch/releases)
[](https://github.com/netchx/netch/releases)
</div>

## Features
Some features may not be implemented in version 1

### Modes
- `ProcessMode` - Use Netfilter driver to intercept process traffic
- `ShareMode` - Share your network based on WinPcap / Npcap
- `TunMode` - Use WinTUN driver to create virtual adapter
- `WebMode` - Web proxy mode

### Protocols
- [`Socks5`](https://www.wikiwand.com/en/SOCKS)
- [`Shadowsocks`](https://shadowsocks.org)
- [`ShadowsocksR`](https://github.com/shadowsocksrr/shadowsocksr-libev)
- [`WireGuard`](https://www.wireguard.com)
- [`Trojan`](https://trojan-gfw.github.io/trojan)
- [`VMess`](https://www.v2fly.org)
- [`VLESS`](https://xtls.github.io)

### Others
- UDP NAT FullCone (Limited by your server)
- .NET 6.0 x64

## Sponsor
<a href="https://www.jetbrains.com/?from=Netch"><img src="jetbrains.svg" alt="JetBrains" width="200"/></a>

## License
Netch is licensed under the [GPLv3](https://raw.githubusercontent.com/netchx/netch/main/LICENSE) license

---

### Overview (`Redirector/README.md`)

# Redirector
```c++
typedef enum _AIO_TYPE {
	AIO_FILTERLOOPBACK,
	AIO_FILTERINTRANET,
	AIO_FILTERPARENT,
	AIO_FILTERICMP,
	AIO_FILTERTCP,
	AIO_FILTERUDP,
	AIO_FILTERDNS,

	AIO_ICMPING,

	AIO_DNSONLY,
	AIO_DNSPROX,
	AIO_DNSHOST,
	AIO_DNSPORT,

	AIO_TGTHOST,
	AIO_TGTPORT,
	AIO_TGTUSER,
	AIO_TGTPASS,

	AIO_CLRNAME,
	AIO_ADDNAME,
	AIO_BYPNAME
} AIO_TYPE;

__declspec(dllexport) BOOL __cdecl aio_register(LPWSTR value);
__declspec(dllexport) BOOL __cdecl aio_unregister(LPWSTR value);
__declspec(dllexport) BOOL __cdecl aio_dial(int name, LPWSTR value);
__declspec(dllexport) BOOL __cdecl aio_init();
__declspec(dllexport) void __cdecl aio_free();
__declspec(dllexport) ULONG64 __cdecl aio_getUP();
__declspec(dllexport) ULONG64 __cdecl aio_getDL();
```

```c#
private enum NameList : int
{
	AIO_FILTERLOOPBACK,
	AIO_FILTERINTRANET,
	AIO_FILTERPARENT,
	AIO_FILTERICMP,
	AIO_FILTERTCP,
	AIO_FILTERUDP,
	AIO_FILTERDNS,

	AIO_ICMPING,

	AIO_DNSONLY,
	AIO_DNSPROX,
	AIO_DNSHOST,
	AIO_DNSPORT,

	AIO_TGTHOST,
	AIO_TGTPORT,
	AIO_TGTUSER,
	AIO_TGTPASS,

	AIO_CLRNAME,
	AIO_ADDNAME,
	AIO_BYPNAME
}

[DllImport("Redirector.bin", CallingConvention = CallingConvention.Cdecl)]
public static extern bool aio_register([MarshalAs(UnmanagedType.LPWStr)] string value);

[DllImport("Redirector.bin", CallingConvention = CallingConvention.Cdecl)]
public static extern bool aio_unregister([MarshalAs(UnmanagedType.LPWStr)] string value);

[DllImport("Redirector.bin", CallingConvention = CallingConvention.Cdecl)]
public static extern bool aio_dial(NameList name, [MarshalAs(UnmanagedType.LPWStr)] string value);

[DllImport("Redirector.bin", CallingConvention = CallingConvention.Cdecl)]
public static extern bool aio_init();

[DllImport("Redirector.bin", CallingConvention = CallingConvention.Cdecl)]
public static extern void aio_free();

[DllImport("Redirector.bin", CallingConvention = CallingConvention.Cdecl)]
public static extern ulong aio_getUP();

[DllImport("Redirector.bin", CallingConvention = CallingConvention.Cdecl)]
public static extern ulong aio_getDL();
```

---

### Overview (`RouteHelper/README.md`)

# RouteHelper
```cpp
ULONG ConvertLuidToIndex(ULONG64 id);
void WaitForUnicastIP();
BOOL CreateIPv4(const char* address, const char* netmask, ULONG index);
BOOL CreateUnicastIP(USHORT inet, const char* address, UINT8 cidr, ULONG index);
BOOL CreateRoute(USHORT inet, const char* address, UINT8 cidr, const char* gateway, ULONG index, ULONG metric);
BOOL DeleteRoute(USHORT inet, const char* address, UINT8 cidr, const char* gateway, ULONG index, ULONG metric);
```

```csharp
[DllImport("RouteHelper.bin", CallingConvention = CallingConvention.Cdecl)]
public static extern uint ConvertLuidToIndex(ulong id);

[DllImport("RouteHelper.bin", CallingConvention = CallingConvention.Cdecl)]
public static extern void WaitForUnicastIP();

[DllImport("RouteHelper.bin", CallingConvention = CallingConvention.Cdecl)]
public static extern bool CreateIPv4(string address, string netmask, uint index);

[DllImport("RouteHelper.bin", CallingConvention = CallingConvention.Cdecl)]
public static extern bool CreateUnicastIP(AddressFamily inet, string address, byte cidr, uint index);

[DllImport("RouteHelper.bin", CallingConvention = CallingConvention.Cdecl)]
public static extern bool CreateRoute(AddressFamily inet, string address, byte cidr, string gateway, uint index, uint metric);

[DllImport("RouteHelper.bin", CallingConvention = CallingConvention.Cdecl)]
public static extern bool CreateRoute(AddressFamily inet, string address, byte cidr, string gateway, uint index, uint metric);
```

---

### Overview (`Storage/README.md`)

# Netch
Prebuilt binaries for Netch version 1

## aiodns
https://github.com/netchx/netch

## Redirector
https://github.com/netchx/netch

## RouteHelper
https://github.com/netchx/netch

## ck-client
https://github.com/cbeuw/Cloak

## GeoLite2
https://www.maxmind.com

## xray-core
https://github.com/xtls/xray-core

## shadowsocks-libev
https://github.com/shadowsocks/shadowsocks-rust

## shadowsocksr-libev
https://github.com/shadowsocksrr/shadowsocksr-libev

## simple-obfs
https://github.com/shadowsocks/simple-obfs

## tun2socks
https://github.com/xjasonlyu/tun2socks

## v2ray-plugin
https://github.com/teddysun/v2ray-plugin

## WinTUN
https://www.wintun.net

---

### Overview (`Other/v2ray-sn/README.md`)

# Project V for SagerNet for Netch
This is not a joke.  
Modified from [SagerNet/v2ray-core](https://github.com/SagerNet/v2ray-core).  
#### Extends all features of SagerNet/v2ray-core

### Changes

- embed ShadowsocksR plugin for shadowsocks

```json
{
  "outbounds": [
    {
      "protocol": "shadowsocks",
      "settings": {
        ...
        "plugin": "shadowsocksr",
        "pluginArgs": [
          "--obfs=<OBFS_TYPE>",
          "--obfs-param=<OBFS_PARAMETERS>",
          "--protocol=<PROTOCOL_TYPE>",
          "--protocol-param=<PROTOCOL_PARAMETERS>"
        ]
      }
    }
  ]
}
```

- embed simple-obfs plugin for shadowsocks

```json
{
  "outbounds": [
    {
      "protocol": "shadowsocks",
      "settings": {
        ...
        "plugin": "obfs-local",
        "pluginOpts": "<SIMPLE_OBFS_OPTIONS>"
      }
    }
  ]
}
```

- Re-enable ReadV

### License

GPL v3

### Credits

This repo relies on the following projects:  
- [SagerNet/LibSagerNetCore](https://github.com/SagerNet/LibSagerNetCore)

---

--- METRICS ---
- Files Extracted: 5
- Estimated Token Budget: ~1740 tokens
- Canonical Reference: https://codewiki.google/github.com/netchx/netch
