github.com/TeaOSLab/EdgeNode@v1.3.8/internal/waf/checkpoints/response_status.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  // ResponseStatusCheckpoint ${bytesSent}
    10  type ResponseStatusCheckpoint struct {
    11  	Checkpoint
    12  }
    13  
    14  func (this *ResponseStatusCheckpoint) IsRequest() bool {
    15  	return false
    16  }
    17  
    18  func (this *ResponseStatusCheckpoint) RequestValue(req requests.Request, param string, options maps.Map, ruleId int64) (value any, hasRequestBody bool, sysErr error, userErr error) {
    19  	value = 0
    20  	return
    21  }
    22  
    23  func (this *ResponseStatusCheckpoint) ResponseValue(req requests.Request, resp *requests.Response, param string, options maps.Map, ruleId int64) (value any, hasRequestBody bool, sysErr error, userErr error) {
    24  	if resp != nil {
    25  		value = resp.StatusCode
    26  	}
    27  	return
    28  }
    29  
    30  func (this *ResponseStatusCheckpoint) CacheLife() utils.CacheLife {
    31  	return utils.CacheLongLife
    32  }