From f817e1f0206ff336fd201f45ecd11d7960a5e376 Mon Sep 17 00:00:00 2001 From: vaalacat Date: Tue, 2 Apr 2024 01:48:44 +0000 Subject: [PATCH] feat: comment for client and decrease default cache --- .drone.yaml | 6 +- .github/workflows/latest.workflow.yml | 2 +- .github/workflows/tag.workflow.yml | 2 +- Dockerfile.standalone | 4 +- README.md | 206 +++++++++++++----------- README_en.md | 220 ++++++++++++++++++++++++++ biz/master/client/get_client.go | 1 + biz/master/client/list_client.go | 1 + biz/master/client/update_tunnel.go | 1 + cache/freecache.go | 2 +- conf/settings.go | 2 +- go.mod | 30 ++-- go.sum | 70 ++++---- idl/api_client.proto | 1 + models/client.go | 1 + pb/api_auth.pb.go | 4 +- pb/api_client.pb.go | 91 ++++++----- pb/api_master.pb.go | 4 +- pb/api_server.pb.go | 4 +- pb/api_user.pb.go | 4 +- pb/common.pb.go | 4 +- pb/rpc_master.pb.go | 4 +- pb/rpc_master_grpc.pb.go | 2 +- services/client/frpc_service.go | 2 +- services/server/frps_service.go | 2 +- www/components/frpc_card.tsx | 9 ++ www/components/frpc_editor.tsx | 13 ++ www/components/frpc_form.tsx | 2 + www/components/proxy_form.tsx | 10 +- www/lib/pb/api_client.ts | 13 +- 30 files changed, 512 insertions(+), 205 deletions(-) create mode 100644 README_en.md diff --git a/.drone.yaml b/.drone.yaml index 81afcbf..b7acd08 100644 --- a/.drone.yaml +++ b/.drone.yaml @@ -3,7 +3,7 @@ name: build-and-publish steps: - name: download modules - image: golang:1.21-alpine + image: golang:1.22-alpine commands: - sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories - apk update --no-cache && apk add --no-cache tzdata git @@ -40,7 +40,7 @@ steps: - promote - rollback - name: build - amd64 - image: golang:1.21-alpine + image: golang:1.22-alpine commands: - CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GOPROXY=https://goproxy.cn,https://proxy.golang.org,direct go build -ldflags="-s -w" -o frp-panel-amd64 cmd/frpp/*.go volumes: @@ -57,7 +57,7 @@ steps: - promote - rollback - name: build - arm64 - image: golang:1.21-alpine + image: golang:1.22-alpine commands: - CGO_ENABLED=0 GOOS=linux GOARCH=arm64 GOPROXY=https://goproxy.cn,https://proxy.golang.org,direct go build -ldflags="-s -w" -o frp-panel-arm64 cmd/frpp/*.go volumes: diff --git a/.github/workflows/latest.workflow.yml b/.github/workflows/latest.workflow.yml index d8cf941..fecf770 100644 --- a/.github/workflows/latest.workflow.yml +++ b/.github/workflows/latest.workflow.yml @@ -18,7 +18,7 @@ jobs: - name: Setup Go uses: actions/setup-go@v4 with: - go-version: "1.21.x" + go-version: "1.22.x" - name: npm install and build run: | cd www diff --git a/.github/workflows/tag.workflow.yml b/.github/workflows/tag.workflow.yml index 60e6367..89fc2b5 100644 --- a/.github/workflows/tag.workflow.yml +++ b/.github/workflows/tag.workflow.yml @@ -19,7 +19,7 @@ jobs: - name: Setup Go uses: actions/setup-go@v4 with: - go-version: "1.21.x" + go-version: "1.22.x" - name: npm install and build run: | cd www diff --git a/Dockerfile.standalone b/Dockerfile.standalone index 8c86e08..afb3987 100644 --- a/Dockerfile.standalone +++ b/Dockerfile.standalone @@ -1,5 +1,5 @@ # Stage 1: Building frontend -FROM node:18-alpine AS frontend +FROM node:20-alpine AS frontend WORKDIR /app/www RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories RUN apk update --no-cache && apk add --no-cache tzdata git openssh @@ -24,7 +24,7 @@ COPY www/*.json ./ RUN ls && mkdir -p ../cmd/frpp && npm run build # Stage 2: Building binary -FROM golang:1.21-alpine AS builder +FROM golang:1.22-alpine AS builder WORKDIR /app RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories RUN apk update --no-cache && apk add --no-cache tzdata git diff --git a/README.md b/README.md index ef636b3..380c0a9 100644 --- a/README.md +++ b/README.md @@ -3,11 +3,13 @@ # FRP-Panel -我们的目标就是做一个: -- 客户端配置可中心化管理 -- 多服务端配置管理 -- 可视化配置界面 -- 简化运行所需要的配置 +[English Version](README_en.md) | [中文文档](README.md) + +我们的目标就是做一个: +- 客户端配置可中心化管理 +- 多服务端配置管理 +- 可视化配置界面 +- 简化运行所需要的配置 的更强更完善的frp! @@ -15,6 +17,116 @@ ![](./doc/frp-panel-demo.gif) +## 项目使用说明 +frp-panel可选docker和直接运行模式部署,直接部署请到release下载文件:[release](https://github.com/VaalaCat/frp-panel/releases) + +注意:二进制有两种,一种是仅客户端,一种是全功能可执行文件,客户端版只能执行client命令(无需client参数) + +客户端版的名字会带有client标识 + +启动过后默认访问地址为 `http://IP:9000` + +默认第一个注册的用户是管理员。且默认不开放注册多用户,如果需要,请在Master启动命令或配置文件中添加参数:`APP_ENABLE_REGISTER=true` + +### docker + +注意⚠️:client 和 server 的启动指令可能会随着项目更新而改变,虽然在项目迭代时会注意前后兼容,但仍难以完全适配,因此 client 和 server 的启动指令以 master 生成为准 + +- master + +```bash +docker run -d -p 9000:9000 \ # API控制台端口 + -p 9001:9001 \ # rpc端口 + -p 7000:7000 \ # frps 端口 + -p 20000-20050:20000-20050 \ # 给frps预留的端口 + --restart=unless-stopped \ + -v /opt/frp-panel:/data \ # 数据存储位置 + -e APP_GLOBAL_SECRET=your_secret \ # Master的secret注意不要泄漏,客户端和服务端的是通过Master生成的 + -e MASTER_RPC_HOST=0.0.0.0 \ # 这里要改成你服务器的外部IP + vaalacat/frp-panel +# 或者 +docker run -d \ + --network=host \ + --restart=unless-stopped \ + -v /opt/frp-panel:/data \ + -e APP_GLOBAL_SECRET=your_secret \ # Master的secret注意不要泄漏,客户端和服务端的是通过Master生成的 + -e MASTER_RPC_HOST=0.0.0.0 \ # 这里要改成你服务器的外部IP + vaalacat/frp-panel +``` +- client + +```bash +docker run -d \ + --network=host \ + --restart=unless-stopped \ + vaalacat/frp-panel client -s xxxx -i xxxx -a xxxx -r 127.0.0.1 -c 9001 -p 9000 -e http # 在master WebUI复制的参数 +``` +- server + +```bash +docker run -d \ + --network=host \ + --restart=unless-stopped \ + vaalacat/frp-panel server -s xxxx -i xxxx -a xxxx -r 127.0.0.1 -c 9001 -p 9000 -e http # 在master WebUI复制的参数 +``` + +### 直接运行(Linux) +- master + +注意修改IP +```powershell +APP_GLOBAL_SECRET=your_secret MASTER_RPC_HOST=0.0.0.0 frp-panel master +``` +- client + +```powershell +frp-panel client -s xxxx -i xxxx -a xxxx -r 127.0.0.1 -c 9001 -p 9000 -e http # 在master WebUI复制的参数 +``` +- server + +```powershell +frp-panel server -s xxxx -i xxxx -a xxxx -r 127.0.0.1 -c 9001 -p 9000 -e http # 在master WebUI复制的参数 +``` +### 直接运行(Windows) +在下载的可执行文件同名文件夹下创建一个 `.env` 文件(注意不要有后缀名),然后输入以下内容保存后运行对应命令,注意,client和server的对应参数需要在web页面复制 + +- master: `frp-panel-amd64.exe master` +``` +APP_GLOBAL_SECRET=your_secret +MASTER_RPC_HOST=IP +DB_DSN=data.db +``` + +client 和 server 要使用在 master WebUI复制的参数 + +- client: `frp-panel-amd64.exe client -s xxxx -i xxxx -a xxxx -r 127.0.0.1 -c 9001 -p 9000 -e http # 在master WebUI复制的参数` + +- server: `frp-panel-amd64.exe server -s xxxx -i xxxx -a xxxx -r 127.0.0.1 -c 9001 -p 9000 -e http # 在master WebUI复制的参数` + +### 隧道高级模式配置 + +本面板完全兼容frp原本的`json`格式配置,仅需要将配置文件内容粘贴到服务端/客户端高级模式编辑框内,更新即可,详细的使用参考:[frp文档](https://gofrp.org/zh-cn/docs/features/common/configure/) + +### 程序启动配置文件 + +程序会按顺序读取以下文件内容作为配置文件:`.env`,`/etc/frpp/.env` + +### 服务管理 + +如果您使用的是面板自带的安装脚本,对于Linux使用systemd控制,对于Windows使用nssm控制 + +Linux安装后使用示例: +```bash +systemctl stop frpp +systemctl start frpp +``` + +Windows安装后使用示例: +``` +C:/frpp/nssm.exe stop frpp +C:/frpp/nssm.exe remove frpp +``` + ## 项目开发指南 ### 平台架构设计 @@ -93,89 +205,7 @@ ![structure](doc/callvis.svg) -## 项目使用说明 -frp-panel可选docker和直接运行模式部署,直接部署请到release下载文件:[release](https://github.com/VaalaCat/frp-panel/releases) - -注意:二进制有两种,一种是仅客户端,一种是全功能可执行文件,客户端版只能执行client命令 - -启动过后默认访问地址为 http://IP:9000 - -### docker - -注意⚠️:client 和 server 的启动指令可能会随着项目更新而改变,虽然在项目迭代时会注意前后兼容,但仍难以完全适配,因此 client 和 server 的启动指令以 master 生成为准 - -- master - -```bash -docker run -d -p 9000:9000 \ # API控制台端口 - -p 9001:9001 \ # rpc端口 - -p 7000:7000 \ # frps 端口 - -p 20000-20050:20000-20050 \ # 给frps预留的端口 - --restart=unless-stopped \ - -v /opt/frp-panel:/data \ # 数据存储位置 - -e APP_GLOBAL_SECRET=your_secret \ # Master的secret注意不要泄漏,客户端和服务端的是通过Master生成的 - -e MASTER_RPC_HOST=0.0.0.0 \ # 这里要改成你服务器的外部IP - vaalacat/frp-panel -# 或者 -docker run -d \ - --network=host \ - --restart=unless-stopped \ - -v /opt/frp-panel:/data \ - -e APP_GLOBAL_SECRET=your_secret \ # Master的secret注意不要泄漏,客户端和服务端的是通过Master生成的 - -e MASTER_RPC_HOST=0.0.0.0 \ # 这里要改成你服务器的外部IP - vaalacat/frp-panel -``` -- client - -```bash -docker run -d \ - --network=host \ - --restart=unless-stopped \ - vaalacat/frp-panel client -s xxxx -i xxxx -a xxxx -r 127.0.0.1 -c 9001 -p 9000 -e http # 在master WebUI复制的参数 -``` -- server - -```bash -docker run -d \ - --network=host \ - --restart=unless-stopped \ - vaalacat/frp-panel server -s xxxx -i xxxx -a xxxx -r 127.0.0.1 -c 9001 -p 9000 -e http # 在master WebUI复制的参数 -``` - -### 直接运行(Linux) -- master - -注意修改IP -``` -APP_GLOBAL_SECRET=your_secret MASTER_RPC_HOST=0.0.0.0 frp-panel master -``` -- client - -``` -frp-panel client -s xxxx -i xxxx -a xxxx -r 127.0.0.1 -c 9001 -p 9000 -e http # 在master WebUI复制的参数 -``` -- server - -``` -frp-panel server -s xxxx -i xxxx -a xxxx -r 127.0.0.1 -c 9001 -p 9000 -e http # 在master WebUI复制的参数 -``` -### 直接运行(Windows) -在下载的可执行文件同名文件夹下创建一个 `.env` 文件(注意不要有后缀名),然后输入以下内容保存后运行对应命令,注意,client和server的对应参数需要在web页面复制 - -- master: `frp-panel-amd64.exe master` -``` -APP_GLOBAL_SECRET=your_secret -MASTER_RPC_HOST=IP -DB_DSN=data.db -``` - -client 和 server 要使用在 master WebUI复制的参数 - -- client: `frp-panel-amd64.exe client -s xxxx -i xxxx -a xxxx -r 127.0.0.1 -c 9001 -p 9000 -e http # 在master WebUI复制的参数` - -- server: `frp-panel-amd64.exe server -s xxxx -i xxxx -a xxxx -r 127.0.0.1 -c 9001 -p 9000 -e http # 在master WebUI复制的参数` - -### 配置说明 +### 本体配置说明 [settings.go](conf/settings.go) 这里有详细的配置参数解释,需要进一步修改配置请参考该文件 diff --git a/README_en.md b/README_en.md new file mode 100644 index 0000000..479dd17 --- /dev/null +++ b/README_en.md @@ -0,0 +1,220 @@ +> Detailed blog post: [https://vaala.cat/2024/01/14/frp-panel-doc/](https://vaala.cat/2024/01/14/frp-panel-doc/) +> You can refer to the blog for instructions, or scroll down to the end. + +# FRP-Panel + +[English Version](README_en.md) | [中文文档](README.md) + +Our goal is to create a more powerful and comprehensive frp that provides: +- Centralized management of client configurations +- Management of multiple server configurations +- Visual configuration interface +- Simplified configuration required for running + +- demo Video: [demo Video](doc/frp-panel-demo.mp4) + +![](./doc/frp-panel-demo.gif) + +## Project Usage Instructions +frp-panel can be deployed in docker or direct run mode. For direct deployment, please download the files from the release: [release](https://github.com/VaalaCat/frp-panel/releases) + +Note: There are two types of binaries, one is for the client only, and the other is a full-featured executable file. The client version will have a "client" identifier in its name. + +After startup, the default access address is `http://IP:9000`. + +The first registered user is the administrator by default. User registration is not open by default. If you need it, please add the following parameter to the Master startup command or configuration file: `APP_ENABLE_REGISTER=true` + +### Docker + +Note⚠️: The startup commands for client and server may change as the project is updated. Although backward compatibility will be considered during project iterations, it is still difficult to fully adapt. Therefore, the startup commands for client and server should be generated from the master. + +- master + +```bash +docker run -d -p 9000:9000 \ # API control console port + -p 9001:9001 \ # rpc port + -p 7000:7000 \ # frps port + -p 20000-20050:20000-20050 \ # Reserved ports for frps + --restart=unless-stopped \ + -v /opt/frp-panel:/data \ # Data storage location + -e APP_GLOBAL_SECRET=your_secret \ # Master's secret, be careful not to leak it, the client and server secrets are generated by the Master + -e MASTER_RPC_HOST=0.0.0.0 \ # Change this to your server's external IP + vaalacat/frp-panel +# or +docker run -d \ + --network=host \ + --restart=unless-stopped \ + -v /opt/frp-panel:/data \ + -e APP_GLOBAL_SECRET=your_secret \ # Master's secret, be careful not to leak it, the client and server secrets are generated by the Master + -e MASTER_RPC_HOST=0.0.0.0 \ # Change this to your server's external IP + vaalacat/frp-panel +``` +- client + +```bash +docker run -d \ + --network=host \ + --restart=unless-stopped \ + vaalacat/frp-panel client -s xxxx -i xxxx -a xxxx -r 127.0.0.1 -c 9001 -p 9000 -e http # Copy the parameters from the master WebUI +``` +- server + +```bash +docker run -d \ + --network=host \ + --restart=unless-stopped \ + vaalacat/frp-panel server -s xxxx -i xxxx -a xxxx -r 127.0.0.1 -c 9001 -p 9000 -e http # Copy the parameters from the master WebUI +``` + +### Direct Run (Linux) +- master + +Note: Modify the IP +```powershell +APP_GLOBAL_SECRET=your_secret MASTER_RPC_HOST=0.0.0.0 frp-panel master +``` +- client + +```powershell +frp-panel client -s xxxx -i xxxx -a xxxx -r 127.0.0.1 -c 9001 -p 9000 -e http # Copy the parameters from the master WebUI +``` +- server + +```powershell +frp-panel server -s xxxx -i xxxx -a xxxx -r 127.0.0.1 -c 9001 -p 9000 -e http # Copy the parameters from the master WebUI +``` +### Direct Run (Windows) +In the same folder as the downloaded executable, create a `.env` file (note that there should be no file extension), then enter the following content and save it before running the corresponding command. Note that the corresponding parameters for client and server need to be copied from the web page. + +- master: `frp-panel-amd64.exe master` +``` +APP_GLOBAL_SECRET=your_secret +MASTER_RPC_HOST=IP +DB_DSN=data.db +``` + +For client and server, use the parameters copied from the master WebUI. + +- client: `frp-panel-amd64.exe client -s xxxx -i xxxx -a xxxx -r 127.0.0.1 -c 9001 -p 9000 -e http # Copy the parameters from the master WebUI` + +- server: `frp-panel-amd64.exe server -s xxxx -i xxxx -a xxxx -r 127.0.0.1 -c 9001 -p 9000 -e http # Copy the parameters from the master WebUI` + +### Tunnel Advanced Mode Configuration + +This panel is fully compatible with frp's original `json` format configuration. You only need to paste the configuration file content into the advanced mode editor for the server/client, and then update it. For detailed usage, please refer to: [frp documentation](https://gofrp.org/docs/features/common/configure/) + +### Program Startup Configuration File + +The program will read the contents of the following files in order as the configuration file: `.env`, `/etc/frpp/.env` + +### Service Management + +If you are using the installation script provided by the panel, systemd is used for Linux control, and nssm is used for Windows control. + +Examples of using Linux after installation: +```bash +systemctl stop frpp +systemctl start frpp +``` + +Examples of using Windows after installation: +``` +C:/frpp/nssm.exe stop frpp +C:/frpp/nssm.exe remove frpp +``` + +## Project Development Guide + +### Platform Architecture Design + +After choosing the tech stack, the next step is to design the architecture of the program. As mentioned in the background, frp itself has frpc and frps (client and server), these two roles are indispensable. Then we need to add something new to manage them, so frp-panel introduces a new master role. The master will be responsible for managing various frpc and frps, as well as centrally storing configuration files and connection information. + +Next, we have frpc and frps. The original version requires writing configuration files on both sides. Since the original version already supports this, we don't need to follow the original approach. We will directly not support configuration files, and all configurations must be obtained from the master. + +In addition, we also need to consider the compatibility with the original version. The client/server of frp-panel must be able to connect to the official frpc/frps service. In this way, both configuration file and non-configuration file modes can work perfectly. +Overall, the architecture is quite simple. + +![arch](doc/arch.png) + +### Development + +The project includes three roles: +1. Master: The control node, accepts requests from the frontend and is responsible for managing Client and Server. +2. Server: The server side, controlled by the control node, responsible for providing services to clients, including frps and rpc (for connecting to the Master) services. +3. Client: The client side, controlled by the control node, including frpc and rpc (for connecting to the Master) services. + +Next, we will provide the functionality of each package in the project: +``` +. +|-- biz # Main business logic +| |-- client # Client logic (here referring to the frp-panel client) +| |-- master # frp-panel control plane, responsible for handling frontend requests, and using rpc to manage frp-panel's server and client +| | |-- auth # Authentication module, including user authentication and client authentication +| | |-- client # Client module, including various APIs for the frontend to manage clients +| | |-- server # Server module, including various APIs for the frontend to manage servers +| | `-- user # User module, including user management, user information retrieval, etc. +| `-- server # Server logic +|-- cache # Cache, used to store frps authentication tokens +|-- cmd # Command line entry, where the main function is located, responsible for starting various modules as needed +|-- common +|-- conf +|-- dao # Data access object, any operations related to the database will call this library +|-- doc # Documentation +|-- idl # IDL definitions +|-- middleware # API middleware, including JWT and context-related, used to process API requests. After authentication passes, user information will be injected into the context and can be obtained through the common package. +|-- models # Database models, used to define database tables. Also includes entity definitions. +|-- pb # Generated protobuf pb files +|-- rpc # Location of various rpcs, including the logic for Client/Server to call Master, as well as the logic for Master to use Stream to call Client and Server +|-- services # Various modules that need to run persistently in memory, this package can manage the running/stopping of various services +| |-- api # API service, requires an external ginRouter to run +| |-- client # frp client, i.e., frpc, can control various configurations/start and stop of frpc +| |-- master # Master service, including the rpc server definition, after receiving an rpc request, it will call the biz package to handle the logic +| |-- rpcclient # Stateful rpc client, because the rpc clients don't have public IP addresses, the rpcclient will call the master's stream long-connection rpc when starting, and after the connection is established, the Master and Client communicate through this package +| `-- server # frp server, i.e., frps, can control various configurations/start and stop of frps +|-- tunnel # Tunnel module, used to manage tunnels, i.e., manage frpc and frps services +|-- utils +|-- watcher # Scheduled tasks, e.g., updating configuration files every 30 seconds +`-- www + |-- api + |-- components # There is an apitest component here for testing + | `-- ui + |-- lib + | `-- pb + |-- pages + |-- public + |-- store + |-- styles + `-- types +``` + +### Debugging and Startup Methods: + +- master: `go run cmd/*.go master` +> For client and server, please copy the content from the master webui +- client: `go run cmd/*.go client -i -s ` +- server: `go run cmd/*.go server -i -s ` + +The project configuration file will read the .env file in the current folder by default. The project includes a sample configuration file, which can be modified according to your needs. + +Detailed architecture call diagram: + +![structure](doc/callvis.svg) + +### Core Configuration Explanation + +[settings.go](conf/settings.go) +This file contains detailed explanations of the configuration parameters. Please refer to this file if you need to further modify the configuration. + +### Some Images + +![](doc/platform_info.png) +![](doc/login.png) +![](doc/register.png) +![](doc/clients_menu.png) +![](doc/server_menu.png) +![](doc/create_client.png) +![](doc/create_server.png) +![](doc/edit_client.png) +![](doc/edit_client_adv.png) +![](doc/edit_server.png) +![](doc/edit_server_adv.png) \ No newline at end of file diff --git a/biz/master/client/get_client.go b/biz/master/client/get_client.go index b902f21..37e480e 100644 --- a/biz/master/client/get_client.go +++ b/biz/master/client/get_client.go @@ -43,6 +43,7 @@ func GetClientHandler(ctx context.Context, req *pb.GetClientRequest) (*pb.GetCli Config: lo.ToPtr(string(client.ConfigContent)), ServerId: lo.ToPtr(client.ServerID), Stopped: lo.ToPtr(client.Stopped), + Comment: lo.ToPtr(client.Comment), }, }, nil } diff --git a/biz/master/client/list_client.go b/biz/master/client/list_client.go index 818b8c6..957e6d8 100644 --- a/biz/master/client/list_client.go +++ b/biz/master/client/list_client.go @@ -43,6 +43,7 @@ func ListClientsHandler(ctx context.Context, req *pb.ListClientsRequest) (*pb.Li Config: lo.ToPtr(string(c.ConfigContent)), ServerId: lo.ToPtr(c.ServerID), Stopped: lo.ToPtr(c.Stopped), + Comment: lo.ToPtr(c.Comment), } }) diff --git a/biz/master/client/update_tunnel.go b/biz/master/client/update_tunnel.go index bf2a356..4374c9b 100644 --- a/biz/master/client/update_tunnel.go +++ b/biz/master/client/update_tunnel.go @@ -85,6 +85,7 @@ func UpdateFrpcHander(c context.Context, req *pb.UpdateFRPCRequest) (*pb.UpdateF cli.ConfigContent = rawCliConf cli.ServerID = serverID + cli.Comment = req.GetComment() if err := dao.UpdateClient(userInfo, cli); err != nil { logrus.WithError(err).Errorf("cannot update client, id: [%s]", clientID) diff --git a/cache/freecache.go b/cache/freecache.go index 89d5a94..527df5e 100644 --- a/cache/freecache.go +++ b/cache/freecache.go @@ -11,7 +11,7 @@ var ( ) func InitCache() { - cacheSize := conf.Get().Master.CacheSize * 1024 * 1024 // 100 MB + cacheSize := conf.Get().Master.CacheSize * 1024 * 1024 // MB cache = freecache.NewCache(cacheSize) logrus.Infof("init cache success, size: %d MB", cacheSize/1024/1024) } diff --git a/conf/settings.go b/conf/settings.go index c4c5aea..b07abd2 100644 --- a/conf/settings.go +++ b/conf/settings.go @@ -26,7 +26,7 @@ type Config struct { APIPort int `env:"API_PORT" env-default:"9000" env-description:"master api port"` APIHost string `env:"API_HOST" env-description:"master host, can behind proxy like cdn"` APIScheme string `env:"API_SCHEME" env-default:"http" env-description:"master api scheme"` - CacheSize int `env:"CACHE_SIZE" env-default:"100" env-description:"cache size in MB"` + CacheSize int `env:"CACHE_SIZE" env-default:"10" env-description:"cache size in MB"` RPCHost string `env:"RPC_HOST" env-default:"127.0.0.1" env-description:"master host, is a public ip or domain"` RPCPort int `env:"RPC_PORT" env-default:"9001" env-description:"master rpc port"` InternalFRPServerHost string `env:"INTERNAL_FRP_SERVER_HOST" env-description:"internal frp server host, used for client connection"` diff --git a/go.mod b/go.mod index 13da360..1cabf25 100644 --- a/go.mod +++ b/go.mod @@ -1,11 +1,11 @@ module github.com/VaalaCat/frp-panel -go 1.21.5 +go 1.22.1 require ( github.com/coocood/freecache v1.2.4 - github.com/fatedier/frp v0.53.2 - github.com/fatedier/golib v0.1.1-0.20230725122706-dcbaee8eef40 + github.com/fatedier/frp v0.56.0 + github.com/fatedier/golib v0.4.2 github.com/gin-contrib/static v0.0.1 github.com/gin-gonic/gin v1.9.1 github.com/glebarez/sqlite v1.10.0 @@ -15,11 +15,11 @@ require ( github.com/ilyakaznacheev/cleanenv v1.5.0 github.com/imroc/req/v3 v3.42.3 github.com/joho/godotenv v1.5.1 - github.com/samber/lo v1.38.1 + github.com/samber/lo v1.39.0 github.com/sirupsen/logrus v1.9.3 github.com/sourcegraph/conc v0.3.0 github.com/spf13/cobra v1.8.0 - golang.org/x/crypto v0.17.0 + golang.org/x/crypto v0.18.0 google.golang.org/grpc v1.60.1 google.golang.org/protobuf v1.31.0 gorm.io/driver/mysql v1.5.2 @@ -41,12 +41,10 @@ require ( github.com/coreos/go-oidc/v3 v3.6.0 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/dustin/go-humanize v1.0.1 // indirect - github.com/fatedier/beego v0.0.0-20171024143340-6c6a4f5bd5eb // indirect - github.com/fatedier/kcp-go v2.0.4-0.20190803094908-fe8645b0a904+incompatible // indirect github.com/gabriel-vasile/mimetype v1.4.2 // indirect github.com/gin-contrib/sse v0.1.0 // indirect github.com/glebarez/go-sqlite v1.21.2 // indirect - github.com/go-jose/go-jose/v3 v3.0.0 // indirect + github.com/go-jose/go-jose/v3 v3.0.1 // indirect github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect github.com/go-playground/validator/v10 v10.14.0 // indirect @@ -69,8 +67,8 @@ require ( github.com/jonboulle/clockwork v0.4.0 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/klauspost/compress v1.17.4 // indirect - github.com/klauspost/cpuid/v2 v2.2.4 // indirect - github.com/klauspost/reedsolomon v1.9.15 // indirect + github.com/klauspost/cpuid/v2 v2.2.6 // indirect + github.com/klauspost/reedsolomon v1.12.0 // indirect github.com/leodido/go-urn v1.2.4 // indirect github.com/mattn/go-isatty v0.0.19 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect @@ -80,8 +78,9 @@ require ( github.com/pelletier/go-toml/v2 v2.1.0 // indirect github.com/pion/dtls/v2 v2.2.7 // indirect github.com/pion/logging v0.2.2 // indirect - github.com/pion/stun v0.6.1 // indirect + github.com/pion/stun/v2 v2.0.0 // indirect github.com/pion/transport/v2 v2.2.1 // indirect + github.com/pion/transport/v3 v3.0.1 // indirect github.com/pires/go-proxyproto v0.7.0 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect @@ -90,17 +89,17 @@ require ( github.com/prometheus/common v0.42.0 // indirect github.com/prometheus/procfs v0.10.1 // indirect github.com/quic-go/qpack v0.4.0 // indirect - github.com/quic-go/qtls-go1-20 v0.4.1 // indirect - github.com/quic-go/quic-go v0.40.1 // indirect + github.com/quic-go/quic-go v0.41.0 // indirect github.com/refraction-networking/utls v1.6.0 // indirect github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect github.com/robfig/cron/v3 v3.0.1 // indirect github.com/spf13/pflag v1.0.5 // indirect - github.com/templexxx/cpufeat v0.0.0-20180724012125-cef66df7f161 // indirect - github.com/templexxx/xor v0.0.0-20191217153810-f85b25db303b // indirect + github.com/templexxx/cpu v0.1.0 // indirect + github.com/templexxx/xorsimd v0.4.2 // indirect github.com/tjfoc/gmsm v1.4.1 // indirect github.com/twitchyliquid64/golang-asm v0.15.1 // indirect github.com/ugorji/go/codec v1.2.11 // indirect + github.com/xtaci/kcp-go/v5 v5.6.7 // indirect go.uber.org/mock v0.4.0 // indirect golang.org/x/arch v0.3.0 // indirect golang.org/x/exp v0.0.0-20240103183307-be819d1f06fc // indirect @@ -117,6 +116,7 @@ require ( gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect + k8s.io/utils v0.0.0-20230209194617-a36077c30491 // indirect modernc.org/libc v1.22.5 // indirect modernc.org/mathutil v1.5.0 // indirect modernc.org/memory v1.5.0 // indirect diff --git a/go.sum b/go.sum index f92a7cb..fc5b6bb 100644 --- a/go.sum +++ b/go.sum @@ -39,14 +39,10 @@ github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+m github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/fatedier/beego v0.0.0-20171024143340-6c6a4f5bd5eb h1:wCrNShQidLmvVWn/0PikGmpdP0vtQmnvyRg3ZBEhczw= -github.com/fatedier/beego v0.0.0-20171024143340-6c6a4f5bd5eb/go.mod h1:wx3gB6dbIfBRcucp94PI9Bt3I0F2c/MyNEWuhzpWiwk= -github.com/fatedier/frp v0.53.2 h1:rbNcXJyKLrEnvurRfGDhSG3BERH7cfv1XRjIs6MSY4s= -github.com/fatedier/frp v0.53.2/go.mod h1:BNJZ9il1aazwhaLeiO2cQCBhY/c9Lq+HP73144bNUkk= -github.com/fatedier/golib v0.1.1-0.20230725122706-dcbaee8eef40 h1:BVdpWT6viE/mpuRa6txNyRNjtHa1Efrii9Du6/gHfJ0= -github.com/fatedier/golib v0.1.1-0.20230725122706-dcbaee8eef40/go.mod h1:Lmi9U4VfvdRvonSMh1FgXVy1hCXycVyJk4E9ktokknE= -github.com/fatedier/kcp-go v2.0.4-0.20190803094908-fe8645b0a904+incompatible h1:ssXat9YXFvigNge/IkkZvFMn8yeYKFX+uI6wn2mLJ74= -github.com/fatedier/kcp-go v2.0.4-0.20190803094908-fe8645b0a904+incompatible/go.mod h1:YpCOaxj7vvMThhIQ9AfTOPW2sfztQR5WDfs7AflSy4s= +github.com/fatedier/frp v0.56.0 h1:DffdbxZr0YdS2Lt7IAskpvEFMUs4v+GiwqyXh9y2bWE= +github.com/fatedier/frp v0.56.0/go.mod h1:Y9xfUKn8jksc7Z3tH7GpLoZxBHDWWI/MWe/am+10wRo= +github.com/fatedier/golib v0.4.2 h1:k+ZBdUFTTipnP1RHfEhGbzyShRdz/rZtFGnjpXG9D9c= +github.com/fatedier/golib v0.4.2/go.mod h1:gpu+1vXxtJ072NYaNsn/YWgojDL8Ap2kFZQtbzT2qkg= github.com/gabriel-vasile/mimetype v1.4.2 h1:w5qFW6JKBz9Y393Y4q372O9A7cUSequkh1Q7OhCmWKU= github.com/gabriel-vasile/mimetype v1.4.2/go.mod h1:zApsH/mKG4w07erKIaJPFiX0Tsq9BFQgN3qGY5GnNgA= github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= @@ -62,8 +58,8 @@ github.com/glebarez/sqlite v1.10.0 h1:u4gt8y7OND/cCei/NMHmfbLxF6xP2wgKcT/BJf2pYk github.com/glebarez/sqlite v1.10.0/go.mod h1:IJ+lfSOmiekhQsFTJRx/lHtGYmCdtAiTaf5wI9u5uHA= github.com/go-co-op/gocron/v2 v2.1.2 h1:+6tTOA9aBaKXpDWExw07hYoGEBzT+4CkGSVAiJ7WSXs= github.com/go-co-op/gocron/v2 v2.1.2/go.mod h1:0MfNAXEchzeSH1vtkZrTAcSMWqyL435kL6CA4b0bjrg= -github.com/go-jose/go-jose/v3 v3.0.0 h1:s6rrhirfEP/CGIoc6p+PZAeogN2SxKav6Wp7+dyMWVo= -github.com/go-jose/go-jose/v3 v3.0.0/go.mod h1:RNkWWRld676jZEYoV3+XK8L2ZnNSvIsxFMht0mSX+u8= +github.com/go-jose/go-jose/v3 v3.0.1 h1:pWmKFVtt+Jl0vBZTIpz/eAKwsm6LkIxDVVbFHKkchhA= +github.com/go-jose/go-jose/v3 v3.0.1/go.mod h1:RNkWWRld676jZEYoV3+XK8L2ZnNSvIsxFMht0mSX+u8= github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= @@ -151,12 +147,11 @@ github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnr github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/klauspost/compress v1.17.4 h1:Ej5ixsIri7BrIjBkRZLTo6ghwrEtHFk7ijlczPW4fZ4= github.com/klauspost/compress v1.17.4/go.mod h1:/dCuZOvVtNoHsyb+cuJD3itjs3NbnF6KH9zAO4BDxPM= -github.com/klauspost/cpuid/v2 v2.0.6/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= -github.com/klauspost/cpuid/v2 v2.2.4 h1:acbojRNwl3o09bUq+yDCtZFc1aiwaAAxtcn8YkZXnvk= -github.com/klauspost/cpuid/v2 v2.2.4/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY= -github.com/klauspost/reedsolomon v1.9.15 h1:g2erWKD2M6rgnPf89fCji6jNlhMKMdXcuNHMW1SYCIo= -github.com/klauspost/reedsolomon v1.9.15/go.mod h1:eqPAcE7xar5CIzcdfwydOEdcmchAKAP/qs14y4GCBOk= +github.com/klauspost/cpuid/v2 v2.2.6 h1:ndNyv040zDGIDh8thGkXYjnFtiN02M1PVVF+JE/48xc= +github.com/klauspost/cpuid/v2 v2.2.6/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= +github.com/klauspost/reedsolomon v1.12.0 h1:I5FEp3xSwVCcEh3F5A7dofEfhXdF/bWhQWPH+XwBFno= +github.com/klauspost/reedsolomon v1.12.0/go.mod h1:EPLZJeh4l27pUGC3aXOjheaoh1I9yut7xTURiW3LQ9Y= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= @@ -185,10 +180,12 @@ github.com/pion/dtls/v2 v2.2.7 h1:cSUBsETxepsCSFSxC3mc/aDo14qQLMSL+O6IjG28yV8= github.com/pion/dtls/v2 v2.2.7/go.mod h1:8WiMkebSHFD0T+dIU+UeBaoV7kDhOW5oDCzZ7WZ/F9s= github.com/pion/logging v0.2.2 h1:M9+AIj/+pxNsDfAT64+MAVgJO0rsyLnoJKCqf//DoeY= github.com/pion/logging v0.2.2/go.mod h1:k0/tDVsRCX2Mb2ZEmTqNa7CWsQPc+YYCB7Q+5pahoms= -github.com/pion/stun v0.6.1 h1:8lp6YejULeHBF8NmV8e2787BogQhduZugh5PdhDyyN4= -github.com/pion/stun v0.6.1/go.mod h1:/hO7APkX4hZKu/D0f2lHzNyvdkTGtIy3NDmLR7kSz/8= +github.com/pion/stun/v2 v2.0.0 h1:A5+wXKLAypxQri59+tmQKVs7+l6mMM+3d+eER9ifRU0= +github.com/pion/stun/v2 v2.0.0/go.mod h1:22qRSh08fSEttYUmJZGlriq9+03jtVmXNODgLccj8GQ= github.com/pion/transport/v2 v2.2.1 h1:7qYnCBlpgSJNYMbLCKuSY9KbQdBFoETvPNETv0y4N7c= github.com/pion/transport/v2 v2.2.1/go.mod h1:cXXWavvCnFF6McHTft3DWS9iic2Mftcz1Aq29pGcU5g= +github.com/pion/transport/v3 v3.0.1 h1:gDTlPJwROfSfz6QfSi0ZmeCSkFcnWWiiR9ES0ouANiM= +github.com/pion/transport/v3 v3.0.1/go.mod h1:UY7kiITrlMv7/IKgd5eTUcaahZx5oUN3l9SzK5f5xE0= github.com/pires/go-proxyproto v0.7.0 h1:IukmRewDQFWC7kfnb66CSomk2q/seBuilHBYFwyq0Hs= github.com/pires/go-proxyproto v0.7.0/go.mod h1:Vz/1JPY/OACxWGQNIRY2BeyDmpoaWmEP40O9LbuiFR4= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= @@ -207,10 +204,8 @@ github.com/prometheus/procfs v0.10.1 h1:kYK1Va/YMlutzCGazswoHKo//tZVlFpKYh+Pymzi github.com/prometheus/procfs v0.10.1/go.mod h1:nwNm2aOCAYw8uTR/9bWRREkZFxAUcWzPHWJq+XBB/FM= github.com/quic-go/qpack v0.4.0 h1:Cr9BXA1sQS2SmDUWjSofMPNKmvF6IiIfDRmgU0w1ZCo= github.com/quic-go/qpack v0.4.0/go.mod h1:UZVnYIfi5GRk+zI9UMaCPsmZ2xKJP7XBUvVyT1Knj9A= -github.com/quic-go/qtls-go1-20 v0.4.1 h1:D33340mCNDAIKBqXuAvexTNMUByrYmFYVfKfDN5nfFs= -github.com/quic-go/qtls-go1-20 v0.4.1/go.mod h1:X9Nh97ZL80Z+bX/gUXMbipO6OxdiDi58b/fMC9mAL+k= -github.com/quic-go/quic-go v0.40.1 h1:X3AGzUNFs0jVuO3esAGnTfvdgvL4fq655WaOi1snv1Q= -github.com/quic-go/quic-go v0.40.1/go.mod h1:PeN7kuVJ4xZbxSv/4OX6S1USOX8MJvydwpTx31vx60c= +github.com/quic-go/quic-go v0.41.0 h1:aD8MmHfgqTURWNJy48IYFg2OnxwHT3JL7ahGs73lb4k= +github.com/quic-go/quic-go v0.41.0/go.mod h1:qCkNjqczPEvgsOnxZ0eCD14lv+B2LHlFAB++CNOh9hA= github.com/refraction-networking/utls v1.6.0 h1:X5vQMqVx7dY7ehxxqkFER/W6DSjy8TMqSItXm8hRDYQ= github.com/refraction-networking/utls v1.6.0/go.mod h1:kHJ6R9DFFA0WsRgBM35iiDku4O7AqPR6y79iuzW7b10= github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= @@ -221,8 +216,8 @@ github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzG github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/samber/lo v1.38.1 h1:j2XEAqXKb09Am4ebOg31SpvzUTTs6EN3VfgeLUhPdXM= -github.com/samber/lo v1.38.1/go.mod h1:+m/ZKRl6ClXCE2Lgf3MsQlWfh4bn1bz6CXEOxnEXnEA= +github.com/samber/lo v1.39.0 h1:4gTz1wUhNYLhFSKl6O+8peW0v2F4BCY034GRpU9WnuA= +github.com/samber/lo v1.39.0/go.mod h1:+m/ZKRl6ClXCE2Lgf3MsQlWfh4bn1bz6CXEOxnEXnEA= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo= @@ -245,10 +240,10 @@ github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/templexxx/cpufeat v0.0.0-20180724012125-cef66df7f161 h1:89CEmDvlq/F7SJEOqkIdNDGJXrQIhuIx9D2DBXjavSU= -github.com/templexxx/cpufeat v0.0.0-20180724012125-cef66df7f161/go.mod h1:wM7WEvslTq+iOEAMDLSzhVuOt5BRZ05WirO+b09GHQU= -github.com/templexxx/xor v0.0.0-20191217153810-f85b25db303b h1:fj5tQ8acgNUr6O8LEplsxDhUIe2573iLkJc+PqnzZTI= -github.com/templexxx/xor v0.0.0-20191217153810-f85b25db303b/go.mod h1:5XA7W9S6mni3h5uvOC75dA3m9CCCaS83lltmc0ukdi4= +github.com/templexxx/cpu v0.1.0 h1:wVM+WIJP2nYaxVxqgHPD4wGA2aJ9rvrQRV8CvFzNb40= +github.com/templexxx/cpu v0.1.0/go.mod h1:w7Tb+7qgcAlIyX4NhLuDKt78AHA5SzPmq0Wj6HiEnnk= +github.com/templexxx/xorsimd v0.4.2 h1:ocZZ+Nvu65LGHmCLZ7OoCtg8Fx8jnHKK37SjvngUoVI= +github.com/templexxx/xorsimd v0.4.2/go.mod h1:HgwaPoDREdi6OnULpSfxhzaiiSUY4Fi3JPn1wpt28NI= github.com/tjfoc/gmsm v1.4.1 h1:aMe1GlZb+0bLjn+cKTPEvvn9oUEBlJitaZiiBwsbgho= github.com/tjfoc/gmsm v1.4.1/go.mod h1:j4INPkHWMrhJb38G+J6W4Tw0AbuN8Thu3PbdVYhVcTE= github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI= @@ -257,6 +252,8 @@ github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVM github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= github.com/ugorji/go/codec v1.2.11 h1:BMaWp1Bb6fHwEtbplGBGJ498wD+LKlNSl25MjdZY4dU= github.com/ugorji/go/codec v1.2.11/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= +github.com/xtaci/kcp-go/v5 v5.6.7 h1:7+rnxNFIsjEwTXQk4cSZpXM4pO0hqtpwE1UFFoJBffA= +github.com/xtaci/kcp-go/v5 v5.6.7/go.mod h1:oE9j2NVqAkuKO5o8ByKGch3vgVX3BNf8zqP8JiGq0bM= github.com/xtaci/lossyconn v0.0.0-20200209145036-adba10fffc37 h1:EWU6Pktpas0n8lLQwDsRyZfmkPeRbdgPtW609es+/9E= github.com/xtaci/lossyconn v0.0.0-20200209145036-adba10fffc37/go.mod h1:HpMP7DB2CyokmAh4lp0EQnnWhmycP/TvwBGzvuie+H0= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= @@ -273,8 +270,9 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20201012173705-84dcc777aaee/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.8.0/go.mod h1:mRqEX+O9/h5TFCrQhkgjo2yKi0yYA+9ecGkdQoHrywE= -golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k= -golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= +golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw= +golang.org/x/crypto v0.18.0 h1:PGVlW0xEltQnzFZ55hkuX5+KLyrMYhHld1YHO4AKcdc= +golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20240103183307-be819d1f06fc h1:ao2WRsKSzW6KuUY9IWPwWahcHCgR0s52IfwutMfEbdM= golang.org/x/exp v0.0.0-20240103183307-be819d1f06fc/go.mod h1:iRJReGqOEeBhDZGkGbynYwcHlctCvnjTYIamk7uXpHI= @@ -296,6 +294,8 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= +golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= +golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI= golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c= golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -317,20 +317,23 @@ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY= -golang.org/x/term v0.15.0 h1:y/Oo/a/q3IXu26lQgl04j/gjuBDOBlx7X6Om1j2CPW4= -golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0= +golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= +golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU= +golang.org/x/term v0.16.0 h1:m+B6fahuftsE9qjo0VWp2FW0mB3MTJvR0BaMQrq0pmE= +golang.org/x/term v0.16.0/go.mod h1:yn7UURbUtPyrVJPGPq404EukNFxcm/foM+bV/bfcDsY= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= @@ -338,6 +341,7 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= @@ -401,6 +405,8 @@ honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= k8s.io/apimachinery v0.27.4 h1:CdxflD4AF61yewuid0fLl6bM4a3q04jWel0IlP+aYjs= k8s.io/apimachinery v0.27.4/go.mod h1:XNfZ6xklnMCOGGFNqXG7bUrQCoR04dh/E7FprV6pb+E= +k8s.io/utils v0.0.0-20230209194617-a36077c30491 h1:r0BAOLElQnnFhE/ApUsg3iHdVYYPBjNSSOMowRZxxsY= +k8s.io/utils v0.0.0-20230209194617-a36077c30491/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= modernc.org/libc v1.22.5 h1:91BNch/e5B0uPbJFgqbxXuOnxBQjlS//icfQEGmvyjE= modernc.org/libc v1.22.5/go.mod h1:jj+Z7dTNX8fBScMVNRAYZ/jF91K8fdT2hYMThc3YjBY= modernc.org/mathutil v1.5.0 h1:rV0Ko/6SfM+8G+yKiyI830l3Wuz1zRutdslNoQ0kfiQ= diff --git a/idl/api_client.proto b/idl/api_client.proto index 1b4b433..76c0dd0 100644 --- a/idl/api_client.proto +++ b/idl/api_client.proto @@ -46,6 +46,7 @@ message UpdateFRPCRequest { optional string client_id = 1; optional string server_id = 2; optional bytes config = 3; + optional string comment = 4; } message UpdateFRPCResponse { diff --git a/models/client.go b/models/client.go index 4d80109..cb77ffd 100644 --- a/models/client.go +++ b/models/client.go @@ -22,6 +22,7 @@ type ClientEntity struct { ConfigContent []byte `json:"config_content"` ConnectSecret string `json:"connect_secret" gorm:"not null"` Stopped bool `json:"stopped"` + Comment string `json:"comment"` CreatedAt time.Time UpdatedAt time.Time DeletedAt gorm.DeletedAt `gorm:"index"` diff --git a/pb/api_auth.pb.go b/pb/api_auth.pb.go index a371ef9..9df987d 100644 --- a/pb/api_auth.pb.go +++ b/pb/api_auth.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.32.0 -// protoc v4.25.1 +// protoc-gen-go v1.33.0 +// protoc v5.26.0 // source: api_auth.proto package pb diff --git a/pb/api_client.pb.go b/pb/api_client.pb.go index 10c9bd5..fd88004 100644 --- a/pb/api_client.pb.go +++ b/pb/api_client.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.32.0 -// protoc v4.25.1 +// protoc-gen-go v1.33.0 +// protoc v5.26.0 // source: api_client.proto package pb @@ -444,6 +444,7 @@ type UpdateFRPCRequest struct { ClientId *string `protobuf:"bytes,1,opt,name=client_id,json=clientId,proto3,oneof" json:"client_id,omitempty"` ServerId *string `protobuf:"bytes,2,opt,name=server_id,json=serverId,proto3,oneof" json:"server_id,omitempty"` Config []byte `protobuf:"bytes,3,opt,name=config,proto3,oneof" json:"config,omitempty"` + Comment *string `protobuf:"bytes,4,opt,name=comment,proto3,oneof" json:"comment,omitempty"` } func (x *UpdateFRPCRequest) Reset() { @@ -499,6 +500,13 @@ func (x *UpdateFRPCRequest) GetConfig() []byte { return nil } +func (x *UpdateFRPCRequest) GetComment() string { + if x != nil && x.Comment != nil { + return *x.Comment + } + return "" +} + type UpdateFRPCResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -884,50 +892,53 @@ var file_api_client_proto_rawDesc = []byte{ 0x2b, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x48, 0x00, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x88, 0x01, 0x01, 0x42, 0x09, 0x0a, 0x07, - 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x9b, 0x01, 0x0a, 0x11, 0x55, 0x70, 0x64, 0x61, + 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0xc6, 0x01, 0x0a, 0x11, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x46, 0x52, 0x50, 0x43, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x20, 0x0a, 0x09, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x08, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x88, 0x01, 0x01, 0x12, 0x20, 0x0a, 0x09, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x08, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x49, 0x64, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x0c, 0x48, 0x02, 0x52, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x88, 0x01, 0x01, 0x42, 0x0c, - 0x0a, 0x0a, 0x5f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x42, 0x0c, 0x0a, 0x0a, - 0x5f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x22, 0x4c, 0x0a, 0x12, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x46, - 0x52, 0x50, 0x43, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2b, 0x0a, 0x06, 0x73, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x63, 0x6f, - 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x48, 0x00, 0x52, 0x06, 0x73, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x88, 0x01, 0x01, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x73, 0x74, 0x61, - 0x74, 0x75, 0x73, 0x22, 0x43, 0x0a, 0x11, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x46, 0x52, 0x50, - 0x43, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x20, 0x0a, 0x09, 0x63, 0x6c, 0x69, 0x65, - 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x08, 0x63, - 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x88, 0x01, 0x01, 0x42, 0x0c, 0x0a, 0x0a, 0x5f, 0x63, - 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x22, 0x4c, 0x0a, 0x12, 0x52, 0x65, 0x6d, 0x6f, - 0x76, 0x65, 0x46, 0x52, 0x50, 0x43, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2b, - 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, - 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x48, 0x00, - 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x88, 0x01, 0x01, 0x42, 0x09, 0x0a, 0x07, 0x5f, - 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x41, 0x0a, 0x0f, 0x53, 0x74, 0x6f, 0x70, 0x46, 0x52, - 0x50, 0x43, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x20, 0x0a, 0x09, 0x63, 0x6c, 0x69, - 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x08, - 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x88, 0x01, 0x01, 0x42, 0x0c, 0x0a, 0x0a, 0x5f, - 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x22, 0x4a, 0x0a, 0x10, 0x53, 0x74, 0x6f, - 0x70, 0x46, 0x52, 0x50, 0x43, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2b, 0x0a, - 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, - 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x48, 0x00, 0x52, - 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x88, 0x01, 0x01, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x73, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x42, 0x0a, 0x10, 0x53, 0x74, 0x61, 0x72, 0x74, 0x46, 0x52, - 0x50, 0x43, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x20, 0x0a, 0x09, 0x63, 0x6c, 0x69, - 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x08, - 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x88, 0x01, 0x01, 0x42, 0x0c, 0x0a, 0x0a, 0x5f, - 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x22, 0x4b, 0x0a, 0x11, 0x53, 0x74, 0x61, - 0x72, 0x74, 0x46, 0x52, 0x50, 0x43, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2b, - 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, - 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x48, 0x00, - 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x88, 0x01, 0x01, 0x42, 0x09, 0x0a, 0x07, 0x5f, - 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x42, 0x07, 0x5a, 0x05, 0x2e, 0x2e, 0x2f, 0x70, 0x62, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x0c, 0x48, 0x02, 0x52, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x88, 0x01, 0x01, 0x12, 0x1d, + 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x48, + 0x03, 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x0c, 0x0a, + 0x0a, 0x5f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x42, 0x0c, 0x0a, 0x0a, 0x5f, + 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x6f, + 0x6e, 0x66, 0x69, 0x67, 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, + 0x22, 0x4c, 0x0a, 0x12, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x46, 0x52, 0x50, 0x43, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2b, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, + 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x48, 0x00, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, + 0x88, 0x01, 0x01, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x43, + 0x0a, 0x11, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x46, 0x52, 0x50, 0x43, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x20, 0x0a, 0x09, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x08, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, + 0x49, 0x64, 0x88, 0x01, 0x01, 0x42, 0x0c, 0x0a, 0x0a, 0x5f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, + 0x5f, 0x69, 0x64, 0x22, 0x4c, 0x0a, 0x12, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x46, 0x52, 0x50, + 0x43, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2b, 0x0a, 0x06, 0x73, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, + 0x6f, 0x6e, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x48, 0x00, 0x52, 0x06, 0x73, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x88, 0x01, 0x01, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x22, 0x41, 0x0a, 0x0f, 0x53, 0x74, 0x6f, 0x70, 0x46, 0x52, 0x50, 0x43, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x20, 0x0a, 0x09, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x08, 0x63, 0x6c, 0x69, 0x65, 0x6e, + 0x74, 0x49, 0x64, 0x88, 0x01, 0x01, 0x42, 0x0c, 0x0a, 0x0a, 0x5f, 0x63, 0x6c, 0x69, 0x65, 0x6e, + 0x74, 0x5f, 0x69, 0x64, 0x22, 0x4a, 0x0a, 0x10, 0x53, 0x74, 0x6f, 0x70, 0x46, 0x52, 0x50, 0x43, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2b, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, + 0x6e, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x48, 0x00, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x88, 0x01, 0x01, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, + 0x22, 0x42, 0x0a, 0x10, 0x53, 0x74, 0x61, 0x72, 0x74, 0x46, 0x52, 0x50, 0x43, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x20, 0x0a, 0x09, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x08, 0x63, 0x6c, 0x69, 0x65, 0x6e, + 0x74, 0x49, 0x64, 0x88, 0x01, 0x01, 0x42, 0x0c, 0x0a, 0x0a, 0x5f, 0x63, 0x6c, 0x69, 0x65, 0x6e, + 0x74, 0x5f, 0x69, 0x64, 0x22, 0x4b, 0x0a, 0x11, 0x53, 0x74, 0x61, 0x72, 0x74, 0x46, 0x52, 0x50, + 0x43, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2b, 0x0a, 0x06, 0x73, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, + 0x6f, 0x6e, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x48, 0x00, 0x52, 0x06, 0x73, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x88, 0x01, 0x01, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x42, 0x07, 0x5a, 0x05, 0x2e, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, } var ( diff --git a/pb/api_master.pb.go b/pb/api_master.pb.go index 882ca9f..68e9e11 100644 --- a/pb/api_master.pb.go +++ b/pb/api_master.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.32.0 -// protoc v4.25.1 +// protoc-gen-go v1.33.0 +// protoc v5.26.0 // source: api_master.proto package pb diff --git a/pb/api_server.pb.go b/pb/api_server.pb.go index 91d4c36..a1402bf 100644 --- a/pb/api_server.pb.go +++ b/pb/api_server.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.32.0 -// protoc v4.25.1 +// protoc-gen-go v1.33.0 +// protoc v5.26.0 // source: api_server.proto package pb diff --git a/pb/api_user.pb.go b/pb/api_user.pb.go index e39961c..86207dd 100644 --- a/pb/api_user.pb.go +++ b/pb/api_user.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.32.0 -// protoc v4.25.1 +// protoc-gen-go v1.33.0 +// protoc v5.26.0 // source: api_user.proto package pb diff --git a/pb/common.pb.go b/pb/common.pb.go index dbe7a5a..8df5a6d 100644 --- a/pb/common.pb.go +++ b/pb/common.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.32.0 -// protoc v4.25.1 +// protoc-gen-go v1.33.0 +// protoc v5.26.0 // source: common.proto package pb diff --git a/pb/rpc_master.pb.go b/pb/rpc_master.pb.go index 9cba5f7..7f95b60 100644 --- a/pb/rpc_master.pb.go +++ b/pb/rpc_master.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.32.0 -// protoc v4.25.1 +// protoc-gen-go v1.33.0 +// protoc v5.26.0 // source: rpc_master.proto package pb diff --git a/pb/rpc_master_grpc.pb.go b/pb/rpc_master_grpc.pb.go index 50e5d8a..faff647 100644 --- a/pb/rpc_master_grpc.pb.go +++ b/pb/rpc_master_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.3.0 -// - protoc v4.25.1 +// - protoc v5.26.0 // source: rpc_master.proto package pb diff --git a/services/client/frpc_service.go b/services/client/frpc_service.go index 1987759..30d7d3d 100644 --- a/services/client/frpc_service.go +++ b/services/client/frpc_service.go @@ -76,7 +76,7 @@ func NewClientHandler(commonCfg *v1.ClientCommonConfig, logrus.Panic(err) } - log.InitLog(commonCfg.Log.To, commonCfg.Log.Level, commonCfg.Log.MaxDays, commonCfg.Log.DisablePrintColor) + log.InitLogger(commonCfg.Log.To, commonCfg.Log.Level, int(commonCfg.Log.MaxDays), commonCfg.Log.DisablePrintColor) cli, err := client.NewService(client.ServiceOptions{ Common: commonCfg, ProxyCfgs: proxyCfgs, diff --git a/services/server/frps_service.go b/services/server/frps_service.go index 183adb6..1cac824 100644 --- a/services/server/frps_service.go +++ b/services/server/frps_service.go @@ -59,7 +59,7 @@ func NewServerHandler(svrCfg *v1.ServerConfig) *Server { logrus.Panic(err) } - log.InitLog(svrCfg.Log.To, svrCfg.Log.Level, svrCfg.Log.MaxDays, svrCfg.Log.DisablePrintColor) + log.InitLogger(svrCfg.Log.To, svrCfg.Log.Level, int(svrCfg.Log.MaxDays), svrCfg.Log.DisablePrintColor) var svr *server.Service diff --git a/www/components/frpc_card.tsx b/www/components/frpc_card.tsx index ff97812..8c73b99 100644 --- a/www/components/frpc_card.tsx +++ b/www/components/frpc_card.tsx @@ -10,6 +10,7 @@ import { Switch } from './ui/switch' import { FRPCEditor } from './frpc_editor' import { FRPCForm } from './frpc_form' import { useSearchParams } from 'next/navigation' +import { $clientProxyConfigs } from '@/store/proxy' export interface FRPCFormCardProps { clientID?: string @@ -66,7 +67,9 @@ export const FRPCFormCard: React.FC = ({ if (paramClientID) { setClientID(paramClientID) setServerID(clientList?.clients?.find((client) => client.id == paramClientID)?.serverId) + refetchClient() } + $clientProxyConfigs.set([]) }, [paramClientID, clientList]) return ( @@ -134,6 +137,12 @@ export const FRPCFormCard: React.FC = ({ + {clientID && !advanceMode && <> + +

