forked from tsl0922/padavan
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
11 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,30 @@ | ||
#!/bin/sh | ||
#from hiboy | ||
killall frpc frps | ||
#创建运行环境 | ||
killall frpc | ||
mkdir -p /tmp/frp | ||
#启动frp功能后会运行以下脚本 | ||
#frp项目地址教程: https://github.com/fatedier/frp/blob/master/README_zh.md | ||
#请自行修改 token 用于对客户端连接进行身份验证 | ||
# IP查询: http://119.29.29.29/d?dn=github.com | ||
|
||
#创建frpc配置文件 | ||
cat > "/tmp/frp/myfrpc.ini" <<-\EOF | ||
# ==========客户端配置:========== | ||
[common] | ||
server_addr = 1192.0.0.3 | ||
server_port = 7000 | ||
token = 12345 | ||
#log_file = /dev/null | ||
#log_level = info | ||
#log_max_days = 3 | ||
log_file = /tmp/frpc.log | ||
log_level = info | ||
log_max_days = 3 | ||
[web] | ||
[test] | ||
remote_port = 6000 | ||
type = http | ||
type = tcp | ||
local_ip = 192.168.2.1 | ||
local_port = 80 | ||
subdomain = test | ||
#host_header_rewrite = 实际你内网访问的域名,可以供公网的域名不一致,如果一致可以不写 | ||
# ==================== | ||
# ================================ | ||
EOF | ||
|
||
#请手动配置【外部网络 (WAN) - 端口转发 (UPnP)】开启 WAN 外网端口 | ||
cat > "/tmp/frp/myfrps.ini" <<-\EOF | ||
# ==========服务端配置:========== | ||
[common] | ||
bind_port = 7000 | ||
dashboard_port = 7500 | ||
# dashboard 用户名密码,默认都为 admin | ||
dashboard_user = admin | ||
dashboard_pwd = admin | ||
vhost_http_port = 88 | ||
token = 12345 | ||
subdomain_host = frps.com | ||
max_pool_count = 50 | ||
#log_file = /dev/null | ||
#log_level = info | ||
#log_max_days = 3 | ||
# ==================== | ||
EOF | ||
|
||
#启动: | ||
#启动程序 | ||
frpc_enable=`nvram get frpc_enable` | ||
frps_enable=`nvram get frps_enable` | ||
if [ "$frpc_enable" = "1" ] ; then | ||
frpc -c /tmp/frp/myfrpc.ini 2>&1 & | ||
fi | ||
if [ "$frps_enable" = "1" ] ; then | ||
frps -c /tmp/frp/myfrps.ini 2>&1 & | ||
fi | ||
|
||
fi |