商业版增加UAM功能

This commit is contained in:
刘祥超
2022-03-29 21:24:57 +08:00
parent db6e20ba37
commit f925d86107
3 changed files with 22 additions and 2 deletions

View File

@@ -241,9 +241,18 @@ func (this *HTTPRequest) doBegin() {
} }
// 处理健康检查 // 处理健康检查
var isHealthCheck = false
var healthCheckKey = this.RawReq.Header.Get(serverconfigs.HealthCheckHeaderName) var healthCheckKey = this.RawReq.Header.Get(serverconfigs.HealthCheckHeaderName)
if len(healthCheckKey) > 0 { if len(healthCheckKey) > 0 {
if this.doHealthCheck(healthCheckKey) { if this.doHealthCheck(healthCheckKey, &isHealthCheck) {
return
}
}
// UAM
if !isHealthCheck && this.ReqServer.UAM != nil && this.ReqServer.UAM.IsOn {
if this.doUAM() {
this.doEnd()
return return
} }
} }

View File

@@ -9,7 +9,7 @@ import (
) )
// 健康检查 // 健康检查
func (this *HTTPRequest) doHealthCheck(key string) (stop bool) { func (this *HTTPRequest) doHealthCheck(key string, isHealthCheck *bool) (stop bool) {
this.tags = append(this.tags, "healthCheck") this.tags = append(this.tags, "healthCheck")
this.RawReq.Header.Del(serverconfigs.HealthCheckHeaderName) this.RawReq.Header.Del(serverconfigs.HealthCheckHeaderName)
@@ -19,6 +19,7 @@ func (this *HTTPRequest) doHealthCheck(key string) (stop bool) {
remotelogs.Error("HTTP_REQUEST_HEALTH_CHECK", "decode key failed: "+err.Error()) remotelogs.Error("HTTP_REQUEST_HEALTH_CHECK", "decode key failed: "+err.Error())
return return
} }
*isHealthCheck = true
if data.GetBool("onlyBasicRequest") { if data.GetBool("onlyBasicRequest") {
return true return true

View File

@@ -0,0 +1,10 @@
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
//go:build !plus
// +build !plus
package nodes
// UAM
func (this *HTTPRequest) doUAM() (block bool) {
return false
}