diff --git a/Cargo.toml b/Cargo.toml index 234af7e..ceb5093 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ name = "easytier" description = "A full meshed p2p VPN, connecting all your devices in one network with one command." homepage = "https://github.com/KKRainbow/EasyTier" repository = "https://github.com/KKRainbow/EasyTier" -version = "0.1.0" +version = "0.1.1" edition = "2021" authors = ["kkrainbow"] keywords = ["vpn", "p2p", "network", "easytier"] diff --git a/README.md b/README.md index 277dc87..e8b684d 100644 --- a/README.md +++ b/README.md @@ -1,78 +1,202 @@ -# EasyTier + # EasyTier + + [![GitHub](https://img.shields.io/github/license/KKRainbow/EasyTier)](https://github.com/KKRainbow/EasyTier/blob/main/LICENSE) + [![GitHub last commit](https://img.shields.io/github/last-commit/KKRainbow/EasyTier)](https://github.com/KKRainbow/EasyTier/commits/main) + [![GitHub issues](https://img.shields.io/github/issues/KKRainbow/EasyTier)](https://github.com/KKRainbow/EasyTier/issues) + [![GitHub actions](https://github.com/KKRainbow/EasyTier/actions/workflows/rust.yml/badge.svg)](https://github.com/KKRainbow/EasyTier/actions/) + +[简体中文](/README_CN.md) | [English](/README.md) -```diff -! NOTICE: THIS SOFTWARE IS STILL BEGIN DEVELOPPING, ONLY POC VERSION IS PROVIDED -``` + EasyTier is a simple, plug-and-play, decentralized VPN networking solution implemented with the Rust language and Tokio framework. + + ## Features + +- **Decentralized**: No need to rely on centralized services, nodes are equal and independent. +- **Cross-platform**: Supports MacOS/Linux/Windows, will support IOS and Android in the future. The executable file is statically linked, making deployment simple. +- **Networking without public IP**: Supports networking using shared public nodes, refer to [Configuration Guide](#Networking-without-public-IP) +- **NAT traversal**: Supports UDP-based NAT traversal, able to establish stable connections even in complex network environments. +- **Subnet Proxy (Point-to-Network)**: Nodes can expose accessible network segments as proxies to the VPN subnet, allowing other nodes to access these subnets through the node. +- **Smart Routing**: Selects links based on traffic to reduce latency and increase throughput. +- **TCP Support**: Provides reliable data transmission through concurrent TCP links when UDP is limited, optimizing performance. +- **High Availability**: Supports multi-path and switches to healthy paths when high packet loss or network errors are detected. -A simple out-of-box alternative of ZeroTier & TailScale in rust. Bring all devices to one virtual net. + + ## Installation + + 1. **Download the precompiled binary file** + + Visit the [GitHub Release page](https://github.com/KKRainbow/EasyTier/releases) to download the binary file suitable for your operating system. + + 2. **Install via crates.io** + ```sh + cargo install easytier + ``` + + 3. **Install from source code** + ```sh + cargo install --git https://github.com/KKRainbow/EasyTier.git + ``` + + ## Quick Start + + Make sure EasyTier is installed according to the [Installation Guide](#Installation), and both easytier-core and easytier-cli commands are available. + + ### Two-node Networking + + Assuming the network topology of the two nodes is as follows + + ```mermaid + flowchart LR + + subgraph Node A IP 22.1.1.1 + nodea[EasyTier\n10.144.144.1] + end + + subgraph Node B + nodeb[EasyTier\n10.144.144.2] + end + + nodea <-----> nodeb + + ``` + + 1. Execute on Node A: + ```sh + sudo easytier-core --ipv4 10.144.144.1 + ``` + Successful execution of the command will print the following. + + ![alt text](assets/image-2.png) + + 2. Execute on Node B + ```sh + sudo easytier-core --ipv4 10.144.144.2 --peers udp://22.1.1.1:11010 + ``` + + 3. Test Connectivity + + The two nodes should connect successfully and be able to communicate within the virtual subnet + ```sh + ping 10.144.144.2 + ``` + + Use easytier-cli to view node information in the subnet + ```sh + easytier-cli peer + ``` + ![alt text](assets/image.png) + ```sh + easytier-cli route + ``` + ![alt text](assets/image-1.png) -this software can serve as a substitute for Zerotier or TailScale in certain scenarios due to following features: - -1. Easy to deploy. - - No roles (moons/derp or other dedicated relay server). All nodes are equal and rely on some p2p algorithms to communicate. - -2. Smart route decision. - - Use links charged by traffic to reduce latency but free links for high throughout app. - -3. Break the UDP throttling. - - Try use TCP to achieve better performance under enviraonment with throttled UDP. Also use some methods to avoid HOL-blocking of TCP over TCP. - -4. High availibility. - - Support multipath and switching to healthy paths when high packet loss rate or network error are detected - -EasyTIer also have following common features which are already supported by other softwares, but may be easier to use. - -1. Multi-platform support. - -2. Effcient P2P hole punching, both UDP & TCP. - -3. High performance. Try use multiple wan interface. - -5. Subnet Route. node can advertise and proxy one or more subnets, so other nodes can directy access these subnets without any iptables/nft trickys. - - -# Usage - -Currently a server with public ip is needed. - -run first node on the public node: - -``` -sudo easytier-core --ipv4 -``` - -run other nodes - -``` -sudo easytier-core --ipv4 --peers tcp://:11010 -``` - -use cli tool to inspect nodes with direct link. - -``` -easytier-cli peer -``` - -cli tool can also be used to inspect the route table - -``` -easytier-cli route -``` - - -# RoadMap - -- [x] Windows / Mac / Linux support -- [x] TCP / UDP tunnel. -- [x] NAT Traverse with relaying. -- [x] NAT Traverse with UDP hole punching. - -- [x] Support shared public server. So users can use it without a public server. -- [x] Broadcast & Multicast support. -- [ ] Encryption. With noise framework or other method. -- [ ] Support mobile platforms. -- [ ] UI tools. +--- + + ### Multi-node Networking + + Based on the two-node networking example just now, if more nodes need to join the virtual network, you can use the following command. + + ``` + sudo easytier-core --ipv4 10.144.144.2 --peers udp://22.1.1.1:11010 + ``` + + The `--peers` parameter can fill in the listening address of any node already in the virtual network. + + --- + + ### Subnet Proxy (Point-to-Network) Configuration + + Assuming the network topology is as follows, Node B wants to share its accessible subnet 10.1.1.0/24 with other nodes. + + ```mermaid + flowchart LR + + subgraph Node A IP 22.1.1.1 + nodea[EasyTier\n10.144.144.1] + end + + subgraph Node B + nodeb[EasyTier\n10.144.144.2] + end + + id1[[10.1.1.0/24]] + + nodea <--> nodeb <-.-> id1 + + ``` + + Then the startup parameters for Node B's easytier are (new -n parameter) + + ```sh + sudo easytier-core --ipv4 10.144.144.2 -n 10.1.1.0/24 + ``` + + Subnet proxy information will automatically sync to each node in the virtual network, and each node will automatically configure the corresponding route. Node A can check whether the subnet proxy is effective through the following command. + + 1. Check whether the routing information has been synchronized, the proxy_cidrs column shows the proxied subnets. + + ```sh + easytier-cli route + ``` + ![alt text](assets/image-3.png) + +2. Test whether Node A can access nodes under the proxied subnet + + ```sh + ping 10.1.1.2 + ``` + + --- + + ### Networking without Public IP + + EasyTier supports networking using shared public nodes. The currently deployed shared public node is ``tcp://easytier.public.kkrainbow.top:11010``. + + When using shared nodes, each node entering the network needs to provide the same ``--network-name`` and ``--network-secret`` parameters as the unique identifier of the network. + + Taking two nodes as an example, Node A executes: + + ```sh + sudo easytier-core -i 10.144.144.1 --network-name abc --network-secret abc -e 'tcp://easytier.public.kkrainbow.top:11010' + ``` + + Node B executes + + ```sh + sudo easytier-core --ipv4 10.144.144.2 --network-name abc --network-secret abc -e 'tcp://easytier.public.kkrainbow.top:11010' + ``` + + After the command is successfully executed, Node A can access Node B through the virtual IP 10.144.144.2. + + + ### Configurations + + You can use ``easytier-core --help`` to view all configuration items + + + # Roadmap + + - [ ] Improve documentation and user guides. + - [ ] Support features such as encryption, TCP hole punching, etc. + - [ ] Support Android, IOS and other mobile platforms. + - [ ] Support Web configuration management. + + # Community and Contribution + + We welcome and encourage community contributions! If you want to get involved, please submit a [GitHub PR](https://github.com/KKRainbow/EasyTier/pulls). Detailed contribution guidelines can be found in [CONTRIBUTING.md](https://github.com/KKRainbow/EasyTier/blob/main/CONTRIBUTING.md). + + # Related Projects and Resources + + - [ZeroTier](https://www.zerotier.com/): A global virtual network for connecting devices. + - [TailScale](https://tailscale.com/): A VPN solution aimed at simplifying network configuration. + - [vpncloud](https://github.com/dswd/vpncloud): A P2P Mesh VPN + + # License + + EasyTier is released under the [Apache License 2.0](https://github.com/KKRainbow/EasyTier/blob/main/LICENSE). + + # Contact + + - Ask questions or report problems: [GitHub Issues](https://github.com/KKRainbow/EasyTier/issues) + - Discussion and exchange: [GitHub Discussions](https://github.com/KKRainbow/EasyTier/discussions) + - QQ Group: 949700262 \ No newline at end of file diff --git a/README_CN.md b/README_CN.md new file mode 100644 index 0000000..865b199 --- /dev/null +++ b/README_CN.md @@ -0,0 +1,203 @@ +# EasyTier + +[![GitHub](https://img.shields.io/github/license/KKRainbow/EasyTier)](https://github.com/KKRainbow/EasyTier/blob/main/LICENSE) +[![GitHub last commit](https://img.shields.io/github/last-commit/KKRainbow/EasyTier)](https://github.com/KKRainbow/EasyTier/commits/main) +[![GitHub issues](https://img.shields.io/github/issues/KKRainbow/EasyTier)](https://github.com/KKRainbow/EasyTier/issues) +[![GitHub actions](https://github.com/KKRainbow/EasyTier/actions/workflows/rust.yml/badge.svg)](https://github.com/KKRainbow/EasyTier/actions/) + +[简体中文](/README_CN.md) | [English](/README.md) + +一个简单、即插即用、去中心化的内网穿透 VPN 组网方案,使用 Rust 语言和 Tokio 框架实现。 + +## 特点 + +- **去中心化**:无需依赖中心化服务,节点平等且独立。 +- **跨平台**:支持 MacOS/Linux/Windows,未来将支持 IOS 和 Android。可执行文件静态链接,部署简单。 +- **无公网 IP 组网**:支持利用共享的公网节点组网,可参考 [配置指南](#无公网IP组网) +- **NAT 穿透**:支持基于 UDP 的 NAT 穿透,即使在复杂的网络环境下也能建立稳定的连接。 +- **子网代理(点对网)**:节点可以将可访问的网段作为代理暴露给 VPN 子网,允许其他节点通过该节点访问这些子网。 +- **智能路由**:根据流量智能选择链路,减少延迟,提高吞吐量。 +- **TCP 支持**:在 UDP 受限的情况下,通过并发 TCP 链接提供可靠的数据传输,优化性能。 +- **高可用性**:支持多路径和在检测到高丢包率或网络错误时切换到健康路径。 + +## 安装 + +1. **下载预编译的二进制文件** + + 访问 [GitHub Release 页面](https://github.com/KKRainbow/EasyTier/releases) 下载适用于您操作系统的二进制文件。 + +2. **通过 crates.io 安装** + ```sh + cargo install easytier + ``` + + +3. **通过源码安装** + ```sh + cargo install --git https://github.com/KKRainbow/EasyTier.git + ``` + +## 快速开始 + +确保已按照 [安装指南](#安装) 安装 EasyTier,并且 easytier-core 和 easytier-cli 两个命令都已经可用。 + +### 双节点组网 + +假设双节点的网络拓扑如下 + +```mermaid +flowchart LR + +subgraph 节点 A IP 22.1.1.1 +nodea[EasyTier\n10.144.144.1] +end + +subgraph 节点 B +nodeb[EasyTier\n10.144.144.2] +end + +nodea <-----> nodeb + +``` + +1. 在节点 A 上执行: + ```sh + sudo easytier-core --ipv4 10.144.144.1 + ``` + 命令执行成功会有如下打印。 + + ![alt text](assets/image-2.png) + +2. 在节点 B 执行 + ```sh + sudo easytier-core --ipv4 10.144.144.2 --peers udp://22.1.1.1:11010 + ``` + +3. 测试联通性 + + 两个节点应成功连接并能够在虚拟子网内通信 + ```sh + ping 10.144.144.2 + ``` + + 使用 easytier-cli 查看子网中的节点信息 + ```sh + easytier-cli peer + ``` + ![alt text](assets/image.png) + ```sh + easytier-cli route + ``` + ![alt text](assets/image-1.png) + +--- + +### 多节点组网 + +基于刚才的双节点组网例子,如果有更多的节点需要加入虚拟网络,可以使用如下命令。 + +``` +sudo easytier-core --ipv4 10.144.144.2 --peers udp://22.1.1.1:11010 +``` + +其中 `--peers ` 参数可以填写任意一个已经在虚拟网络中的节点的监听地址。 + +--- + +### 子网代理(点对网)配置 + +假设网络拓扑如下,节点 B 想将其可访问的子网 10.1.1.0/24 共享给其他节点。 + +```mermaid +flowchart LR + +subgraph 节点 A IP 22.1.1.1 +nodea[EasyTier\n10.144.144.1] +end + +subgraph 节点 B +nodeb[EasyTier\n10.144.144.2] +end + +id1[[10.1.1.0/24]] + +nodea <--> nodeb <-.-> id1 + +``` + +则节点 B 的 easytier 启动参数为(新增 -n 参数) + +```sh +sudo easytier-core --ipv4 10.144.144.2 -n 10.1.1.0/24 +``` + +子网代理信息会自动同步到虚拟网络的每个节点,各个节点会自动配置相应的路由,节点 A 可以通过如下命令检查子网代理是否生效。 + +1. 检查路由信息是否已经同步,proxy_cidrs 列展示了被代理的子网。 + + ```sh + easytier-cli route + ``` + ![alt text](assets/image-3.png) + +2. 测试节点 A 是否可访问被代理子网下的节点 + + ```sh + ping 10.1.1.2 + ``` + +--- + +### 无公网IP组网 + +EasyTier 支持共享公网节点进行组网。目前已部署共享的公网节点 ``tcp://easytier.public.kkrainbow.top:11010``。 + +使用共享节点时,需要每个入网节点提供相同的 ``--network-name`` 和 ``--network-secret`` 参数,作为网络的唯一标识。 + +以双节点为例,节点 A 执行: + +```sh +sudo easytier-core -i 10.144.144.1 --network-name abc --network-secret abc -e 'tcp://easytier.public.kkrainbow.top:11010' +``` + +节点 B 执行 + +```sh +sudo easytier-core --ipv4 10.144.144.2 --network-name abc --network-secret abc -e 'tcp://easytier.public.kkrainbow.top:11010' +``` + +命令执行成功后,节点 A 即可通过虚拟 IP 10.144.144.2 访问节点 B。 + +--- + +### 其他配置 + +可使用 ``easytier-core --help`` 查看全部配置项 + + +# 路线图 + +- [ ] 完善文档和用户指南。 +- [ ] 支持加密、TCP 打洞等特性。 +- [ ] 支持 Android、IOS 等移动平台。 +- [ ] 支持 Web 配置管理。 + +# 社区和贡献 + +我们欢迎并鼓励社区贡献!如果你想参与进来,请提交 [GitHub PR](https://github.com/KKRainbow/EasyTier/pulls)。详细的贡献指南可以在 [CONTRIBUTING.md](https://github.com/KKRainbow/EasyTier/blob/main/CONTRIBUTING.md) 中找到。 + +# 相关项目和资源 + +- [ZeroTier](https://www.zerotier.com/): 一个全球虚拟网络,用于连接设备。 +- [TailScale](https://tailscale.com/): 一个旨在简化网络配置的 VPN 解决方案。 +- [vpncloud](https://github.com/dswd/vpncloud): 一个 P2P Mesh VPN + +# 许可证 + +EasyTier 根据 [Apache License 2.0](https://github.com/KKRainbow/EasyTier/blob/main/LICENSE) 许可证发布。 + +# 联系方式 + +- 提问或报告问题:[GitHub Issues](https://github.com/KKRainbow/EasyTier/issues) +- 讨论和交流:[GitHub Discussions](https://github.com/KKRainbow/EasyTier/discussions) +- QQ 群: 949700262 \ No newline at end of file diff --git a/assets/image-1.png b/assets/image-1.png new file mode 100644 index 0000000..c22e584 Binary files /dev/null and b/assets/image-1.png differ diff --git a/assets/image-2.png b/assets/image-2.png new file mode 100644 index 0000000..daf2d34 Binary files /dev/null and b/assets/image-2.png differ diff --git a/assets/image-3.png b/assets/image-3.png new file mode 100644 index 0000000..809eaba Binary files /dev/null and b/assets/image-3.png differ diff --git a/assets/image.png b/assets/image.png new file mode 100644 index 0000000..deefbb8 Binary files /dev/null and b/assets/image.png differ