Documentation
¶
Index ¶
- Constants
- Variables
- func ProductRuleConfCheck(conf ProductRuleConfFile) error
- type CacheType
- type ConfModSessionSticky
- type ModuleSessionState
- type ModuleSessionSticky
- func (m *ModuleSessionSticky) FindAndCacheStickyRule(request *bfe_basic.Request, rules *StickyRuleList) *StickyRule
- func (m *ModuleSessionSticky) FindStickyRule(request *bfe_basic.Request, rules *StickyRuleList) *StickyRule
- func (m *ModuleSessionSticky) Init(cbs *bfe_module.BfeCallbacks, whs *web_monitor.WebHandlers, cr string) error
- func (m *ModuleSessionSticky) Name() string
- type ProductRuleConf
- type ProductRuleConfFile
- type ProductRuleTable
- type ProductRules
- type ProductRulesFile
- type RedisSessionData
- type RuleType
- type SessionStickyData
- type StickyRule
- type StickyRuleFile
- type StickyRuleFileList
- type StickyRuleList
Constants ¶
View Source
const ( DefaultCookieKey = "bfe_ssbl" DefaultMaxAge = 3600 DefaultMaskCode = "defaultmask" DefaultStandbyMaskCode = "standbymask" DefaultHttpOnly = false DefaultSecure = false MinMaskCodeLen = 4 )
Variables ¶
View Source
var ( ModSessionStickyKey = "mod_session_sticky_key" // StickyRedisKeyPrefix is the Redis key prefix for sticky mapping StickyRedisKeyPrefix = "bfe:stickyid:" )
Functions ¶
func ProductRuleConfCheck ¶
func ProductRuleConfCheck(conf ProductRuleConfFile) error
check productRuleConf
Types ¶
type CacheType ¶
type CacheType int
CacheType defines the cache type for session sticky
func ParseCacheType ¶
ParseCacheType converts string to CacheType
type ConfModSessionSticky ¶
type ConfModSessionSticky struct {
Basic struct {
DataPath string // path of config data (session sticky)
CacheSize int // sticky cache size
CacheType string // cache type: "local" or "redis"
}
// Redis configuration (refer to mod_req_limit)
Redis struct {
Bns string // BNS service name
ConnectTimeout int // connect timeout (ms)
ReadTimeout int // read timeout (ms)
WriteTimeout int // write timeout (ms)
MaxIdle int // max idle connections
MaxActive int // max active connections (0 means unlimited)
Password string // Redis password
ExpireSeconds int // cache expire time (seconds)
}
Log struct {
OpenDebug bool
}
}
func ConfLoad ¶
func ConfLoad(filePath string, confRoot string) (*ConfModSessionSticky, error)
ConfLoad loades config from config file
func (*ConfModSessionSticky) Check ¶
func (cfg *ConfModSessionSticky) Check(confRoot string) error
type ModuleSessionState ¶
type ModuleSessionSticky ¶
type ModuleSessionSticky struct {
// contains filtered or unexported fields
}
func NewModuleSessionSticky ¶
func NewModuleSessionSticky() *ModuleSessionSticky
func (*ModuleSessionSticky) FindAndCacheStickyRule ¶
func (m *ModuleSessionSticky) FindAndCacheStickyRule(request *bfe_basic.Request, rules *StickyRuleList) *StickyRule
OBSOLETE! find and cache sticky rule which can match request;
func (*ModuleSessionSticky) FindStickyRule ¶
func (m *ModuleSessionSticky) FindStickyRule(request *bfe_basic.Request, rules *StickyRuleList) *StickyRule
find sticky rule which can match request;
func (*ModuleSessionSticky) Init ¶
func (m *ModuleSessionSticky) Init(cbs *bfe_module.BfeCallbacks, whs *web_monitor.WebHandlers, cr string) error
func (*ModuleSessionSticky) Name ¶
func (m *ModuleSessionSticky) Name() string
type ProductRuleConf ¶
type ProductRuleConf struct {
Version string // version of the config
Config ProductRules // product rules for sticky
}
func ProductRuleConfLoad ¶
func ProductRuleConfLoad(filename string) (ProductRuleConf, error)
load sticky rule config from file
Returns:
(ProductRuleConf, error)
type ProductRuleConfFile ¶
type ProductRuleConfFile struct {
Version *string
Config *ProductRulesFile
}
type ProductRuleTable ¶
type ProductRuleTable struct {
// contains filtered or unexported fields
}
func NewProductRuleTable ¶
func NewProductRuleTable() *ProductRuleTable
func (*ProductRuleTable) Search ¶
func (t *ProductRuleTable) Search(product string) (*StickyRuleList, bool)
func (*ProductRuleTable) Update ¶
func (t *ProductRuleTable) Update(conf ProductRuleConf)
type ProductRules ¶
type ProductRules map[string]*StickyRuleList
type ProductRulesFile ¶
type ProductRulesFile map[string]*StickyRuleFileList // product => list of sticky rules
type RedisSessionData ¶
type RedisSessionData struct {
Addr string `json:"addr"`
Port int `json:"port"`
SubCluster string `json:"sub_cluster"`
CreatedAt int64 `json:"created_at"`
}
RedisSessionData is used for JSON serialization when storing in Redis
type SessionStickyData ¶
type SessionStickyData struct {
// contains filtered or unexported fields
}
type StickyRule ¶
type StickyRule struct {
Cond condition.Condition // condition for sticky
Type RuleType
CookieKey string // cookie key
Domain string // cookie domain
Path string // cookie path
MaxAge int // max age
MaskCode string // active mask code which used to mask original bytes
StandbyMaskCode string // stand by mask code which used to mask original bytes
Header string // sticky header name
URIParam string // sticky uri param name
Secure bool
HttpOnly bool
RenewWindow int // renew window in seconds
StickyRequestField string // JSON field name in request body for sticky ID (e.g., previous_response_id)
StickyResponseField string // JSON field name in response body for sticky ID (e.g., response_id)
}
type StickyRuleFile ¶
type StickyRuleFile struct {
Cond *string // condition string for sticky
Type *string // "Cookie" | "Sticky"
CookieKey *string // cookie key
Domain *string // cookie domain
Path *string // cookie path
MaxAge *int // max age
MaskCode *string // active mask code which used to mask original bytes
StandbyMaskCode *string // stand by mask code which used to mask original bytes
Header *string // sticky header name
URIParam *string // sticky uri param name
Secure *bool
HttpOnly *bool
RenewWindow *int // renew window in seconds
StickyRequestField *string // JSON field name in request body for sticky ID (e.g., previous_response_id)
StickyResponseField *string // JSON field name in response body for sticky ID (e.g., response_id)
}
type StickyRuleFileList ¶
type StickyRuleFileList []StickyRuleFile
type StickyRuleList ¶
type StickyRuleList []StickyRule
Click to show internal directories.
Click to hide internal directories.