rename to frps-panel

add i18n for some words
This commit is contained in:
杨黄林
2023-09-10 01:24:52 +08:00
parent 56be865d3e
commit 60d8cfcf70
15 changed files with 92 additions and 86 deletions

View File

@@ -3,10 +3,10 @@ export CGO_ENABLED=0
export GOOS=linux
export GOARCH=amd64
build: frps-multiuser
cp ./config/frps-multiuser.ini ./bin/frps-multiuser.ini
build: frps-panel
cp ./config/frps-panel.ini ./bin/frps-panel.ini
cp -r ./assets/ ./bin/assets/
frps-multiuser:
frps-panel:
rm -rf ./bin
go build -o ./bin/frps-multiuser ./cmd/frps-multiuser
go build -o ./bin/frps-panel ./cmd/frps-panel

View File

@@ -5,20 +5,20 @@ package: copy
sh ./package.sh
copy: build
cp ./config/frps-multiuser.ini ./release/frps-multiuser.ini
cp ./config/frps-panel.ini ./release/frps-panel.ini
cp -r ./assets/ ./release/assets/
build:
env CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags "$(LDFLAGS)" -o ./release/frps-multiuser-darwin-amd64 ./cmd/frps-multiuser
env CGO_ENABLED=0 GOOS=freebsd GOARCH=386 go build -ldflags "$(LDFLAGS)" -o ./release/frps-multiuser-freebsd-386 ./cmd/frps-multiuser
env CGO_ENABLED=0 GOOS=freebsd GOARCH=amd64 go build -ldflags "$(LDFLAGS)" -o ./release/frps-multiuser-freebsd-amd64 ./cmd/frps-multiuser
env CGO_ENABLED=0 GOOS=linux GOARCH=386 go build -ldflags "$(LDFLAGS)" -o ./release/frps-multiuser-linux-386 ./cmd/frps-multiuser
env CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "$(LDFLAGS)" -o ./release/frps-multiuser-linux-amd64 ./cmd/frps-multiuser
env CGO_ENABLED=0 GOOS=linux GOARCH=arm go build -ldflags "$(LDFLAGS)" -o ./release/frps-multiuser-linux-arm ./cmd/frps-multiuser
env CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags "$(LDFLAGS)" -o ./release/frps-multiuser-linux-arm64 ./cmd/frps-multiuser
env CGO_ENABLED=0 GOOS=windows GOARCH=386 go build -ldflags "$(LDFLAGS)" -o ./release/frps-multiuser-windows-386.exe ./cmd/frps-multiuser
env CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags "$(LDFLAGS)" -o ./release/frps-multiuser-windows-amd64.exe ./cmd/frps-multiuser
env CGO_ENABLED=0 GOOS=linux GOARCH=mips64 go build -ldflags "$(LDFLAGS)" -o ./release/frps-multiuser-linux-mips64 ./cmd/frps-multiuser
env CGO_ENABLED=0 GOOS=linux GOARCH=mips64le go build -ldflags "$(LDFLAGS)" -o ./release/frps-multiuser-linux-mips64le ./cmd/frps-multiuser
env CGO_ENABLED=0 GOOS=linux GOARCH=mips GOMIPS=softfloat go build -ldflags "$(LDFLAGS)" -o ./release/frps-multiuser-linux-mips ./cmd/frps-multiuser
env CGO_ENABLED=0 GOOS=linux GOARCH=mipsle GOMIPS=softfloat go build -ldflags "$(LDFLAGS)" -o ./release/frps-multiuser-linux-mipsle ./cmd/frps-multiuser
env CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags "$(LDFLAGS)" -o ./release/frps-panel-darwin-amd64 ./cmd/frps-panel
env CGO_ENABLED=0 GOOS=freebsd GOARCH=386 go build -ldflags "$(LDFLAGS)" -o ./release/frps-panel-freebsd-386 ./cmd/frps-panel
env CGO_ENABLED=0 GOOS=freebsd GOARCH=amd64 go build -ldflags "$(LDFLAGS)" -o ./release/frps-panel-freebsd-amd64 ./cmd/frps-panel
env CGO_ENABLED=0 GOOS=linux GOARCH=386 go build -ldflags "$(LDFLAGS)" -o ./release/frps-panel-linux-386 ./cmd/frps-panel
env CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "$(LDFLAGS)" -o ./release/frps-panel-linux-amd64 ./cmd/frps-panel
env CGO_ENABLED=0 GOOS=linux GOARCH=arm go build -ldflags "$(LDFLAGS)" -o ./release/frps-panel-linux-arm ./cmd/frps-panel
env CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags "$(LDFLAGS)" -o ./release/frps-panel-linux-arm64 ./cmd/frps-panel
env CGO_ENABLED=0 GOOS=windows GOARCH=386 go build -ldflags "$(LDFLAGS)" -o ./release/frps-panel-windows-386.exe ./cmd/frps-panel
env CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags "$(LDFLAGS)" -o ./release/frps-panel-windows-amd64.exe ./cmd/frps-panel
env CGO_ENABLED=0 GOOS=linux GOARCH=mips64 go build -ldflags "$(LDFLAGS)" -o ./release/frps-panel-linux-mips64 ./cmd/frps-panel
env CGO_ENABLED=0 GOOS=linux GOARCH=mips64le go build -ldflags "$(LDFLAGS)" -o ./release/frps-panel-linux-mips64le ./cmd/frps-panel
env CGO_ENABLED=0 GOOS=linux GOARCH=mips GOMIPS=softfloat go build -ldflags "$(LDFLAGS)" -o ./release/frps-panel-linux-mips ./cmd/frps-panel
env CGO_ENABLED=0 GOOS=linux GOARCH=mipsle GOMIPS=softfloat go build -ldflags "$(LDFLAGS)" -o ./release/frps-panel-linux-mipsle ./cmd/frps-panel

