Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
企猫商务
frp
提交
127a31ea
F
frp
项目概览
企猫商务
/
frp
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
F
frp
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
127a31ea
编写于
11月 23, 2020
作者:
Y
yuyulei
提交者:
GitHub
11月 23, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix typo (#2089)
上级
a85bd9a4
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
53 addition
and
31 deletion
+53
-31
client/control.go
client/control.go
+2
-2
conf/frpc_full.ini
conf/frpc_full.ini
+17
-2
conf/frps_full.ini
conf/frps_full.ini
+20
-13
pkg/config/client_common.go
pkg/config/client_common.go
+8
-8
pkg/config/server_common.go
pkg/config/server_common.go
+4
-4
server/control.go
server/control.go
+1
-1
server/dashboard_api.go
server/dashboard_api.go
+1
-1
未找到文件。
client/control.go
浏览文件 @
127a31ea
...
...
@@ -295,7 +295,7 @@ func (ctl *Control) msgHandler() {
}()
defer
ctl
.
msgHandlerShutdown
.
Done
()
hbSend
:=
time
.
NewTicker
(
time
.
Duration
(
ctl
.
clientCfg
.
Heart
B
eatInterval
)
*
time
.
Second
)
hbSend
:=
time
.
NewTicker
(
time
.
Duration
(
ctl
.
clientCfg
.
Heart
b
eatInterval
)
*
time
.
Second
)
defer
hbSend
.
Stop
()
hbCheck
:=
time
.
NewTicker
(
time
.
Second
)
defer
hbCheck
.
Stop
()
...
...
@@ -314,7 +314,7 @@ func (ctl *Control) msgHandler() {
}
ctl
.
sendCh
<-
pingMsg
case
<-
hbCheck
.
C
:
if
time
.
Since
(
ctl
.
lastPong
)
>
time
.
Duration
(
ctl
.
clientCfg
.
Heart
B
eatTimeout
)
*
time
.
Second
{
if
time
.
Since
(
ctl
.
lastPong
)
>
time
.
Duration
(
ctl
.
clientCfg
.
Heart
b
eatTimeout
)
*
time
.
Second
{
xl
.
Warn
(
"heartbeat timeout"
)
// let reader() stop
ctl
.
conn
.
Close
()
...
...
conf/frpc_full.ini
浏览文件 @
127a31ea
...
...
@@ -23,15 +23,30 @@ log_max_days = 3
disable_log_color
=
false
# for authentication, should be same as your frps.ini
#
AuthenticateHeartB
eats specifies whether to include authentication token in heartbeats sent to frps. By default, this value is false.
#
authenticate_heartb
eats specifies whether to include authentication token in heartbeats sent to frps. By default, this value is false.
authenticate_heartbeats
=
false
#
AuthenticateNewWorkC
onns specifies whether to include authentication token in new work connections sent to frps. By default, this value is false.
#
authenticate_new_work_c
onns specifies whether to include authentication token in new work connections sent to frps. By default, this value is false.
authenticate_new_work_conns
=
false
# auth token
token
=
12345678
# oidc_client_id specifies the client ID to use to get a token in OIDC authentication if AuthenticationMethod == "oidc".
# By default, this value is "".
oidc_client_id
=
# oidc_client_secret specifies the client secret to use to get a token in OIDC authentication if AuthenticationMethod == "oidc".
# By default, this value is "".
oidc_client_secret
=
# oidc_audience specifies the audience of the token in OIDC authentication if AuthenticationMethod == "oidc". By default, this value is "".
oidc_audience
=
# oidc_token_endpoint_url specifies the URL which implements OIDC Token Endpoint.
# It will be used to get an OIDC token if AuthenticationMethod == "oidc". By default, this value is "".
oidc_token_endpoint_url
=
# set admin address for control frpc's action by http api such as reload
admin_addr
=
127.0.0.1
admin_port
=
7400
...
...
conf/frps_full.ini
浏览文件 @
127a31ea
...
...
@@ -23,7 +23,7 @@ vhost_https_port = 443
# response header timeout(seconds) for vhost http server, default is 60s
# vhost_http_timeout = 60
#
TcpMuxHttpConnectP
ort specifies the port that the server listens for TCP
#
tcpmux_httpconnect_p
ort specifies the port that the server listens for TCP
# HTTP CONNECT requests. If the value is 0, the server will not multiplex TCP
# requests on one single port. If it's not - it will listen on this value for
# HTTP CONNECT requests. By default, this value is 0.
...
...
@@ -44,6 +44,7 @@ enable_prometheus = true
# dashboard assets directory(only for debug mode)
# assets_dir = ./static
# console or real logFile path like ./frps.log
log_file
=
./frps.log
...
...
@@ -58,12 +59,12 @@ disable_log_color = false
# DetailedErrorsToClient defines whether to send the specific error (with debug info) to frpc. By default, this value is true.
detailed_errors_to_client
=
true
#
AuthenticationM
ethod specifies what authentication method to use authenticate frpc with frps.
#
authentication_m
ethod specifies what authentication method to use authenticate frpc with frps.
# If "token" is specified - token will be read into login message.
# If "oidc" is specified - OIDC (Open ID Connect) token will be issued using OIDC settings. By default, this value is "token".
authentication_method
=
token
#
AuthenticateHeartB
eats specifies whether to include authentication token in heartbeats sent to frps. By default, this value is false.
#
authenticate_heartb
eats specifies whether to include authentication token in heartbeats sent to frps. By default, this value is false.
authenticate_heartbeats
=
false
# AuthenticateNewWorkConns specifies whether to include authentication token in new work connections sent to frps. By default, this value is false.
...
...
@@ -72,25 +73,31 @@ authenticate_new_work_conns = false
# auth token
token
=
12345678
#
OidcClientId specifies the client ID to use to get a token in OIDC authentication if AuthenticationMethod == "oidc"
.
#
oidc_issuer specifies the issuer to verify OIDC tokens with
.
# By default, this value is "".
oidc_
client_id
=
oidc_
issuer
=
#
OidcClientSecret specifies the client secret to use to get a token in OIDC authentication if AuthenticationMethod == "oidc"
.
#
oidc_audience specifies the audience OIDC tokens should contain when validated
.
# By default, this value is "".
oidc_client_secret
=
oidc_audience
=
# oidc_skip_expiry_check specifies whether to skip checking if the OIDC token is expired.
# By default, this value is false.
oidc_skip_expiry_check
=
false
# OidcAudience specifies the audience of the token in OIDC authentication if AuthenticationMethod == "oidc". By default, this value is "".
oidc_audience =
#
OidcTokenEndpointUrl specifies the URL which implements OIDC Token Endpoint
.
#
It will be used to get an OIDC token if AuthenticationMethod == "oidc". By default, this value is ""
.
oidc_
token_endpoint_url
=
#
oidc_skip_issuer_check specifies whether to skip checking if the OIDC token's issuer claim matches the issuer specified in OidcIssuer
.
#
By default, this value is false
.
oidc_
skip_issuer_check
=
false
# heartbeat configure, it's not recommended to modify the default value
# the default value of heartbeat_timeout is 90
# heartbeat_timeout = 90
# user_conn_timeout configure, it's not recommended to modify the default value
# the default value of user_conn_timeout is 10
# user_conn_timeout = 10
# only allow frpc to bind ports you list, if you set nothing, there won't be any limit
allow_ports
=
2000-3000,3001,3003,4000-50000
...
...
@@ -100,7 +107,7 @@ max_pool_count = 5
# max ports can be used for each client, default value is 0 means no limit
max_ports_per_client
=
0
#
TlsO
nly specifies whether to only accept TLS-encrypted connections. By default, the value is false.
#
tls_o
nly specifies whether to only accept TLS-encrypted connections. By default, the value is false.
tls_only
=
false
# tls_cert_file = server.crt
...
...
pkg/config/client_common.go
浏览文件 @
127a31ea
...
...
@@ -121,11 +121,11 @@ type ClientCommonConf struct {
// HeartBeatInterval specifies at what interval heartbeats are sent to the
// server, in seconds. It is not recommended to change this value. By
// default, this value is 30.
Heart
B
eatInterval
int64
`json:"heartbeat_interval"`
Heart
b
eatInterval
int64
`json:"heartbeat_interval"`
// HeartBeatTimeout specifies the maximum allowed heartbeat response delay
// before the connection is terminated, in seconds. It is not recommended
// to change this value. By default, this value is 90.
Heart
B
eatTimeout
int64
`json:"heartbeat_timeout"`
Heart
b
eatTimeout
int64
`json:"heartbeat_timeout"`
// Client meta info
Metas
map
[
string
]
string
`json:"metas"`
// UDPPacketSize specifies the udp packet size
...
...
@@ -160,8 +160,8 @@ func GetDefaultClientConf() ClientCommonConf {
TLSCertFile
:
""
,
TLSKeyFile
:
""
,
TLSTrustedCaFile
:
""
,
Heart
B
eatInterval
:
30
,
Heart
B
eatTimeout
:
90
,
Heart
b
eatInterval
:
30
,
Heart
b
eatTimeout
:
90
,
Metas
:
make
(
map
[
string
]
string
),
UDPPacketSize
:
1500
,
}
...
...
@@ -312,7 +312,7 @@ func UnmarshalClientConfFromIni(content string) (cfg ClientCommonConf, err error
err
=
fmt
.
Errorf
(
"Parse conf error: invalid heartbeat_timeout"
)
return
}
cfg
.
Heart
B
eatTimeout
=
v
cfg
.
Heart
b
eatTimeout
=
v
}
if
tmpStr
,
ok
=
conf
.
Get
(
"common"
,
"heartbeat_interval"
);
ok
{
...
...
@@ -320,7 +320,7 @@ func UnmarshalClientConfFromIni(content string) (cfg ClientCommonConf, err error
err
=
fmt
.
Errorf
(
"Parse conf error: invalid heartbeat_interval"
)
return
}
cfg
.
Heart
B
eatInterval
=
v
cfg
.
Heart
b
eatInterval
=
v
}
for
k
,
v
:=
range
conf
.
Section
(
"common"
)
{
if
strings
.
HasPrefix
(
k
,
"meta_"
)
{
...
...
@@ -338,12 +338,12 @@ func UnmarshalClientConfFromIni(content string) (cfg ClientCommonConf, err error
}
func
(
cfg
*
ClientCommonConf
)
Check
()
(
err
error
)
{
if
cfg
.
Heart
B
eatInterval
<=
0
{
if
cfg
.
Heart
b
eatInterval
<=
0
{
err
=
fmt
.
Errorf
(
"Parse conf error: invalid heartbeat_interval"
)
return
}
if
cfg
.
Heart
BeatTimeout
<
cfg
.
HeartB
eatInterval
{
if
cfg
.
Heart
beatTimeout
<
cfg
.
Heartb
eatInterval
{
err
=
fmt
.
Errorf
(
"Parse conf error: invalid heartbeat_timeout, heartbeat_timeout is less than heartbeat_interval"
)
return
}
...
...
pkg/config/server_common.go
浏览文件 @
127a31ea
...
...
@@ -83,7 +83,7 @@ type ServerCommonConf struct {
// AssetsDir specifies the local directory that the dashboard will load
// resources from. If this value is "", assets will be loaded from the
// bundled executable using statik. By default, this value is "".
AssetsDir
string
`json:"asse
r
ts_dir"`
AssetsDir
string
`json:"assets_dir"`
// LogFile specifies a file where logs will be written to. This value will
// only be used if LogWay is set appropriately. By default, this value is
// "console".
...
...
@@ -154,7 +154,7 @@ type ServerCommonConf struct {
// HeartBeatTimeout specifies the maximum time to wait for a heartbeat
// before terminating the connection. It is not recommended to change this
// value. By default, this value is 90.
Heart
BeatTimeout
int64
`json:"heart_
beat_timeout"`
Heart
beatTimeout
int64
`json:"heart
beat_timeout"`
// UserConnTimeout specifies the maximum time to wait for a work
// connection. By default, this value is 10.
UserConnTimeout
int64
`json:"user_conn_timeout"`
...
...
@@ -199,7 +199,7 @@ func GetDefaultServerConf() ServerCommonConf {
TLSCertFile
:
""
,
TLSKeyFile
:
""
,
TLSTrustedCaFile
:
""
,
Heart
B
eatTimeout
:
90
,
Heart
b
eatTimeout
:
90
,
UserConnTimeout
:
10
,
Custom404Page
:
""
,
HTTPPlugins
:
make
(
map
[
string
]
plugin
.
HTTPPluginOptions
),
...
...
@@ -421,7 +421,7 @@ func UnmarshalServerConfFromIni(content string) (cfg ServerCommonConf, err error
err
=
fmt
.
Errorf
(
"Parse conf error: heartbeat_timeout is incorrect"
)
return
}
cfg
.
Heart
B
eatTimeout
=
v
cfg
.
Heart
b
eatTimeout
=
v
}
if
tmpStr
,
ok
=
conf
.
Get
(
"common"
,
"tls_only"
);
ok
&&
tmpStr
==
"true"
{
...
...
server/control.go
浏览文件 @
127a31ea
...
...
@@ -408,7 +408,7 @@ func (ctl *Control) manager() {
for
{
select
{
case
<-
heartbeat
.
C
:
if
time
.
Since
(
ctl
.
lastPing
)
>
time
.
Duration
(
ctl
.
serverCfg
.
Heart
B
eatTimeout
)
*
time
.
Second
{
if
time
.
Since
(
ctl
.
lastPing
)
>
time
.
Duration
(
ctl
.
serverCfg
.
Heart
b
eatTimeout
)
*
time
.
Second
{
xl
.
Warn
(
"heartbeat timeout"
)
return
}
...
...
server/dashboard_api.go
浏览文件 @
127a31ea
...
...
@@ -74,7 +74,7 @@ func (svr *Service) APIServerInfo(w http.ResponseWriter, r *http.Request) {
SubdomainHost
:
svr
.
cfg
.
SubDomainHost
,
MaxPoolCount
:
svr
.
cfg
.
MaxPoolCount
,
MaxPortsPerClient
:
svr
.
cfg
.
MaxPortsPerClient
,
HeartBeatTimeout
:
svr
.
cfg
.
Heart
B
eatTimeout
,
HeartBeatTimeout
:
svr
.
cfg
.
Heart
b
eatTimeout
,
TotalTrafficIn
:
serverStats
.
TotalTrafficIn
,
TotalTrafficOut
:
serverStats
.
TotalTrafficOut
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录