add config generator (#92)

* add config generator

* update install windows service
This commit is contained in:
Sijie.Sun
2025-02-07 23:51:40 +08:00
committed by GitHub
parent 5c2970e19f
commit 422f7226b3
8 changed files with 410 additions and 123 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

+4
View File
@@ -13,3 +13,7 @@ Note: The configuration file has a higher priority. When a configuration file is
Running with parameters can generate a configuration file with the corresponding parameters. The configuration file will be printed in the command line, and you can manually copy and save it as a toml file.
Running `easytier-core` directly without parameters will generate the minimal configuration file.
## Configuration File Generator
The official website provides a configuration file generator, which you can access via <a href="https://easytier.cn/web/index.html#config_generator">Configuration File Generator</a> to generate configuration files.
@@ -1,10 +1,151 @@
# Install as a Windows Service
1. Go to the NSSM official website [https://nssm.cc/download] to download NSSM and extract it to a local directory.
2. Download the command-line version of easytier-core.exe and remember the storage directory, such as `D:\Software\Easytier\cli\easytier-core.exe`.
3. Register it as a Windows service, for example, name it `easytier_service`:
- `nssm.exe install easytier_service D:\Software\Easytier\cli\easytier-core.exe --ipv4 10.144.144.2 --network-name abc --network-secret abc -e tcp://public.easytier.top:11010`
4. Run `services.msc`, find the easytier_service service, enable it and set it to delayed start.
5. To remove the service: `nssm.exe remove easytier_service`
6. Note that after registering as a service, the program (referring to easytier-core.exe) cannot be modified, deleted, or moved. Otherwise, you need to delete and re-register or modify the Windows registry.
7. To conveniently execute `easytier-cli.exe` to check the connection status, you can store it under `C:\Users\Administrator` (Administrator is your Windows username). You can open cmd or PowerShell at will to execute it, such as: `easytier-cli.exe peer`.
> Thanks to BeiChen℃ for providing the tutorial
On Windows systems, installing certain applications as services allows them to run automatically in the background without manual intervention. This greatly improves the stability and convenience of the application. In this guide, we will use NSSM (Non-Sucking Service Manager) to install the easytier application as a Windows service and walk you through the entire process.
## 1. Preparation
**Download NSSM**:
Open your web browser and visit the NSSM official website [https://nssm.cc/download](https://nssm.cc/download).
On the website, locate the version appropriate for your system (usually the latest version) and click the download link to save it locally.
Once downloaded, extract the zip file to your chosen local directory, for example, `D:\NSSM`.
**Download the easytier Application**:
Find the download link for the latest version of `easytier-windows-x86_64-v2.2.0.zip` and download it locally.
After downloading, extract the zip file to a directory on your system, for instance, `D:\Program Files\EasyTier`.
## 2. Installing as a Windows Service
**Open Command Prompt or PowerShell**:
Press `Win + R` to open the Run dialog box.
Type `cmd` (for Command Prompt) or `powershell` (for PowerShell) and click "OK".
**Navigate to the NSSM Directory**:
In Command Prompt or PowerShell, use the `cd` command to change to the directory where NSSM was extracted. For example, if NSSM was extracted to `D:\NSSM`, type:
```
cd D:\NSSM
```
and press Enter.
**Install the Service**:
Type the following command to install the service:
```
nssm.exe install easytier_service
```
Press Enter. This will open the NSSM configuration window.
## 3. Configuring Service Parameters
**Set the Path**:
In the NSSM configuration window, locate the "Path" field.
Enter the full path to `easytier-core.exe`. For example, if `easytier-core.exe` is in the `D:\Program Files\EasyTier` directory, enter:
```
D:\Program Files\EasyTier\easytier-core.exe
```
**Set the Startup Directory**:
Find the "Startup directory" field and enter the directory where `easytier-core.exe` is located, e.g., `D:\Program Files\EasyTier`.
**Set Arguments**:
In the "Arguments" field, enter any startup parameters you require. For example:
```
-i 10.10.10.2 --network-name easytier --network-secret easytier --peers tcp://public.easytier.top:11010
```
Customize these parameters according to your needs.
![easytier nssm](/assets/win-service.png)
**Save the Configuration and Close the Window**:
After setting the parameters, click the "Edit service" button in the NSSM window to save the configuration and close the window. The `easytier_service` is now installed and configured.
## 4. Removing the Service
If you need to remove the installed service, follow these steps:
**Open Command Prompt or PowerShell**:
Press `Win + R`, enter `cmd` (for Command Prompt) or `powershell` (for PowerShell), and click "OK".
**Navigate to the NSSM Directory**:
Change to the NSSM extraction directory with:
```
cd D:\NSSM
```
Press Enter.
**Remove the Service**:
Type the command:
```
nssm.exe remove easytier_service
```
Press Enter. Follow the prompts to complete the removal of the service.
## 5. Checking Connection Status
To conveniently use `easytier-cli.exe` to check connection status, you can choose one of the following methods:
**Register to the Environment Variables**:
Right-click on "This PC" and select "Properties".
In the window that opens, click on "Advanced system settings" on the left.
In the "System Properties" window, go to the "Advanced" tab and click the "Environment Variables" button.
Under "System variables", locate the "Path" variable and click "Edit".
In the "Edit environment variable" window, click "New" and add the directory path where `easytier-cli.exe` is located. For example, if it is in `D:\Program Files\EasyTier`, add:
```
D:\Program Files\EasyTier
```
Click "OK" to save your changes and close all the windows.
**Place into a Specific Directory**:
Copy the `easytier-cli.exe` file to the `C:\Users\Administrator` directory (replace `Administrator` with your actual Windows username).
Open any Command Prompt or PowerShell window, type:
```
easytier-cli.exe peer
```
and press Enter to check the connection status.
## 6. Notes
Once registered as a service, the program (i.e., `easytier-core.exe`) should not be arbitrarily modified, deleted, or moved. If you need to perform such actions, you must first remove the service and then re-register it or modify the Windows registry accordingly.
Ensure that the service parameters are correctly configured; otherwise, the service might not start properly.
Exercise caution when editing environment variables to avoid removing or altering other important variables.
+18
View File
@@ -39,3 +39,21 @@ By default, the KCP proxy uses the kernel's network stack, which may not work co
If you do not want traffic destined for a specific node to use the KCP protocol, start EasyTier on the target node with the `--disable-kcp-input` parameter.
For example, if you do not want Node B to receive KCP traffic, start EasyTier on Node B with the `--disable-kcp-input` parameter. In this case, even if Node A has enabled the KCP proxy, the traffic from Node A to Node B will continue to use the TCP protocol.
## Checking KCP Proxy Status
You can check the status of KCP proxy connections using the EasyTier CLI tool.
```bash
$ easytier-cli proxy
┌────────────────────┬───────────────────┬─────────────────────────┬───────────┬────────────────┐
│ src │ dst │ start_time │ state │ transport_type │
├────────────────────┼───────────────────┼─────────────────────────┼───────────┼────────────────┤
│ 10.126.126.7:51838 │ 10.147.223.128:22 │ 2025-02-07 10:39:08 UTC │ Connected │ Tcp │
├────────────────────┼───────────────────┼─────────────────────────┼───────────┼────────────────┤
│ 0.0.0.0:0 │ 10.147.223.1:80 │ 2025-02-07 10:41:28 UTC │ Connected │ Kcp │
├────────────────────┼───────────────────┼─────────────────────────┼───────────┼────────────────┤
│ 0.0.0.0:0 │ 10.147.223.1:80 │ 2025-02-07 10:41:18 UTC │ Connected │ Kcp │
└────────────────────┴───────────────────┴─────────────────────────┴───────────┴────────────────┘
```
+4
View File
@@ -13,3 +13,7 @@ easytier-core -c ./config.yaml
使用参数运行可以获得对应参数的配置文件。配置文件会打印在命令行中,可以手动复制对应配置保存为toml文件即可。
在不使用参数的情况下直接运行 `easytier-core` 可以获得最小配置文件。
## 配置文件生成工具
官网提供了配置文件生成工具,可以通过访问 <a href="https://easytier.cn/web/index.html#config_generator">配置文件生成工具</a> 来生成配置文件。
+111 -9
View File
@@ -1,9 +1,111 @@
# 安装为windows服务
1. 前往NSSM官网[https://nssm.cc/download]下载NSSM并解压到本地目录
2. 下载好命令行版easytier-core.exe,记住存放目录,如`D:\Software\Easytier\cli\easytier-core.exe`
3. 将其注册为windows服务,如命名为`easytier_service`
- `nssm.exe install easytier_service D:\Software\Easytier\cli\easytier-core.exe --ipv4 10.144.144.2 --network-name abc --network-secret abc -e tcp://public.easytier.top:11010`
4. 运行 `services.msc`,找到easytier_service服务,启用并将其设置为延时启动
5. 如要删除服务:`nssm.exe remove easytier_service`
6. 注意注册成服务后程序(指easytier-core.exe)不能修改、删除或移动,否则需要删除以重新注册或修改win注册表
7. 为方便执行`easytier-cli.exe`查看连接情况,可将其存放到`C:\Users\Administrator`(Administrator是你windows用户名)底下,随意打开cmd或powershell即可执行,如:`easytier-cli.exe peer`
# 安装为 Windows 服务
> 感谢 北辰℃ 提供的教程
在 Windows 系统中,将某些应用程序安装为服务可以使其在后台自动运行,无需用户手动干预,极大地提高了应用的运行稳定性和便捷性。本教程将以使用 NSSMNon-Sucking Service Manager)工具将 easytier 应用安装为 Windows 服务为例,详细介绍整个操作流程。
## 一、前期准备
**下载 NSSM**
打开浏览器,访问 NSSM 官网 \[[ht](https://nssm.cc/download)[tps:/](https://nssm.cc/download)[/nssm](https://nssm.cc/download)[.cc/d](https://nssm.cc/download)[ownlo](https://nssm.cc/download)[ad](https://nssm.cc/download)]。
在官网页面中找到适用于你系统的版本(通常是最新版本),点击下载链接将其下载到本地。
下载完成后,将压缩包解压到你指定的本地目录,例如`D:\NSSM`
**下载 easytier 应用**
找到最新版本的`easytier-windows-x86_64-v2.2.0.zip`文件下载链接,将其下载到本地。
下载完成后,将该压缩包解压到本地目录,比如`D:\Program Files\EasyTier`
## 二、安装为 Windows 服务
**打开命令提示符或 PowerShell**
按下`Win + R`组合键,打开 “运行” 对话框。
在对话框中输入`cmd`(打开命令提示符)或`powershell`(打开 PowerShell),然后点击 “确定” 按钮。
**切换到 NSSM 解压目录**
在命令提示符或 PowerShell 中,使用`cd`命令切换到 NSSM 解压后的目录。例如,如果 NSSM 解压到了`D:\NSSM`,则输入`cd D:\NSSM`,然后按下回车键。
**安装服务**
在命令提示符或 PowerShell 中输入`nssm.exe install easytier_service`,然后按下回车键。此时会弹出一个 NSSM 配置窗口。
## 三、配置服务参数
**设置 Path**
在 NSSM 配置窗口中,找到 “Path” 字段。
`easytier-core.exe`的完整路径填入该字段。例如,如果`easytier-core.exe`位于`D:\Program Files\EasyTier`目录下,则填写`D:\Program Files\EasyTier\easytier-core.exe`
**设置 Startup directory**
找到 “Startup directory” 字段。
填入`easytier-core.exe`所在的目录,即`D:\Program Files\EasyTier`
**设置 Arguments**
在 “Arguments” 字段中,填入你需要的启动参数。例如`-i 10.10.10.2 --network-name easytier --network-secret easytier --peers tcp://public.easytier.top:11010`。这些参数根据你的实际需求进行配置。
![easytier nssm](/assets/win-service.png)
**保存配置并关闭窗口**
完成上述参数设置后,点击 NSSM 配置窗口中的 “Edit service” 按钮,保存配置并关闭窗口。此时,`easytier_service`服务已经安装并配置完成。
## 四、删除服务
如果需要删除已安装的服务,可以按照以下步骤操作:
**打开命令提示符或 PowerShell**
按下`Win + R`组合键,打开 “运行” 对话框。
在对话框中输入`cmd`(打开命令提示符)或`powershell`(打开 PowerShell),然后点击 “确定” 按钮。
**切换到 NSSM 解压目录**
使用`cd`命令切换到 NSSM 解压后的目录。例如,如果 NSSM 解压到了`D:\NSSM`,则输入`cd D:\NSSM`,然后按下回车键。
**删除服务**
在命令提示符或 PowerShell 中输入`nssm.exe remove easytier_service`,然后按下回车键。根据提示完成服务的删除操作。
## 五、查看连接情况
为了方便执行`easytier-cli.exe`查看连接情况,可以采用以下两种方法:
**注册到环境变量**
右键点击 “此电脑”,选择 “属性”。
在弹出的窗口中,点击左侧的 “高级系统设置”。
在 “系统属性” 窗口中,点击 “高级” 选项卡,然后点击 “环境变量” 按钮。
在 “环境变量” 窗口中,找到 “系统变量” 下的 “Path” 变量,点击 “编辑”。
在弹出的 “编辑环境变量” 窗口中,点击 “新建”,然后将`easytier-cli.exe`所在的目录路径添加进去。例如,如果`easytier-cli.exe`位于`D:\Program Files\EasyTier`目录下,则添加`D:\Program Files\EasyTier`
点击 “确定” 按钮保存设置,关闭所有窗口。
**存放到指定目录**
`easytier-cli.exe`文件复制到`C:\Users\Administrator`目录下(`Administrator`请替换为你自己的 Windows 用户名)。
打开任意一个命令提示符或 PowerShell 窗口,输入`easytier-cli.exe peer`,按下回车键即可查看连接情况。
## 六、注意事项
注册成服务后,程序(指`easytier-core.exe`)不能随意修改、删除或移动。如果需要进行这些操作,需要先删除服务,然后重新注册或修改 Windows 注册表。
在配置服务参数时,确保参数的正确性,否则可能导致服务无法正常启动。
在设置环境变量时,要小心操作,避免误删或误改其他重要的环境变量。
+18
View File
@@ -42,3 +42,21 @@ KCP 代理默认使用内核的网络栈,可能由于系统防火墙设置导
如果不希望发往某个节点的流量使用 KCP 协议,可以在对端节点上启动 EasyTier 时指定 `--disable-kcp-input` 参数。
以简介中的例子为例,如果不希望 B 节点接收 KCP 流量,可以在 B 节点上启动 EasyTier 时指定 `--disable-kcp-input` 参数。这样即使 A 节点启用了 KCP 代理,A 节点发往 B 节点的流量依然使用 TCP 协议。
## 查看 KCP 代理状态
可以通过 EasyTier Cli 工具查看 KCP 代理的链接的状态。
```bash
$ easytier-cli proxy
┌────────────────────┬───────────────────┬─────────────────────────┬───────────┬────────────────┐
│ src │ dst │ start_time │ state │ transport_type │
├────────────────────┼───────────────────┼─────────────────────────┼───────────┼────────────────┤
│ 10.126.126.7:51838 │ 10.147.223.128:22 │ 2025-02-07 10:39:08 UTC │ Connected │ Tcp │
├────────────────────┼───────────────────┼─────────────────────────┼───────────┼────────────────┤
│ 0.0.0.0:0 │ 10.147.223.1:80 │ 2025-02-07 10:41:28 UTC │ Connected │ Kcp │
├────────────────────┼───────────────────┼─────────────────────────┼───────────┼────────────────┤
│ 0.0.0.0:0 │ 10.147.223.1:80 │ 2025-02-07 10:41:18 UTC │ Connected │ Kcp │
└────────────────────┴───────────────────┴─────────────────────────┴───────────┴────────────────┘
```
+106 -106
View File
File diff suppressed because one or more lines are too long