github.com/TeaOSLab/EdgeNode@v1.3.8/internal/waf/checkpoints/request_cname.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 RequestCNAMECheckpoint struct {
    10  	Checkpoint
    11  }
    12  
    13  func (this *RequestCNAMECheckpoint) RequestValue(req requests.Request, param string, options maps.Map, ruleId int64) (value any, hasRequestBody bool, sysErr error, userErr error) {
    14  	value = req.Format("${cname}")
    15  	return
    16  }
    17  
    18  func (this *RequestCNAMECheckpoint) 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 *RequestCNAMECheckpoint) CacheLife() utils.CacheLife {
    26  	return utils.CacheLongLife
    27  }