mirror of https://github.com/bjdgyc/anylink.git
增加mtu的配置参数
This commit is contained in:
parent
6a997bfd46
commit
54f7a59a91
|
@ -66,6 +66,7 @@ type ServerConfig struct {
|
||||||
CstpDpd int `json:"cstp_dpd"` // Dead peer detection in seconds
|
CstpDpd int `json:"cstp_dpd"` // Dead peer detection in seconds
|
||||||
MobileKeepalive int `json:"mobile_keepalive"`
|
MobileKeepalive int `json:"mobile_keepalive"`
|
||||||
MobileDpd int `json:"mobile_dpd"`
|
MobileDpd int `json:"mobile_dpd"`
|
||||||
|
Mtu int `json:"mtu"`
|
||||||
|
|
||||||
SessionTimeout int `json:"session_timeout"` // in seconds
|
SessionTimeout int `json:"session_timeout"` // in seconds
|
||||||
// AuthTimeout int `json:"auth_timeout"` // in seconds
|
// AuthTimeout int `json:"auth_timeout"` // in seconds
|
||||||
|
|
|
@ -54,6 +54,7 @@ var configs = []config{
|
||||||
{Typ: cfgInt, Name: "cstp_dpd", Usage: "死链接检测时间(秒)", ValInt: 30},
|
{Typ: cfgInt, Name: "cstp_dpd", Usage: "死链接检测时间(秒)", ValInt: 30},
|
||||||
{Typ: cfgInt, Name: "mobile_keepalive", Usage: "移动端keepalive接检测时间(秒)", ValInt: 50},
|
{Typ: cfgInt, Name: "mobile_keepalive", Usage: "移动端keepalive接检测时间(秒)", ValInt: 50},
|
||||||
{Typ: cfgInt, Name: "mobile_dpd", Usage: "移动端死链接检测时间(秒)", ValInt: 60},
|
{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: "session_timeout", Usage: "session过期时间(秒)", ValInt: 3600},
|
||||||
// {Typ: cfgInt, Name: "auth_timeout", Usage: "auth_timeout", ValInt: 0},
|
// {Typ: cfgInt, Name: "auth_timeout", Usage: "auth_timeout", ValInt: 0},
|
||||||
{Typ: cfgInt, Name: "audit_interval", Usage: "审计去重间隔(秒),-1关闭", ValInt: -1},
|
{Typ: cfgInt, Name: "audit_interval", Usage: "审计去重间隔(秒),-1关闭", ValInt: -1},
|
||||||
|
|
|
@ -60,6 +60,10 @@ cstp_keepalive = 20
|
||||||
cstp_dpd = 30
|
cstp_dpd = 30
|
||||||
mobile_keepalive = 40
|
mobile_keepalive = 40
|
||||||
mobile_dpd = 50
|
mobile_dpd = 50
|
||||||
|
|
||||||
|
#设置最大传输单元
|
||||||
|
mtu = 1460
|
||||||
|
|
||||||
#session过期时间,用于断线重连,0永不过期
|
#session过期时间,用于断线重连,0永不过期
|
||||||
session_timeout = 3600
|
session_timeout = 3600
|
||||||
auth_timeout = 0
|
auth_timeout = 0
|
||||||
|
|
|
@ -294,9 +294,12 @@ func (cs *ConnSession) ratePeriod() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const MaxMtu = 1460
|
var MaxMtu = 1460
|
||||||
|
|
||||||
func (cs *ConnSession) SetMtu(mtu string) {
|
func (cs *ConnSession) SetMtu(mtu string) {
|
||||||
|
if base.Cfg.Mtu > 0 {
|
||||||
|
MaxMtu = base.Cfg.Mtu
|
||||||
|
}
|
||||||
cs.Mtu = MaxMtu
|
cs.Mtu = MaxMtu
|
||||||
|
|
||||||
mi, err := strconv.Atoi(mtu)
|
mi, err := strconv.Atoi(mtu)
|
||||||
|
|
Loading…
Reference in New Issue