View File

@@ -4,7 +4,7 @@
frp server plugin to support multiple users for [frp](https://github.com/fatedier/frp).
frps-multiuser will run as one single process and accept HTTP requests from frps.
frps-panel will run as one single process and accept HTTP requests from frps.
![用户列表](screenshots/user%20list.png)
![新增列表](screenshots/new%20user.png)
@@ -13,8 +13,8 @@ frps-multiuser will run as one single process and accept HTTP requests from frps
## Update Notes
+ **the default tokens file is frps-multiuser.ini now,ini file support comment**
+ **remove `-l`,it configure in `frps-multiuser.ini` now**
+ **the default tokens file is frps-panel.ini now,ini file support comment**
+ **remove `-l`,it configure in `frps-panel.ini` now**
+ **change `-f` to `-c`,the same as `frps`**
+ **if \[users\] section is empty,the authentication will only be handle by frps**
+ **if user under \[disabled\] section ,and the value is `disable`, it means that user is be disabled, and can not connect to server**
@@ -34,7 +34,7 @@ frps-multiuser will run as one single process and accept HTTP requests from frps
### Download
Download frps-multiuser binary file from [Release](../../releases).
Download frps-panel binary file from [Release](../../releases).
### Requirements
@@ -42,7 +42,7 @@ frp version >= v0.31.0
### Usage
1. Create file `frps-multiuser.ini` including all support usernames and tokens.
1. Create file `frps-panel.ini` including all support usernames and tokens.
```ini
[common]
@@ -80,9 +80,9 @@ user2 = disable
One user each line. Username and token are split by `=`.
2. Run frps-multiuser:
2. Run frps-panel:
`./frps-multiuser -c ./frps-multiuser.ini`
`./frps-panel -c ./frps-panel.ini`
3. Register plugin in frps.
@@ -135,8 +135,8 @@ remote_port = 6000
this example is for `ubuntu` and with `root` user
+ 1.unzip `frps-multiuser.zip` to dir `/root/frps-multiuser`
+ 2.touch a file with command `touch frps-multiuser.service` in dir `/root/frps-multiuser`.the file content is:
+ 1.unzip `frps-panel.zip` to dir `/root/frps-panel`
+ 2.touch a file with command `touch frps-panel.service` in dir `/root/frps-panel`.the file content is:
```ini
[Unit]
Description = frp multiuser service
@@ -145,23 +145,23 @@ Wants = network.target
[Service]
Type = simple
# config of frps-multiuser.ini,you should change the file path
Environment=FRPS_MULTIUSER_OPTS="-c /root/frps-multiuser/frps-multiuser.ini"
# command of run frps-multiuser,you should change the file path
ExecStart = /root/frps-multiuser/frps-multiuser $FRPS_MULTIUSER_OPTS
# config of frps-panel.ini,you should change the file path
Environment=FRPS_MULTIUSER_OPTS="-c /root/frps-panel/frps-panel.ini"
# command of run frps-panel,you should change the file path
ExecStart = /root/frps-panel/frps-panel $FRPS_MULTIUSER_OPTS
[Install]
WantedBy = multi-user.target
```
+ 3.copy `frps-multiuser.service` to `/etc/systemd/system/` with command `cp /root/frps-multiuser.service /etc/systemd/system/`
+ 3.copy `frps-panel.service` to `/etc/systemd/system/` with command `cp /root/frps-panel.service /etc/systemd/system/`
+ 4.reload service with command `systemctl daemon-reload`
+ 5.start service with command `service frps-multiuser start`
+ 5.start service with command `service frps-panel start`
## Issues & Ideas
___If you want visit mange ui from internet, you should change `plugin_addr` to `0.0.0.0`___
If you have any issues or ideas, put it on [issues](https://github.com/yhl452493373/frps-multiuser/issues). I will try my best to achieve it.
If you have any issues or ideas, put it on [issues](https://github.com/yhl452493373/frps-panel/issues). I will try my best to achieve it.
## Credits

View File

@@ -1,10 +1,10 @@
# frps-multiuser
# frps-panel
[README](README.md) | [中文文档](README_zh.md)
frps-multiuser 是 [frp](https://github.com/fatedier/frp) 的一个服务端插件,用于支持多用户鉴权。
frps-panel 是 [frp](https://github.com/fatedier/frp) 的一个服务端插件,用于支持多用户鉴权。
frps-multiuser 会以一个单独的进程运行,并接收 frps 发送过来的 HTTP 请求。
frps-panel 会以一个单独的进程运行,并接收 frps 发送过来的 HTTP 请求。
![用户列表](screenshots/user%20list.png)
![新增列表](screenshots/new%20user.png)
@@ -14,7 +14,7 @@ frps-multiuser 会以一个单独的进程运行,并接收 frps 发送过来
## 更新说明
+ **配置文件改为ini格式便于增加注释**
+ **删除-l参数其需要的配置由`frps-multiuser.ini`决定**
+ **删除-l参数其需要的配置由`frps-panel.ini`决定**
+ **指定配置文件的参数由`-f`改为`-c`,和`frps`一致**
+ **配置文件中,\[users\]节下如无用户信息则直接由frps的token认证**
+ **配置文件中,\[disabled\]节下用户名对应的值如果为`disable`,则说明该账户被禁用,无法连接到服务器**
@@ -42,7 +42,7 @@ frps-multiuser 会以一个单独的进程运行,并接收 frps 发送过来
### 使用示例
1. 创建 `frps-multiuser.ini` 文件,内容为所有支持的用户名和 token。
1. 创建 `frps-panel.ini` 文件,内容为所有支持的用户名和 token。
```ini
[common]
@@ -80,9 +80,9 @@ user2 = disable
每一个用户占一行,用户名和 token 之间以 `=` 号分隔。
2. 运行 frps-multiuser,指定监听地址以及 token 存储文件路径。
2. 运行 frps-panel,指定监听地址以及 token 存储文件路径。
`./frps-multiuser -c ./frps-multiuser.ini`
`./frps-panel -c ./frps-panel.ini`
3. 在 frps 的配置文件中注册插件,并启动。
@@ -135,8 +135,8 @@ remote_port = 6000
本实例是在 `ubuntu` 下, 以 `root` 用户执操作
+ 1、解压 `frps-multiuser.zip` 到目录 `/root/frps-multiuser`
+ 2、在目录 `/root/frps-multiuser` 下 用命令创建文件:`touch frps-multiuser.service`。创建后修改文件内容:
+ 1、解压 `frps-panel.zip` 到目录 `/root/frps-panel`
+ 2、在目录 `/root/frps-panel` 下 用命令创建文件:`touch frps-panel.service`。创建后修改文件内容:
```ini
[Unit]
Description = frp multiuser service
@@ -145,23 +145,23 @@ Wants = network.target
[Service]
Type = simple
# 启动frps-multiuser的配置文件路径需修改为您的frps-multiuser.ini的路径
Environment=FRPS_MULTIUSER_OPTS="-c /root/frps-multiuser/frps-multiuser.ini"
# 启动frps-multiuser的命令需修改为您的frps-multiuser的安装路径
ExecStart = /root/frps-multiuser/frps-multiuser $FRPS_MULTIUSER_OPTS
# 启动frps-panel的配置文件路径需修改为您的frps-panel.ini的路径
Environment=FRPS_MULTIUSER_OPTS="-c /root/frps-panel/frps-panel.ini"
# 启动frps-panel的命令需修改为您的frps-panel的安装路径
ExecStart = /root/frps-panel/frps-panel $FRPS_MULTIUSER_OPTS
[Install]
WantedBy = multi-user.target
```
+ 3、复制服务文件 `cp /root/frps-multiuser.service /etc/systemd/system/`
+ 3、复制服务文件 `cp /root/frps-panel.service /etc/systemd/system/`
+ 4、重载服务 `systemctl daemon-reload`
+ 5、启动服务 `service frps-multiuser start`
+ 5、启动服务 `service frps-panel start`
## 使用
___如果要从外网访问管理界面, 需要把配置中的 `plugin_addr` 改为 `0.0.0.0`___
如果使用中有问题或者有其他想法,在[issues](https://github.com/yhl452493373/frps-multiuser/issues)上提出来。 如果我能搞定的话,我尽量搞。
如果使用中有问题或者有其他想法,在[issues](https://github.com/yhl452493373/frps-panel/issues)上提出来。 如果我能搞定的话,我尽量搞。
## 致谢

View File

@@ -1,6 +1,5 @@
{
"User Manage": "User Manage",
"frps multiuser": "frps multiuser",
"Frps Panel": "Frps Panel",
"User": "User",
"Token": "Token",
"Notes": "Notes",
@@ -46,5 +45,8 @@
"Subdomains is invalid": "Subdomains is invalid",
"Comment is invalid": "Comment is invalid, it cannot include line breaks",
"Not limit": "Not limit",
"None": "None"
"None": "None",
"Server Info": "Server Info",
"Users": "Users",
"Proxies": "Proxies"
}

View File

@@ -1,6 +1,5 @@
{
"User Manage": "用户管理",
"frps multiuser": "frps用户管理",
"Frps Panel": "Frps 面板",
"User": "用户名(user)",
"Token": "凭证(meta_token)",
"Notes": "备注",
@@ -46,5 +45,8 @@
"Subdomains is invalid": "子域名不正确",
"Comment is invalid": "备注不正确,不能包含换行",
"Not limit": "无限制",
"None": "无"
"None": "无",
"Server Info": "服务器信息",
"Users": "用户列表",
"Proxies": "代理列表"
}

View File

@@ -239,8 +239,11 @@ var loadUserList = (function ($) {
verify: verifyRules
});
var $section = $('#content > section');
layui.table.render({
elem: '#tokenTable',
height: $section.height() - $('#searchForm').height() + 8,
text: {none: lang['EmptyData']},
url: '/tokens',
method: 'get',
where: {},
@@ -249,7 +252,6 @@ var loadUserList = (function ($) {
page: navigator.language.indexOf("zh") !== -1,
toolbar: '#userListToolbarTemplate',
defaultToolbar: false,
text: {none: lang['EmptyData']},
cols: [[
{type: 'checkbox'},
{field: 'user', title: lang['User'], width: 150, sort: true},

View File

@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="">
<head>
<title>${ .UserManage }</title>
<title>${ .FrpsPanel }</title>
<link rel="stylesheet" href="./static/lib/layui/css/layui.css">
<link rel="stylesheet" href="./static/css/layui-theme-dark.css">
<link rel="stylesheet" href="./static/css/index.css">
@@ -31,20 +31,20 @@
<body>
<div class="layui-layout layui-layout-admin">
<div class="layui-header layui-bg-blue">
<div class="layui-logo layui-hide-xs layui-bg-black">${ .FrpsMultiuser }</div>
<div class="layui-logo layui-hide-xs layui-bg-black">${ .FrpsPanel }</div>
<div class="layui-title" id="title"></div>
</div>
<div class="layui-side layui-bg-black">
<div class="layui-side-scroll">
<ul class="layui-nav layui-nav-tree" lay-filter="leftNav" id="leftNav">
<li class="layui-nav-item layui-this">
<a href="javascript:void(0)" id="serverInfo">服务器信息</a>
<a href="javascript:void(0)" id="serverInfo">${ .ServerInfo }</a>
</li>
<li class="layui-nav-item">
<a href="javascript:void(0)" id="userList">用户列表</a>
<a href="javascript:void(0)" id="userList">${ .Users }</a>
</li>
<li class="layui-nav-item layui-nav-itemed" id="proxyList">
<a class="" href="javascript:void(0)">代理列表</a>
<a class="" href="javascript:void(0)">${ .Proxies }</a>
<dl class="layui-nav-child">
<dd>
<a href="javascript:void(0)" id="tcp">TCP</a>

View File

@@ -2,8 +2,8 @@ package main
import (
"errors"
"frps-multiuser/pkg/server"
"frps-multiuser/pkg/server/controller"
"frps-panel/pkg/server"
"frps-panel/pkg/server/controller"
"github.com/spf13/cobra"
"gopkg.in/ini.v1"
"io/fs"
@@ -21,13 +21,13 @@ var (
)
func init() {
rootCmd.PersistentFlags().BoolVarP(&showVersion, "version", "v", false, "version of frps-multiuser")
rootCmd.PersistentFlags().StringVarP(&configFile, "config", "c", "./frps-multiuser.ini", "config file of frps-multiuser")
rootCmd.PersistentFlags().BoolVarP(&showVersion, "version", "v", false, "version of frps-panel")
rootCmd.PersistentFlags().StringVarP(&configFile, "config", "c", "./frps-panel.ini", "config file of frps-panel")
}
var rootCmd = &cobra.Command{
Use: "frps-multiuser",
Short: "frps-multiuser is the server plugin of frp to support multiple users.",
Use: "frps-panel",
Short: "frps-panel is the server plugin of frp to support multiple users.",
RunE: func(cmd *cobra.Command, args []string) error {
if showVersion {
log.Println(version)
@@ -42,7 +42,7 @@ var rootCmd = &cobra.Command{
common, tokens, ports, domains, subdomains, iniFile, err := ParseConfigFile(configFile)
if err != nil {
log.Printf("fail to start frps-multiuser : %v", err)
log.Printf("fail to start frps-panel : %v", err)
return err
}
s, err := server.New(

View File

@@ -1,20 +1,18 @@
; basic options
[common]
; frps config info
plugin_addr = 127.0.0.1
plugin_port = 7200
admin_user = admin
admin_pwd = admin
plugin_addr = 127.0.0.1
plugin_port = 7200
admin_user = admin
admin_pwd = admin
; frp dashboard config info
dashboard_addr = 127.0.0.1
dashboard_addr = frp.yanghuanglin.com
dashboard_port = 7500
dashboard_user = admin
dashboard_pwd = admin
dashboard_pwd = 19910621
; user tokens
[users]
user1 = token1
; user been disabled
[disabled]

2
go.mod
View File

@@ -1,4 +1,4 @@
module frps-multiuser
module frps-panel
go 1.21

View File

@@ -1,12 +1,12 @@
#!/bin/bash
cd ./release || exit
rm -rf *.zip
list=$(ls frps-multiuser-*)
list=$(ls frps-panel-*)
echo "$list"
for binFile in $list
do
cp "$binFile" frps-multiuser
zip -r "$binFile".zip frps-multiuser frps-multiuser.ini assets -x "*.git*" "*.idea*" "*.DS_Store" "*.contentFlavour"
rm -rf "$binFile" frps-multiuser
cp "$binFile" frps-panel
zip -r "$binFile".zip frps-panel frps-panel.ini assets -x "*.git*" "*.idea*" "*.DS_Store" "*.contentFlavour"
rm -rf "$binFile" frps-panel
done
rm -rf frps-multiuser.ini assets
rm -rf frps-panel.ini assets

View File

@@ -176,8 +176,7 @@ func (c *HandleController) MakeHandlerFunc() gin.HandlerFunc {
func (c *HandleController) MakeManagerFunc() func(context *gin.Context) {
return func(context *gin.Context) {
context.HTML(http.StatusOK, "index.html", gin.H{
"UserManage": ginI18n.MustGetMessage(context, "User Manage"),
"FrpsMultiuser": ginI18n.MustGetMessage(context, "frps multiuser"),
"FrpsPanel": ginI18n.MustGetMessage(context, "Frps Panel"),
"User": ginI18n.MustGetMessage(context, "User"),
"Token": ginI18n.MustGetMessage(context, "Token"),
"Notes": ginI18n.MustGetMessage(context, "Notes"),
@@ -201,6 +200,9 @@ func (c *HandleController) MakeManagerFunc() func(context *gin.Context) {
"PleaseInputAllowedSubdomains": ginI18n.MustGetMessage(context, "Please input allowed subdomains"),
"NotLimit": ginI18n.MustGetMessage(context, "Not limit"),
"None": ginI18n.MustGetMessage(context, "None"),
"ServerInfo": ginI18n.MustGetMessage(context, "Server Info"),
"Users": ginI18n.MustGetMessage(context, "Users"),
"Proxies": ginI18n.MustGetMessage(context, "Proxies"),
})
}
}

View File

@@ -5,7 +5,7 @@ import (
"encoding/json"
"errors"
"fmt"
"frps-multiuser/pkg/server/controller"
"frps-panel/pkg/server/controller"
ginI18n "github.com/gin-contrib/i18n"
"github.com/gin-gonic/gin"
"golang.org/x/text/language"