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

     1  // Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
     2  
     3  package checkpoints
     4  
     5  import (
     6  	"github.com/TeaOSLab/EdgeNode/internal/waf/requests"
     7  	"github.com/TeaOSLab/EdgeNode/internal/waf/utils"
     8  	"github.com/iwind/TeaGo/maps"
     9  )
    10  
    11  type RequestGeoCityNameCheckpoint struct {
    12  	Checkpoint
    13  }
    14  
    15  func (this *RequestGeoCityNameCheckpoint) IsComposed() bool {
    16  	return false
    17  }
    18  
    19  func (this *RequestGeoCityNameCheckpoint) RequestValue(req requests.Request, param string, options maps.Map, ruleId int64) (value any, hasRequestBody bool, sysErr error, userErr error) {
    20  	value = req.Format("${geo.city.name}")
    21  	return
    22  }
    23  
    24  func (this *RequestGeoCityNameCheckpoint) ResponseValue(req requests.Request, resp *requests.Response, param string, options maps.Map, ruleId int64) (value any, hasRequestBody bool, sysErr error, userErr error) {
    25  	return this.RequestValue(req, param, options, ruleId)
    26  }
    27  
    28  func (this *RequestGeoCityNameCheckpoint) CacheLife() utils.CacheLife {
    29  	return utils.CacheLongLife
    30  }