go build:
git clone https://github.com/fatedier/frp.git
#windows客户端
frp/cmd/frpc
GOARCH=amd64 GOOS=windows CGO_ENABLED=0 go build -ldflags "-s -w"
#linux服务端
frp/cmd/frps
go build -ldflags "-s -w"
服务端配置文件:
[common]
bind_addr = 0.0.0.0
bind_port = 7000
dashboard_addr = 0.0.0.0
dashboard_port = 7500
dashboard_user = admin
dashboard_pwd = admin
log_file = /run/log/frp/frps.log
# trace, debug, info, warn, error
log_level = info
log_max_days = 3
disable_log_color = false
token = password
pool_count = 5
tcp_mux = false
allow_ports = 2000-3000,3001,3003,4000-50000
max_ports_per_client = 0
客户端配置文件:
[common]
server_addr = www.haiyun.me
server_port = 7000
log_file = ./frpc.log
# trace, debug, info, warn, error
log_level = info
log_max_days = 3
disable_log_color = false
login_fail_exit = false
token = password
pool_count = 5
protocol = tcp
tcp_mux = false
tls_enable = false
dns_server = 114.114.114.114
admin_addr = 127.0.0.1
admin_port = 7400
admin_user = admin
admin_pwd = admin
[ssh]
type = tcp
local_ip = 127.0.0.1
local_port = 3389
remote_port = 3389
use_encryption = true
use_compression = false
windows下使用winsw将frpc安装为系统服务开机自动启动,将winsw放到frp目录,并新建winsw.xml配置文件:
<service>
<id>frp</id>
<name>frp client</name>
<description>frp client</description>
<executable>C:\test\frpc.exe</executable>
<arguments>-c frpc.ini</arguments>
<onfailure action="restart" delay="60 sec"/>
<logmode>append</logmode>
<logpath>logs</logpath>
</service>
以管理员启动cmd进入frp目录,安装frp为系统服务并启动:
cd C:\test\
winsw install
winsw start frp
标签:none