Skip to content

Commit 2fa59d1

Browse files
committed
init
1 parent 45277ff commit 2fa59d1

File tree

11 files changed

+329
-1
lines changed

11 files changed

+329
-1
lines changed

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
**/.idea/*
2+
**/.vscode/*
3+
**/_mac/*
4+
5+
# Mac系统图表文件
6+
**/.DS_Store
7+

README.md

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,36 @@
1-
# frpc-qnap
1+
# 威联通 Frp 客户端
2+
3+
### 介绍
4+
25
Package frpc into qnap application.
6+
7+
为威联通Nas打包了一下 frp的客户端,方便大家安装
8+
9+
默认安装路径:`/share/CACHEDEV1_DATA/.qpkg/frpc/`
10+
默认配置文件路径:`/share/CACHEDEV1_DATA/.qpkg/frpc/frpc.ini`
11+
12+
13+
安装后需要修改 配置文件 才能正常使用。
14+
具体配置方法见 [frp官方文档](https://github.com/fatedier/frp)
15+
16+
### 安装使用
17+
18+
1、下载安装包:直接在Releases页面下载安装包
19+
2、安装:在威联通App Center 选择手动安装 即可
20+
3、安装完成后,先停止应用,然后手动修改配置文件内容为自己配置
21+
4、重新启动 尝试链接成功即可
22+
23+
### 其他说明
24+
25+
1、基于威联通[QDK 2.13](https://github.com/qnap-dev/QDK)[QDK官方文档](https://cheng-yuan-hong.gitbook.io/qdk-quick-start-guide/)
26+
2、仅封装打包Frp客户端,未对Frpc做任何改动,[frp官网](https://github.com/fatedier/frp)
27+
28+
### 开发
29+
30+
1、安装QDK,使其可以正常使用qbuild打包
31+
2、拉取本项目放置在nas的任意目录下
32+
3、进入本项目根目录下使用`qbuild`命令打包
33+
4、打包成功后的文件放置在本项目根路径下的`build`目录下
34+
35+
36+

build/frpc_0.45.0_x86_64.qpkg

4.25 MB
Binary file not shown.

build/frpc_0.45.0_x86_64.qpkg.md5

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
e69de4215d4d17b231cdfd619baa8d56 build/frpc_0.45.0_x86_64.qpkg

icons/frpc.gif

2.1 KB
Loading

icons/frpc_80.gif

3.43 KB
Loading

icons/frpc_gray.gif

1.63 KB
Loading

package_routines

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
######################################################################
2+
# List of available definitions (it's not necessary to uncomment them)
3+
######################################################################
4+
###### Command definitions #####
5+
#CMD_AWK="/bin/awk"
6+
#CMD_CAT="/bin/cat"
7+
#CMD_CHMOD="/bin/chmod"
8+
#CMD_CHOWN="/bin/chown"
9+
#CMD_CP="/bin/cp"
10+
#CMD_CUT="/bin/cut"
11+
#CMD_DATE="/bin/date"
12+
#CMD_ECHO="/bin/echo"
13+
#CMD_EXPR="/usr/bin/expr"
14+
#CMD_FIND="/usr/bin/find"
15+
#CMD_GETCFG="/sbin/getcfg"
16+
#CMD_GREP="/bin/grep"
17+
#CMD_GZIP="/bin/gzip"
18+
#CMD_HOSTNAME="/bin/hostname"
19+
#CMD_LN="/bin/ln"
20+
#CMD_LOG_TOOL="/sbin/log_tool"
21+
#CMD_MD5SUM="/bin/md5sum"
22+
#CMD_MKDIR="/bin/mkdir"
23+
#CMD_MV="/bin/mv"
24+
#CMD_RM="/bin/rm"
25+
#CMD_RMDIR="/bin/rmdir"
26+
#CMD_SED="/bin/sed"
27+
#CMD_SETCFG="/sbin/setcfg"
28+
#CMD_SLEEP="/bin/sleep"
29+
#CMD_SORT="/usr/bin/sort"
30+
#CMD_SYNC="/bin/sync"
31+
#CMD_TAR="/bin/tar"
32+
#CMD_TOUCH="/bin/touch"
33+
#CMD_WGET="/usr/bin/wget"
34+
#CMD_WLOG="/sbin/write_log"
35+
#CMD_XARGS="/usr/bin/xargs"
36+
#CMD_7Z="/usr/local/sbin/7z"
37+
#
38+
###### System definitions #####
39+
#SYS_EXTRACT_DIR="$(pwd)"
40+
#SYS_CONFIG_DIR="/etc/config"
41+
#SYS_INIT_DIR="/etc/init.d"
42+
#SYS_STARTUP_DIR="/etc/rcS.d"
43+
#SYS_SHUTDOWN_DIR="/etc/rcK.d"
44+
#SYS_RSS_IMG_DIR="/home/httpd/RSS/images"
45+
#SYS_QPKG_DATA_FILE_GZIP="./data.tar.gz"
46+
#SYS_QPKG_DATA_FILE_BZIP2="./data.tar.bz2"
47+
#SYS_QPKG_DATA_FILE_7ZIP="./data.tar.7z"
48+
#SYS_QPKG_DATA_CONFIG_FILE="./conf.tar.gz"
49+
#SYS_QPKG_DATA_MD5SUM_FILE="./md5sum"
50+
#SYS_QPKG_DATA_PACKAGES_FILE="./Packages.gz"
51+
#SYS_QPKG_CONFIG_FILE="$SYS_CONFIG_DIR/qpkg.conf"
52+
#SYS_QPKG_CONF_FIELD_QPKGFILE="QPKG_File"
53+
#SYS_QPKG_CONF_FIELD_NAME="Name"
54+
#SYS_QPKG_CONF_FIELD_VERSION="Version"
55+
#SYS_QPKG_CONF_FIELD_ENABLE="Enable"
56+
#SYS_QPKG_CONF_FIELD_DATE="Date"
57+
#SYS_QPKG_CONF_FIELD_SHELL="Shell"
58+
#SYS_QPKG_CONF_FIELD_INSTALL_PATH="Install_Path"
59+
#SYS_QPKG_CONF_FIELD_CONFIG_PATH="Config_Path"
60+
#SYS_QPKG_CONF_FIELD_WEBUI="WebUI"
61+
#SYS_QPKG_CONF_FIELD_WEBPORT="Web_Port"
62+
#SYS_QPKG_CONF_FIELD_SERVICEPORT="Service_Port"
63+
#SYS_QPKG_CONF_FIELD_SERVICE_PIDFILE="Pid_File"
64+
#SYS_QPKG_CONF_FIELD_AUTHOR="Author"
65+
#SYS_QPKG_CONF_FIELD_RC_NUMBER="RC_Number"
66+
## The following variables are assigned values at run-time.
67+
#SYS_HOSTNAME=$($CMD_HOSTNAME)
68+
## Data file name (one of SYS_QPKG_DATA_FILE_GZIP, SYS_QPKG_DATA_FILE_BZIP2,
69+
## or SYS_QPKG_DATA_FILE_7ZIP)
70+
#SYS_QPKG_DATA_FILE=
71+
## Base location.
72+
#SYS_QPKG_BASE=""
73+
## Base location of QPKG installed packages.
74+
#SYS_QPKG_INSTALL_PATH=""
75+
## Location of installed software.
76+
#SYS_QPKG_DIR=""
77+
## If the QPKG should be enabled or disabled after the installation/upgrade.
78+
#SYS_QPKG_SERVICE_ENABLED=""
79+
## Architecture of the device the QPKG is installed on.
80+
#SYS_CPU_ARCH=""
81+
## Name and location of system shares
82+
#SYS_PUBLIC_SHARE=""
83+
#SYS_PUBLIC_PATH=""
84+
#SYS_DOWNLOAD_SHARE=""
85+
#SYS_DOWNLOAD_PATH=""
86+
#SYS_MULTIMEDIA_SHARE=""
87+
#SYS_MULTIMEDIA_PATH=""
88+
#SYS_RECORDINGS_SHARE=""
89+
#SYS_RECORDINGS_PATH=""
90+
#SYS_USB_SHARE=""
91+
#SYS_USB_PATH=""
92+
#SYS_WEB_SHARE=""
93+
#SYS_WEB_PATH=""
94+
## Path to ipkg or opkg package tool if installed.
95+
#CMD_PKG_TOOL=
96+
#
97+
######################################################################
98+
# All package specific functions shall call 'err_log MSG' if an error
99+
# is detected that shall terminate the installation.
100+
######################################################################
101+
#
102+
######################################################################
103+
# Define any package specific operations that shall be performed when
104+
# the package is removed.
105+
######################################################################
106+
#PKG_PRE_REMOVE="{
107+
#}"
108+
#
109+
#PKG_MAIN_REMOVE="{
110+
#}"
111+
#
112+
#PKG_POST_REMOVE="{
113+
#}"
114+
#
115+
######################################################################
116+
# Define any package specific initialization that shall be performed
117+
# before the package is installed.
118+
######################################################################
119+
#pkg_init(){
120+
#}
121+
#
122+
######################################################################
123+
# Define any package specific requirement checks that shall be
124+
# performed before the package is installed.
125+
######################################################################
126+
#pkg_check_requirement(){
127+
#}
128+
#
129+
######################################################################
130+
# Define any package specific operations that shall be performed when
131+
# the package is installed.
132+
######################################################################
133+
#pkg_pre_install(){
134+
#}
135+
#
136+
#pkg_install(){
137+
#}
138+
#
139+
#pkg_post_install(){
140+
#}

qpkg.cfg

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# Name of the packaged application.
2+
QPKG_NAME="frpc"
3+
# Name of the display application.
4+
# QPKG_DISPLAY_NAME=""
5+
# Version of the packaged application.
6+
QPKG_VER="0.45.0"
7+
# Author or maintainer of the package
8+
QPKG_AUTHOR="zhxping"
9+
# License for the packaged application
10+
#QPKG_LICENSE=""
11+
# One-line description of the packaged application
12+
QPKG_SUMMARY="frp qnap client"
13+
14+
# Preferred number in start/stop sequence.
15+
QPKG_RC_NUM="111"
16+
# Init-script used to control the start and stop of the installed application.
17+
QPKG_SERVICE_PROGRAM="frpc.sh"
18+
19+
# Specifies any packages required for the current package to operate.
20+
#QPKG_REQUIRE="Python >= 2.7"
21+
# Specifies what packages cannot be installed if the current package
22+
# is to operate properly.
23+
#QPKG_CONFLICT="Python"
24+
# Name of configuration file (multiple definitions are allowed).
25+
# QPKG_CONFIG="frpc.ini"
26+
#QPKG_CONFIG="/etc/config/myApp.conf"
27+
# Port number used by service program.
28+
#QPKG_SERVICE_PORT=""
29+
# Location of file with running service's PID
30+
#QPKG_SERVICE_PIDFILE=""
31+
# Relative path to web interface
32+
#QPKG_WEBUI=""
33+
# Port number for the web interface.
34+
#QPKG_WEB_PORT=""
35+
# Port number for the SSL web interface.
36+
#QPKG_WEB_SSL_PORT=""
37+
38+
# Use QTS HTTP Proxy and set Proxy_Path in the qpkg.conf.
39+
# When the QPKG has its own HTTP service port, and want clients to connect via QTS HTTP port (default 8080).
40+
# Usually use this option when the QPKG need to connect via myQNAPcloud service.
41+
#QPKG_USE_PROXY="1"
42+
#QPKG_PROXY_PATH="/qpkg_name"
43+
44+
#Desktop Application (since 4.1)
45+
# Set value to 1 means to open the QPKG's Web UI inside QTS desktop instead of new window.
46+
#QPKG_DESKTOP_APP="1"
47+
# Desktop Application Window default inner width (since 4.1) (not over 1178)
48+
#QPKG_DESKTOP_APP_WIN_WIDTH=""
49+
# Desktop Application Window default inner height (since 4.1) (not over 600)
50+
#QPKG_DESKTOP_APP_WIN_HEIGHT=""
51+
52+
# Minimum QTS version requirement
53+
QTS_MINI_VERSION="5.0.0"
54+
# Maximum QTS version requirement
55+
QTS_MAX_VERSION="10.0.0"
56+
57+
# Select volume
58+
# 1: support installation
59+
# 2: support migration
60+
# 3 (1+2): support both installation and migration
61+
#QPKG_VOLUME_SELECT="0"
62+
63+
# Set timeout for QPKG enable and QPKG disable (since 4.1.0)
64+
# Format in seconds (enable, disable)
65+
#QPKG_TIMEOUT="10,30"
66+
67+
# Visible setting for the QPKG that has web UI, show this QPKG on the Main menu of
68+
# 1(default): administrators, 2: all NAS users.
69+
#QPKG_VISIBLE="2"
70+
71+
# Location of icons for the packaged application.
72+
QDK_DATA_DIR_ICONS="icons"
73+
# Location of files specific to arm-x19 packages.
74+
#QDK_DATA_DIR_X19="arm-x19"
75+
# Location of files specific to arm-x31 packages.
76+
#QDK_DATA_DIR_X31="arm-x31"
77+
# Location of files specific to arm-x41 packages.
78+
#QDK_DATA_DIR_X41="arm_al"
79+
# Location of files specific to x86 packages.
80+
#QDK_DATA_DIR_X86="x86"
81+
# Location of files specific to x86 (64-bit) packages.
82+
#QDK_DATA_DIR_X86_64="x86_64"
83+
# Location of files common to all architectures.
84+
#QDK_DATA_DIR_SHARED="shared"
85+
# Location of configuration files.
86+
#QDK_DATA_DIR_CONFIG="config"
87+
# Name of local data package.
88+
#QDK_DATA_FILE=""
89+
# Name of extra package (multiple definitions are allowed).
90+
#QDK_EXTRA_FILE=""

shared/frpc.sh

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#!/bin/sh
2+
CONF=/etc/config/qpkg.conf
3+
QPKG_NAME="frpc"
4+
# frpc 安装路径
5+
QPKG_ROOT=`/sbin/getcfg $QPKG_NAME Install_Path -f ${CONF}`
6+
7+
# frpc 配置文件路径 默认安装路径下的 frpc.ini
8+
CONF_PATH=$QPKG_ROOT/$QPKG_NAME.ini
9+
# frpc 日志文件 默认frpc.log
10+
LOG_PATH=$QPKG_ROOT/$QPKG_NAME.log
11+
12+
export QNAP_QPKG=$QPKG_NAME
13+
14+
case "$1" in
15+
start)
16+
ENABLED=$(/sbin/getcfg $QPKG_NAME Enable -u -d FALSE -f $CONF)
17+
if [ "$ENABLED" != "TRUE" ]; then
18+
echo "$QPKG_NAME is disabled."
19+
exit 1
20+
fi
21+
mkdir -p $QPKG_ROOT
22+
if [ -f $CONF_PATH ]; then
23+
$QPKG_ROOT/frpc -c $CONF_PATH > $LOG_PATH 2>&1 &
24+
else
25+
cat >$CONF_PATH <<EOF
26+
[common]
27+
server_addr = 127.0.0.1
28+
server_port = 7000
29+
30+
[ssh]
31+
type = tcp
32+
local_ip = 127.0.0.1
33+
local_port = 22
34+
remote_port = 6000
35+
36+
EOF
37+
$QPKG_ROOT/frpc -c $CONF_PATH > $LOG_PATH 2>&1 &
38+
39+
fi
40+
;;
41+
42+
stop)
43+
killall -9 frpc
44+
;;
45+
46+
restart)
47+
$0 stop
48+
$0 start
49+
;;
50+
51+
*)
52+
echo "Usage: $0 {start|stop|restart}"
53+
exit 1
54+
esac
55+
56+
exit 0

0 commit comments

Comments
 (0)