Merge pull request #105 from lanrenwo/main

增加mtu的配置参数
This commit is contained in:
bjdgyc 2022-06-14 16:55:21 +08:00 committed by GitHub
commit c76b074893
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 1 deletions

View File

@ -66,6 +66,7 @@ type ServerConfig struct {
CstpDpd int `json:"cstp_dpd"` // Dead peer detection in seconds
MobileKeepalive int `json:"mobile_keepalive"`
MobileDpd int `json:"mobile_dpd"`
Mtu int `json:"mtu"`
SessionTimeout int `json:"session_timeout"` // in seconds
// AuthTimeout int `json:"auth_timeout"` // in seconds

View File

@ -54,6 +54,7 @@ var configs = []config{
{Typ: cfgInt, Name: "cstp_dpd", Usage: "死链接检测时间(秒)", ValInt: 30},
{Typ: cfgInt, Name: "mobile_keepalive", Usage: "移动端keepalive接检测时间(秒)", ValInt: 50},
{Typ: cfgInt, Name: "mobile_dpd", Usage: "移动端死链接检测时间(秒)", ValInt: 60},
{Typ: cfgInt, Name: "mtu", Usage: "最大传输单元MTU", ValInt: 1460},
{Typ: cfgInt, Name: "session_timeout", Usage: "session过期时间(秒)", ValInt: 3600},
// {Typ: cfgInt, Name: "auth_timeout", Usage: "auth_timeout", ValInt: 0},
{Typ: cfgInt, Name: "audit_interval", Usage: "审计去重间隔(秒),-1关闭", ValInt: -1},

View File

@ -60,6 +60,10 @@ cstp_keepalive = 20
cstp_dpd = 30
mobile_keepalive = 40
mobile_dpd = 50
#设置最大传输单元
mtu = 1460
#session过期时间用于断线重连0永不过期
session_timeout = 3600
auth_timeout = 0

View File

@ -294,9 +294,12 @@ func (cs *ConnSession) ratePeriod() {
}
}
const MaxMtu = 1460
var MaxMtu = 1460
func (cs *ConnSession) SetMtu(mtu string) {
if base.Cfg.Mtu > 0 {
MaxMtu = base.Cfg.Mtu
}
cs.Mtu = MaxMtu
mi, err := strconv.Atoi(mtu)