github.com/TeaOSLab/EdgeNode@v1.3.8/internal/waf/checkpoints/request_proto.go (about)

     1  package checkpoints
     2  
     3  import (
     4  	"github.com/TeaOSLab/EdgeNode/internal/waf/requests"
     5  	"github.com/TeaOSLab/EdgeNode/internal/waf/utils"
     6  	"github.com/iwind/TeaGo/maps"
     7  )
     8  
     9  type RequestProtoCheckpoint struct {
    10  	Checkpoint
    11  }
    12  
    13  func (this *RequestProtoCheckpoint) RequestValue(req requests.Request, param string, options maps.Map, ruleId int64) (value any, hasRequestBody bool, sysErr error, userErr error) {
    14  	value = req.WAFRaw().Proto
    15  	return
    16  }
    17  
    18  func (this *RequestProtoCheckpoint) ResponseValue(req requests.Request, resp *requests.Response, param string, options maps.Map, ruleId int64) (value any, hasRequestBody bool, sysErr error, userErr error) {
    19  	if this.IsRequest() {
    20  		return this.RequestValue(req, param, options, ruleId)
    21  	}
    22  	return
    23  }
    24  
    25  func (this *RequestProtoCheckpoint) CacheLife() utils.CacheLife {
    26  	return utils.CacheLongLife
    27  }