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