mod_header

package
v1.8.9-preview.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 20, 2026 License: Apache-2.0 Imports: 24 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	ReqCookieSet = "REQ_COOKIE_SET"
	ReqCookieDel = "REQ_COOKIE_DEL"
	RspCookieSet = "RSP_COOKIE_SET"
	RspCookieDel = "RSP_COOKIE_DEL"
)
View Source
const (
	ReqHeader = iota
	RspHeader
	TotalType
)
View Source
const (
	GlobalProduct = "global"
)
View Source
const (
	Unknown = "unknown"
)

Variables

View Source
var VariableHandlers = map[string]HeaderValueHandler{

	"bfe_client_ip":    getClientIp,
	"bfe_client_port":  getClientPort,
	"bfe_request_host": getRequestHost,

	"bfe_session_id": getSessionId,
	"bfe_log_id":     getLogId,
	"bfe_cip":        getClientIp,
	"bfe_vip":        getBfeVip,
	"bfe_bip":        getBfeBip,
	"bfe_rip":        getBfeRip,

	"bfe_server_name": getBfeServerName,

	"bfe_cluster":      getBfeCluster,
	"bfe_backend_info": getBfeBackendInfo,

	"bfe_ssl_resume":                          getBfeSslResume,
	"bfe_ssl_cipher":                          getBfeSslCipher,
	"bfe_ssl_version":                         getBfeSslVersion,
	"bfe_ssl_ja3_raw":                         getBfeSslJa3Raw,
	"bfe_ssl_ja3_hash":                        getBfeSslJa3Hash,
	"bfe_protocol":                            getBfeProtocol,
	"client_cert_serial_number":               getClientCertSerialNumber,
	"client_cert_subject_title":               getClientCertSubjectTitle,
	"client_cert_subject_common_name":         getClientCertSubjectCommonName,
	"client_cert_subject_organization":        getClientCertSubjectOrganization,
	"client_cert_subject_organizational_unit": getClientCertSubjectOrganizationalUnit,
	"client_cert_subject_province":            getClientCertSubjectProvince,
	"client_cert_subject_country":             getClientCertSubjectCountry,
	"client_cert_subject_locality":            getClientCertSubjectLocality,

	"bfe_http2_fingerprint": getBfeHTTP2Fingerprint,

	"bfe_client_geo_country_iso_code":     getClientGeoCountryIsoCode,
	"bfe_client_geo_subdivision_iso_code": getClientGeoSubdivisionIsoCode,
	"bfe_client_geo_city_name":            getClientGeoCityName,
	"bfe_client_geo_latitude":             getClientGeoLatitude,
	"bfe_client_geo_longitude":            getClientGeoLongitude,
}

Functions

func ActionFileCheck

func ActionFileCheck(conf ActionFile) error

func ActionFileListCheck

func ActionFileListCheck(conf *ActionFileList) error

func DoHeader

func DoHeader(req *bfe_basic.Request, headerType int, ruleList *RuleList)

func HeaderActionDo

func HeaderActionDo(h *bfe_http.Header, cmd string, headerName string, value string)

func HeaderActionsDo

func HeaderActionsDo(req *bfe_basic.Request, headerType int, actions []Action)

func HeaderConfCheck

func HeaderConfCheck(conf HeaderConfFile) error

func HeaderRuleCheck

func HeaderRuleCheck(conf HeaderRuleFile) error

func ProductRulesCheck

func ProductRulesCheck(conf *ProductRulesFile) error

func ReqCookieActionDo

func ReqCookieActionDo(req *bfe_basic.Request, action Action)

func RspCookieActionDo

func RspCookieActionDo(req *bfe_basic.Request, action Action)

func RuleListCheck

func RuleListCheck(conf *RuleFileList) error

Types

type Action

type Action struct {
	Cmd    string   // command of action (for header set/add/del)
	Params []string // params of action ([header, value] or [header])
}

type ActionFile

type ActionFile struct {
	Cmd    *string // command of action
	Params []string
}

type ActionFileList

type ActionFileList []ActionFile

type ConfModHeader

type ConfModHeader struct {
	Basic struct {
		DataPath             string // path of config data (mod_header)
		DisableDefaultHeader bool   // disable default header or not
	}

	Log struct {
		OpenDebug bool
	}
}

func ConfLoad

func ConfLoad(filePath string, confRoot string) (*ConfModHeader, error)

func (*ConfModHeader) Check

func (cfg *ConfModHeader) Check(confRoot string) error

type HeaderConf

type HeaderConf struct {
	Version string       // version of the config
	Config  ProductRules // product rules for header
}

func HeaderConfLoad

func HeaderConfLoad(filename string) (HeaderConf, error)

HeaderConfLoad loads config of header from file.

type HeaderConfFile

type HeaderConfFile struct {
	Version *string // version of the config
	Config  *ProductRulesFile
}

type HeaderRule

type HeaderRule struct {
	Cond    condition.Condition // condition for header
	Actions []Action            // list of actions
	Last    bool                // if true, not to check the next rule in the list if

}

type HeaderRuleFile

type HeaderRuleFile struct {
	Cond    *string         // condition for header
	Actions *ActionFileList // list of actions
	Last    *bool           // if true, not to check the next rule in the list if

}

type HeaderTable

type HeaderTable struct {
	// contains filtered or unexported fields
}

func NewHeaderTable

func NewHeaderTable() *HeaderTable

func (*HeaderTable) Search

func (t *HeaderTable) Search(product string) ([]*RuleList, bool)

func (*HeaderTable) Update

func (t *HeaderTable) Update(conf HeaderConf)

type HeaderValueHandler

type HeaderValueHandler func(req *bfe_basic.Request) string

type ModuleHeader

type ModuleHeader struct {
	// contains filtered or unexported fields
}

func NewModuleHeader

func NewModuleHeader() *ModuleHeader

func (*ModuleHeader) Init

func (*ModuleHeader) Name

func (m *ModuleHeader) Name() string

type ProductRules

type ProductRules map[string][]*RuleList // product => list of header rules

type ProductRulesFile

type ProductRulesFile map[string]*RuleFileList // product => list of header rules

type RuleFileList

type RuleFileList []HeaderRuleFile

type RuleList

type RuleList []HeaderRule

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL