github.com/TeaOSLab/EdgeNode@v1.3.8/internal/waf/checkpoints/sample_request.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  // SampleRequestCheckpoint just a sample checkpoint, copy and change it for your new checkpoint
    10  type SampleRequestCheckpoint struct {
    11  	Checkpoint
    12  }
    13  
    14  func (this *SampleRequestCheckpoint) RequestValue(req requests.Request, param string, options maps.Map, ruleId int64) (value any, hasRequestBody bool, sysErr error, userErr error) {
    15  	return
    16  }
    17  
    18  func (this *SampleRequestCheckpoint) 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 *SampleRequestCheckpoint) CacheLife() utils.CacheLife {
    26  	return utils.CacheMiddleLife
    27  }