From 05650ccde0ef9770ebef01e6dfc8b39e801c4397 Mon Sep 17 00:00:00 2001 From: shenyunet Date: Sat, 24 Feb 2024 01:06:02 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=88=B0=E6=9C=80=E6=96=B0?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=B9=B6=E6=94=AF=E6=8C=81toml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 6 +++--- README.md | 9 +++++---- frps.ini | 21 --------------------- frps.service | 2 +- frps.toml | 34 ++++++++++++++++++++++++++++++++++ frps_linux_install.sh | 22 +++++++++++----------- 6 files changed, 54 insertions(+), 40 deletions(-) delete mode 100644 frps.ini create mode 100644 frps.toml diff --git a/Dockerfile b/Dockerfile index f5bead2..49b607a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ FROM alpine:3.8 LABEL maintainer="Stille " -ENV VERSION 0.51.3 +ENV VERSION 0.54.0 ENV TZ=Asia/Shanghai WORKDIR / @@ -18,10 +18,10 @@ RUN if [ "$(uname -m)" = "x86_64" ]; then export PLATFORM=amd64 ; \ && tar xzf frp_${VERSION}_linux_${PLATFORM}.tar.gz \ && cd frp_${VERSION}_linux_${PLATFORM} \ && mkdir /frp \ - && mv frps frps.ini /frp \ + && mv frps frps.toml /frp \ && cd .. \ && rm -rf *.tar.gz frp_${VERSION}_linux_${PLATFORM} VOLUME /frp -CMD /frp/frps -c /frp/frps.ini +CMD /frp/frps -c /frp/frps.toml diff --git a/README.md b/README.md index ea3c77e..fa32627 100644 --- a/README.md +++ b/README.md @@ -7,14 +7,15 @@ > *docker image support for X86 and ARM* ## 更新 +- **2024-02-25** 更新toml配置文件 - **2021-05-31** 更新国内镜像方便使用 - **2021-05-31** 更新 Linux 一键安装脚本同时支持 X86 和 ARM - **2021-05-29** 更新从`0.36.2`版本起 docker 镜像同时支持 X86 和 ARM ## 使用 -由于 frps 服务端需要配置参数,本脚本为原版 frps.ini ,安装完毕后请自行编辑 frps.ini 配置端口,密码等相关参数并重启服务.同时你也可以 fork 本仓库后自行修改 frps.ini ,在进行一键安装也非常方便.后期也可自行配置 frps.ini 和调整 frps 的版本. +由于 frps 服务端需要配置参数,本脚本为原版 frps.toml ,安装完毕后请自行编辑 frps.toml 配置端口,密码等相关参数并重启服务.同时你也可以 fork 本仓库后自行修改 frps.toml ,在进行一键安装也非常方便.后期也可自行配置 frps.toml 和调整 frps 的版本. -### 一键脚本(先执行脚本,在自行修改 frps.ini 文件.) +### 一键脚本(先执行脚本,在自行修改 frps.toml 文件.) 安装 ```shell wget https://raw.githubusercontent.com/stilleshan/frps/master/frps_linux_install.sh && chmod +x frps_linux_install.sh && ./frps_linux_install.sh @@ -24,7 +25,7 @@ wget https://github.ioiox.com/stilleshan/frps/raw/branch/master/frps_linux_insta 使用 ```shell -vi /usr/local/frp/frps.ini +vi /usr/local/frp/frps.toml # 修改 frps.ini 配置 sudo systemctl restart frps # 重启 frps 服务即可生效 @@ -39,7 +40,7 @@ wget https://github.ioiox.com/stilleshan/frps/raw/branch/master/frps_linux_unins ### 自定义一键脚本(先 fork 本仓库,在自行修改 frps.ini 文件后执行脚本.) - 首先 fork 本仓库 -- 配置 frps.ini +- 配置 frps.toml - 修改 frps_linux_install.sh 脚本 - 修改脚本链接 - Push 仓库到 GitHub diff --git a/frps.ini b/frps.ini deleted file mode 100644 index 61a8bb7..0000000 --- a/frps.ini +++ /dev/null @@ -1,21 +0,0 @@ -[common] -bind_addr = 0.0.0.0 -bind_port = 7000 -bind_udp_port = 7001 -kcp_bind_port = 7000 -vhost_http_port = 80 -vhost_https_port = 443 -dashboard_addr = 0.0.0.0 -dashboard_port = 7500 -dashboard_user = admin -dashboard_pwd = admin -log_file = ./frps.log -log_level = info -log_max_days = 3 -disable_log_color = false -token = 12345678 -allow_ports = 2000-3000,3001,3003,4000-50000 -max_pool_count = 5 -max_ports_per_client = 0 -subdomain_host = frps.com -tcp_mux = true \ No newline at end of file diff --git a/frps.service b/frps.service index 3d21a70..b7ab15c 100644 --- a/frps.service +++ b/frps.service @@ -7,7 +7,7 @@ Wants=network.target Type=simple Restart=on-failure RestartSec=5s -ExecStart=/usr/local/frp/frps -c /usr/local/frp/frps.ini +ExecStart=/usr/local/frp/frps -c /usr/local/frp/frps.toml [Install] WantedBy=multi-user.target \ No newline at end of file diff --git a/frps.toml b/frps.toml new file mode 100644 index 0000000..4d9aa75 --- /dev/null +++ b/frps.toml @@ -0,0 +1,34 @@ +bindAddr = "0.0.0.0" +bindPort = 7000 +#kcpBindPort = 7000 +quicBindPort = 7000 + +transport.maxPoolCount = 2000 +transport.tcpMux = true +transport.tcpMuxKeepaliveInterval = 60 +transport.tcpKeepalive = 7200 +transport.tls.force = false + +webServer.addr = "0.0.0.0" +webServer.port = 7500 +webServer.user = "admin" +webServer.password = "admin" +webServer.pprofEnable = false + +log.to = "./frps.log" +# trace, debug, info, warn, error +log.level = "error" +log.maxDays = 1 +log.disablePrintColor = false + +auth.method = "token" +auth.token = "admin" + +# Only allow frpc to bind ports you list. By default, there won't be any limit. +allowPorts = [ + { start = 1, end = 65535 } +] + +maxPortsPerClient = 0 +udpPacketSize = 1500 +natholeAnalysisDataReserveHours = 24 \ No newline at end of file diff --git a/frps_linux_install.sh b/frps_linux_install.sh index 1459605..ab6c12e 100644 --- a/frps_linux_install.sh +++ b/frps_linux_install.sh @@ -12,7 +12,7 @@ Font="\033[0m" # fonts color # variable -FRP_VERSION=0.51.3 +FRP_VERSION=0.54.0 REPO=stilleshan/frps WORK_PATH=$(dirname $(readlink -f $0)) FRP_NAME=frps @@ -20,14 +20,14 @@ FRP_PATH=/usr/local/frp PROXY_URL="https://ghproxy.com/" # check frps -if [ -f "/usr/local/frp/${FRP_NAME}" ] || [ -f "/usr/local/frp/${FRP_NAME}.ini" ] || [ -f "/lib/systemd/system/${FRP_NAME}.service" ];then +if [ -f "/usr/local/frp/${FRP_NAME}" ] || [ -f "/usr/local/frp/${FRP_NAME}.toml" ] || [ -f "/lib/systemd/system/${FRP_NAME}.service" ];then echo -e "${Green}=========================================================================${Font}" echo -e "${RedBG}当前已退出脚本.${Font}" echo -e "${Green}检查到服务器已安装${Font} ${Red}${FRP_NAME}${Font}" - echo -e "${Green}请手动确认和删除${Font} ${Red}/usr/local/frp/${Font} ${Green}目录下的${Font} ${Red}${FRP_NAME}${Font} ${Green}和${Font} ${Red}/${FRP_NAME}.ini${Font} ${Green}文件以及${Font} ${Red}/lib/systemd/system/${FRP_NAME}.service${Font} ${Green}文件,再次执行本脚本.${Font}" + echo -e "${Green}请手动确认和删除${Font} ${Red}/usr/local/frp/${Font} ${Green}目录下的${Font} ${Red}${FRP_NAME}${Font} ${Green}和${Font} ${Red}/${FRP_NAME}.toml${Font} ${Green}文件以及${Font} ${Red}/lib/systemd/system/${FRP_NAME}.service${Font} ${Green}文件,再次执行本脚本.${Font}" echo -e "${Green}参考命令如下:${Font}" echo -e "${Red}rm -rf /usr/local/frp/${FRP_NAME}${Font}" - echo -e "${Red}rm -rf /usr/local/frp/${FRP_NAME}.ini${Font}" + echo -e "${Red}rm -rf /usr/local/frp/${FRP_NAME}.toml${Font}" echo -e "${Red}rm -rf /lib/systemd/system/${FRP_NAME}.service${Font}" echo -e "${Green}=========================================================================${Font}" exit 2 @@ -75,21 +75,21 @@ FILE_NAME=frp_${FRP_VERSION}_linux_${PLATFORM} # download if [ $GOOGLE_HTTP_CODE == "200" ]; then wget -P ${WORK_PATH} https://github.com/fatedier/frp/releases/download/v${FRP_VERSION}/${FILE_NAME}.tar.gz -O ${FILE_NAME}.tar.gz - wget -P ${WORK_PATH} https://raw.githubusercontent.com/${REPO}/master/${FRP_NAME}.ini -O ${FRP_NAME}.ini + wget -P ${WORK_PATH} https://raw.githubusercontent.com/${REPO}/master/${FRP_NAME}.toml -O ${FRP_NAME}.toml else if [ $PROXY_HTTP_CODE == "200" ]; then wget -P ${WORK_PATH} ${PROXY_URL}https://github.com/fatedier/frp/releases/download/v${FRP_VERSION}/${FILE_NAME}.tar.gz -O ${FILE_NAME}.tar.gz - wget -P ${WORK_PATH} ${PROXY_URL}https://raw.githubusercontent.com/${REPO}/master/${FRP_NAME}.ini -O ${FRP_NAME}.ini + wget -P ${WORK_PATH} ${PROXY_URL}https://raw.githubusercontent.com/${REPO}/master/${FRP_NAME}.toml -O ${FRP_NAME}.toml else echo -e "${Red}检测 GitHub Proxy 代理失效 开始使用官方地址下载${Font}" wget -P ${WORK_PATH} https://github.com/fatedier/frp/releases/download/v${FRP_VERSION}/${FILE_NAME}.tar.gz -O ${FILE_NAME}.tar.gz - wget -P ${WORK_PATH} https://raw.githubusercontent.com/${REPO}/master/${FRP_NAME}.ini -O ${FRP_NAME}.ini + wget -P ${WORK_PATH} https://raw.githubusercontent.com/${REPO}/master/${FRP_NAME}.toml -O ${FRP_NAME}.toml fi fi tar -zxvf ${FILE_NAME}.tar.gz mkdir -p ${FRP_PATH} mv ${FILE_NAME}/${FRP_NAME} ${FRP_PATH} -mv ${FRP_NAME}.ini ${FRP_PATH} +mv ${FRP_NAME}.toml ${FRP_PATH} # 配置 frps.service cat >/lib/systemd/system/frps.service <<'EOF' @@ -102,7 +102,7 @@ Wants=network.target Type=simple Restart=on-failure RestartSec=5s -ExecStart=/usr/local/frp/frps -c /usr/local/frp/frps.ini +ExecStart=/usr/local/frp/frps -c /usr/local/frp/frps.toml [Install] WantedBy=multi-user.target @@ -117,8 +117,8 @@ sudo systemctl enable ${FRP_NAME} rm -rf ${WORK_PATH}/${FILE_NAME}.tar.gz ${WORK_PATH}/${FILE_NAME} ${FRP_NAME}_linux_install.sh echo -e "${Green}====================================================================${Font}" -echo -e "${Green}安装成功,请先修改 ${FRP_NAME}.ini 文件,确保格式及配置正确无误!${Font}" -echo -e "${Red}vi /usr/local/frp/${FRP_NAME}.ini${Font}" +echo -e "${Green}安装成功,请先修改 ${FRP_NAME}.toml 文件,确保格式及配置正确无误!${Font}" +echo -e "${Red}vi /usr/local/frp/${FRP_NAME}.toml${Font}" echo -e "${Green}修改完毕后执行以下命令重启服务:${Font}" echo -e "${Red}sudo systemctl restart ${FRP_NAME}${Font}" echo -e "${Green}====================================================================${Font}"