Documentation
¶
Index ¶
- Constants
- Variables
- func AllLocationPatternTypes() []maps.Map
- func AllServerTypes() []maps.Map
- func FindAccessLogStorageTypeName(storageType string) string
- func FindAccessLogSyslogStoragePriorityName(priority AccessLogSyslogStoragePriority) string
- func FindAllAccessLogStorageTypes() []*shared.Definition
- func FindAllMetricChartTypes() []*shared.Definition
- func FindAllMetricKeyDefinitions(category MetricItemCategory) []*shared.Definition
- func FindAllServerProtocols() []maps.Map
- func FindAllServerProtocolsForType(serverType ServerType) []maps.Map
- func FindCachePolicyStorageName(policyType CachePolicyStorageType) string
- func FindIPLibraryWithType(libraryType string) maps.Map
- func FindLocationPatternType(patternType int) maps.Map
- func FindLocationPatternTypeName(patternType int) string
- func FindMetricChartTypeName(chartType MetricChartType) string
- func FindMetricPeriodUnitName(unit string) string
- func FindMetricValueName(category MetricItemCategory, code string) string
- func FindMetricValueType(category MetricItemCategory, code string) string
- func FindServerType(code string) maps.Map
- func HumanMetricTime(periodUnit MetricItemPeriodUnit, time string) string
- func IsCommonRequestHeader(headerName string) bool
- func IsHTTPServerType(serverType ServerType) bool
- func NormalizeServerNames(serverNames []*ServerNameConfig)
- func PlainServerNames(serverNames []*ServerNameConfig) (result []string)
- type AccessLogCommandStorageConfig
- type AccessLogESStorageConfig
- type AccessLogFileStorageConfig
- type AccessLogQueueConfig
- type AccessLogStorageType
- type AccessLogSyslogStorageConfig
- type AccessLogSyslogStoragePriority
- type AccessLogSyslogStorageProtocol
- type AccessLogTCPStorageConfig
- type BaseProtocol
- type CacheDir
- type CachePolicyStorageType
- type CommonScript
- type DomainMismatchAction
- type DomainMismatchCloseOptions
- type DomainMismatchPageOptions
- type FTPServerConfig
- type FTPServerRef
- type GlobalConfig
- type GlobalServerConfig
- type HTTPAccessLogField
- type HTTPAccessLogRef
- type HTTPAuthBaseMethod
- type HTTPAuthBasicMethod
- type HTTPAuthBasicMethodUser
- type HTTPAuthConfig
- type HTTPAuthMethodInterface
- type HTTPAuthPolicy
- type HTTPAuthPolicyRef
- type HTTPAuthSubRequestMethod
- type HTTPAuthType
- type HTTPAuthTypeDefinition
- type HTTPBrotliCompressionConfig
- type HTTPCacheConfig
- type HTTPCachePolicy
- type HTTPCacheRef
- func (this *HTTPCacheRef) ContainsCacheControl(value string) bool
- func (this *HTTPCacheRef) Init() error
- func (this *HTTPCacheRef) LifeSeconds() int64
- func (this *HTTPCacheRef) MatchRequest(req *http.Request) bool
- func (this *HTTPCacheRef) MatchStatus(statusCode int) bool
- func (this *HTTPCacheRef) MaxSizeBytes() int64
- func (this *HTTPCacheRef) MinSizeBytes() int64
- type HTTPCacheStaleConfig
- type HTTPCharsetConfig
- type HTTPCompressionConfig
- func (this *HTTPCompressionConfig) Init() error
- func (this *HTTPCompressionConfig) MatchAcceptEncoding(acceptEncodings string) (compressionType HTTPCompressionType, compressionEncoding string, ok bool)
- func (this *HTTPCompressionConfig) MatchResponse(mimeType string, contentLength int64, requestExt string, ...) bool
- func (this *HTTPCompressionConfig) MaxBytes() int64
- func (this *HTTPCompressionConfig) MinBytes() int64
- type HTTPCompressionRef
- type HTTPCompressionType
- type HTTPDeflateCompressionConfig
- type HTTPExpiresTimeConfig
- type HTTPFastcgiConfig
- func (this *HTTPFastcgiConfig) FilterParams() maps.Map
- func (this *HTTPFastcgiConfig) Init() error
- func (this *HTTPFastcgiConfig) Network() string
- func (this *HTTPFastcgiConfig) Param(paramName string) string
- func (this *HTTPFastcgiConfig) PathInfoRegexp() *regexp.Regexp
- func (this *HTTPFastcgiConfig) ReadTimeoutDuration() time.Duration
- func (this *HTTPFastcgiConfig) RealAddress() string
- type HTTPFastcgiParam
- type HTTPFastcgiRef
- type HTTPFileCacheStorage
- type HTTPFilterPolicy
- type HTTPFilterRef
- type HTTPGzipCompressionConfig
- type HTTPGzipRef
- type HTTPHostRedirectConfig
- func (this *HTTPHostRedirectConfig) BeforeURLRegexp() *regexp.Regexp
- func (this *HTTPHostRedirectConfig) ContainsPort(reqPort int) bool
- func (this *HTTPHostRedirectConfig) Init() error
- func (this *HTTPHostRedirectConfig) MatchRequest(formatter func(source string) string) bool
- func (this *HTTPHostRedirectConfig) RealBeforeURL() string
- type HTTPHostRedirectType
- type HTTPLocationConfig
- func (this *HTTPLocationConfig) ExtractPattern() error
- func (this *HTTPLocationConfig) Init() error
- func (this *HTTPLocationConfig) IsCaseInsensitive() bool
- func (this *HTTPLocationConfig) IsReverse() bool
- func (this *HTTPLocationConfig) Match(path string, formatter func(source string) string) (vars map[string]string, isMatched bool)
- func (this *HTTPLocationConfig) PatternString() string
- func (this *HTTPLocationConfig) PatternType() int
- func (this *HTTPLocationConfig) SetPattern(pattern string, patternType int, caseInsensitive bool, reverse bool)
- type HTTPLocationPatternType
- type HTTPLocationRef
- type HTTPMemoryCacheStorage
- type HTTPPageConfig
- type HTTPProtocolConfig
- type HTTPRedirectToHTTPSConfig
- type HTTPRemoteAddrConfig
- type HTTPRequestLimitConfig
- type HTTPRequestScriptsConfig
- type HTTPRewriteMode
- type HTTPRewriteRef
- type HTTPRewriteRule
- func (this *HTTPRewriteRule) Init() error
- func (this *HTTPRewriteRule) IsExternalURL(url string) bool
- func (this *HTTPRewriteRule) MatchRequest(requestPath string, formatter func(source string) string) (replace string, varMapping map[string]string, matched bool)
- func (this *HTTPRewriteRule) ProxyHostHasVariables() bool
- type HTTPRootConfig
- type HTTPSProtocolConfig
- type HTTPShutdownConfig
- type HTTPStatRef
- type HTTPStatus
- type HTTPWebConfig
- type HTTPWebsocketConfig
- type HTTPWebsocketRef
- type HealthCheckConfig
- type IPLibraryType
- type IPVersion
- type MetricChartType
- type MetricItemCategory
- type MetricItemConfig
- func (this *MetricItemConfig) CurrentTime() string
- func (this *MetricItemConfig) HasHTTPConnectionValue() bool
- func (this *MetricItemConfig) Init() error
- func (this *MetricItemConfig) LocalExpiresTime() string
- func (this *MetricItemConfig) ServerExpiresDay() string
- func (this *MetricItemConfig) ServerExpiresTime() string
- func (this *MetricItemConfig) UploadDuration() time.Duration
- type MetricItemPeriodUnit
- type MetricItemValueType
- type MetricValueDefinition
- type NetworkAddressConfig
- type OpenFileCacheConfig
- type OriginConfig
- func (this *OriginConfig) CandidateCodes() []string
- func (this *OriginConfig) CandidateWeight() uint
- func (this *OriginConfig) ConnTimeoutDuration() time.Duration
- func (this *OriginConfig) IdleTimeoutDuration() time.Duration
- func (this *OriginConfig) Init() error
- func (this *OriginConfig) ReadTimeoutDuration() time.Duration
- func (this *OriginConfig) RequestHostHasVariables() bool
- func (this *OriginConfig) RequestURIHasVariables() bool
- func (this *OriginConfig) UniqueKey() string
- type OriginGroupConfig
- type OriginRef
- type PlanConfig
- type Protocol
- func (this Protocol) IsHTTPFamily() bool
- func (this Protocol) IsHTTPSFamily() bool
- func (this Protocol) IsTCPFamily() bool
- func (this Protocol) IsTLSFamily() bool
- func (this Protocol) IsUDPFamily() bool
- func (this Protocol) IsUnixFamily() bool
- func (this Protocol) Primary() Protocol
- func (this Protocol) Scheme() string
- func (this Protocol) String() string
- type ProxyProtocolConfig
- type ProxyProtocolVersion
- type ReferersConfig
- type RequestHostType
- type ReverseProxyConfig
- func (this *ReverseProxyConfig) AddBackupOrigin(origin *OriginConfig)
- func (this *ReverseProxyConfig) AddPrimaryOrigin(origin *OriginConfig)
- func (this *ReverseProxyConfig) AnyOrigin(call *shared.RequestCall, excludingOriginIds []int64) *OriginConfig
- func (this *ReverseProxyConfig) FindSchedulingConfig() *SchedulingConfig
- func (this *ReverseProxyConfig) Init() error
- func (this *ReverseProxyConfig) NextOrigin(call *shared.RequestCall) *OriginConfig
- func (this *ReverseProxyConfig) RequestHostHasVariables() bool
- func (this *ReverseProxyConfig) RequestURIHasVariables() bool
- func (this *ReverseProxyConfig) ResetScheduling()
- func (this *ReverseProxyConfig) SetupScheduling(isBackup bool, checkOk bool, lock bool)
- func (this *ReverseProxyConfig) ShouldAddXForwardedByHeader() bool
- func (this *ReverseProxyConfig) ShouldAddXForwardedForHeader() bool
- func (this *ReverseProxyConfig) ShouldAddXForwardedHostHeader() bool
- func (this *ReverseProxyConfig) ShouldAddXForwardedProtoHeader() bool
- func (this *ReverseProxyConfig) ShouldAddXRealIPHeader() bool
- type ReverseProxyRef
- type SchedulingConfig
- type SchedulingGroup
- type ScriptConfig
- type ScriptGroupConfig
- type ServerAddressGroup
- func (this *ServerAddressGroup) Add(server *ServerConfig)
- func (this *ServerAddressGroup) Addr() string
- func (this *ServerAddressGroup) FirstServer() *ServerConfig
- func (this *ServerAddressGroup) FirstTLSServer() *ServerConfig
- func (this *ServerAddressGroup) FullAddr() string
- func (this *ServerAddressGroup) IsHTTP() bool
- func (this *ServerAddressGroup) IsHTTPS() bool
- func (this *ServerAddressGroup) IsTCP() bool
- func (this *ServerAddressGroup) IsTLS() bool
- func (this *ServerAddressGroup) IsUDP() bool
- func (this *ServerAddressGroup) IsUnix() bool
- func (this *ServerAddressGroup) MatchServerCNAME(serverName string) *ServerConfig
- func (this *ServerAddressGroup) MatchServerName(serverName string) *ServerConfig
- func (this *ServerAddressGroup) Protocol() Protocol
- func (this *ServerAddressGroup) Servers() []*ServerConfig
- type ServerConfig
- func (this *ServerConfig) AllFuzzyNames() []string
- func (this *ServerConfig) AllStrictNames() []string
- func (this *ServerConfig) AsJSON() ([]byte, error)
- func (this *ServerConfig) FindAndCheckReverseProxy(dataType string) (*ReverseProxyConfig, error)
- func (this *ServerConfig) FullAddresses() []string
- func (this *ServerConfig) Init() (results []error)
- func (this *ServerConfig) IsHTTPFamily() bool
- func (this *ServerConfig) IsInitialized() bool
- func (this *ServerConfig) IsOk() bool
- func (this *ServerConfig) IsTCPFamily() bool
- func (this *ServerConfig) IsUDPFamily() bool
- func (this *ServerConfig) IsUnixFamily() bool
- func (this *ServerConfig) Listen() []*NetworkAddressConfig
- func (this *ServerConfig) PlanId() int64
- func (this *ServerConfig) SSLPolicy() *sslconfigs.SSLPolicy
- func (this *ServerConfig) ShouldCheckTrafficLimit() bool
- type ServerGroupConfig
- type ServerNameConfig
- type ServerNameType
- type ServerType
- type TCPProtocolConfig
- type TLSProtocolConfig
- type TrafficLimitConfig
- type TrafficLimitStatus
- type UAMConfig
- type UDPProtocolConfig
- type UnixProtocolConfig
- type UserAgentAction
- type UserAgentConfig
- type UserAgentFilter
- type UserAgentKeyword
- type UserPlanConfig
- type WebPImageConfig
- func (this *WebPImageConfig) Init() error
- func (this *WebPImageConfig) MatchAccept(acceptContentTypes string) bool
- func (this *WebPImageConfig) MatchRequest(requestExt string, formatter shared.Formatter) bool
- func (this *WebPImageConfig) MatchResponse(mimeType string, contentLength int64, requestExt string, ...) bool
- type WildcardStatus
Constants ¶
const ( DomainMismatchActionPage = "page" DomainMismatchActionClose = "close" )
const ( DefaultTCPPortRangeMin = 10000 DefaultTCPPortRangeMax = 40000 )
const ( HTTPRewriteTargetProxy = 1 HTTPRewriteTargetURL = 2 )
const DefaultOpenFileCacheMax = 1024
const DefaultPlanExpireNoticePageBody = `` /* 241-byte string literal not displayed */
DefaultPlanExpireNoticePageBody 套餐过期时提示
const DefaultTrafficLimitNoticePageBody = `` /* 276-byte string literal not displayed */
DefaultTrafficLimitNoticePageBody 达到流量限制时默认提示内容
const HealthCheckHeaderName = "X-Edge-Health-Check-Key"
Variables ¶
var AccessLogSyslogStoragePriorities = []maps.Map{ { "name": "[无]", "value": -1, }, { "name": "EMERG", "value": AccessLogSyslogStoragePriorityEmerg, }, { "name": "ALERT", "value": AccessLogSyslogStoragePriorityAlert, }, { "name": "CRIT", "value": AccessLogSyslogStoragePriorityCrit, }, { "name": "ERR", "value": AccessLogSyslogStoragePriorityErr, }, { "name": "WARNING", "value": AccessLogSyslogStoragePriorityWarning, }, { "name": "NOTICE", "value": AccessLogSyslogStoragePriorityNotice, }, { "name": "INFO", "value": AccessLogSyslogStoragePriorityInfo, }, { "name": "DEBUG", "value": AccessLogSyslogStoragePriorityDebug, }, }
var AllCachePolicyStorageTypes = []maps.Map{ { "name": "文件缓存", "type": CachePolicyStorageFile, }, { "name": "内存缓存", "type": CachePolicyStorageMemory, }, }
var AllHTTPCommonRequestHeaders = append(append([]string{}, HTTPCommonRequestHeaders...), HTTPCommonRequestHeaders2...)
var AllHTTPCommonResponseHeaders = append(append([]string{}, HTTPCommonResponseHeaders...), HTTPCommonResponseHeaders2...)
var DefaultHTTPAccessLogRef = NewHTTPAccessLogRef()
DefaultHTTPAccessLogRef 默认的访问日志配置
var DefaultHTTPCompressionTypes = []HTTPCompressionType{HTTPCompressionTypeBrotli, HTTPCompressionTypeGzip, HTTPCompressionTypeDeflate}
var DefaultIPLibraryType = IPLibraryTypeIP2Region
var DefaultSkippedResponseCacheControlValues = []string{"private", "no-cache", "no-store"}
var HTTPAccessLogDefaultFieldsCodes = []HTTPAccessLogField{ HTTPAccessLogFieldHeader, HTTPAccessLogFieldSentHeader, HTTPAccessLogFieldReferer, HTTPAccessLogFieldUserAgent, }
var HTTPAccessLogFields = []maps.Map{ { "code": HTTPAccessLogFieldHeader, "name": "请求Header列表", }, { "code": HTTPAccessLogFieldSentHeader, "name": "响应Header列表", }, { "code": HTTPAccessLogFieldArg, "name": "参数列表", }, { "code": HTTPAccessLogFieldCookie, "name": "Cookie列表", }, { "code": HTTPAccessLogFieldExtend, "name": "位置和浏览器分析", }, { "code": HTTPAccessLogFieldReferer, "name": "请求来源", }, { "code": HTTPAccessLogFieldUserAgent, "name": "终端信息", }, { "code": HTTPAccessLogFieldRequestBody, "name": "请求Body", }, }
var HTTPAccessLogFieldsCodes = []HTTPAccessLogField{ HTTPAccessLogFieldHeader, HTTPAccessLogFieldSentHeader, HTTPAccessLogFieldArg, HTTPAccessLogFieldCookie, HTTPAccessLogFieldExtend, HTTPAccessLogFieldReferer, HTTPAccessLogFieldUserAgent, HTTPAccessLogFieldRequestBody, HTTPAccessLogFieldResponseBody, }
var HTTPAccessLogShortFields = []maps.Map{ { "code": HTTPAccessLogFieldHeader, "name": "请求Header列表", }, { "code": HTTPAccessLogFieldSentHeader, "name": "响应Header列表", }, }
HTTPAccessLogShortFields 精简版的日志字段,用来用
var HTTPCommonRequestHeaders = []string{
"A-IM",
"Accept",
"Accept-Charset",
"Accept-Datetime",
"Accept-Encoding",
"Accept-Language",
"Access-Control-Request-Method",
"Access-Control-Request-Headers",
"Authorization",
"Cache-Control",
"Connection",
"Content-Encoding",
"Content-Length",
"Content-MD5",
"Content-Type",
"Cookie",
"Date",
"Expect",
"Forwarded",
"From",
"Host",
"HTTP2-Settings",
"If-Match",
"If-Modified-Since",
"If-None-Match",
"If-Range",
"If-Unmodified-Since",
"Max-Forwards",
"Origin",
"Pragma",
"Prefer",
"Proxy-Authorization",
"Range",
"Referer",
"TE",
"Trailer",
"Transfer-Encoding",
"User-Agent",
"Upgrade",
"Via",
"Warning",
"Keep-Alive",
}
var HTTPCommonRequestHeaders2 = []string{
"Upgrade-Insecure-Requests",
"X-Requested-With",
"DNT",
"X-Forwarded-For",
"X-Forwarded-Host",
"X-Forwarded-Proto",
"X-Forwarded-By",
"X-Real-IP",
"Front-End-Https",
"X-Http-Method-Override",
"X-ATT-DeviceId",
"X-Wap-Profile",
"Proxy-Connection",
"X-UIDH",
"X-Csrf-Token",
"X-Request-ID",
"X-Correlation-ID",
"Correlation-ID",
"Save-Data",
"Device-Memory",
"Downlink",
"Early-Data",
"ECT",
"RTT",
"Sec-CH-UA",
"Sec-CH-UA-Arch",
"Sec-CH-UA-Bitness",
"Sec-CH-UA-Full-Version",
"Sec-CH-UA-Full-Version-List",
"Sec-CH-UA-Mobile",
"Sec-CH-UA-Model",
"Sec-CH-UA-Platform",
"Sec-CH-UA-Platform-Version",
"Sec-Fetch-Dest",
"Sec-Fetch-Mode",
"Sec-Fetch-Site",
"Sec-Fetch-User",
"Sec-GPC",
"Service-Worker-Navigation-Preload",
"Viewport-Width",
"Want-Digest",
}
var HTTPCommonResponseHeaders = []string{
"Accept-CH",
"Access-Control-Allow-Origin",
"Access-Control-Allow-Credentials",
"Access-Control-Expose-Headers",
"Access-Control-Max-Age",
"Access-Control-Allow-Methods",
"Access-Control-Allow-Headers",
"Accept-Patch",
"Accept-Post",
"Accept-Ranges",
"Age",
"Allow",
"Alt-Svc",
"Cache-Control",
"Clear-Site-Data",
"Connection",
"Content-Disposition",
"Content-Encoding",
"Content-Language",
"Content-Length",
"Content-Location",
"Content-MD5",
"Content-Range",
"Content-Type",
"Date",
"Delta-Base",
"ETag",
"Expires",
"IM",
"Last-Modified",
"Link",
"Location",
"P3P",
"Pragma",
"Preference-Applied",
"Proxy-Authenticate",
"Public-Key-Pins",
"Retry-After",
"Server",
"Server-Timing",
"Set-Cookie",
"Strict-Transport-Security",
"Trailer",
"Transfer-Encoding",
"Tk",
"Upgrade",
"Vary",
"Via",
"Warning",
"WWW-Authenticate",
"X-Frame-Options",
"Keep-Alive",
"Referrer-Policy",
}
var HTTPCommonResponseHeaders2 = []string{
"Content-Security-Policy",
"X-Content-Security-Policy",
"Content-Security-Policy-Report-Only",
"Cross-Origin-Embedder-Policy",
"Cross-Origin-Opener-Policy",
"Cross-Origin-Resource-Policy",
"Digest",
"X-WebKit-CSP",
"Expect-CT",
"NEL",
"Permissions-Policy",
"Refresh",
"Report-To",
"Status",
"Timing-Allow-Origin",
"X-Content-Duration",
"X-Content-Type-Options",
"X-Powered-By",
"X-Redirect-By",
"X-Request-ID",
"X-Correlation-ID",
"X-UA-Compatible",
"X-XSS-Protection",
"Sec-WebSocket-Accept",
"SourceMap",
"X-DNS-Prefetch-Control",
}
var IPLibraryTypes = []maps.Map{ { "name": "ip2region", "code": IPLibraryTypeIP2Region, "description": "一个开源的IP库:https://github.com/lionsoul2014/ip2region", "ext": ".db", }, }
所有的IP库类型
Functions ¶
func AllLocationPatternTypes ¶
AllLocationPatternTypes 取得所有的匹配类型信息
func FindAccessLogStorageTypeName ¶
FindAccessLogStorageTypeName 根据类型查找名称
func FindAccessLogSyslogStoragePriorityName ¶
func FindAccessLogSyslogStoragePriorityName(priority AccessLogSyslogStoragePriority) string
func FindAllAccessLogStorageTypes ¶
func FindAllAccessLogStorageTypes() []*shared.Definition
FindAllAccessLogStorageTypes 所有存储引擎列表
func FindAllMetricChartTypes ¶
func FindAllMetricChartTypes() []*shared.Definition
func FindAllMetricKeyDefinitions ¶
func FindAllMetricKeyDefinitions(category MetricItemCategory) []*shared.Definition
FindAllMetricKeyDefinitions 指标对象定义
func FindAllServerProtocols ¶ added in v0.5.0
FindAllServerProtocols 查找所有协议
func FindAllServerProtocolsForType ¶ added in v0.5.0
func FindAllServerProtocolsForType(serverType ServerType) []maps.Map
FindAllServerProtocolsForType 获取所有协议
func FindCachePolicyStorageName ¶
func FindCachePolicyStorageName(policyType CachePolicyStorageType) string
根据类型查找名称
func FindLocationPatternType ¶
FindLocationPatternType 查找单个匹配类型信息
func FindLocationPatternTypeName ¶
FindLocationPatternTypeName 查找单个匹配类型名称
func FindMetricChartTypeName ¶
func FindMetricChartTypeName(chartType MetricChartType) string
func FindMetricValueName ¶
func FindMetricValueName(category MetricItemCategory, code string) string
func FindMetricValueType ¶
func FindMetricValueType(category MetricItemCategory, code string) string
func HumanMetricTime ¶
func HumanMetricTime(periodUnit MetricItemPeriodUnit, time string) string
HumanMetricTime 格式化时间,让时间更易读
func IsCommonRequestHeader ¶ added in v0.5.6
IsCommonRequestHeader 判断某个HTTP请求Header名称是否为通用
func IsHTTPServerType ¶
func IsHTTPServerType(serverType ServerType) bool
IsHTTPServerType 判断某个服务类型是否属于HTTP簇
func NormalizeServerNames ¶
func NormalizeServerNames(serverNames []*ServerNameConfig)
NormalizeServerNames 格式化一组域名
func PlainServerNames ¶
func PlainServerNames(serverNames []*ServerNameConfig) (result []string)
PlainServerNames 获取所有域名
Types ¶
type AccessLogCommandStorageConfig ¶
type AccessLogCommandStorageConfig struct {
Command string `yaml:"command" json:"command"`
Args []string `yaml:"args" json:"args"`
Dir string `yaml:"dir" json:"dir"`
}
AccessLogCommandStorageConfig 通过命令行存储
type AccessLogESStorageConfig ¶
type AccessLogESStorageConfig struct {
Endpoint string `yaml:"endpoint" json:"endpoint"`
Index string `yaml:"index" json:"index"`
MappingType string `yaml:"mappingType" json:"mappingType"`
Username string `yaml:"username" json:"username"`
Password string `yaml:"password" json:"password"`
IsDataStream bool `yaml:"isDataStream" json:"isDataStream"` // 是否为Data Stream模式
}
AccessLogESStorageConfig ElasticSearch存储策略
type AccessLogFileStorageConfig ¶
type AccessLogFileStorageConfig struct {
Path string `yaml:"path" json:"path"` // 文件路径,支持变量:${year|month|week|day|hour|minute|second}
AutoCreate bool `yaml:"autoCreate" json:"autoCreate"` // 是否自动创建目录
}
AccessLogFileStorageConfig 文件存储配置
type AccessLogQueueConfig ¶
type AccessLogQueueConfig struct {
MaxLength int `yaml:"maxLength" json:"maxLength"` // 队列最大长度
CountPerSecond int `yaml:"countPerSecond" json:"countPerSecond"` // 每秒写入数量
Percent int `yaml:"percent" json:"percent"` // 比例,如果为0-100,默认为100
EnableAutoPartial bool `yaml:"enableAutoPartial" json:"enableAutoPartial"` // 是否启动自动分表
RowsPerTable int64 `yaml:"rowsPerTable" json:"rowsPerTable"` // 单表最大行数
}
AccessLogQueueConfig 访问日志队列配置
type AccessLogStorageType ¶
type AccessLogStorageType = string
AccessLogStorageType 访问日志存储类型
const ( AccessLogStorageTypeFile AccessLogStorageType = "file" AccessLogStorageTypeES AccessLogStorageType = "es" AccessLogStorageTypeTCP AccessLogStorageType = "tcp" AccessLogStorageTypeSyslog AccessLogStorageType = "syslog" AccessLogStorageTypeCommand AccessLogStorageType = "command" )
type AccessLogSyslogStorageConfig ¶
type AccessLogSyslogStorageConfig struct {
Protocol string `yaml:"protocol" json:"protocol"` // SysLogStorageProtocol*
ServerAddr string `yaml:"serverAddr" json:"serverAddr"`
ServerPort int `yaml:"serverPort" json:"serverPort"`
Socket string `yaml:"socket" json:"socket"` // sock file
Tag string `yaml:"tag" json:"tag"`
Priority AccessLogSyslogStoragePriority `yaml:"priority" json:"priority"`
}
AccessLogSyslogStorageConfig syslog存储策略
type AccessLogSyslogStoragePriority ¶
type AccessLogSyslogStoragePriority = int
const ( AccessLogSyslogStoragePriorityEmerg AccessLogSyslogStoragePriority = iota AccessLogSyslogStoragePriorityAlert AccessLogSyslogStoragePriorityCrit AccessLogSyslogStoragePriorityErr AccessLogSyslogStoragePriorityWarning AccessLogSyslogStoragePriorityNotice AccessLogSyslogStoragePriorityInfo AccessLogSyslogStoragePriorityDebug )
type AccessLogSyslogStorageProtocol ¶
type AccessLogSyslogStorageProtocol = string
const ( AccessLogSyslogStorageProtocolTCP AccessLogSyslogStorageProtocol = "tcp" AccessLogSyslogStorageProtocolUDP AccessLogSyslogStorageProtocol = "udp" AccessLogSyslogStorageProtocolNone AccessLogSyslogStorageProtocol = "none" AccessLogSyslogStorageProtocolSocket AccessLogSyslogStorageProtocol = "socket" )
type AccessLogTCPStorageConfig ¶
type AccessLogTCPStorageConfig struct {
Network string `yaml:"network" json:"network"` // tcp, unix
Addr string `yaml:"addr" json:"addr"`
}
AccessLogTCPStorageConfig TCP存储策略
type BaseProtocol ¶
type BaseProtocol struct {
IsOn bool `yaml:"isOn" json:"isOn"` // 是否开启
Listen []*NetworkAddressConfig `yaml:"listen" json:"listen"` // 绑定的网络地址
}
BaseProtocol 协议基础数据结构
func (*BaseProtocol) AddListen ¶
func (this *BaseProtocol) AddListen(addr ...*NetworkAddressConfig)
AddListen 添加地址
func (*BaseProtocol) FullAddresses ¶
func (this *BaseProtocol) FullAddresses() []string
FullAddresses 获取完整的地址列表
type CacheDir ¶ added in v0.5.8
type CacheDir struct {
Path string `yaml:"path" json:"path"` // 目录
Capacity *shared.SizeCapacity `yaml:"capacity" json:"capacity"` // 容量限制 TODO 暂时不实现
}
type CachePolicyStorageType ¶
type CachePolicyStorageType = string
const ( CachePolicyStorageFile CachePolicyStorageType = "file" CachePolicyStorageMemory CachePolicyStorageType = "memory" )
type CommonScript ¶
type CommonScript struct {
Id int64 `yaml:"id" json:"id"`
IsOn bool `yaml:"isOn" json:"isOn"`
Filename string `yaml:"filename" json:"filename"`
Code string `yaml:"code" json:"code"`
}
CommonScript 公共脚本
type DomainMismatchAction ¶
type DomainMismatchAction struct {
Code string `yaml:"code" json:"code"` // 动作代号
Options maps.Map `yaml:"options" json:"options"` // 动作选项
}
func (*DomainMismatchAction) Init ¶
func (this *DomainMismatchAction) Init() error
type DomainMismatchCloseOptions ¶
type DomainMismatchCloseOptions struct {
}
type FTPServerConfig ¶
type FTPServerConfig struct {
Username string `yaml:"username" json:"username"` // 用户名
Password string `yaml:"password" json:"password"` // 密码
Dir string `yaml:"dir" json:"dir"` // 目录
}
FTP源站配置
type FTPServerRef ¶
type GlobalConfig ¶
type GlobalConfig struct {
// HTTP & HTTPS相关配置
HTTPAll struct {
//MatchDomainStrictly bool `yaml:"matchDomainStrictly" json:"matchDomainStrictly"` // 是否严格匹配域名
//AllowMismatchDomains []string `yaml:"allowMismatchDomains" json:"allowMismatchDomains"` // 允许的不匹配的域名
//DefaultDomain string `yaml:"defaultDomain" json:"defaultDomain"` // 默认的域名
//DomainMismatchAction *DomainMismatchAction `yaml:"domainMismatchAction" json:"domainMismatchAction"` // 不匹配时采取的动作
DomainAuditingIsOn bool `yaml:"domainAuditingIsOn" json:"domainAuditingIsOn"` // 域名是否需要审核
DomainAuditingPrompt string `yaml:"domainAuditingPrompt" json:"domainAuditingPrompt"` // 域名审核的提示
} `yaml:"httpAll" json:"httpAll"`
TCPAll struct {
PortRangeMin int `yaml:"portRangeMin" json:"portRangeMin"` // 最小端口
PortRangeMax int `yaml:"portRangeMax" json:"portRangeMax"` // 最大端口
DenyPorts []int `yaml:"denyPorts" json:"denyPorts"` // 禁止使用的端口
} `yaml:"tcpAll" json:"tcpAll"`
}
GlobalConfig 服务相关的全局设置 Deprecated
func (*GlobalConfig) Init ¶
func (this *GlobalConfig) Init() error
type GlobalServerConfig ¶ added in v0.5.3
type GlobalServerConfig struct {
HTTPAll struct {
MatchDomainStrictly bool `yaml:"matchDomainStrictly" json:"matchDomainStrictly"` // 是否严格匹配域名
AllowMismatchDomains []string `yaml:"allowMismatchDomains" json:"allowMismatchDomains"` // 允许的不匹配的域名
AllowNodeIP bool `yaml:"allowNodeIP" json:"allowNodeIP"` // 允许IP直接访问
DefaultDomain string `yaml:"defaultDomain" json:"defaultDomain"` // 默认的域名
DomainMismatchAction *DomainMismatchAction `yaml:"domainMismatchAction" json:"domainMismatchAction"` // 不匹配时采取的动作
} `yaml:"httpAll" json:"httpAll"`
HTTPAccessLog struct {
EnableRequestHeaders bool `yaml:"enableRequestHeaders" json:"enableRequestHeaders"` // 记录请求Header
CommonRequestHeadersOnly bool `yaml:"commonRequestHeadersOnly" json:"commonRequestHeadersOnly"` // 只保留通用Header
EnableResponseHeaders bool `yaml:"enableResponseHeaders" json:"enableResponseHeaders"` // 记录响应Header
EnableCookies bool `yaml:"enableCookies" json:"enableCookies"` // 记录Cookie
} `yaml:"httpAccessLog" json:"httpAccessLog"` // 访问日志配置
Performance struct {
Debug bool `yaml:"debug" json:"debug"` // Debug模式
AutoWriteTimeout bool `yaml:"autoWriteTimeout" json:"autoWriteTimeout"` // 是否自动写超时
AutoReadTimeout bool `yaml:"autoReadTimeout" json:"autoReadTimeout"` // 是否自动读超时
} `yaml:"performance" json:"performance"` // 性能
Log struct {
RecordServerError bool `yaml:"recordServerError" json:"recordServerError"` // 记录服务错误到运行日志
} `yaml:"log" json:"log"` // 运行日志配置
}
GlobalServerConfig 全局的服务配置
func DefaultGlobalServerConfig ¶ added in v0.5.3
func DefaultGlobalServerConfig() *GlobalServerConfig
func (*GlobalServerConfig) Init ¶ added in v0.5.3
func (this *GlobalServerConfig) Init() error
type HTTPAccessLogField ¶
type HTTPAccessLogField = int
const ( HTTPAccessLogFieldHeader HTTPAccessLogField = 1 HTTPAccessLogFieldSentHeader HTTPAccessLogField = 2 HTTPAccessLogFieldArg HTTPAccessLogField = 3 HTTPAccessLogFieldCookie HTTPAccessLogField = 4 HTTPAccessLogFieldExtend HTTPAccessLogField = 5 HTTPAccessLogFieldReferer HTTPAccessLogField = 6 HTTPAccessLogFieldUserAgent HTTPAccessLogField = 7 HTTPAccessLogFieldRequestBody HTTPAccessLogField = 8 HTTPAccessLogFieldResponseBody HTTPAccessLogField = 9 )
type HTTPAccessLogRef ¶
type HTTPAccessLogRef struct {
IsPrior bool `yaml:"isPrior" json:"isPrior"` // 是否覆盖
IsOn bool `yaml:"isOn" json:"isOn"` // 是否启用
Fields []int `yaml:"fields" json:"fields"` // 记录的字段
Status1 bool `yaml:"status1" json:"status1"` // 1xx
Status2 bool `yaml:"status2" json:"status2"` // 2xx
Status3 bool `yaml:"status3" json:"status3"` // 3xx
Status4 bool `yaml:"status4" json:"status4"` // 4xx
Status5 bool `yaml:"status5" json:"status5"` // 5xx
EnableClientClosed bool `yaml:"enableClientClosed" json:"enableClientClosed"` // 是否记录客户端关闭事件
StorageOnly bool `yaml:"storageOnly" json:"storageOnly"` // 是否只输出到存储策略
StoragePolicies []int64 `yaml:"storagePolicies" json:"storagePolicies"` // 存储策略Ids
FirewallOnly bool `yaml:"firewallOnly" json:"firewallOnly"` // 是否只记录防火墙相关日志
}
HTTPAccessLogRef 代理访问日志配置
func (*HTTPAccessLogRef) ContainsField ¶
func (this *HTTPAccessLogRef) ContainsField(field int) bool
ContainsField 检查是否包含某个Field
func (*HTTPAccessLogRef) ContainsStoragePolicy ¶
func (this *HTTPAccessLogRef) ContainsStoragePolicy(storagePolicyId int64) bool
ContainsStoragePolicy 是否包含某个存储策略
func (*HTTPAccessLogRef) Match ¶
func (this *HTTPAccessLogRef) Match(status int) bool
Match 判断是否应该记录
type HTTPAuthBaseMethod ¶ added in v0.5.2
func (*HTTPAuthBaseMethod) MatchRequest ¶ added in v0.5.2
func (this *HTTPAuthBaseMethod) MatchRequest(req *http.Request) bool
func (*HTTPAuthBaseMethod) SetDomains ¶ added in v0.5.2
func (this *HTTPAuthBaseMethod) SetDomains(domains []string)
func (*HTTPAuthBaseMethod) SetExts ¶ added in v0.5.2
func (this *HTTPAuthBaseMethod) SetExts(exts []string)
type HTTPAuthBasicMethod ¶
type HTTPAuthBasicMethod struct {
HTTPAuthBaseMethod
Users []*HTTPAuthBasicMethodUser `json:"users"`
Realm string `json:"realm"`
Charset string `json:"charset"`
// contains filtered or unexported fields
}
HTTPAuthBasicMethod BasicAuth方法定义
func NewHTTPAuthBasicMethod ¶
func NewHTTPAuthBasicMethod() *HTTPAuthBasicMethod
type HTTPAuthBasicMethodUser ¶
type HTTPAuthBasicMethodUser struct {
Username string `json:"username"`
Password string `json:"password"`
}
HTTPAuthBasicMethodUser BasicAuth中的用户
type HTTPAuthConfig ¶
type HTTPAuthConfig struct {
IsPrior bool `yaml:"isPrior" json:"isPrior"`
IsOn bool `yaml:"isOn" json:"isOn"`
PolicyRefs []*HTTPAuthPolicyRef `yaml:"policyRefs" json:"policyRefs"`
}
HTTPAuthConfig 认证配置
func (*HTTPAuthConfig) Init ¶
func (this *HTTPAuthConfig) Init() error
type HTTPAuthMethodInterface ¶
type HTTPAuthMethodInterface interface {
// Init 初始化
Init(params map[string]any) error
// MatchRequest 是否匹配请求
MatchRequest(req *http.Request) bool
// Filter 过滤
Filter(req *http.Request, subReqFunc func(subReq *http.Request) (status int, err error), formatter func(string) string) (ok bool, newURI string, uriChanged bool, err error)
// SetExts 设置扩展名
SetExts(exts []string)
// SetDomains 设置域名
SetDomains(domains []string)
}
HTTPAuthMethodInterface HTTP认证接口定义
type HTTPAuthPolicy ¶
type HTTPAuthPolicy struct {
Id int64 `json:"id"`
Name string `json:"name"`
IsOn bool `json:"isOn"`
Type HTTPAuthType `json:"type"`
Params map[string]interface{} `json:"params"`
// contains filtered or unexported fields
}
HTTPAuthPolicy HTTP认证策略
func (*HTTPAuthPolicy) Filter ¶
func (this *HTTPAuthPolicy) Filter(req *http.Request, subReqFunc func(subReq *http.Request) (status int, err error), formatter func(string) string) (ok bool, newURI string, uriChanged bool, err error)
Filter 过滤
func (*HTTPAuthPolicy) MatchRequest ¶ added in v0.5.2
func (this *HTTPAuthPolicy) MatchRequest(req *http.Request) bool
MatchRequest 检查是否匹配请求
func (*HTTPAuthPolicy) Method ¶
func (this *HTTPAuthPolicy) Method() HTTPAuthMethodInterface
Method 获取认证实例
type HTTPAuthPolicyRef ¶
type HTTPAuthPolicyRef struct {
IsOn bool `yaml:"isOn" json:"isOn"`
AuthPolicyId int64 `yaml:"authPolicyId" json:"authPolicyId"`
AuthPolicy *HTTPAuthPolicy `yaml:"authPolicy" json:"authPolicy"`
}
HTTPAuthPolicyRef 认证策略引用
func (*HTTPAuthPolicyRef) Init ¶
func (this *HTTPAuthPolicyRef) Init() error
type HTTPAuthSubRequestMethod ¶
type HTTPAuthSubRequestMethod struct {
HTTPAuthBaseMethod
URL string `json:"url"`
Method string `json:"method"`
// contains filtered or unexported fields
}
HTTPAuthSubRequestMethod 使用URL认证
func NewHTTPAuthSubRequestMethod ¶
func NewHTTPAuthSubRequestMethod() *HTTPAuthSubRequestMethod
type HTTPAuthType ¶
type HTTPAuthType = string
const ( HTTPAuthTypeBasicAuth HTTPAuthType = "basicAuth" // BasicAuth HTTPAuthTypeSubRequest HTTPAuthType = "subRequest" // 子请求 )
type HTTPAuthTypeDefinition ¶
type HTTPAuthTypeDefinition struct {
Name string `json:"name"`
Code string `json:"code"`
Description string `json:"description"`
}
func FindAllHTTPAuthTypes ¶
func FindAllHTTPAuthTypes() []*HTTPAuthTypeDefinition
type HTTPBrotliCompressionConfig ¶
type HTTPBrotliCompressionConfig struct {
Id int64 `yaml:"id" json:"id"` // ID
IsOn bool `yaml:"isOn" json:"isOn"`
Level int8 `yaml:"level" json:"level"` // 级别
MinLength *shared.SizeCapacity `yaml:"minLength" json:"minLength"` // 最小压缩对象比如4m, 24k
MaxLength *shared.SizeCapacity `yaml:"maxLength" json:"maxLength"` // 最大压缩对象
Conds *shared.HTTPRequestCondsConfig `yaml:"conds" json:"conds"` // 匹配条件
// contains filtered or unexported fields
}
func (*HTTPBrotliCompressionConfig) Init ¶
func (this *HTTPBrotliCompressionConfig) Init() error
type HTTPCacheConfig ¶
type HTTPCacheConfig struct {
IsPrior bool `yaml:"isPrior" json:"isPrior"`
IsOn bool `yaml:"isOn" json:"isOn"`
AddStatusHeader bool `yaml:"addStatusHeader" json:"addStatusHeader"` // 是否增加命中状态Header(X-Cache)
AddAgeHeader bool `yaml:"addAgeHeader" json:"addAgeHeader"` // 是否增加Age Header
EnableCacheControlMaxAge bool `yaml:"enableCacheControlMaxAge" json:"enableCacheControlMaxAge"` // 是否支持Cache-Control: max-age=...
DisablePolicyRefs bool `yaml:"disablePolicyRefs" json:"disablePolicyRefs"` // 是否停用策略中定义的条件
PurgeIsOn bool `yaml:"purgeIsOn" json:"purgeIsOn"` // 是否允许使用Purge方法清理
PurgeKey string `yaml:"purgeKey" json:"purgeKey"` // Purge时使用的X-Edge-Purge-Key
Stale *HTTPCacheStaleConfig `yaml:"stale" json:"stale"` // 陈旧缓存使用策略
CacheRefs []*HTTPCacheRef `yaml:"cacheRefs" json:"cacheRefs"` // 缓存条件配置
}
func (*HTTPCacheConfig) AsJSON ¶
func (this *HTTPCacheConfig) AsJSON() ([]byte, error)
func (*HTTPCacheConfig) Init ¶
func (this *HTTPCacheConfig) Init() error
type HTTPCachePolicy ¶
type HTTPCachePolicy struct {
Id int64 `yaml:"id" json:"id"`
IsOn bool `yaml:"isOn" json:"isOn"` // 是否开启
Name string `yaml:"name" json:"name"` // 名称
Description string `yaml:"description" json:"description"` // 描述
Capacity *shared.SizeCapacity `yaml:"capacity" json:"capacity"` // 最大内容容量
MaxKeys int64 `yaml:"maxKeys" json:"maxKeys"` // 最多Key值
MaxSize *shared.SizeCapacity `yaml:"maxSize" json:"maxSize"` // 单个缓存最大尺寸
Type CachePolicyStorageType `yaml:"type" json:"type"` // 类型
Options map[string]interface{} `yaml:"options" json:"options"` // 选项
Life *shared.TimeDuration `yaml:"life" json:"life"` // 默认有效期 TODO 需要实现
MinLife *shared.TimeDuration `yaml:"minLife" json:"minLife"` // 最小有效期 TODO 需要实现
MaxLife *shared.TimeDuration `yaml:"maxLife" json:"maxLife"` // 最大有效期 TODO 需要实现
SyncCompressionCache bool `yaml:"syncCompressionCache" json:"syncCompressionCache"` // 同步写入压缩缓存
CacheRefs []*HTTPCacheRef `yaml:"cacheRefs" json:"cacheRefs"` // 缓存配置
PersistenceAutoPurgeCount int `yaml:"persistenceAutoPurgeCount" json:"persistenceAutoPurgeCount"` // 每次自动清理的条数 TODO 需要实现
PersistenceAutoPurgeInterval int `yaml:"persistenceAutoPurgeInterval" json:"persistenceAutoPurgeInterval"` // 自动清理的时间间隔(秒) TODO 需要实现
PersistenceLFUFreePercent float32 `yaml:"persistenceLFUFreePercent" json:"persistenceLFUFreePercent"` // LFU算法执行阈值,剩余空间比例,使用百分比,比如20 TODO 需要实现
PersistenceHitSampleRate int `yaml:"persistenceHitSampleRate" json:"persistenceHitSampleRate"` // 热点数据采样比例 TODO 需要实现
MemoryAutoPurgeCount int `yaml:"memoryAutoPurgeCount" json:"memoryAutoPurgeCount"` // 每次自动清理的条数 TODO 需要实现
MemoryAutoPurgeInterval int `yaml:"memoryAutoPurgeInterval" json:"memoryAutoPurgeInterval"` // 自动清理的时间间隔(秒) TODO 需要实现
MemoryLFUFreePercent float32 `yaml:"memoryLFUFreePercent" json:"memoryLFUFreePercent"` // LFU算法执行阈值,剩余空间比例,使用百分比,比如20 TODO 需要实现
MemoryAutoFlushQueueSize int `yaml:"memoryAutoFlushQueueSize" json:"memoryAutoFlushQueueSize"` // 自动刷新到持久层队列尺寸 TODO 需要实现
// contains filtered or unexported fields
}
HTTPCachePolicy 缓存策略配置
func (*HTTPCachePolicy) CapacityBytes ¶
func (this *HTTPCachePolicy) CapacityBytes() int64
CapacityBytes 容量
func (*HTTPCachePolicy) IsSame ¶
func (this *HTTPCachePolicy) IsSame(anotherPolicy *HTTPCachePolicy) bool
IsSame 对比Policy是否有变化
func (*HTTPCachePolicy) MaxSizeBytes ¶
func (this *HTTPCachePolicy) MaxSizeBytes() int64
MaxSizeBytes 单个缓存最大尺寸
func (*HTTPCachePolicy) UpdateDiskDir ¶
func (this *HTTPCachePolicy) UpdateDiskDir(dir string, subDirs []*CacheDir)
UpdateDiskDir 修改文件路径
type HTTPCacheRef ¶
type HTTPCacheRef struct {
IsOn bool `yaml:"isOn" json:"isOn"`
CachePolicyId int64 `yaml:"cachePolicyId" json:"cachePolicyId"`
Key string `yaml:"key" json:"key"` // 每个缓存的Key规则,里面可以有变量
Life *shared.TimeDuration `yaml:"life" json:"life"` // 时间
ExpiresTime *HTTPExpiresTimeConfig `yaml:"expiresTime" json:"expiresTime"` // 客户端过期时间
Status []int `yaml:"status" json:"status"` // 缓存的状态码列表
MinSize *shared.SizeCapacity `yaml:"minSize" json:"minSize"` // 能够缓存的最小尺寸
MaxSize *shared.SizeCapacity `yaml:"maxSize" json:"maxSize"` // 能够缓存的最大尺寸
Methods []string `yaml:"methods" json:"methods"` // 支持的请求方法
SkipResponseCacheControlValues []string `yaml:"skipCacheControlValues" json:"skipCacheControlValues"` // 可以跳过的响应的Cache-Control值
SkipResponseSetCookie bool `yaml:"skipSetCookie" json:"skipSetCookie"` // 是否跳过响应的Set-Cookie Header
EnableRequestCachePragma bool `yaml:"enableRequestCachePragma" json:"enableRequestCachePragma"` // 是否支持客户端的Pragma: no-cache
AllowChunkedEncoding bool `yaml:"allowChunkedEncoding" json:"allowChunkedEncoding"` // 是否允许分片内容
AllowPartialContent bool `yaml:"allowPartialContent" json:"allowPartialContent"` // 支持分段内容缓存
EnableIfNoneMatch bool `yaml:"enableIfNoneMatch" json:"enableIfNoneMatch"`
EnableIfModifiedSince bool `yaml:"enableIfModifiedSince" json:"enableIfModifiedSince"`
Conds *shared.HTTPRequestCondsConfig `yaml:"conds" json:"conds"` // 复杂请求条件组合
SimpleCond *shared.HTTPRequestCond `yaml:"simpleCond" json:"simpleCond"` // 简单条件
CachePolicy *HTTPCachePolicy `yaml:"cachePolicy" json:"cachePolicy"`
IsReverse bool `yaml:"isReverse" json:"isReverse"` // 是否为反向条件,反向条件的不缓存
// contains filtered or unexported fields
}
func (*HTTPCacheRef) ContainsCacheControl ¶
func (this *HTTPCacheRef) ContainsCacheControl(value string) bool
ContainsCacheControl 是否包含某个Cache-Control值
func (*HTTPCacheRef) Init ¶
func (this *HTTPCacheRef) Init() error
func (*HTTPCacheRef) MatchRequest ¶
func (this *HTTPCacheRef) MatchRequest(req *http.Request) bool
MatchRequest 匹配请求
func (*HTTPCacheRef) MatchStatus ¶
func (this *HTTPCacheRef) MatchStatus(statusCode int) bool
MatchStatus 检查是否包含某个状态码
func (*HTTPCacheRef) MaxSizeBytes ¶
func (this *HTTPCacheRef) MaxSizeBytes() int64
MaxSizeBytes 最大数据尺寸
func (*HTTPCacheRef) MinSizeBytes ¶
func (this *HTTPCacheRef) MinSizeBytes() int64
MinSizeBytes 最小数据尺寸
type HTTPCacheStaleConfig ¶
type HTTPCacheStaleConfig struct {
IsPrior bool `yaml:"isPrior" json:"isPrior"`
IsOn bool `yaml:"isOn" json:"isOn"` // 是否启用
Status []int `yaml:"status" json:"status"` // 状态列表
SupportStaleIfErrorHeader bool `yaml:"supportStaleIfErrorHeader" json:"supportStaleIfErrorHeader"` // 是否支持stale-if-error
Life *shared.TimeDuration `yaml:"life" json:"life"` // 陈旧内容生命周期
}
HTTPCacheStaleConfig Stale策略配置
type HTTPCharsetConfig ¶
type HTTPCharsetConfig struct {
IsPrior bool `yaml:"isPrior" json:"isPrior"` // 是否覆盖
IsOn bool `yaml:"isOn" json:"isOn"` // 是否启用
Charset string `yaml:"charset" json:"charset"` // 字符集
IsUpper bool `yaml:"isUpper" json:"isUpper"` // 是否要大写
}
字符集设置
type HTTPCompressionConfig ¶
type HTTPCompressionConfig struct {
IsPrior bool `yaml:"isPrior" json:"isPrior"`
IsOn bool `yaml:"isOn" json:"isOn"`
UseDefaultTypes bool `yaml:"useDefaultTypes" json:"useDefaultTypes"` // 是否使用默认的类型
Types []HTTPCompressionType `yaml:"types" json:"types"` // 支持的类型,如果为空表示默认顺序
Level int8 `yaml:"level" json:"level"` // 级别:1-12
DecompressData bool `yaml:"decompressData" json:"decompressData"` // 是否解压已压缩内容
GzipRef *HTTPCompressionRef `yaml:"gzipRef" json:"gzipRef"`
DeflateRef *HTTPCompressionRef `yaml:"deflateRef" json:"deflateRef"`
BrotliRef *HTTPCompressionRef `yaml:"brotliRef" json:"brotliRef"`
Gzip *HTTPGzipCompressionConfig `yaml:"gzip" json:"gzip"`
Deflate *HTTPDeflateCompressionConfig `yaml:"deflate" json:"deflate"`
Brotli *HTTPBrotliCompressionConfig `yaml:"brotli" json:"brotli"`
MinLength *shared.SizeCapacity `yaml:"minLength" json:"minLength"` // 最小压缩对象比如4m, 24k
MaxLength *shared.SizeCapacity `yaml:"maxLength" json:"maxLength"` // 最大压缩对象
MimeTypes []string `yaml:"mimeTypes" json:"mimeTypes"` // 支持的MimeType,支持image/*这样的通配符使用
Extensions []string `yaml:"extensions" json:"extensions"` // 文件扩展名,包含点符号,不区分大小写
ExceptExtensions []string `yaml:"exceptExtensions" json:"exceptExtensions"` // 例外扩展名
Conds *shared.HTTPRequestCondsConfig `yaml:"conds" json:"conds"` // 匹配条件
EnablePartialContent bool `yaml:"enablePartialContent" json:"enablePartialContent"` // 支持PartialContent压缩
// contains filtered or unexported fields
}
HTTPCompressionConfig 内容压缩配置
func (*HTTPCompressionConfig) MatchAcceptEncoding ¶
func (this *HTTPCompressionConfig) MatchAcceptEncoding(acceptEncodings string) (compressionType HTTPCompressionType, compressionEncoding string, ok bool)
MatchAcceptEncoding 根据Accept-Encoding选择优先的压缩方式
func (*HTTPCompressionConfig) MatchResponse ¶
func (this *HTTPCompressionConfig) MatchResponse(mimeType string, contentLength int64, requestExt string, formatter shared.Formatter) bool
MatchResponse 是否匹配响应
func (*HTTPCompressionConfig) MaxBytes ¶
func (this *HTTPCompressionConfig) MaxBytes() int64
MaxBytes 可压缩最大尺寸
func (*HTTPCompressionConfig) MinBytes ¶
func (this *HTTPCompressionConfig) MinBytes() int64
MinBytes 可压缩最小尺寸
type HTTPCompressionRef ¶
type HTTPCompressionType ¶
type HTTPCompressionType = string
const ( HTTPCompressionTypeGzip HTTPCompressionType = "gzip" HTTPCompressionTypeDeflate HTTPCompressionType = "deflate" HTTPCompressionTypeBrotli HTTPCompressionType = "brotli" HTTPCompressionTypeZSTD HTTPCompressionType = "zstd" )
type HTTPDeflateCompressionConfig ¶
type HTTPDeflateCompressionConfig struct {
Id int64 `yaml:"id" json:"id"` // ID
IsOn bool `yaml:"isOn" json:"isOn"`
Level int8 `yaml:"level" json:"level"` // 级别
MinLength *shared.SizeCapacity `yaml:"minLength" json:"minLength"` // 最小压缩对象比如4m, 24k
MaxLength *shared.SizeCapacity `yaml:"maxLength" json:"maxLength"` // 最大压缩对象
Conds *shared.HTTPRequestCondsConfig `yaml:"conds" json:"conds"` // 匹配条件
// contains filtered or unexported fields
}
func (*HTTPDeflateCompressionConfig) Init ¶
func (this *HTTPDeflateCompressionConfig) Init() error
type HTTPExpiresTimeConfig ¶
type HTTPExpiresTimeConfig struct {
IsPrior bool `yaml:"isPrior" json:"isPrior"` // 是否覆盖父级设置
IsOn bool `yaml:"isOn" json:"isOn"` // 是否启用
Overwrite bool `yaml:"overwrite" json:"overwrite"` // 是否覆盖
AutoCalculate bool `yaml:"autoCalculate" json:"autoCalculate"` // 是否自动计算
Duration *shared.TimeDuration `yaml:"duration" json:"duration"` // 周期
}
HTTPExpiresTimeConfig 发送到客户端的过期时间设置
type HTTPFastcgiConfig ¶
type HTTPFastcgiConfig struct {
Id int64 `yaml:"id" json:"id"`
IsOn bool `yaml:"isOn" json:"isOn"`
// fastcgi地址配置
// 支持unix:/tmp/php-fpm.sock ...
Address string `yaml:"address" json:"address"`
Index string `yaml:"index" json:"index"` // @TODO
Params []*HTTPFastcgiParam `yaml:"params" json:"params"` // 参数
ReadTimeout *shared.TimeDuration `yaml:"readTimeout" json:"readTimeout"` // @TODO 读取超时时间
SendTimeout *shared.TimeDuration `yaml:"sendTimeout" json:"sendTimeout"` // @TODO 发送超时时间
ConnTimeout *shared.TimeDuration `yaml:"connTimeout" json:"connTimeout"` // @TODO 连接超时时间
Weight int `yaml:"weight" json:"weight"` // TODO 权重
PoolSize int `yaml:"poolSize" json:"poolSize"` // 连接池尺寸
PathInfoPattern string `yaml:"pathInfoPattern" json:"pathInfoPattern"` // PATH_INFO匹配正则
// contains filtered or unexported fields
}
HTTPFastcgiConfig Fastcgi配置
func (*HTTPFastcgiConfig) FilterParams ¶
func (this *HTTPFastcgiConfig) FilterParams() maps.Map
FilterParams 过滤参数
func (*HTTPFastcgiConfig) Param ¶
func (this *HTTPFastcgiConfig) Param(paramName string) string
Param 读取参数
func (*HTTPFastcgiConfig) PathInfoRegexp ¶
func (this *HTTPFastcgiConfig) PathInfoRegexp() *regexp.Regexp
PathInfoRegexp PATH_INFO正则
func (*HTTPFastcgiConfig) ReadTimeoutDuration ¶
func (this *HTTPFastcgiConfig) ReadTimeoutDuration() time.Duration
ReadTimeoutDuration 超时时间
func (*HTTPFastcgiConfig) RealAddress ¶
func (this *HTTPFastcgiConfig) RealAddress() string
RealAddress 网络地址
type HTTPFastcgiParam ¶
type HTTPFastcgiParam struct {
Name string `yaml:"name" json:"name"`
Value string `yaml:"value" json:"value"`
}
HTTPFastcgiParam Fastcgi参数
type HTTPFastcgiRef ¶
type HTTPFileCacheStorage ¶
type HTTPFileCacheStorage struct {
Dir string `yaml:"dir" json:"dir"` // 目录
SubDirs []*CacheDir `yaml:"cacheDir" json:"subDirs"` // 子目录
MemoryPolicy *HTTPCachePolicy `yaml:"memoryPolicy" json:"memoryPolicy"` // 内存二级缓存
OpenFileCache *OpenFileCacheConfig `yaml:"openFileCache" json:"openFileCache"` // open file cache配置
EnableSendfile bool `yaml:"enableSendFile" json:"enableSendfile"` // 是否启用Sendfile
}
HTTPFileCacheStorage 文件缓存存储策略
func (*HTTPFileCacheStorage) Init ¶
func (this *HTTPFileCacheStorage) Init() error
type HTTPFilterPolicy ¶
type HTTPFilterPolicy struct {
}
func (*HTTPFilterPolicy) Init ¶
func (this *HTTPFilterPolicy) Init() error
type HTTPFilterRef ¶
type HTTPFilterRef struct {
IsPrior bool `yaml:"isPrior" json:"isPrior"`
IsOn bool `yaml:"isOn" json:"isOn"`
FilterPolicyId int64 `yaml:"filterPolicyId" json:"filterPolicyId"`
}
func (*HTTPFilterRef) Init ¶
func (this *HTTPFilterRef) Init() error
type HTTPGzipCompressionConfig ¶
type HTTPGzipCompressionConfig struct {
Id int64 `yaml:"id" json:"id"` // ID
IsOn bool `yaml:"isOn" json:"isOn"` // 是否启用
Level int8 `yaml:"level" json:"level"` // 1-9
MinLength *shared.SizeCapacity `yaml:"minLength" json:"minLength"` // 最小压缩对象比如4m, 24k
MaxLength *shared.SizeCapacity `yaml:"maxLength" json:"maxLength"` // 最大压缩对象
Conds *shared.HTTPRequestCondsConfig `yaml:"conds" json:"conds"` // 匹配条件
// contains filtered or unexported fields
}
HTTPGzipCompressionConfig gzip配置
func (*HTTPGzipCompressionConfig) Init ¶
func (this *HTTPGzipCompressionConfig) Init() error
Init 校验
func (*HTTPGzipCompressionConfig) MaxBytes ¶
func (this *HTTPGzipCompressionConfig) MaxBytes() int64
MaxBytes 可压缩最大尺寸
func (*HTTPGzipCompressionConfig) MinBytes ¶
func (this *HTTPGzipCompressionConfig) MinBytes() int64
MinBytes 可压缩最小尺寸
type HTTPGzipRef ¶
type HTTPHostRedirectConfig ¶
type HTTPHostRedirectConfig struct {
IsOn bool `yaml:"isOn" json:"isOn"` // 是否开启
Status int `yaml:"status" json:"status"` // 跳转用的状态码
Type string `yaml:"type" json:"type"` // 类型
Mode HTTPHostRedirectType `yaml:"mode" json:"mode"` // 模式
// URL跳转
BeforeURL string `yaml:"beforeURL" json:"beforeURL"` // 跳转前的地址
AfterURL string `yaml:"afterURL" json:"afterURL"` // 跳转后的地址
MatchPrefix bool `yaml:"matchPrefix" json:"matchPrefix"` // 只匹配前缀部分
MatchRegexp bool `yaml:"matchRegexp" json:"matchRegexp"` // 匹配正则表达式
KeepRequestURI bool `yaml:"keepRequestURI" json:"keepRequestURI"` // 保留请求URI
KeepArgs bool `yaml:"keepArgs" json:"keepArgs"` // 保留参数
Conds *shared.HTTPRequestCondsConfig `yaml:"conds" json:"conds"` // 匹配条件
// 域名跳转
DomainsAll bool `yaml:"domainAll" json:"domainsAll"` // 所有域名都跳转
DomainsBefore []string `yaml:"domainsBefore" json:"domainsBefore"` // 指定跳转之前的域名
DomainBeforeIgnorePorts bool `yaml:"domainBeforeIgnorePorts" json:"domainBeforeIgnorePorts"` // 忽略跳转前端口
DomainAfter string `yaml:"domainAfter" json:"domainAfter"` // 跳转之后的域名
DomainAfterScheme string `yaml:"domainAfterScheme" json:"domainAfterScheme"` // 跳转之后的协议
// 端口跳转
PortsAll bool `yaml:"portsAll" json:"portsAll"` // 所有端口
PortsBefore []string `yaml:"portsBefore" json:"portsBefore"` // 跳转之前的端口:8080, 8080-8090
PortAfter int `yaml:"port" json:"portAfter"` // 跳转之后的端口
PortAfterScheme string `yaml:"portAfterScheme" json:"portAfterScheme"` // 跳转之后的协议
// contains filtered or unexported fields
}
HTTPHostRedirectConfig 主机名跳转设置
func (*HTTPHostRedirectConfig) BeforeURLRegexp ¶
func (this *HTTPHostRedirectConfig) BeforeURLRegexp() *regexp.Regexp
BeforeURLRegexp 跳转前URL正则表达式
func (*HTTPHostRedirectConfig) ContainsPort ¶ added in v0.5.6
func (this *HTTPHostRedirectConfig) ContainsPort(reqPort int) bool
ContainsPort 是否包含端口
func (*HTTPHostRedirectConfig) MatchRequest ¶
func (this *HTTPHostRedirectConfig) MatchRequest(formatter func(source string) string) bool
MatchRequest 判断请求是否符合条件
func (*HTTPHostRedirectConfig) RealBeforeURL ¶
func (this *HTTPHostRedirectConfig) RealBeforeURL() string
RealBeforeURL 跳转前URL
type HTTPHostRedirectType ¶ added in v0.5.6
type HTTPHostRedirectType = string
const ( HTTPHostRedirectTypeURL HTTPHostRedirectType = "url" HTTPHostRedirectTypeDomain HTTPHostRedirectType = "domain" HTTPHostRedirectTypePort HTTPHostRedirectType = "port" )
type HTTPLocationConfig ¶
type HTTPLocationConfig struct {
Id int64 `yaml:"id" json:"id"` // ID
IsOn bool `yaml:"isOn" json:"isOn"` // 是否启用
Pattern string `yaml:"pattern" json:"pattern"` // 匹配规则 TODO 未来支持更多样的匹配规则
Name string `yaml:"name" json:"name"` // 名称
Web *HTTPWebConfig `yaml:"web" json:"web"` // Web配置
URLPrefix string `yaml:"urlPrefix" json:"urlPrefix"` // 实际的URL前缀,TODO 未来支持变量
Description string `yaml:"description" json:"description"` // 描述
ReverseProxyRef *ReverseProxyRef `yaml:"reverseProxyRef" json:"reverseProxyRef"` // 反向代理引用
ReverseProxy *ReverseProxyConfig `yaml:"reverseProxy" json:"reverseProxy"` // 反向代理设置
IsBreak bool `yaml:"isBreak" json:"isBreak"` // 终止向下解析
Children []*HTTPLocationConfig `yaml:"children" json:"children"` // 子规则
Conds *shared.HTTPRequestCondsConfig `yaml:"conds" json:"conds"` // 匹配条件
Domains []string `yaml:"domains" json:"domains"` // 所属域名
// contains filtered or unexported fields
}
func (*HTTPLocationConfig) ExtractPattern ¶
func (this *HTTPLocationConfig) ExtractPattern() error
ExtractPattern 分析匹配条件
func (*HTTPLocationConfig) Init ¶
func (this *HTTPLocationConfig) Init() error
func (*HTTPLocationConfig) IsCaseInsensitive ¶
func (this *HTTPLocationConfig) IsCaseInsensitive() bool
IsCaseInsensitive 是否大小写非敏感
func (*HTTPLocationConfig) IsReverse ¶
func (this *HTTPLocationConfig) IsReverse() bool
IsReverse 是否翻转
func (*HTTPLocationConfig) Match ¶
func (this *HTTPLocationConfig) Match(path string, formatter func(source string) string) (vars map[string]string, isMatched bool)
Match 判断是否匹配路径 TODO 支持子Location
func (*HTTPLocationConfig) PatternString ¶
func (this *HTTPLocationConfig) PatternString() string
PatternString 模式字符串 去掉了模式字符
func (*HTTPLocationConfig) PatternType ¶
func (this *HTTPLocationConfig) PatternType() int
PatternType 模式类型
func (*HTTPLocationConfig) SetPattern ¶
func (this *HTTPLocationConfig) SetPattern(pattern string, patternType int, caseInsensitive bool, reverse bool)
SetPattern 组合参数为一个字符串
type HTTPLocationPatternType ¶
type HTTPLocationPatternType = int
HTTPLocationPatternType 匹配类型
const ( HTTPLocationPatternTypePrefix HTTPLocationPatternType = 1 HTTPLocationPatternTypeSuffix HTTPLocationPatternType = 4 HTTPLocationPatternTypeExact HTTPLocationPatternType = 2 HTTPLocationPatternTypeRegexp HTTPLocationPatternType = 3 )
内置的匹配类型定义
type HTTPLocationRef ¶
type HTTPLocationRef struct {
IsOn bool `yaml:"isOn" json:"isOn"` // 是否启用
LocationId int64 `yaml:"locationId" json:"locationId"` // 路径ID
Children []*HTTPLocationRef `yaml:"children" json:"children"` // 子路径规则
}
type HTTPMemoryCacheStorage ¶
type HTTPMemoryCacheStorage struct {
}
func (*HTTPMemoryCacheStorage) Init ¶
func (this *HTTPMemoryCacheStorage) Init() error
type HTTPPageConfig ¶
type HTTPPageConfig struct {
Id int64 `yaml:"id" json:"id"` // 页面ID
IsOn bool `yaml:"isOn" json:"isOn"` // 是否开启 TODO
Status []string `yaml:"status" json:"status"` // 响应支持40x, 50x, 3x2
NewStatus int `yaml:"newStatus" json:"newStatus"` // 新状态码
BodyType shared.BodyType `yaml:"bodyType" json:"bodyType"` // 内容类型
URL string `yaml:"url" json:"url"` // URL
Body string `yaml:"body" json:"body"` // 输出的内容
// contains filtered or unexported fields
}
HTTPPageConfig 特殊页面配置 TODO 需要支持Header定义
type HTTPProtocolConfig ¶
type HTTPProtocolConfig struct {
BaseProtocol `yaml:",inline"`
}
func NewHTTPProtocolConfigFromJSON ¶
func NewHTTPProtocolConfigFromJSON(configJSON []byte) (*HTTPProtocolConfig, error)
func (*HTTPProtocolConfig) AsJSON ¶
func (this *HTTPProtocolConfig) AsJSON() ([]byte, error)
转换为JSON
func (*HTTPProtocolConfig) Init ¶
func (this *HTTPProtocolConfig) Init() error
type HTTPRedirectToHTTPSConfig ¶
type HTTPRedirectToHTTPSConfig struct {
IsPrior bool `yaml:"isPrior" json:"isPrior"` // 是否覆盖
IsOn bool `yaml:"isOn" json:"isOn"` // 是否开启
Status int `yaml:"status" json:"status"` // 跳转用的状态码
Host string `yaml:"host" json:"host"` // 跳转后的Host
Port int `yaml:"port" json:"port"` // 跳转后的端口
OnlyDomains []string `yaml:"onlyDomains" json:"onlyDomains"` // 允许的域名
ExceptDomains []string `yaml:"exceptDomains" json:"exceptDomains"` // 排除的域名
}
HTTPRedirectToHTTPSConfig 跳转到HTTPS配置
func (*HTTPRedirectToHTTPSConfig) Init ¶
func (this *HTTPRedirectToHTTPSConfig) Init() error
Init 初始化
func (*HTTPRedirectToHTTPSConfig) MatchDomain ¶
func (this *HTTPRedirectToHTTPSConfig) MatchDomain(domain string) bool
MatchDomain 检查域名是否匹配
type HTTPRemoteAddrConfig ¶
type HTTPRemoteAddrConfig struct {
IsPrior bool `yaml:"isPrior" json:"isPrior"`
IsOn bool `yaml:"isOn" json:"isOn"`
Value string `yaml:"value" json:"value"` // 值变量
IsCustomized bool `yaml:"isCustomized" json:"isCustomized"` // 是否自定义
// contains filtered or unexported fields
}
HTTPRemoteAddrConfig HTTP获取客户端IP地址方式
func (*HTTPRemoteAddrConfig) IsEmpty ¶
func (this *HTTPRemoteAddrConfig) IsEmpty() bool
IsEmpty 是否为空
type HTTPRequestLimitConfig ¶
type HTTPRequestLimitConfig struct {
IsPrior bool `yaml:"isPrior" json:"isPrior"` // 是否覆盖父级
IsOn bool `yaml:"isOn" json:"isOn"` // 是否启用
MaxConns int `yaml:"maxConns" json:"maxConns"` // 并发连接数
MaxConnsPerIP int `yaml:"maxConnsPerIP" json:"maxConnsPerIP"` // 单个IP并发连接数
OutBandwidthPerConn *shared.SizeCapacity `yaml:"outBandwidthPerConn" json:"outBandwidthPerConn"` // 下行流量限制
MaxBodySize *shared.SizeCapacity `yaml:"maxBodySize" json:"maxBodySize"` // 单个请求最大尺寸
// contains filtered or unexported fields
}
HTTPRequestLimitConfig HTTP请求限制相关限制配置
func (*HTTPRequestLimitConfig) Init ¶
func (this *HTTPRequestLimitConfig) Init() error
func (*HTTPRequestLimitConfig) MaxBodyBytes ¶
func (this *HTTPRequestLimitConfig) MaxBodyBytes() int64
func (*HTTPRequestLimitConfig) OutBandwidthPerConnBytes ¶
func (this *HTTPRequestLimitConfig) OutBandwidthPerConnBytes() int64
type HTTPRequestScriptsConfig ¶
type HTTPRequestScriptsConfig struct {
InitGroup *ScriptGroupConfig `yaml:"initGroup" json:"initGroup"`
RequestGroup *ScriptGroupConfig `yaml:"requestGroup" json:"requestGroup"`
}
func (*HTTPRequestScriptsConfig) Init ¶
func (this *HTTPRequestScriptsConfig) Init() error
func (*HTTPRequestScriptsConfig) IsEmpty ¶
func (this *HTTPRequestScriptsConfig) IsEmpty() bool
type HTTPRewriteMode ¶
type HTTPRewriteMode = string
const ( HTTPRewriteModeRedirect HTTPRewriteMode = "redirect" // 跳转 HTTPRewriteModeProxy HTTPRewriteMode = "proxy" // 代理 )
type HTTPRewriteRef ¶
type HTTPRewriteRef struct {
IsOn bool `yaml:"isOn" json:"isOn"` // 是否启用
RewriteRuleId int64 `yaml:"rewriteRuleId" json:"rewriteRuleId"` // 规则ID
}
重写规则的引用
type HTTPRewriteRule ¶
type HTTPRewriteRule struct {
Id int64 `yaml:"id" json:"id"` // ID
IsOn bool `yaml:"isOn" json:"isOn"` // 是否开启
// 开启的条件
// 语法为:cond param operator value 比如:
// - cond ${status} gte 200
// - cond ${arg.name} eq lily
// - cond ${requestPath} regexp .*\.png
Conds *shared.HTTPRequestCondsConfig `yaml:"conds" json:"conds"` // 匹配条件
// 规则
// 语法为:pattern regexp 比如:
// - pattern ^/article/(\d+).html
Pattern string `yaml:"pattern" json:"pattern"`
// 模式
Mode HTTPRewriteMode `yaml:"mode" json:"mode"`
RedirectStatus int `yaml:"redirectStatus" json:"redirectStatus"` // 跳转的状态码
ProxyHost string `yaml:"proxyHost" json:"proxyHost"` // 代理模式下的Host
// 要替换成的URL
// 支持反向引用:${0}, ${1}, ...,也支持?P<NAME>语法
// - 如果以 proxy:// 开头,表示目标为代理,首先会尝试作为代理ID请求,如果找不到,会尝试作为代理Host请求
Replace string `yaml:"replace" json:"replace"`
// 其他选项
IsBreak bool `yaml:"isBreak" json:"isBreak"` // 终止向下解析
WithQuery bool `yaml:"withQuery" json:"withQuery"` // 是否保留QueryString
// contains filtered or unexported fields
}
HTTPRewriteRule 重写规则定义 TODO 实现对其他代理服务的引用
func (*HTTPRewriteRule) IsExternalURL ¶
func (this *HTTPRewriteRule) IsExternalURL(url string) bool
IsExternalURL 判断是否是外部URL
func (*HTTPRewriteRule) MatchRequest ¶
func (this *HTTPRewriteRule) MatchRequest(requestPath string, formatter func(source string) string) (replace string, varMapping map[string]string, matched bool)
MatchRequest 对某个请求执行规则
func (*HTTPRewriteRule) ProxyHostHasVariables ¶
func (this *HTTPRewriteRule) ProxyHostHasVariables() bool
ProxyHostHasVariables 判断ProxyHost是否有变量
type HTTPRootConfig ¶
type HTTPRootConfig struct {
IsPrior bool `yaml:"isPrior" json:"isPrior"` // 是否优先
IsOn bool `yaml:"isOn" json:"isOn"` // 是否启用
Dir string `yaml:"dir" json:"dir"` // 目录
Indexes []string `yaml:"indexes" json:"indexes"` // 默认首页文件
StripPrefix string `yaml:"stripPrefix" json:"stripPrefix"` // 去除URL前缀
DecodePath bool `yaml:"decodePath" json:"decodePath"` // 是否对请求路径进行解码
IsBreak bool `yaml:"isBreak" json:"isBreak"` // 找不到文件的情况下是否终止
// contains filtered or unexported fields
}
Web文档目录配置
type HTTPSProtocolConfig ¶
type HTTPSProtocolConfig struct {
BaseProtocol `yaml:",inline"`
SSLPolicyRef *sslconfigs.SSLPolicyRef `yaml:"sslPolicyRef" json:"sslPolicyRef"`
SSLPolicy *sslconfigs.SSLPolicy `yaml:"sslPolicy" json:"sslPolicy"`
}
HTTPSProtocolConfig HTTPS协议配置
func NewHTTPSProtocolConfigFromJSON ¶
func NewHTTPSProtocolConfigFromJSON(configJSON []byte) (*HTTPSProtocolConfig, error)
func (*HTTPSProtocolConfig) AsJSON ¶
func (this *HTTPSProtocolConfig) AsJSON() ([]byte, error)
AsJSON 转换为JSON
type HTTPShutdownConfig ¶
type HTTPShutdownConfig struct {
IsPrior bool `yaml:"isPrior" json:"isPrior"`
IsOn bool `yaml:"isOn" json:"isOn"`
BodyType shared.BodyType `yaml:"bodyType" json:"bodyType"` // 内容类型
URL string `yaml:"url" json:"url"` // URL
Body string `yaml:"body" json:"body"` // 输出的内容
Status int `yaml:"status" json:"status"`
}
HTTPShutdownConfig 关闭页面配置
type HTTPStatRef ¶
type HTTPStatRef struct {
IsPrior bool `yaml:"isPrior" json:"isPrior"` // 是否覆盖
IsOn bool `yaml:"isOn" json:"isOn"` // 是否开启
}
func (*HTTPStatRef) Init ¶
func (this *HTTPStatRef) Init() error
type HTTPStatus ¶
func AllHTTPRedirectStatusList ¶
func AllHTTPRedirectStatusList() []*HTTPStatus
type HTTPWebConfig ¶
type HTTPWebConfig struct {
Id int64 `yaml:"id" json:"id"` // ID
IsOn bool `yaml:"isOn" json:"isOn"` // 是否启用
Locations []*HTTPLocationConfig `yaml:"locations" json:"locations"` // 路径规则 TODO
LocationRefs []*HTTPLocationRef `yaml:"locationRefs" json:"locationRefs"` // 路径规则应用
Compression *HTTPCompressionConfig `yaml:"compression" json:"compression"` // 压缩配置
WebP *WebPImageConfig `yaml:"webp" json:"webp"` // WebP配置
Charset *HTTPCharsetConfig `yaml:"charset" json:"charset"` // 字符编码
Shutdown *HTTPShutdownConfig `yaml:"shutdown" json:"shutdown"` // 临时关闭配置
Pages []*HTTPPageConfig `yaml:"pages" json:"pages"` // 特殊页面配置
RedirectToHttps *HTTPRedirectToHTTPSConfig `yaml:"redirectToHTTPS" json:"redirectToHTTPS"` // 是否自动跳转到Https
Root *HTTPRootConfig `yaml:"root" json:"root"` // 资源根目录 TODO
MaxRequestBodySize string `yaml:"maxRequestBodySize" json:"maxRequestBodySize"` // 请求body最大尺寸 TODO 需要实现
AccessLogRef *HTTPAccessLogRef `yaml:"accessLog" json:"accessLog"` // 访问日志配置
StatRef *HTTPStatRef `yaml:"statRef" json:"statRef"` // 统计配置
Cache *HTTPCacheConfig `yaml:"cache" json:"cache"` // 缓存配置
FirewallRef *firewallconfigs.HTTPFirewallRef `yaml:"firewallRef" json:"firewallRef"` // 防火墙设置
FirewallPolicy *firewallconfigs.HTTPFirewallPolicy `yaml:"firewallPolicy" json:"firewallPolicy"` // 防火墙策略
WebsocketRef *HTTPWebsocketRef `yaml:"websocketRef" json:"websocketRef"` // Websocket应用配置
Websocket *HTTPWebsocketConfig `yaml:"websocket" json:"websocket"` // Websocket配置
RewriteRefs []*HTTPRewriteRef `yaml:"rewriteRefs" json:"rewriteRefs"` // 重写规则配置
RewriteRules []*HTTPRewriteRule `yaml:"rewriteRules" json:"rewriteRules"` // 重写规则
FastcgiRef *HTTPFastcgiRef `yaml:"fastcgiRef" json:"fastcgiRef"` // Fastcgi引用
FastcgiList []*HTTPFastcgiConfig `yaml:"fastcgiList" json:"fastcgiList"` // Fastcgi配置
UserAgent *UserAgentConfig `yaml:"userAgent" json:"userAgent"` // UserAgent配置
RequestHeaderPolicyRef *shared.HTTPHeaderPolicyRef `yaml:"requestHeaderPolicyRef" json:"requestHeaderPolicyRef"` // 请求Header
RequestHeaderPolicy *shared.HTTPHeaderPolicy `yaml:"requestHeaderPolicy" json:"requestHeaderPolicy"` // 请求Header策略
ResponseHeaderPolicyRef *shared.HTTPHeaderPolicyRef `yaml:"responseHeaderPolicyRef" json:"responseHeaderPolicyRef"` // 响应Header`
ResponseHeaderPolicy *shared.HTTPHeaderPolicy `yaml:"responseHeaderPolicy" json:"responseHeaderPolicy"` // 响应Header策略
FilterRefs []*HTTPFilterRef `yaml:"filterRefs" json:"filterRefs"` // 筛选配置 TODO
FilterPolicies []*HTTPFilterPolicy `yaml:"filterPolicies" json:"filterPolicies"` // 筛选策略
HostRedirects []*HTTPHostRedirectConfig `yaml:"hostRedirects" json:"hostRedirects"` // 主机跳转
Auth *HTTPAuthConfig `yaml:"auth" json:"auth"` // 认证配置
Referers *ReferersConfig `yaml:"referers" json:"referers"` // 防盗链设置
RemoteAddr *HTTPRemoteAddrConfig `yaml:"remoteAddr" json:"remoteAddr"` // 客户端IP获取方式
MergeSlashes bool `yaml:"mergeSlashes" json:"mergeSlashes"` // 是否合并路径中的斜杠(/)
RequestLimit *HTTPRequestLimitConfig `yaml:"requestLimit" json:"requestLimit"` // 并发请求限制
RequestScripts *HTTPRequestScriptsConfig `yaml:"requestScripts" json:"requestScripts"` // HTTP请求相关脚本
// UAM
UAM *UAMConfig `yaml:"uam" json:"uam"`
}
func (*HTTPWebConfig) Init ¶
func (this *HTTPWebConfig) Init() error
func (*HTTPWebConfig) RemoveLocationRef ¶
func (this *HTTPWebConfig) RemoveLocationRef(locationId int64)
type HTTPWebsocketConfig ¶
type HTTPWebsocketConfig struct {
Id int64 `yaml:"id" json:"id"` // ID
IsOn bool `yaml:"isOn" json:"isOn"` // 是否开启
// 握手超时时间
HandshakeTimeout *shared.TimeDuration `yaml:"handshakeTimeout" json:"handshakeTimeout"`
// 允许的来源域名,支持 www.example.com, example.com, .example.com, *.example.com
AllowAllOrigins bool `yaml:"allowAllOrigins" json:"allowAllOrigins"`
AllowedOrigins []string `yaml:"allowedOrigins" json:"allowedOrigins"`
// 向后传递的来源
RequestSameOrigin bool `yaml:"requestSameOrigin" json:"requestSameOrigin"` // 和请求一致
RequestOrigin string `yaml:"requestOrigin" json:"requestOrigin"` // 自行指定Origin,支持变量
// contains filtered or unexported fields
}
HTTPWebsocketConfig websocket设置
func (*HTTPWebsocketConfig) HandshakeTimeoutDuration ¶
func (this *HTTPWebsocketConfig) HandshakeTimeoutDuration() time.Duration
获取握手超时时间
func (*HTTPWebsocketConfig) MatchOrigin ¶
func (this *HTTPWebsocketConfig) MatchOrigin(origin string) bool
匹配域名
func (*HTTPWebsocketConfig) RequestOriginHasVariables ¶
func (this *HTTPWebsocketConfig) RequestOriginHasVariables() bool
判断请求Origin是否有变量
type HTTPWebsocketRef ¶
type HTTPWebsocketRef struct {
IsPrior bool `yaml:"isPrior" json:"isPrior"`
IsOn bool `yaml:"isOn" json:"isOn"`
WebsocketId int64 `yaml:"websocketId" json:"websocketId"`
}
func (*HTTPWebsocketRef) Init ¶
func (this *HTTPWebsocketRef) Init() error
type HealthCheckConfig ¶
type HealthCheckConfig struct {
IsOn bool `yaml:"isOn" json:"isOn"` // 是否开启
URL string `yaml:"url" json:"url"` // 读取的URL
Interval *shared.TimeDuration `yaml:"interval" json:"interval"` // 检测周期
StatusCodes []int `yaml:"statusCodes" json:"statusCodes"` // 返回的状态码要求
Timeout *shared.TimeDuration `yaml:"timeout" json:"timeout"` // 超时时间
CountTries int64 `yaml:"countTries" json:"countTries"` // 尝试次数
TryDelay *shared.TimeDuration `yaml:"tryDelay" json:"tryDelay"` // 尝试间隔
FailActions []maps.Map `yaml:"failActions" json:"failActions"` // 失败采取的动作 TODO
RecoverActions []maps.Map `yaml:"recoverActions" json:"recoverActions"` // 恢复采取的动作 TODO
AutoDown bool `yaml:"autoDown" json:"autoDown"` // 是否自动下线
CountUp int `yaml:"countUp" json:"countUp"` // 连续在线认定次数
CountDown int `yaml:"countDown" json:"countDown"` // 连续离线认定次数
UserAgent string `yaml:"userAgent" json:"userAgent"` // 发起请求用的UserAgent
OnlyBasicRequest bool `yaml:"onlyBasicRequest" json:"onlyBasicRequest"` // 只做基础的请求,不处理WAF、反向代理等
AccessLogIsOn bool `yaml:"accessLogIsOn" json:"accessLogIsOn"` // 是否关闭访问日志
}
HealthCheckConfig 健康检查设置
type IPLibraryType ¶
type IPLibraryType = string
const (
IPLibraryTypeIP2Region IPLibraryType = "ip2region"
)
type MetricChartType ¶
type MetricChartType = string
const ( MetricChartTypePie MetricChartType = "pie" MetricChartTypeBar MetricChartType = "bar" MetricChartTypeTimeBar MetricChartType = "timeBar" MetricChartTypeTimeLine MetricChartType = "timeLine" MetricChartTypeTable MetricChartType = "table" )
type MetricItemCategory ¶
type MetricItemCategory = string
MetricItemCategory 指标分类
const ( MetricItemCategoryHTTP MetricItemCategory = "http" MetricItemCategoryTCP MetricItemCategory = "tcp" MetricItemCategoryUDP MetricItemCategory = "udp" )
func FindAllMetricItemCategoryCodes ¶
func FindAllMetricItemCategoryCodes() []MetricItemCategory
type MetricItemConfig ¶
type MetricItemConfig struct {
Id int64 `yaml:"id" json:"id"`
IsOn bool `yaml:"isOn" json:"isOn"`
Category MetricItemCategory `yaml:"category" json:"category"`
Period int `yaml:"period" json:"period"` // 统计周期
PeriodUnit MetricItemPeriodUnit `yaml:"periodUnit" json:"periodUnit"` // 统计周期单位
Keys []string `yaml:"keys" json:"keys"`
Value string `yaml:"value" json:"value"`
Version int32 `yaml:"version" json:"version"`
ExpiresPeriod int `yaml:"expiresPeriod" json:"expiresPeriod"` // 过期周期
// contains filtered or unexported fields
}
MetricItemConfig 指标配置
func (*MetricItemConfig) CurrentTime ¶
func (this *MetricItemConfig) CurrentTime() string
CurrentTime 根据周期计算时间
func (*MetricItemConfig) HasHTTPConnectionValue ¶
func (this *MetricItemConfig) HasHTTPConnectionValue() bool
func (*MetricItemConfig) LocalExpiresTime ¶
func (this *MetricItemConfig) LocalExpiresTime() string
LocalExpiresTime 根据周期计算本地端过期时间
func (*MetricItemConfig) ServerExpiresDay ¶
func (this *MetricItemConfig) ServerExpiresDay() string
ServerExpiresDay 根据周期计算服务器端数据过期日期
func (*MetricItemConfig) ServerExpiresTime ¶
func (this *MetricItemConfig) ServerExpiresTime() string
ServerExpiresTime 根据周期计算服务器端数据过期时间
func (*MetricItemConfig) UploadDuration ¶
func (this *MetricItemConfig) UploadDuration() time.Duration
UploadDuration 上传数据的周期
type MetricItemPeriodUnit ¶
type MetricItemPeriodUnit = string
MetricItemPeriodUnit 指标周期单位
const ( MetricItemPeriodUnitMinute MetricItemPeriodUnit = "minute" MetricItemPeriodUnitHour MetricItemPeriodUnit = "hour" MetricItemPeriodUnitDay MetricItemPeriodUnit = "day" MetricItemPeriodUnitWeek MetricItemPeriodUnit = "week" MetricItemPeriodUnitMonth MetricItemPeriodUnit = "month" )
type MetricItemValueType ¶
type MetricItemValueType = string
MetricItemValueType 值类型
const ( MetricItemValueTypeCount MetricItemValueType = "count" // 数量 MetricItemValueTypeByte MetricItemValueType = "byte" // 字节 )
type MetricValueDefinition ¶
type MetricValueDefinition struct {
Name string `json:"name"`
Code string `json:"code"`
Description string `json:"description"`
Icon string `json:"icon"`
Type string `json:"type"`
}
MetricValueDefinition 指标数值定义
func FindAllMetricValueDefinitions ¶
func FindAllMetricValueDefinitions(category MetricItemCategory) []*MetricValueDefinition
FindAllMetricValueDefinitions 指标数值定义
type NetworkAddressConfig ¶
type NetworkAddressConfig struct {
Protocol Protocol `yaml:"protocol" json:"protocol"` // 协议,http、tcp、tcp4、tcp6、unix、udp等
Host string `yaml:"host" json:"host"` // 主机地址或主机名,支持变量
PortRange string `yaml:"portRange" json:"portRange"` // 端口范围,支持 8080、8080-8090、8080:8090
MinPort int `yaml:"minPort" json:"minPort"` // minPort和maxPort只是用来记录PortRange分解后的结果,不需要用户输入
MaxPort int `yaml:"maxPort" json:"maxPort"`
// contains filtered or unexported fields
}
NetworkAddressConfig 网络地址配置
func (*NetworkAddressConfig) Addresses ¶
func (this *NetworkAddressConfig) Addresses() []string
Addresses 所有的地址列表,不包括scheme
func (*NetworkAddressConfig) FullAddresses ¶
func (this *NetworkAddressConfig) FullAddresses() []string
FullAddresses 所有的地址列表,包含scheme
func (*NetworkAddressConfig) HostHasVariables ¶
func (this *NetworkAddressConfig) HostHasVariables() bool
HostHasVariables 判断Host是否包含变量
func (*NetworkAddressConfig) PickAddress ¶
func (this *NetworkAddressConfig) PickAddress() string
PickAddress 选择其中一个地址
type OpenFileCacheConfig ¶
type OpenFileCacheConfig struct {
IsOn bool `yaml:"isOn" json:"isOn"`
Max int `yaml:"max" json:"max"`
}
OpenFileCacheConfig open file cache配置
func (*OpenFileCacheConfig) Init ¶
func (this *OpenFileCacheConfig) Init() error
type OriginConfig ¶
type OriginConfig struct {
Id int64 `yaml:"id" json:"id"` // ID
IsOn bool `yaml:"isOn" json:"isOn"` // 是否启用
Version int `yaml:"version" json:"version"` // 版本
Name string `yaml:"name" json:"name"` // 名称
Addr *NetworkAddressConfig `yaml:"addr" json:"addr"` // 地址
Description string `yaml:"description" json:"description"` // 描述 TODO
Code string `yaml:"code" json:"code"` // 代号 TODO
Weight uint `yaml:"weight" json:"weight"` // 权重
ConnTimeout *shared.TimeDuration `yaml:"connTimeout" json:"connTimeout"` // 连接失败超时
ReadTimeout *shared.TimeDuration `yaml:"readTimeout" json:"readTimeout"` // 读取超时时间
IdleTimeout *shared.TimeDuration `yaml:"idleTimeout" json:"idleTimeout"` // 空闲连接超时时间
MaxFails int `yaml:"maxFails" json:"maxFails"` // 最多失败次数 TODO
MaxConns int `yaml:"maxConns" json:"maxConns"` // 最大并发连接数
MaxIdleConns int `yaml:"idleConns" json:"idleConns"` // 最大空闲连接数
Domains []string `yaml:"domains" json:"domains"` // 所属域名
StripPrefix string `yaml:"stripPrefix" json:"stripPrefix"` // 去除URL前缀
RequestURI string `yaml:"requestURI" json:"requestURI"` // 转发后的请求URI TODO
RequestHost string `yaml:"requestHost" json:"requestHost"` // 自定义主机名
FollowPort bool `yaml:"followPort" json:"followPort"` // 端口跟随
RequestHeaderPolicyRef *shared.HTTPHeaderPolicyRef `yaml:"requestHeaderPolicyRef" json:"requestHeaderPolicyRef"` // 请求Header
RequestHeaderPolicy *shared.HTTPHeaderPolicy `yaml:"requestHeaderPolicy" json:"requestHeaderPolicy"` // 请求Header策略
ResponseHeaderPolicyRef *shared.HTTPHeaderPolicyRef `yaml:"responseHeaderPolicyRef" json:"responseHeaderPolicyRef"` // 响应Header`
ResponseHeaderPolicy *shared.HTTPHeaderPolicy `yaml:"responseHeaderPolicy" json:"responseHeaderPolicy"` // 响应Header策略
// 健康检查URL,目前支持:
// - http|https 返回2xx-3xx认为成功
HealthCheck *HealthCheckConfig `yaml:"healthCheck" json:"healthCheck"` // TODO
CertRef *sslconfigs.SSLCertRef `yaml:"certRef" json:"certRef"` // 证书的引用
Cert *sslconfigs.SSLCertConfig `yaml:"cert" json:"cert"` // 请求源服务器用的证书
// ftp
FTPServerRef *FTPServerRef `yaml:"ftpServerRef" json:"ftpServerRef"` // TODO
FTPServer *FTPServerConfig `yaml:"ftpServer" json:"ftpServer"` // TODO
IsOk bool `yaml:"isOk" json:"isOk"` // 是否可以正常访问,仅仅用于运行时检查
// contains filtered or unexported fields
}
OriginConfig 源站服务配置
func (*OriginConfig) CandidateCodes ¶
func (this *OriginConfig) CandidateCodes() []string
CandidateCodes 候选对象代号
func (*OriginConfig) CandidateWeight ¶
func (this *OriginConfig) CandidateWeight() uint
CandidateWeight 候选对象权重
func (*OriginConfig) ConnTimeoutDuration ¶
func (this *OriginConfig) ConnTimeoutDuration() time.Duration
ConnTimeoutDuration 连接超时时间
func (*OriginConfig) IdleTimeoutDuration ¶
func (this *OriginConfig) IdleTimeoutDuration() time.Duration
IdleTimeoutDuration 休眠超时时间
func (*OriginConfig) ReadTimeoutDuration ¶
func (this *OriginConfig) ReadTimeoutDuration() time.Duration
ReadTimeoutDuration 读取超时时间
func (*OriginConfig) RequestHostHasVariables ¶
func (this *OriginConfig) RequestHostHasVariables() bool
RequestHostHasVariables 判断RequestHost是否有变量
func (*OriginConfig) RequestURIHasVariables ¶
func (this *OriginConfig) RequestURIHasVariables() bool
RequestURIHasVariables 判断RequestURI是否有变量
type OriginGroupConfig ¶
type OriginGroupConfig struct {
Origins []*OriginConfig `yaml:"origins" json:"origins"` // 源站列表
}
TODO 需要实现
type PlanConfig ¶
func (*PlanConfig) Init ¶
func (this *PlanConfig) Init() error
type Protocol ¶
type Protocol string
const ( ProtocolHTTP Protocol = "http" ProtocolHTTPS Protocol = "https" ProtocolTCP Protocol = "tcp" ProtocolTLS Protocol = "tls" ProtocolUnix Protocol = "unix" ProtocolUDP Protocol = "udp" // 子协议 ProtocolHTTP4 Protocol = "http4" ProtocolHTTP6 Protocol = "http6" ProtocolHTTPS4 Protocol = "https4" ProtocolHTTPS6 Protocol = "https6" ProtocolTCP4 Protocol = "tcp4" ProtocolTCP6 Protocol = "tcp6" ProtocolTLS4 Protocol = "tls4" ProtocolTLS6 Protocol = "tls6" )
func AllProtocols ¶
func AllProtocols() []Protocol
func (Protocol) IsHTTPFamily ¶
func (Protocol) IsHTTPSFamily ¶
func (Protocol) IsTCPFamily ¶
func (Protocol) IsTLSFamily ¶
func (Protocol) IsUDPFamily ¶
func (Protocol) IsUnixFamily ¶
type ProxyProtocolConfig ¶
type ProxyProtocolConfig struct {
IsOn bool `yaml:"isOn" json:"isOn"`
Version ProxyProtocolVersion `yaml:"version" json:"version"`
}
ProxyProtocolConfig PROXY Protocol配置
type ProxyProtocolVersion ¶
type ProxyProtocolVersion = int
const ( ProxyProtocolVersion1 ProxyProtocolVersion = 1 ProxyProtocolVersion2 ProxyProtocolVersion = 2 )
type ReferersConfig ¶ added in v0.5.3
type ReferersConfig struct {
IsPrior bool `yaml:"isPrior" json:"isPrior"`
IsOn bool `yaml:"isOn" json:"isOn"`
AllowEmpty bool `yaml:"allowEmpty" json:"allowEmpty"` // 来源域名允许为空
AllowSameDomain bool `yaml:"allowSameDomain" json:"allowSameDomain"` // 允许来源域名和当前访问的域名一致,相当于在站内访问
AllowDomains []string `yaml:"allowDomains" json:"allowDomains"` // 允许的来源域名列表
DenyDomains []string `yaml:"denyDomains" json:"denyDomains"` // 禁止的来源域名列表
}
ReferersConfig 防盗链设置
func (*ReferersConfig) Init ¶ added in v0.5.3
func (this *ReferersConfig) Init() error
func (*ReferersConfig) MatchDomain ¶ added in v0.5.3
func (this *ReferersConfig) MatchDomain(requestDomain string, refererDomain string) bool
type RequestHostType ¶
type RequestHostType = int8
const ( RequestHostTypeProxyServer RequestHostType = 0 RequestHostTypeOrigin RequestHostType = 1 RequestHostTypeCustomized RequestHostType = 2 )
type ReverseProxyConfig ¶
type ReverseProxyConfig struct {
Id int64 `yaml:"id" json:"id"` // ID
IsOn bool `yaml:"isOn" json:"isOn"` // 是否启用
PrimaryOrigins []*OriginConfig `yaml:"primaryOrigins" json:"primaryOrigins"` // 主要源站列表
PrimaryOriginRefs []*OriginRef `yaml:"primaryOriginRefs" json:"primaryOriginRefs"` // 主要源站引用
BackupOrigins []*OriginConfig `yaml:"backupOrigins" json:"backupOrigins"` // 备用源站列表
BackupOriginRefs []*OriginRef `yaml:"backupOriginRefs" json:"backupOriginRefs"` // 备用源站引用
Scheduling *SchedulingConfig `yaml:"scheduling" json:"scheduling"` // 调度算法选项
ConnTimeout *shared.TimeDuration `yaml:"connTimeout" json:"connTimeout"` // 连接失败超时 TODO
ReadTimeout *shared.TimeDuration `yaml:"readTimeout" json:"readTimeout"` // 读取超时时间 TODO
IdleTimeout *shared.TimeDuration `yaml:"idleTimeout" json:"idleTimeout"` // 空闲连接超时时间 TODO
MaxFails int `yaml:"maxFails" json:"maxFails"` // 最多失败次数 TODO
MaxConns int `yaml:"maxConns" json:"maxConns"` // 最大并发连接数 TODO
MaxIdleConns int `yaml:"maxIdleConns" json:"maxIdleConns"` // 最大空闲连接数 TODO
StripPrefix string `yaml:"stripPrefix" json:"stripPrefix"` // 去除URL前缀
RequestHostType RequestHostType `yaml:"requestHostType" json:"requestHostType"` // 请求Host类型
RequestHost string `yaml:"requestHost" json:"requestHost"` // 请求Host,支持变量
RequestURI string `yaml:"requestURI" json:"requestURI"` // 请求URI,支持变量,如果同时定义了StripPrefix,则先执行StripPrefix
RequestHostExcludingPort bool `yaml:"requestHostExcludingPort" json:"requestHostExcludingPort"` // 请求Host不包括端口
AddHeaders []string `yaml:"addHeaders" json:"addHeaders"` // 自动添加的Header
AutoFlush bool `yaml:"autoFlush" json:"autoFlush"` // 是否自动刷新缓冲区,在比如SSE(server-sent events)场景下很有用
ProxyProtocol *ProxyProtocolConfig `yaml:"proxyProtocol" json:"proxyProtocol"` // PROXY Protocol
FollowRedirects bool `yaml:"followRedirects" json:"followRedirects"` // 回源跟随
// contains filtered or unexported fields
}
ReverseProxyConfig 反向代理设置
func (*ReverseProxyConfig) AddBackupOrigin ¶
func (this *ReverseProxyConfig) AddBackupOrigin(origin *OriginConfig)
AddBackupOrigin 添加备用源站配置
func (*ReverseProxyConfig) AddPrimaryOrigin ¶
func (this *ReverseProxyConfig) AddPrimaryOrigin(origin *OriginConfig)
AddPrimaryOrigin 添加主源站配置
func (*ReverseProxyConfig) AnyOrigin ¶ added in v0.5.0
func (this *ReverseProxyConfig) AnyOrigin(call *shared.RequestCall, excludingOriginIds []int64) *OriginConfig
AnyOrigin 取下一个任意的源站
func (*ReverseProxyConfig) FindSchedulingConfig ¶
func (this *ReverseProxyConfig) FindSchedulingConfig() *SchedulingConfig
FindSchedulingConfig 获取调度配置对象
func (*ReverseProxyConfig) NextOrigin ¶
func (this *ReverseProxyConfig) NextOrigin(call *shared.RequestCall) *OriginConfig
NextOrigin 取得下一个可用的源站
func (*ReverseProxyConfig) RequestHostHasVariables ¶
func (this *ReverseProxyConfig) RequestHostHasVariables() bool
RequestHostHasVariables 判断RequestHost是否有变量
func (*ReverseProxyConfig) RequestURIHasVariables ¶
func (this *ReverseProxyConfig) RequestURIHasVariables() bool
RequestURIHasVariables 判断RequestURI是否有变量
func (*ReverseProxyConfig) ResetScheduling ¶
func (this *ReverseProxyConfig) ResetScheduling()
ResetScheduling 重置调度算法
func (*ReverseProxyConfig) SetupScheduling ¶
func (this *ReverseProxyConfig) SetupScheduling(isBackup bool, checkOk bool, lock bool)
SetupScheduling 设置调度算法
func (*ReverseProxyConfig) ShouldAddXForwardedByHeader ¶
func (this *ReverseProxyConfig) ShouldAddXForwardedByHeader() bool
ShouldAddXForwardedByHeader 是否添加X-Forwarded-By
func (*ReverseProxyConfig) ShouldAddXForwardedForHeader ¶
func (this *ReverseProxyConfig) ShouldAddXForwardedForHeader() bool
ShouldAddXForwardedForHeader 是否添加X-Forwarded-For
func (*ReverseProxyConfig) ShouldAddXForwardedHostHeader ¶
func (this *ReverseProxyConfig) ShouldAddXForwardedHostHeader() bool
ShouldAddXForwardedHostHeader 是否添加X-Forwarded-Host
func (*ReverseProxyConfig) ShouldAddXForwardedProtoHeader ¶
func (this *ReverseProxyConfig) ShouldAddXForwardedProtoHeader() bool
ShouldAddXForwardedProtoHeader 是否添加X-Forwarded-Proto
func (*ReverseProxyConfig) ShouldAddXRealIPHeader ¶
func (this *ReverseProxyConfig) ShouldAddXRealIPHeader() bool
ShouldAddXRealIPHeader 是否添加X-Real-IP
type ReverseProxyRef ¶
type ReverseProxyRef struct {
IsPrior bool `yaml:"isPrior" json:"isPrior"` // 是否覆盖
IsOn bool `yaml:"isOn" json:"isOn"` // 是否启用
ReverseProxyId int64 `yaml:"reverseProxyId" json:"reverseProxyId"` // 反向代理ID
}
ReverseProxyRef 反向代理引用
type SchedulingConfig ¶
type SchedulingConfig struct {
Code string `yaml:"code" json:"code"` // 类型
Options maps.Map `yaml:"options" json:"options"` // 选项
}
SchedulingConfig 调度算法配置
type SchedulingGroup ¶
type SchedulingGroup struct {
Scheduling *SchedulingConfig `yaml:"scheduling" json:"scheduling"`
PrimaryOrigins []*OriginConfig
BackupOrigins []*OriginConfig
// contains filtered or unexported fields
}
SchedulingGroup 负载均衡分组
func (*SchedulingGroup) AnyOrigin ¶ added in v0.5.0
func (this *SchedulingGroup) AnyOrigin(excludingOriginIds []int64) *OriginConfig
AnyOrigin 取下一个任意源站
func (*SchedulingGroup) NextOrigin ¶
func (this *SchedulingGroup) NextOrigin(call *shared.RequestCall) *OriginConfig
NextOrigin 取得下一个可用源站
func (*SchedulingGroup) SetupScheduling ¶
func (this *SchedulingGroup) SetupScheduling(isBackup bool, checkOk bool)
SetupScheduling 设置调度算法
type ScriptConfig ¶
type ScriptConfig struct {
IsPrior bool `yaml:"isPrior" json:"isPrior"`
IsOn bool `yaml:"isOn" json:"isOn"`
Code string `yaml:"code" json:"code"`
}
func (*ScriptConfig) Init ¶
func (this *ScriptConfig) Init() error
type ScriptGroupConfig ¶
type ScriptGroupConfig struct {
IsOn bool `yaml:"isOn" json:"isOn"`
IsPrior bool `yaml:"isPrior" json:"isPrior"`
Scripts []*ScriptConfig `yaml:"scripts" json:"scripts"`
// contains filtered or unexported fields
}
func (*ScriptGroupConfig) Init ¶
func (this *ScriptGroupConfig) Init() error
func (*ScriptGroupConfig) IsEmpty ¶
func (this *ScriptGroupConfig) IsEmpty() bool
type ServerAddressGroup ¶
type ServerAddressGroup struct {
// contains filtered or unexported fields
}
func NewServerAddressGroup ¶
func NewServerAddressGroup(fullAddr string) *ServerAddressGroup
func (*ServerAddressGroup) FirstServer ¶
func (this *ServerAddressGroup) FirstServer() *ServerConfig
FirstServer 获取第一个Server
func (*ServerAddressGroup) FirstTLSServer ¶
func (this *ServerAddressGroup) FirstTLSServer() *ServerConfig
FirstTLSServer 获取第一个TLS Server
func (*ServerAddressGroup) FullAddr ¶
func (this *ServerAddressGroup) FullAddr() string
FullAddr 获取完整的地址
func (*ServerAddressGroup) IsHTTP ¶
func (this *ServerAddressGroup) IsHTTP() bool
IsHTTP 判断当前分组是否为HTTP
func (*ServerAddressGroup) IsHTTPS ¶
func (this *ServerAddressGroup) IsHTTPS() bool
IsHTTPS 判断当前分组是否为HTTPS
func (*ServerAddressGroup) IsUnix ¶
func (this *ServerAddressGroup) IsUnix() bool
IsUnix 判断当前分组是否为Unix
func (*ServerAddressGroup) MatchServerCNAME ¶
func (this *ServerAddressGroup) MatchServerCNAME(serverName string) *ServerConfig
MatchServerCNAME 使用CNAME查找服务
func (*ServerAddressGroup) MatchServerName ¶
func (this *ServerAddressGroup) MatchServerName(serverName string) *ServerConfig
MatchServerName 使用域名查找服务
func (*ServerAddressGroup) Protocol ¶
func (this *ServerAddressGroup) Protocol() Protocol
Protocol 获取当前分组的协议
func (*ServerAddressGroup) Servers ¶
func (this *ServerAddressGroup) Servers() []*ServerConfig
Servers 读取所有服务
type ServerConfig ¶
type ServerConfig struct {
Id int64 `yaml:"id" json:"id"` // ID
ClusterId int64 `yaml:"clusterId" json:"clusterId"` // 集群ID
UserId int64 `yaml:"userId" json:"userId"` // 用户ID
Type string `yaml:"type" json:"type"` // 类型
IsOn bool `yaml:"isOn" json:"isOn"` // 是否开启
Name string `yaml:"name" json:"name"` // 名称
Description string `yaml:"description" json:"description"` // 描述
AliasServerNames []string `yaml:"aliasServerNames" json:"aliasServerNames"` // 关联的域名,比如CNAME之类的
ServerNames []*ServerNameConfig `yaml:"serverNames" json:"serverNames"` // 域名
CNameDomain string `yaml:"cnameDomain" json:"cnameDomain"` // CNAME(末尾不带点(.))
CNameAsDomain bool `yaml:"cnameAsDomain" json:"cnameAsDomain"` // 启用CNAME域名访问
SupportCNAME bool `yaml:"supportCNAME" json:"supportCNAME"` // 是否支持CNAME
// 前端协议
HTTP *HTTPProtocolConfig `yaml:"http" json:"http"` // HTTP配置
HTTPS *HTTPSProtocolConfig `yaml:"https" json:"https"` // HTTPS配置
TCP *TCPProtocolConfig `yaml:"tcp" json:"tcp"` // TCP配置
TLS *TLSProtocolConfig `yaml:"tls" json:"tls"` // TLS配置
Unix *UnixProtocolConfig `yaml:"unix" json:"unix"` // Unix配置
UDP *UDPProtocolConfig `yaml:"udp" json:"udp"` // UDP配置
// Web配置
Web *HTTPWebConfig `yaml:"web" json:"web"`
// 反向代理配置
ReverseProxyRef *ReverseProxyRef `yaml:"reverseProxyRef" json:"reverseProxyRef"`
ReverseProxy *ReverseProxyConfig `yaml:"reverseProxy" json:"reverseProxy"`
// WAF策略
HTTPFirewallPolicyId int64 `yaml:"httpFirewallPolicyId" json:"httpFirewallPolicyId"`
HTTPFirewallPolicy *firewallconfigs.HTTPFirewallPolicy `yaml:"httpFirewallPolicy" json:"httpFirewallPolicy"` // 通过 HTTPFirewallPolicyId 获取
// 缓存策略
HTTPCachePolicyId int64 `yaml:"httpCachePolicyId" json:"httpCachePolicyId"`
HTTPCachePolicy *HTTPCachePolicy `yaml:"httpCachePolicy" json:"httpCachePolicy"` // 通过 HTTPCachePolicyId 获取
// 流量限制
TrafficLimit *TrafficLimitConfig `yaml:"trafficLimit" json:"trafficLimit"`
TrafficLimitStatus *TrafficLimitStatus `yaml:"trafficLimitStatus" json:"trafficLimitStatus"`
// 套餐
UserPlan *UserPlanConfig `yaml:"userPlan" json:"userPlan"`
// 分组
Group *ServerGroupConfig `yaml:"group" json:"group"`
// UAM
UAM *UAMConfig `yaml:"uam" json:"uam"`
// contains filtered or unexported fields
}
func NewServerConfig ¶
func NewServerConfig() *ServerConfig
func NewServerConfigFromJSON ¶
func NewServerConfigFromJSON(data []byte) (*ServerConfig, error)
NewServerConfigFromJSON 从JSON中解析Server配置
func (*ServerConfig) AllFuzzyNames ¶
func (this *ServerConfig) AllFuzzyNames() []string
AllFuzzyNames 所有模糊域名
func (*ServerConfig) AllStrictNames ¶
func (this *ServerConfig) AllStrictNames() []string
AllStrictNames 所有严格域名
func (*ServerConfig) AsJSON ¶
func (this *ServerConfig) AsJSON() ([]byte, error)
func (*ServerConfig) FindAndCheckReverseProxy ¶
func (this *ServerConfig) FindAndCheckReverseProxy(dataType string) (*ReverseProxyConfig, error)
FindAndCheckReverseProxy 根据条件查找ReverseProxy
func (*ServerConfig) FullAddresses ¶
func (this *ServerConfig) FullAddresses() []string
func (*ServerConfig) Init ¶
func (this *ServerConfig) Init() (results []error)
func (*ServerConfig) IsHTTPFamily ¶
func (this *ServerConfig) IsHTTPFamily() bool
func (*ServerConfig) IsInitialized ¶ added in v0.5.3
func (this *ServerConfig) IsInitialized() bool
func (*ServerConfig) IsTCPFamily ¶
func (this *ServerConfig) IsTCPFamily() bool
func (*ServerConfig) IsUDPFamily ¶
func (this *ServerConfig) IsUDPFamily() bool
func (*ServerConfig) IsUnixFamily ¶
func (this *ServerConfig) IsUnixFamily() bool
func (*ServerConfig) Listen ¶
func (this *ServerConfig) Listen() []*NetworkAddressConfig
func (*ServerConfig) SSLPolicy ¶
func (this *ServerConfig) SSLPolicy() *sslconfigs.SSLPolicy
SSLPolicy SSL信息
func (*ServerConfig) ShouldCheckTrafficLimit ¶
func (this *ServerConfig) ShouldCheckTrafficLimit() bool
ShouldCheckTrafficLimit 检查是否需要检查流量限制
type ServerGroupConfig ¶
type ServerGroupConfig struct {
Id int64 `yaml:"id" json:"id"`
Name string `yaml:"name" json:"name"`
IsOn bool `yaml:"isOn" json:"isOn"`
// 反向代理配置
HTTPReverseProxyRef *ReverseProxyRef `yaml:"httpReverseProxyRef" json:"httpReverseProxyRef"`
HTTPReverseProxy *ReverseProxyConfig `yaml:"httpReverseProxy" json:"httpReverseProxy"`
TCPReverseProxyRef *ReverseProxyRef `yaml:"tcpReverseProxyRef" json:"tcpReverseProxyRef"`
TCPReverseProxy *ReverseProxyConfig `yaml:"tcpReverseProxy" json:"tcpReverseProxy"`
UDPReverseProxyRef *ReverseProxyRef `yaml:"udpReverseProxyRef" json:"udpReverseProxyRef"`
UDPReverseProxy *ReverseProxyConfig `yaml:"udpReverseProxy" json:"udpReverseProxy"`
Web *HTTPWebConfig `yaml:"web" json:"web"`
}
ServerGroupConfig 服务分组配置
type ServerNameConfig ¶
type ServerNameConfig struct {
Name string `yaml:"name" json:"name"` // 名称
Type string `yaml:"type" json:"type"` // 类型
SubNames []string `yaml:"subNames" json:"subNames"` // 子名称,用来支持大量的域名批量管理
}
ServerNameConfig 主机名(域名)配置
func (*ServerNameConfig) Count ¶ added in v0.5.6
func (this *ServerNameConfig) Count() int
Count 计算域名数量
func (*ServerNameConfig) FirstName ¶
func (this *ServerNameConfig) FirstName() string
FirstName 获取第一个名称
func (*ServerNameConfig) Match ¶
func (this *ServerNameConfig) Match(name string) bool
Match 判断主机名是否匹配
type ServerNameType ¶
type ServerNameType = string
const ( ServerNameTypeFull ServerNameType = "full" // 完整的域名,包含通配符等 ServerNameTypePrefix ServerNameType = "prefix" // 前缀 ServerNameTypeSuffix ServerNameType = "suffix" // 后缀 ServerNameTypeMatch ServerNameType = "match" // 正则匹配 )
type ServerType ¶
type ServerType = string
const ( ServerTypeHTTPProxy ServerType = "httpProxy" ServerTypeHTTPWeb ServerType = "httpWeb" ServerTypeTCPProxy ServerType = "tcpProxy" ServerTypeUnixProxy ServerType = "unixProxy" ServerTypeUDPProxy ServerType = "udpProxy" )
type TCPProtocolConfig ¶
type TCPProtocolConfig struct {
BaseProtocol `yaml:",inline"`
}
func NewTCPProtocolConfigFromJSON ¶
func NewTCPProtocolConfigFromJSON(configJSON []byte) (*TCPProtocolConfig, error)
func (*TCPProtocolConfig) AsJSON ¶
func (this *TCPProtocolConfig) AsJSON() ([]byte, error)
AsJSON 转换为JSON
func (*TCPProtocolConfig) Init ¶
func (this *TCPProtocolConfig) Init() error
type TLSProtocolConfig ¶
type TLSProtocolConfig struct {
BaseProtocol `yaml:",inline"`
SSLPolicyRef *sslconfigs.SSLPolicyRef `yaml:"sslPolicyRef" json:"sslPolicyRef"`
SSLPolicy *sslconfigs.SSLPolicy `yaml:"sslPolicy" json:"sslPolicy"`
}
TLSProtocolConfig TLS协议配置
func NewTLSProtocolConfigFromJSON ¶
func NewTLSProtocolConfigFromJSON(configJSON []byte) (*TLSProtocolConfig, error)
func (*TLSProtocolConfig) AsJSON ¶
func (this *TLSProtocolConfig) AsJSON() ([]byte, error)
AsJSON 转换为JSON
type TrafficLimitConfig ¶
type TrafficLimitConfig struct {
IsOn bool `yaml:"isOn" json:"isOn"` // 是否启用
DailySize *shared.SizeCapacity `yaml:"dailySize" json:"dailySize"` // 每日限制
MonthlySize *shared.SizeCapacity `yaml:"monthlySize" json:"monthlySize"` // 每月限制
TotalSize *shared.SizeCapacity `yaml:"totalSize" json:"totalSize"` // 总限制 TODO 需要实现
NoticePageBody string `yaml:"noticePageBody" json:"noticePageBody"` // 超出限制时的提醒,支持请求变量
}
TrafficLimitConfig 流量限制
func (*TrafficLimitConfig) DailyBytes ¶
func (this *TrafficLimitConfig) DailyBytes() int64
DailyBytes 每天限制 不使用Init()来初始化数据,是为了让其他地方不经过Init()也能得到计算值
func (*TrafficLimitConfig) IsEmpty ¶
func (this *TrafficLimitConfig) IsEmpty() bool
IsEmpty 检查是否有限制值
func (*TrafficLimitConfig) MonthlyBytes ¶
func (this *TrafficLimitConfig) MonthlyBytes() int64
MonthlyBytes 每月限制
func (*TrafficLimitConfig) TotalBytes ¶
func (this *TrafficLimitConfig) TotalBytes() int64
TotalBytes 总限制
type TrafficLimitStatus ¶
type TrafficLimitStatus struct {
UntilDay string `yaml:"untilDay" json:"untilDay"` // 有效日期,格式YYYYMMDD
}
TrafficLimitStatus 流量限制状态
func (*TrafficLimitStatus) IsValid ¶
func (this *TrafficLimitStatus) IsValid() bool
type UAMConfig ¶
type UAMConfig struct {
IsPrior bool `yaml:"isPrior" json:"isPrior"`
IsOn bool `yaml:"isOn" json:"isOn"`
}
UAMConfig UAM配置
type UDPProtocolConfig ¶
type UDPProtocolConfig struct {
BaseProtocol `yaml:",inline"`
}
func NewUDPProtocolConfigFromJSON ¶
func NewUDPProtocolConfigFromJSON(configJSON []byte) (*UDPProtocolConfig, error)
func (*UDPProtocolConfig) AsJSON ¶
func (this *UDPProtocolConfig) AsJSON() ([]byte, error)
AsJSON 转换为JSON
func (*UDPProtocolConfig) Init ¶
func (this *UDPProtocolConfig) Init() error
type UnixProtocolConfig ¶
type UnixProtocolConfig struct {
BaseProtocol `yaml:",inline"`
}
func (*UnixProtocolConfig) AsJSON ¶
func (this *UnixProtocolConfig) AsJSON() ([]byte, error)
转换为JSON
func (*UnixProtocolConfig) Init ¶
func (this *UnixProtocolConfig) Init() error
type UserAgentAction ¶ added in v0.6.0
type UserAgentAction = string
const ( UserAgentActionAllow UserAgentAction = "allow" UserAgentActionDeny UserAgentAction = "deny" )
type UserAgentConfig ¶ added in v0.6.0
type UserAgentConfig struct {
IsPrior bool `yaml:"isPrior" json:"isPrior"`
IsOn bool `yaml:"isOn" json:"isOn"`
Filters []*UserAgentFilter `yaml:"filters" json:"filters"`
}
func NewUserAgentConfig ¶ added in v0.6.0
func NewUserAgentConfig() *UserAgentConfig
func (*UserAgentConfig) AllowRequest ¶ added in v0.6.0
func (this *UserAgentConfig) AllowRequest(req *http.Request) bool
func (*UserAgentConfig) Init ¶ added in v0.6.0
func (this *UserAgentConfig) Init() error
type UserAgentFilter ¶ added in v0.6.0
type UserAgentFilter struct {
Keywords []string `yaml:"keywords" json:"keywords"` // 关键词
Action UserAgentAction `yaml:"action" json:"action"` // 动作
// contains filtered or unexported fields
}
func (*UserAgentFilter) Init ¶ added in v0.6.0
func (this *UserAgentFilter) Init() error
func (*UserAgentFilter) Match ¶ added in v0.6.0
func (this *UserAgentFilter) Match(userAgent string) bool
type UserAgentKeyword ¶ added in v0.6.0
type UserAgentKeyword struct {
// contains filtered or unexported fields
}
func NewUserAgentKeyword ¶ added in v0.6.0
func NewUserAgentKeyword(keyword string) *UserAgentKeyword
type UserPlanConfig ¶
type UserPlanConfig struct {
DayTo string `yaml:"dayTo" json:"dayTo"` // 有效期
Plan *PlanConfig `yaml:"plan" json:"plan"`
}
UserPlanConfig 用户套餐配置
func (*UserPlanConfig) IsAvailable ¶
func (this *UserPlanConfig) IsAvailable() bool
IsAvailable 是否有效
type WebPImageConfig ¶
type WebPImageConfig struct {
IsPrior bool `yaml:"isPrior" json:"isPrior"`
IsOn bool `yaml:"isOn" json:"isOn"`
Quality int `yaml:"quality" json:"quality"` // 0-100
MinLength *shared.SizeCapacity `yaml:"minLength" json:"minLength"` // 最小压缩对象比如4m, 24k
MaxLength *shared.SizeCapacity `yaml:"maxLength" json:"maxLength"` // 最大压缩对象
MimeTypes []string `yaml:"mimeTypes" json:"mimeTypes"` // 支持的MimeType,支持image/*这样的通配符使用
Extensions []string `yaml:"extensions" json:"extensions"` // 文件扩展名,包含点符号,不区分大小写
Conds *shared.HTTPRequestCondsConfig `yaml:"conds" json:"conds"` // 匹配条件
// contains filtered or unexported fields
}
WebPImageConfig WebP配置
func (*WebPImageConfig) Init ¶
func (this *WebPImageConfig) Init() error
func (*WebPImageConfig) MatchAccept ¶
func (this *WebPImageConfig) MatchAccept(acceptContentTypes string) bool
MatchAccept 检查客户端是否能接受WebP
func (*WebPImageConfig) MatchRequest ¶
func (this *WebPImageConfig) MatchRequest(requestExt string, formatter shared.Formatter) bool
MatchRequest 是否匹配请求
func (*WebPImageConfig) MatchResponse ¶
func (this *WebPImageConfig) MatchResponse(mimeType string, contentLength int64, requestExt string, formatter shared.Formatter) bool
MatchResponse 是否匹配响应
type WildcardStatus ¶
可能含有x字母的状态码
Source Files
¶
- access_log_queue_config.go
- access_log_storage_command.go
- access_log_storage_es.go
- access_log_storage_file.go
- access_log_storage_syslog.go
- access_log_storage_tcp.go
- access_log_storages.go
- domain_mismatch_action.go
- ftp_server_config.go
- ftp_server_ref.go
- global_config.go
- global_server_config.go
- health_check_config.go
- http_access_log_fields.go
- http_access_log_ref.go
- http_auth_config.go
- http_auth_method_base.go
- http_auth_method_basic.go
- http_auth_method_interface.go
- http_auth_method_sub_request.go
- http_auth_methods.go
- http_auth_policy.go
- http_auth_policy_init.go
- http_auth_policy_ref.go
- http_cache_config.go
- http_cache_policy.go
- http_cache_policy_types.go
- http_cache_ref.go
- http_cache_stale_config.go
- http_cache_storage_file.go
- http_cache_storage_memory.go
- http_charset_config.go
- http_common_headers.go
- http_compression_brotli_config.go
- http_compression_config.go
- http_compression_deflate_config.go
- http_compression_gzip_config.go
- http_compression_gzip_ref.go
- http_compression_types.go
- http_expires_time_config.go
- http_fastcgi_config.go
- http_fastcgi_ref.go
- http_filter_config.go
- http_filter_ref.go
- http_host_redirect_config.go
- http_location_config.go
- http_location_pattern_types.go
- http_location_ref.go
- http_page_config.go
- http_redirect_to_https_config.go
- http_remote_addr_config.go
- http_request_limit_config.go
- http_request_scripts_config.go
- http_rewrite_ref.go
- http_rewrite_rule.go
- http_root_config.go
- http_shutdown_config.go
- http_stat_config.go
- http_status.go
- http_web_config.go
- http_websocket_config.go
- http_websocket_ref.go
- http_wildcard_status.go
- image_webp_config.go
- ip_library_types.go
- ip_version.go
- metric_chart.go
- metric_item_config.go
- metric_item_utils.go
- network_address_config.go
- open_file_cache_config.go
- origin_config.go
- origin_ref.go
- origin_server_group_config.go
- plan_config.go
- protocol.go
- protocol_base.go
- protocol_http_config.go
- protocol_https_config.go
- protocol_tcp_config.go
- protocol_tls_config.go
- protocol_udp_config.go
- protocol_unix_config.go
- proxy_protocol_config.go
- referers_config.go
- reverse_proxy_config.go
- reverse_proxy_ref.go
- scheduling_config.go
- scheduling_group.go
- script_common.go
- script_config.go
- script_group_config.go
- server_address_group.go
- server_config.go
- server_group_config.go
- server_name_config.go
- server_types.go
- traffic_limit_config.go
- traffic_limit_status.go
- uam_config.go
- user_agent_config.go
- user_plan_config.go