可以到高级模式修改备注哦!

+

+ {client?.client?.comment == undefined || client?.client?.comment === '' ? '空空如也' : client?.client?.comment} +

} {clientID && serverID && !advanceMode && } {clientID && serverID && advanceMode && } diff --git a/www/components/frpc_editor.tsx b/www/components/frpc_editor.tsx index 0e84714..68a0f4b 100644 --- a/www/components/frpc_editor.tsx +++ b/www/components/frpc_editor.tsx @@ -19,6 +19,7 @@ export const FRPCEditor: React.FC = ({ clientID, serverID }) => { }) const [configContent, setConfigContent] = useState('{}') + const [clientComment, setClientComment] = useState('') const updateFrpc = useMutation({ mutationFn: updateFRPC }) const [editorValue, setEditorValue] = useState('') @@ -28,6 +29,7 @@ export const FRPCEditor: React.FC = ({ clientID, serverID }) => { clientId: clientID, config: Buffer.from(editorValue), serverId: serverID, + comment: clientComment, }) if (res.status?.code !== RespCode.SUCCESS) { toast({ title: '更新失败' }) @@ -60,14 +62,25 @@ export const FRPCEditor: React.FC = ({ clientID, serverID }) => { 2, ), ) + setClientComment(client?.client?.comment || '') } catch (error) { setConfigContent('{}') setEditorValue('{}') + setClientComment('') } }, [client, refetchClient]) return (
+ +