mirror of https://github.com/bjdgyc/anylink.git
修改审计参数
This commit is contained in:
parent
a47cdc9a00
commit
a0065ade42
|
@ -55,7 +55,7 @@ var configs = []config{
|
||||||
{Typ: cfgInt, Name: "mobile_dpd", Usage: "移动端死链接检测时间(秒)", ValInt: 60},
|
{Typ: cfgInt, Name: "mobile_dpd", Usage: "移动端死链接检测时间(秒)", ValInt: 60},
|
||||||
{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: "审计去重间隔(秒),0关闭", ValInt: 0},
|
{Typ: cfgInt, Name: "audit_interval", Usage: "审计去重间隔(秒),-1关闭", ValInt: -1},
|
||||||
}
|
}
|
||||||
|
|
||||||
var envs = map[string]string{}
|
var envs = map[string]string{}
|
||||||
|
|
|
@ -62,7 +62,7 @@ mobile_dpd = 50
|
||||||
#session过期时间,用于断线重连,0永不过期
|
#session过期时间,用于断线重连,0永不过期
|
||||||
session_timeout = 3600
|
session_timeout = 3600
|
||||||
auth_timeout = 0
|
auth_timeout = 0
|
||||||
|
audit_interval = -1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -100,15 +100,11 @@ func checkLinkAcl(group *dbdata.Group, pl *sessdata.Payload) bool {
|
||||||
|
|
||||||
// 访问日志审计
|
// 访问日志审计
|
||||||
func logAudit(cSess *sessdata.ConnSession, pl *sessdata.Payload) {
|
func logAudit(cSess *sessdata.ConnSession, pl *sessdata.Payload) {
|
||||||
if base.Cfg.AuditInterval <= 0 {
|
if base.Cfg.AuditInterval < 0 {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
ipSrc := waterutil.IPv4Source(pl.Data)
|
|
||||||
ipDst := waterutil.IPv4Destination(pl.Data)
|
|
||||||
ipPort := waterutil.IPv4DestinationPort(pl.Data)
|
|
||||||
ipProto := waterutil.IPv4Protocol(pl.Data)
|
ipProto := waterutil.IPv4Protocol(pl.Data)
|
||||||
|
|
||||||
// 只统计 tcp和udp 的访问
|
// 只统计 tcp和udp 的访问
|
||||||
switch ipProto {
|
switch ipProto {
|
||||||
case waterutil.TCP:
|
case waterutil.TCP:
|
||||||
|
@ -117,6 +113,10 @@ func logAudit(cSess *sessdata.ConnSession, pl *sessdata.Payload) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ipSrc := waterutil.IPv4Source(pl.Data)
|
||||||
|
ipDst := waterutil.IPv4Destination(pl.Data)
|
||||||
|
ipPort := waterutil.IPv4DestinationPort(pl.Data)
|
||||||
|
|
||||||
b := getByte34()
|
b := getByte34()
|
||||||
key := *b
|
key := *b
|
||||||
copy(key[:16], ipSrc)
|
copy(key[:16], ipSrc)
|
||||||
|
|
|
@ -186,10 +186,14 @@ func (s *Session) NewConn() *ConnSession {
|
||||||
PayloadIn: make(chan *Payload, 64),
|
PayloadIn: make(chan *Payload, 64),
|
||||||
PayloadOutCstp: make(chan *Payload, 64),
|
PayloadOutCstp: make(chan *Payload, 64),
|
||||||
PayloadOutDtls: make(chan *Payload, 64),
|
PayloadOutDtls: make(chan *Payload, 64),
|
||||||
IpAuditMap: make(map[string]int64, 512),
|
|
||||||
dSess: &atomic.Value{},
|
dSess: &atomic.Value{},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ip 审计
|
||||||
|
if base.Cfg.AuditInterval >= 0 {
|
||||||
|
cSess.IpAuditMap = make(map[string]int64, 512)
|
||||||
|
}
|
||||||
|
|
||||||
dSess := &DtlsSession{
|
dSess := &DtlsSession{
|
||||||
isActive: -1,
|
isActive: -1,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue