Documentation ¶
Index ¶
- Constants
- Variables
- func AllLocationPatternTypes() []maps.Map
- func AllNodeRoles() []string
- func AllSSLClientAuthTypes() []maps.Map
- func AllTimePasts() []maps.Map
- func AllWebsocketForwardModes() []maps.Map
- func ExistNodeRole(role NodeRole) bool
- func FindLocationPatternType(patternType int) maps.Map
- func FindLocationPatternTypeName(patternType int) string
- func FindSSLClientAuthTypeName(authType SSLClientAuthType) string
- func GoSSLClientAuthType(authType SSLClientAuthType) tls.ClientAuthType
- func TimePastUnixTime(past TimePast) (timestamp int64)
- func TimePastUnixTimeWithUnit(number int64, unit TimeUnit) int64
- type ACMEDNSProvider
- type ACMEDNSRecord
- type ACMELocalUser
- type ACMELocalUserList
- type ACMERequest
- func (this *ACMERequest) CertDate() [2]string
- func (this *ACMERequest) CertObject() (*tls.Certificate, error)
- func (this *ACMERequest) Client() (client *lego.Client, err error)
- func (this *ACMERequest) Renew(client *lego.Client) error
- func (this *ACMERequest) Retrieve(client *lego.Client) error
- func (this *ACMERequest) RetrieveDNSRecords(client *lego.Client) (records []*ACMEDNSRecord, err error)
- func (this *ACMERequest) WriteCertFile(path string) error
- func (this *ACMERequest) WriteKeyFile(path string) error
- type ACMEUser
- type AccessLogConfig
- type AccessLogStoragePolicy
- func (this *AccessLogStoragePolicy) Delete() error
- func (this *AccessLogStoragePolicy) MatchConds(formatter func(string) string) bool
- func (this *AccessLogStoragePolicy) MatchKeyword(keyword string) (matched bool, name string, tags []string)
- func (this *AccessLogStoragePolicy) Save() error
- func (this *AccessLogStoragePolicy) Validate() error
- type AccessLogStoragePolicyList
- type BackendConfig
- func (this *BackendConfig) AddRequestGroupId(requestGroupId string)
- func (this *BackendConfig) AddResponseHeader(header *shared.HeaderConfig)
- func (this *BackendConfig) CandidateCodes() []string
- func (this *BackendConfig) CandidateWeight() uint
- func (this *BackendConfig) CheckHealth() bool
- func (this *BackendConfig) CloneState(oldBackend *BackendConfig)
- func (this *BackendConfig) Compatible()
- func (this *BackendConfig) DecreaseConn() int32
- func (this *BackendConfig) DownCallback(callback func(backend *BackendConfig))
- func (this *BackendConfig) FailTimeoutDuration() time.Duration
- func (this *BackendConfig) HasCheckURL() bool
- func (this *BackendConfig) HasHost() bool
- func (this *BackendConfig) HasRequestGroupId(requestGroupId string) bool
- func (this *BackendConfig) HasRequestURI() bool
- func (this *BackendConfig) HasResponseHeaders() bool
- func (this *BackendConfig) IdleTimeoutDuration() time.Duration
- func (this *BackendConfig) IncreaseConn() int32
- func (this *BackendConfig) IncreaseFails() int32
- func (this *BackendConfig) IsFTP() bool
- func (this *BackendConfig) IsHTTP() bool
- func (this *BackendConfig) IsTCP() bool
- func (this *BackendConfig) OnAttach()
- func (this *BackendConfig) OnDetach()
- func (this *BackendConfig) OnDown()
- func (this *BackendConfig) OnUp()
- func (this *BackendConfig) ReadTimeoutDuration() time.Duration
- func (this *BackendConfig) RemoveRequestGroupId(requestGroupId string)
- func (this *BackendConfig) RequestArgs() string
- func (this *BackendConfig) RequestPath() string
- func (this *BackendConfig) RestartChecking()
- func (this *BackendConfig) StopChecking()
- func (this *BackendConfig) Touch()
- func (this *BackendConfig) UniqueKey() string
- func (this *BackendConfig) UpCallback(callback func(backend *BackendConfig))
- func (this *BackendConfig) Validate() error
- type BackendDownEvent
- type BackendList
- func (this *BackendList) AddBackend(backend *BackendConfig)
- func (this *BackendList) AllBackends() []*BackendConfig
- func (this *BackendList) CloneBackendList() *BackendList
- func (this *BackendList) DeleteBackend(backendId string)
- func (this *BackendList) DeleteBackends(backendIds []string)
- func (this *BackendList) FindBackend(backendId string) *BackendConfig
- func (this *BackendList) HasBackends() bool
- func (this *BackendList) NextBackend(call *shared.RequestCall) *BackendConfig
- func (this *BackendList) SchedulingConfig() *SchedulingConfig
- func (this *BackendList) SetSchedulingConfig(scheduling *SchedulingConfig)
- func (this *BackendList) SetupScheduling(isBackup bool)
- func (this *BackendList) ValidateBackends() error
- type BackendListInterface
- type BackendUpEvent
- type Board
- type BoardChart
- type CacheConfig
- type FTPBackendConfig
- type FastcgiConfig
- func (this *FastcgiConfig) Address() string
- func (this *FastcgiConfig) FilterParams(req *http.Request) maps.Map
- func (this *FastcgiConfig) Network() string
- func (this *FastcgiConfig) Param(paramName string) string
- func (this *FastcgiConfig) PathInfoRegexp() *regexp.Regexp
- func (this *FastcgiConfig) ReadTimeoutDuration() time.Duration
- func (this *FastcgiConfig) Validate() error
- type FastcgiList
- func (this *FastcgiList) AddFastcgi(fastcgi *FastcgiConfig)
- func (this *FastcgiList) AllFastcgi() []*FastcgiConfig
- func (this *FastcgiList) FindFastcgi(fastcgiId string) *FastcgiConfig
- func (this *FastcgiList) NextFastcgi() *FastcgiConfig
- func (this *FastcgiList) RemoveFastcgi(fastcgiId string)
- func (this *FastcgiList) ValidateFastcgi() error
- type FastcgiListInterface
- type GzipConfig
- type HSTSConfig
- type IPRangeList
- type LocationConfig
- func (this *LocationConfig) AddCond(cond *shared.RequestCond)
- func (this *LocationConfig) AddPage(page *PageConfig)
- func (this *LocationConfig) AddRequestGroup(group *RequestGroup)
- func (this *LocationConfig) CachePolicyObject() *shared.CachePolicy
- func (this *LocationConfig) CloneState(oldLocation *LocationConfig)
- func (this *LocationConfig) Compatible(version string)
- func (this *LocationConfig) IsCaseInsensitive() bool
- func (this *LocationConfig) IsReverse() bool
- func (this *LocationConfig) Match(path string, formatter func(source string) string) (map[string]string, bool)
- func (this *LocationConfig) MatchKeyword(keyword string) (matched bool, name string, tags []string)
- func (this *LocationConfig) MatchRequestGroup(formatter func(source string) string) *RequestGroup
- func (this *LocationConfig) MaxBodyBytes() int64
- func (this *LocationConfig) NextBackend(call *shared.RequestCall) *BackendConfig
- func (this *LocationConfig) OnAttach()
- func (this *LocationConfig) OnDetach()
- func (this *LocationConfig) PatternString() string
- func (this *LocationConfig) PatternType() int
- func (this *LocationConfig) RefersProxy(proxyId string) bool
- func (this *LocationConfig) SetPattern(pattern string, patternType int, caseInsensitive bool, reverse bool)
- func (this *LocationConfig) SetupScheduling(isBackup bool)
- func (this *LocationConfig) Validate() error
- func (this *LocationConfig) WAF() *teawaf.WAF
- type LocationPatternType
- type MimeTypeRule
- type NodeConfig
- type NodeRole
- type PageConfig
- type RequestGroup
- func (this *RequestGroup) AddCond(cond *shared.RequestCond)
- func (this *RequestGroup) AddIPRange(ipRange *shared.IPRangeConfig)
- func (this *RequestGroup) AddRequestHeader(header *shared.HeaderConfig)
- func (this *RequestGroup) AddResponseHeader(header *shared.HeaderConfig)
- func (this *RequestGroup) Copy() *RequestGroup
- func (this *RequestGroup) HasFilters() bool
- func (this *RequestGroup) HasRequestHeaders() bool
- func (this *RequestGroup) HasResponseHeaders() bool
- func (this *RequestGroup) Match(formatter func(source string) string) bool
- func (this *RequestGroup) Validate() error
- type RewriteList
- func (this *RewriteList) AddRewriteRule(rewrite *RewriteRule)
- func (this *RewriteList) AllRewriteRules() []*RewriteRule
- func (this *RewriteList) FindRewriteRule(rewriteId string) *RewriteRule
- func (this *RewriteList) RemoveRewriteRule(rewriteId string)
- func (this *RewriteList) ValidateRewriteRules() error
- type RewriteListInterface
- type RewriteRule
- func (this *RewriteRule) AddCond(cond *shared.RequestCond)
- func (this *RewriteRule) AddFlag(flag string, options maps.Map)
- func (this *RewriteRule) IsExternalURL(url string) bool
- func (this *RewriteRule) Match(requestPath string, formatter func(source string) string) (replace string, varMapping map[string]string, matched bool)
- func (this *RewriteRule) RedirectMode() string
- func (this *RewriteRule) RefersProxy(proxyId string) bool
- func (this *RewriteRule) ResetFlags()
- func (this *RewriteRule) TargetProxy() string
- func (this *RewriteRule) TargetType() int
- func (this *RewriteRule) TargetURL() string
- func (this *RewriteRule) Validate() error
- type SSLCertConfig
- func (this *SSLCertConfig) CertObject() *tls.Certificate
- func (this *SSLCertConfig) DNSNames() []string
- func (this *SSLCertConfig) DeleteFiles() error
- func (this *SSLCertConfig) FindShared() *SSLCertConfig
- func (this *SSLCertConfig) FullCertPath() string
- func (this *SSLCertConfig) FullKeyPath() string
- func (this *SSLCertConfig) Issuer() pkix.Name
- func (this *SSLCertConfig) MatchDomain(domain string) bool
- func (this *SSLCertConfig) MatchKeyword(keyword string) (matched bool, name string, tags []string)
- func (this *SSLCertConfig) ReadCert() ([]byte, error)
- func (this *SSLCertConfig) ReadKey() ([]byte, error)
- func (this *SSLCertConfig) TimeAfter() time.Time
- func (this *SSLCertConfig) TimeBefore() time.Time
- func (this *SSLCertConfig) Validate() error
- type SSLCertList
- func (this *SSLCertList) AddCert(cert *SSLCertConfig)
- func (this *SSLCertList) AddTask(task *SSLCertTask)
- func (this *SSLCertList) FindCert(certId string) *SSLCertConfig
- func (this *SSLCertList) FindTask(taskId string) *SSLCertTask
- func (this *SSLCertList) RemoveCert(certId string)
- func (this *SSLCertList) RemoveTask(taskId string)
- func (this *SSLCertList) Save() error
- type SSLCertTask
- type SSLClientAuthType
- type SSLConfig
- func (this *SSLConfig) AddCert(cert *SSLCertConfig)
- func (this *SSLConfig) AddCertTask(certTask *SSLCertTask)
- func (this *SSLConfig) CAPool() *x509.CertPool
- func (this *SSLConfig) ContainsFile(file string) bool
- func (this *SSLConfig) DeleteFiles() error
- func (this *SSLConfig) FindCert(certId string) *SSLCertConfig
- func (this *SSLConfig) FindCertTask(certTaskId string) *SSLCertTask
- func (this *SSLConfig) FirstCert() *tls.Certificate
- func (this *SSLConfig) MatchDomain(domain string) (cert *tls.Certificate, ok bool)
- func (this *SSLConfig) RemoveCertTask(certTaskId string)
- func (this *SSLConfig) TLSCipherSuites() []uint16
- func (this *SSLConfig) TLSMinVersion() uint16
- func (this *SSLConfig) Validate() error
- type SchedulingConfig
- type ServerConfig
- func (this *ServerConfig) AddListen(address string)
- func (this *ServerConfig) AddLocation(location *LocationConfig)
- func (this *ServerConfig) AddName(name ...string)
- func (this *ServerConfig) AddNoticeReceiver(level notices.NoticeLevel, receiver *notices.NoticeReceiver)
- func (this *ServerConfig) AddPage(page *PageConfig)
- func (this *ServerConfig) AddRequestGroup(group *RequestGroup)
- func (this *ServerConfig) AddStatItem(item string)
- func (this *ServerConfig) CachePolicyObject() *shared.CachePolicy
- func (this *ServerConfig) CloneState(oldServer *ServerConfig)
- func (this *ServerConfig) Delete() error
- func (this *ServerConfig) FindAllNoticeReceivers(level ...notices.NoticeLevel) []*notices.NoticeReceiver
- func (this *ServerConfig) FindBackendList(locationId string, websocket bool) (backendList BackendListInterface, err error)
- func (this *ServerConfig) FindCerts(certId string) (result []*SSLCertConfig)
- func (this *ServerConfig) FindFastcgiList(locationId string) (fastcgiList FastcgiListInterface, err error)
- func (this *ServerConfig) FindHeaderList(locationId string, backendId string, rewriteId string, fastcgiId string) (headerList shared.HeaderListInterface, err error)
- func (this *ServerConfig) FindLocation(locationId string) *LocationConfig
- func (this *ServerConfig) FindRequestGroup(groupId string) *RequestGroup
- func (this *ServerConfig) FindRewriteList(locationId string) (rewriteList RewriteListInterface, err error)
- func (this *ServerConfig) FirstName() string
- func (this *ServerConfig) IsHTTP() bool
- func (this *ServerConfig) IsTCP() bool
- func (this *ServerConfig) LocationAtIndex(index int) *LocationConfig
- func (this *ServerConfig) MatchKeyword(keyword string) (matched bool, name string, tags []string)
- func (this *ServerConfig) MatchName(name string) (matchedName string, matched bool)
- func (this *ServerConfig) MatchRequestGroup(formatter func(source string) string) *RequestGroup
- func (this *ServerConfig) MaxBodyBytes() int64
- func (this *ServerConfig) MoveLocation(fromIndex int, toIndex int)
- func (this *ServerConfig) NextBackend(call *shared.RequestCall) *BackendConfig
- func (this *ServerConfig) NextBackendIgnore(call *shared.RequestCall, backendIds []string) *BackendConfig
- func (this *ServerConfig) OnAttach()
- func (this *ServerConfig) OnDetach()
- func (this *ServerConfig) RefersProxy(proxyId string) (description string, referred bool)
- func (this *ServerConfig) RemoveLocation(locationId string)
- func (this *ServerConfig) RemoveNoticeReceiver(level notices.NoticeLevel, receiverId string)
- func (this *ServerConfig) RemoveRequestGroup(groupId string)
- func (this *ServerConfig) RemoveStatItem(item string)
- func (this *ServerConfig) Save() error
- func (this *ServerConfig) SetupNoticeItems()
- func (this *ServerConfig) SetupNoticeItemsFromRequest(req *http.Request)
- func (this *ServerConfig) SetupScheduling(isBackup bool)
- func (this *ServerConfig) Validate() error
- func (this *ServerConfig) WAF() *teawaf.WAF
- type ServerList
- type ShutdownConfig
- type TCPConfig
- type TLSCipherSuite
- type TLSVersion
- type TimePast
- type TimeUnit
- type TunnelConfig
- type WAFList
- type WebConfig
- type WebsocketConfig
- func (this *WebsocketConfig) AddRequestGroup(group *RequestGroup)
- func (this *WebsocketConfig) CloneState(oldWebsocket *WebsocketConfig)
- func (this *WebsocketConfig) ForwardModeSummary() maps.Map
- func (this *WebsocketConfig) HandshakeTimeoutDuration() time.Duration
- func (this *WebsocketConfig) MatchOrigin(origin string) bool
- func (this *WebsocketConfig) MatchRequestGroup(formatter func(source string) string) *RequestGroup
- func (this *WebsocketConfig) NextBackend(call *shared.RequestCall) *BackendConfig
- func (this *WebsocketConfig) OnDetach()
- func (this *WebsocketConfig) SetupScheduling(isBackup bool)
- func (this *WebsocketConfig) Validate() error
- type WebsocketForwardMode
- type WildcardStatus
Constants ¶
const ( EventBackendDown teaevents.EventType = "EventBackendDown" EventBackendUp teaevents.EventType = "EventBackendUp" )
const ( LocationPatternTypePrefix = 1 LocationPatternTypeExact = 2 LocationPatternTypeRegexp = 3 )
内置的匹配类型定义
const ( NodeRoleMaster = "MASTER" NodeRoleSlave = "SLAVE" )
const ( RewriteTargetProxy = 1 RewriteTargetURL = 2 )
const ( RewriteFlagRedirect = "r" // 跳转,TODO: 实现 302, 305 RewriteFlagProxy = "p" // 代理 )
const ( WebsocketForwardModeWebsocket = "websocket" WebsocketForwardModeHttp = "http" )
Variables ¶
var AllTLSCipherSuites = []TLSCipherSuite{
"TLS_RSA_WITH_RC4_128_SHA",
"TLS_RSA_WITH_3DES_EDE_CBC_SHA",
"TLS_RSA_WITH_AES_128_CBC_SHA",
"TLS_RSA_WITH_AES_256_CBC_SHA",
"TLS_RSA_WITH_AES_128_CBC_SHA256",
"TLS_RSA_WITH_AES_128_GCM_SHA256",
"TLS_RSA_WITH_AES_256_GCM_SHA384",
"TLS_ECDHE_ECDSA_WITH_RC4_128_SHA",
"TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA",
"TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA",
"TLS_ECDHE_RSA_WITH_RC4_128_SHA",
"TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA",
"TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA",
"TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA",
"TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256",
"TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256",
"TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256",
"TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256",
"TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384",
"TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384",
"TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305",
"TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305",
"TLS_AES_128_GCM_SHA256",
"TLS_AES_256_GCM_SHA384",
"TLS_CHACHA20_POLY1305_SHA256",
}
var AllTlsVersions = []TLSVersion{"SSL 3.0", "TLS 1.0", "TLS 1.1", "TLS 1.2", "TLS 1.3"}
var (
DefaultGzipMimeTypes = []string{"text/html", "application/json"}
)
默认的文件类型
var TLSIntermediateCipherSuites = []string{
"TLS_AES_128_GCM_SHA256",
"TLS_CHACHA20_POLY1305_SHA256",
"TLS_AES_256_GCM_SHA384",
"TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305",
"TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305",
"TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256",
"TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256",
"TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384",
"TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384",
"TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256",
"TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256",
"TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA",
"TLS_RSA_WITH_3DES_EDE_CBC_SHA",
}
var TLSModernCipherSuites = []string{
"TLS_AES_128_GCM_SHA256",
"TLS_CHACHA20_POLY1305_SHA256",
"TLS_AES_256_GCM_SHA384",
"TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305",
"TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305",
"TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256",
"TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256",
"TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384",
"TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384",
}
Functions ¶
func AllTimePasts ¶ added in v0.1.7
func FindLocationPatternTypeName ¶
查找单个匹配类型名称
func FindSSLClientAuthTypeName ¶ added in v0.1.7
func FindSSLClientAuthTypeName(authType SSLClientAuthType) string
查找单个认证方式的名称
func GoSSLClientAuthType ¶ added in v0.1.7
func GoSSLClientAuthType(authType SSLClientAuthType) tls.ClientAuthType
认证类型和tls包内类型的映射
func TimePastUnixTime ¶ added in v0.1.7
func TimePastUnixTimeWithUnit ¶ added in v0.1.7
Types ¶
type ACMEDNSProvider ¶ added in v0.1.5
type ACMEDNSProvider struct {
// contains filtered or unexported fields
}
自定义ACME DNS解析
func NewACMEDNSProvider ¶ added in v0.1.5
func NewACMEDNSProvider(apiAuthToken string) *ACMEDNSProvider
func (*ACMEDNSProvider) CleanUp ¶ added in v0.1.5
func (this *ACMEDNSProvider) CleanUp(domain, token, keyAuth string) error
func (*ACMEDNSProvider) Present ¶ added in v0.1.5
func (this *ACMEDNSProvider) Present(domain, token, keyAuth string) error
type ACMEDNSRecord ¶ added in v0.1.5
type ACMEDNSRecord struct { FQDN string `yaml:"fqdn" json:"fqdn"` Value string `yaml:"value" json:"value"` }
ACME DNS记录
type ACMELocalUser ¶ added in v0.1.5
type ACMELocalUser struct { Id string `yaml:"id" json:"id"` Name string `yaml:"name" json:"name"` On bool `yaml:"on" json:"on"` Email string `yaml:"email" json:"email"` Key string `yaml:"key" json:"key"` // base64 URI string `yaml:"uri" json:"uri"` }
本地用户信息
type ACMELocalUserList ¶ added in v0.1.5
type ACMELocalUserList struct {
Users []*ACMELocalUser `yaml:"users" json:"users"`
}
本地用户列表
func SharedACMELocalUserList ¶ added in v0.1.5
func SharedACMELocalUserList() *ACMELocalUserList
取得共享的本地用户列表
func (*ACMELocalUserList) AddUser ¶ added in v0.1.5
func (this *ACMELocalUserList) AddUser(user *ACMELocalUser)
添加用户
func (*ACMELocalUserList) FindUser ¶ added in v0.1.5
func (this *ACMELocalUserList) FindUser(userId string) *ACMELocalUser
查找用户
func (*ACMELocalUserList) RemoveUser ¶ added in v0.1.5
func (this *ACMELocalUserList) RemoveUser(userId string)
删除用户
type ACMERequest ¶ added in v0.1.5
type ACMERequest struct { User *ACMELocalUser `yaml:"user" json:"user"` Domains []string `yaml:"domains" json:"domains"` DNSRecords []*ACMEDNSRecord `yaml:"dnsRecords" json:"dnsRecords"` CertURL string `yaml:"certURL" json:"certURL"` Cert string `yaml:"cert" json:"cert"` Key string `yaml:"key" json:"key"` }
ACME DNS Request
func (*ACMERequest) CertObject ¶ added in v0.1.5
func (this *ACMERequest) CertObject() (*tls.Certificate, error)
获取证书对象
func (*ACMERequest) Client ¶ added in v0.1.5
func (this *ACMERequest) Client() (client *lego.Client, err error)
获取连接客户端
func (*ACMERequest) Renew ¶ added in v0.1.5
func (this *ACMERequest) Renew(client *lego.Client) error
更新
func (*ACMERequest) Retrieve ¶ added in v0.1.5
func (this *ACMERequest) Retrieve(client *lego.Client) error
获取证书信息
func (*ACMERequest) RetrieveDNSRecords ¶ added in v0.1.5
func (this *ACMERequest) RetrieveDNSRecords(client *lego.Client) (records []*ACMEDNSRecord, err error)
获取要设置的DNS记录
func (*ACMERequest) WriteCertFile ¶ added in v0.1.5
func (this *ACMERequest) WriteCertFile(path string) error
写入证书文件
func (*ACMERequest) WriteKeyFile ¶ added in v0.1.5
func (this *ACMERequest) WriteKeyFile(path string) error
写入密钥文件
type ACMEUser ¶ added in v0.1.5
type ACMEUser struct { Email string Registration *registration.Resource Key crypto.PrivateKey }
ACME用户账号定义
func (*ACMEUser) GetPrivateKey ¶ added in v0.1.5
func (this *ACMEUser) GetPrivateKey() crypto.PrivateKey
func (*ACMEUser) GetRegistration ¶ added in v0.1.5
func (this *ACMEUser) GetRegistration() *registration.Resource
type AccessLogConfig ¶
type AccessLogConfig struct { Id string `yaml:"id" json:"id"` On bool `yaml:"on" json:"on"` 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 StorageOnly bool `yaml:"storageOnly" json:"storageOnly"` // 是否只输出到存储策略 StoragePolicies []string `yaml:"storagePolicies" json:"storagePolicies"` // 存储策略Ids }
代理访问日志配置
func (*AccessLogConfig) ContainsStoragePolicy ¶ added in v0.1.6
func (this *AccessLogConfig) ContainsStoragePolicy(storagePolicyId string) bool
是否包含某个存储策略
func (*AccessLogConfig) Match ¶ added in v0.1.5
func (this *AccessLogConfig) Match(status int) bool
判断是否应该记录
type AccessLogStoragePolicy ¶ added in v0.1.6
type AccessLogStoragePolicy struct { Id string `yaml:"id" json:"id"` Name string `yaml:"name" json:"name"` On bool `yaml:"bool" json:"on"` Type string `yaml:"type" json:"type"` // 存储类型 Options map[string]interface{} `yaml:"options" json:"options"` // 存储选项 Cond []*shared.RequestCond `yaml:"cond" json:"cond"` // 请求条件 }
日志存储策略 存储在configs/accesslog.storage.$id.conf
func NewAccessLogStoragePolicy ¶ added in v0.1.6
func NewAccessLogStoragePolicy() *AccessLogStoragePolicy
创建新策略
func NewAccessLogStoragePolicyFromId ¶ added in v0.1.6
func NewAccessLogStoragePolicyFromId(id string) *AccessLogStoragePolicy
从文件中加载策略
func (*AccessLogStoragePolicy) Delete ¶ added in v0.1.6
func (this *AccessLogStoragePolicy) Delete() error
删除
func (*AccessLogStoragePolicy) MatchConds ¶ added in v0.1.8
func (this *AccessLogStoragePolicy) MatchConds(formatter func(string) string) bool
匹配条件
func (*AccessLogStoragePolicy) MatchKeyword ¶ added in v0.1.7
func (this *AccessLogStoragePolicy) MatchKeyword(keyword string) (matched bool, name string, tags []string)
匹配关键词
func (*AccessLogStoragePolicy) Save ¶ added in v0.1.6
func (this *AccessLogStoragePolicy) Save() error
保存
func (*AccessLogStoragePolicy) Validate ¶ added in v0.1.8
func (this *AccessLogStoragePolicy) Validate() error
校验
type AccessLogStoragePolicyList ¶ added in v0.1.6
type AccessLogStoragePolicyList struct {
Ids []string `yaml:"id" json:"id"`
}
存储策略列表
func SharedAccessLogStoragePolicyList ¶ added in v0.1.6
func SharedAccessLogStoragePolicyList() *AccessLogStoragePolicyList
获取共享的存储策略列表
func (*AccessLogStoragePolicyList) AddId ¶ added in v0.1.6
func (this *AccessLogStoragePolicyList) AddId(id string)
添加策略ID
func (*AccessLogStoragePolicyList) FindAllPolicies ¶ added in v0.1.6
func (this *AccessLogStoragePolicyList) FindAllPolicies() []*AccessLogStoragePolicy
查找所有的策略列表
func (*AccessLogStoragePolicyList) RemoveId ¶ added in v0.1.6
func (this *AccessLogStoragePolicyList) RemoveId(id string)
删除策略ID
func (*AccessLogStoragePolicyList) Save ¶ added in v0.1.6
func (this *AccessLogStoragePolicyList) Save() error
保存
type BackendConfig ¶
type BackendConfig struct { shared.HeaderList `yaml:",inline"` TeaVersion string `yaml:"teaVersion" json:"teaVersion"` On bool `yaml:"on" json:"on"` // 是否启用 Id string `yaml:"id" json:"id"` // ID Version int `yaml:"version" json:"version"` // 版本号 Code string `yaml:"code" json:"code"` // 代号 Address string `yaml:"address" json:"address"` // 地址 Scheme string `yaml:"scheme" json:"scheme"` // 协议,http、https、tcp、tcp+tls、ftp Weight uint `yaml:"weight" json:"weight"` // 权重 IsBackup bool `yaml:"backup" json:"isBackup"` // 是否为备份 FailTimeout string `yaml:"failTimeout" json:"failTimeout"` // 连接失败超时 ReadTimeout string `yaml:"readTimeout" json:"readTimeout"` // 读取超时时间 IdleTimeout string `yaml:"idleTimeout" json:"idleTimeout"` // 空闲连接超时时间 MaxFails int32 `yaml:"maxFails" json:"maxFails"` // 最多失败次数 CurrentFails int32 `yaml:"currentFails" json:"currentFails"` // 当前已失败次数 MaxConns int32 `yaml:"maxConns" json:"maxConns"` // 最大并发连接数 CurrentConns int32 `yaml:"currentConns" json:"currentConns"` // 当前连接数 IdleConns int32 `yaml:"idleConns" json:"idleConns"` // 最大空闲连接数 IsDown bool `yaml:"down" json:"isDown"` // 是否下线 DownTime time.Time `yaml:"downTime,omitempty" json:"downTime,omitempty"` // 下线时间 RequestGroupIds []string `yaml:"requestGroupIds" json:"requestGroupIds"` // 所属请求分组 RequestURI string `yaml:"requestURI" json:"requestURI"` // 转发后的请求URI ResponseHeaders []*shared.HeaderConfig `yaml:"responseHeaders" json:"responseHeaders"` // 响应Header Host string `yaml:"host" json:"host"` // 自定义主机名 // 健康检查URL,目前支持: // - http|https 返回2xx-3xx认为成功 CheckOn bool `yaml:"checkOn" json:"checkOn"` // 是否开启 CheckURL string `yaml:"checkURL" json:"checkURL"` CheckInterval int `yaml:"checkInterval" json:"checkInterval"` CheckTimeout string `yaml:"checkTimeout" json:"checkTimeout"` // 超时时间 Cert *SSLCertConfig `yaml:"cert" json:"cert"` // 请求源服务器用的证书 // ftp FTP *FTPBackendConfig `yaml:"ftp" json:"ftp"` // contains filtered or unexported fields }
服务后端配置
func (*BackendConfig) AddRequestGroupId ¶ added in v0.1.2
func (this *BackendConfig) AddRequestGroupId(requestGroupId string)
添加请求分组
func (*BackendConfig) AddResponseHeader ¶ added in v0.1.2
func (this *BackendConfig) AddResponseHeader(header *shared.HeaderConfig)
添加响应Header
func (*BackendConfig) CheckHealth ¶ added in v0.1.2
func (this *BackendConfig) CheckHealth() bool
健康检查
func (*BackendConfig) CloneState ¶ added in v0.1.6
func (this *BackendConfig) CloneState(oldBackend *BackendConfig)
克隆状态
func (*BackendConfig) DecreaseConn ¶
func (this *BackendConfig) DecreaseConn() int32
减少连接数,并返回减少之后的数字
func (*BackendConfig) DownCallback ¶ added in v0.1.2
func (this *BackendConfig) DownCallback(callback func(backend *BackendConfig))
增加下线回调
func (*BackendConfig) FailTimeoutDuration ¶
func (this *BackendConfig) FailTimeoutDuration() time.Duration
连接超时时间
func (*BackendConfig) HasCheckURL ¶ added in v0.1.2
func (this *BackendConfig) HasCheckURL() bool
判断是否有URL Check
func (*BackendConfig) HasHost ¶ added in v0.1.3
func (this *BackendConfig) HasHost() bool
判断是否有自定义主机名
func (*BackendConfig) HasRequestGroupId ¶ added in v0.1.2
func (this *BackendConfig) HasRequestGroupId(requestGroupId string) bool
判断是否有某个情趣分组ID
func (*BackendConfig) HasRequestURI ¶ added in v0.1.2
func (this *BackendConfig) HasRequestURI() bool
判断是否设置RequestURI
func (*BackendConfig) HasResponseHeaders ¶ added in v0.1.2
func (this *BackendConfig) HasResponseHeaders() bool
判断是否有响应Header
func (*BackendConfig) IdleTimeoutDuration ¶ added in v0.1.7
func (this *BackendConfig) IdleTimeoutDuration() time.Duration
保持空闲连接时间
func (*BackendConfig) IncreaseConn ¶
func (this *BackendConfig) IncreaseConn() int32
增加连接数,并返回增加之后的数字
func (*BackendConfig) ReadTimeoutDuration ¶
func (this *BackendConfig) ReadTimeoutDuration() time.Duration
读取超时时间
func (*BackendConfig) RemoveRequestGroupId ¶ added in v0.1.2
func (this *BackendConfig) RemoveRequestGroupId(requestGroupId string)
删除某个请求分组
func (*BackendConfig) RequestArgs ¶ added in v0.1.2
func (this *BackendConfig) RequestArgs() string
获取转发后的附加参数
func (*BackendConfig) RequestPath ¶ added in v0.1.2
func (this *BackendConfig) RequestPath() string
获取转发后的Path
func (*BackendConfig) RestartChecking ¶ added in v0.1.2
func (this *BackendConfig) RestartChecking()
重启检查
func (*BackendConfig) StopChecking ¶ added in v0.1.2
func (this *BackendConfig) StopChecking()
停止Checking
func (*BackendConfig) UniqueKey ¶ added in v0.1.7
func (this *BackendConfig) UniqueKey() string
获取唯一ID
func (*BackendConfig) UpCallback ¶ added in v0.1.2
func (this *BackendConfig) UpCallback(callback func(backend *BackendConfig))
增加上线回调
type BackendDownEvent ¶ added in v0.1.8
type BackendDownEvent struct { Server *ServerConfig Backend *BackendConfig Location *LocationConfig Websocket *WebsocketConfig }
后端服务器下线事件
func (*BackendDownEvent) Type ¶ added in v0.1.8
func (this *BackendDownEvent) Type() string
type BackendList ¶
type BackendList struct { Backends []*BackendConfig `yaml:"backends" json:"backends"` Scheduling *SchedulingConfig `yaml:"scheduling" json:"scheduling"` // 调度算法选项 // contains filtered or unexported fields }
BackendList定义
func (*BackendList) AddBackend ¶
func (this *BackendList) AddBackend(backend *BackendConfig)
添加Backend
func (*BackendList) AllBackends ¶
func (this *BackendList) AllBackends() []*BackendConfig
所有的Backends
func (*BackendList) CloneBackendList ¶ added in v0.1.6
func (this *BackendList) CloneBackendList() *BackendList
克隆
func (*BackendList) DeleteBackend ¶
func (this *BackendList) DeleteBackend(backendId string)
删除后端服务器
func (*BackendList) DeleteBackends ¶ added in v0.1.6
func (this *BackendList) DeleteBackends(backendIds []string)
删除一组后端服务器
func (*BackendList) FindBackend ¶
func (this *BackendList) FindBackend(backendId string) *BackendConfig
根据ID查找后端服务器
func (*BackendList) HasBackends ¶ added in v0.1.2
func (this *BackendList) HasBackends() bool
判断是否有后端服务器
func (*BackendList) NextBackend ¶
func (this *BackendList) NextBackend(call *shared.RequestCall) *BackendConfig
取得下一个可用的后端服务
func (*BackendList) SchedulingConfig ¶
func (this *BackendList) SchedulingConfig() *SchedulingConfig
调度算法
func (*BackendList) SetSchedulingConfig ¶
func (this *BackendList) SetSchedulingConfig(scheduling *SchedulingConfig)
设置调度算法
func (*BackendList) SetupScheduling ¶
func (this *BackendList) SetupScheduling(isBackup bool)
设置调度算法
type BackendListInterface ¶
type BackendListInterface interface { // 校验 ValidateBackends() error // 添加Backend AddBackend(backend *BackendConfig) // 所有的Backends AllBackends() []*BackendConfig // 删除后端服务器 DeleteBackend(backendId string) // 查找后端服务器 FindBackend(backendId string) *BackendConfig // 调度算法 SchedulingConfig() *SchedulingConfig // 设置调度算法 SetSchedulingConfig(scheduling *SchedulingConfig) // 重新建立调度 SetupScheduling(isBackup bool) }
BackendList接口定义
type BackendUpEvent ¶ added in v0.1.8
type BackendUpEvent struct { Server *ServerConfig Backend *BackendConfig Location *LocationConfig Websocket *WebsocketConfig }
后端服务器上线事件
func (*BackendUpEvent) Type ¶ added in v0.1.8
func (this *BackendUpEvent) Type() string
type BoardChart ¶
type BoardChart struct { WidgetId string `yaml:"widgetId" json:"widgetId"` ChartId string `yaml:"chartId" json:"chartId"` }
看板图表
type CacheConfig ¶
type CacheConfig struct { Filename string `yaml:"filename" json:"filename"` // 文件名 PolicyFiles []string `yaml:"policyFiles" json:"policyFiles"` // 策略文件 }
缓存管理
func (*CacheConfig) FindAllPolicies ¶
func (this *CacheConfig) FindAllPolicies() []*shared.CachePolicy
查找所有的缓存策略
type FTPBackendConfig ¶ added in v0.1.9
type FTPBackendConfig struct { Username string `yaml:"username" json:"username"` // 用户名 Password string `yaml:"password" json:"password"` // 密码 Dir string `yaml:"dir" json:"dir"` // 目录 }
backend
type FastcgiConfig ¶
type FastcgiConfig struct { shared.HeaderList `yaml:",inline"` On bool `yaml:"on" json:"on"` Id string `yaml:"id" json:"id"` // fastcgi地址配置 // 支持unix:/tmp/php-fpm.sock ... Pass string `yaml:"pass" json:"pass"` Index string `yaml:"index" json:"index"` //@TODO Params map[string]string `yaml:"params" json:"params"` //@TODO ReadTimeout string `yaml:"readTimeout" json:"readTimeout"` // @TODO 读取超时时间 SendTimeout string `yaml:"sendTimeout" json:"sendTimeout"` // @TODO 发送超时时间 ConnTimeout string `yaml:"connTimeout" json:"connTimeout"` // @TODO 连接超时时间 PoolSize int `yaml:"poolSize" json:"poolSize"` // 连接池尺寸 PathInfoPattern string `yaml:"pathInfoPattern" json:"pathInfoPattern"` // PATH_INFO匹配正则 // contains filtered or unexported fields }
Fastcgi配置
func (*FastcgiConfig) FilterParams ¶
func (this *FastcgiConfig) FilterParams(req *http.Request) maps.Map
过滤参数
func (*FastcgiConfig) PathInfoRegexp ¶ added in v0.1.2
func (this *FastcgiConfig) PathInfoRegexp() *regexp.Regexp
PATH_INFO正则
func (*FastcgiConfig) ReadTimeoutDuration ¶
func (this *FastcgiConfig) ReadTimeoutDuration() time.Duration
超时时间
type FastcgiList ¶
type FastcgiList struct {
Fastcgi []*FastcgiConfig `yaml:"fastcgi" json:"fastcgi"`
}
FastcgiList定义
func (*FastcgiList) AddFastcgi ¶
func (this *FastcgiList) AddFastcgi(fastcgi *FastcgiConfig)
添加Fastcgi
func (*FastcgiList) AllFastcgi ¶
func (this *FastcgiList) AllFastcgi() []*FastcgiConfig
取得所有的Fastcgi
func (*FastcgiList) FindFastcgi ¶
func (this *FastcgiList) FindFastcgi(fastcgiId string) *FastcgiConfig
根据ID查找Fastcgi
func (*FastcgiList) NextFastcgi ¶
func (this *FastcgiList) NextFastcgi() *FastcgiConfig
查找下一个可用的Fastcgi
func (*FastcgiList) RemoveFastcgi ¶
func (this *FastcgiList) RemoveFastcgi(fastcgiId string)
删除Fastcgi
type FastcgiListInterface ¶
type FastcgiListInterface interface { // 校验 ValidateFastcgi() error // 取得所有的Fastcgi AllFastcgi() []*FastcgiConfig // 根据ID查找Fastcgi FindFastcgi(fastcgiId string) *FastcgiConfig // 添加Fastcgi AddFastcgi(fastcgi *FastcgiConfig) // 删除Fastcgi RemoveFastcgi(fastcgiId string) // 查找下一个可用的Fastcgi NextFastcgi() *FastcgiConfig }
FastcgiList接口定义
type GzipConfig ¶ added in v0.1.8
type GzipConfig struct { Level int8 `yaml:"level" json:"level"` // 1-9 MinLength string `yaml:"minLength" json:"minLength"` // 比如4m, 24k MimeTypes []string `yaml:"mimeTypes" json:"mimeTypes"` // 比如text/html, text/* // contains filtered or unexported fields }
gzip配置
func (*GzipConfig) MatchContentType ¶ added in v0.1.8
func (this *GzipConfig) MatchContentType(contentType string) bool
检查是否匹配Content-Type
type HSTSConfig ¶ added in v0.1.5
type HSTSConfig struct { On bool `yaml:"on" json:"on"` MaxAge int `yaml:"maxAge" json:"maxAge"` // 单位秒 IncludeSubDomains bool `yaml:"includeSubDomains" json:"includeSubDomains"` Preload bool `yaml:"preload" json:"preload"` Domains []string `yaml:"domains" json:"domains"` // contains filtered or unexported fields }
HSTS设置 参考: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Strict-Transport-Security
func (*HSTSConfig) HeaderKey ¶ added in v0.1.5
func (this *HSTSConfig) HeaderKey() string
Header Key
func (*HSTSConfig) HeaderValue ¶ added in v0.1.5
func (this *HSTSConfig) HeaderValue() string
取得当前的Header值
func (*HSTSConfig) Match ¶ added in v0.1.5
func (this *HSTSConfig) Match(domain string) bool
判断是否匹配域名
type IPRangeList ¶ added in v0.1.2
type IPRangeList struct {
IPRanges []*shared.IPRangeConfig
}
IP Range列表
func (*IPRangeList) AddIPRange ¶ added in v0.1.2
func (this *IPRangeList) AddIPRange(ipRange *shared.IPRangeConfig)
添加
func (*IPRangeList) RemoveIPRange ¶ added in v0.1.2
func (this *IPRangeList) RemoveIPRange(ipRangeId string)
删除
type LocationConfig ¶
type LocationConfig struct { shared.HeaderList `yaml:",inline"` FastcgiList `yaml:",inline"` RewriteList `yaml:",inline"` BackendList `yaml:",inline"` On bool `yaml:"on" json:"on"` // 是否开启 Id string `yaml:"id" json:"id"` // ID Name string `yaml:"name" json:"name"` // 名称 Pattern string `yaml:"pattern" json:"pattern"` // 匹配规则 Async bool `yaml:"async" json:"async"` // 是否异步请求 @TODO Notify []interface{} `yaml:"notify" json:"notify"` // 转发请求,可以配置转发策略 @TODO LogOnly bool `yaml:"logOnly" json:"logOnly"` // 是否只记录日志 @TODO URLPrefix string `yaml:"urlPrefix" json:"urlPrefix"` // 实际的URL前缀,目前和资源根目录配合使用 Root string `yaml:"root" json:"root"` // 资源根目录 Index []string `yaml:"index" json:"index"` // 默认文件 Charset string `yaml:"charset" json:"charset"` // 字符集设置 MaxBodySize string `yaml:"maxBodySize" json:"maxBodySize"` // 请求body最大尺寸 GzipLevel1 int8 `yaml:"gzipLevel" json:"gzipLevel"` // deprecated v0.1.8 Gzip压缩级别 GzipMinLength1 string `yaml:"gzipMinLength" json:"gzipMinLength"` // deprecated v0.1.8 需要压缩的最小内容尺寸 Gzip *GzipConfig `yaml:"gzip" json:"gzip"` AccessPolicy *shared.AccessPolicy `yaml:"accessPolicy" json:"accessPolicy"` // 访问控制 RedirectToHttps bool `yaml:"redirectToHttps" json:"redirectToHttps"` // 是否自动跳转到Https // 日志 AccessLog []*AccessLogConfig `yaml:"accessLog" json:"accessLog"` // 访问日志设置,如果为空表示继承上一级设置 DisableAccessLog1 bool `yaml:"disableAccessLog" json:"disableAccessLog"` // deprecated: 是否禁用访问日志 AccessLogFields1 []int `yaml:"accessLogFields" json:"accessLogFields"` // deprecated: 访问日志保留的字段,如果为nil,则表示没有设置 DisableStat bool `yaml:"disableStat" json:"disableStat"` // 是否禁用统计 // 参考:http://nginx.org/en/docs/http/ngx_http_access_module.html Allow []string `yaml:"allow" json:"allow"` // 允许的终端地址 @TODO Deny []string `yaml:"deny" json:"deny"` // 禁止的终端地址 @TODO Proxy string `yaml:"proxy" json:"proxy"` // 代理配置 @TODO CachePolicy string `yaml:"cachePolicy" json:"cachePolicy"` // 缓存策略 CacheOn bool `yaml:"cacheOn" json:"cacheOn"` // 缓存是否打开 WAFOn bool `yaml:"wafOn" json:"wafOn"` // 是否启用 WafId string `yaml:"wafId" json:"wafId"` // WAF ID // websocket设置 Websocket *WebsocketConfig `yaml:"websocket" json:"websocket"` // 开启的条件 // 语法为:cond param operator value 比如: // - cond ${status} gte 200 // - cond ${arg.name} eq lily // - cond ${requestPath} regexp .*\.png Cond []*shared.RequestCond `yaml:"cond" json:"cond"` Pages []*PageConfig `yaml:"pages" json:"pages"` // 特殊页 Shutdown *ShutdownConfig `yaml:"shutdown" json:"shutdown"` // 关闭页 ShutdownPageOn1 bool `yaml:"shutdownPageOn" json:"shutdownPageOn"` // deprecated: v0.1.8, 是否开启临时关闭页面 ShutdownPage1 string `yaml:"shutdownPage" json:"shutdownPage"` // deprecated: v0.1.8, 临时关闭页面 // contains filtered or unexported fields }
路径配置
func (*LocationConfig) AddCond ¶ added in v0.1.2
func (this *LocationConfig) AddCond(cond *shared.RequestCond)
添加过滤条件
func (*LocationConfig) AddPage ¶ added in v0.1.7
func (this *LocationConfig) AddPage(page *PageConfig)
添加Page
func (*LocationConfig) AddRequestGroup ¶ added in v0.1.2
func (this *LocationConfig) AddRequestGroup(group *RequestGroup)
添加请求分组
func (*LocationConfig) CachePolicyObject ¶
func (this *LocationConfig) CachePolicyObject() *shared.CachePolicy
缓存策略
func (*LocationConfig) CloneState ¶ added in v0.1.6
func (this *LocationConfig) CloneState(oldLocation *LocationConfig)
克隆运行时状态
func (*LocationConfig) Compatible ¶ added in v0.1.5
func (this *LocationConfig) Compatible(version string)
兼容性设置
func (*LocationConfig) IsCaseInsensitive ¶
func (this *LocationConfig) IsCaseInsensitive() bool
是否大小写非敏感
func (*LocationConfig) Match ¶
func (this *LocationConfig) Match(path string, formatter func(source string) string) (map[string]string, bool)
判断是否匹配路径
func (*LocationConfig) MatchKeyword ¶ added in v0.1.7
func (this *LocationConfig) MatchKeyword(keyword string) (matched bool, name string, tags []string)
匹配关键词
func (*LocationConfig) MatchRequestGroup ¶ added in v0.1.2
func (this *LocationConfig) MatchRequestGroup(formatter func(source string) string) *RequestGroup
使用请求匹配分组
func (*LocationConfig) NextBackend ¶ added in v0.1.2
func (this *LocationConfig) NextBackend(call *shared.RequestCall) *BackendConfig
取得下一个可用的后端服务
func (*LocationConfig) PatternString ¶
func (this *LocationConfig) PatternString() string
模式字符串 去掉了模式字符
func (*LocationConfig) RefersProxy ¶ added in v0.1.2
func (this *LocationConfig) RefersProxy(proxyId string) bool
是否在引用某个代理
func (*LocationConfig) SetPattern ¶
func (this *LocationConfig) SetPattern(pattern string, patternType int, caseInsensitive bool, reverse bool)
组合参数为一个字符串
func (*LocationConfig) SetupScheduling ¶ added in v0.1.2
func (this *LocationConfig) SetupScheduling(isBackup bool)
设置调度算法
type MimeTypeRule ¶ added in v0.1.8
mime type
type NodeConfig ¶ added in v0.1.4
type NodeConfig struct { Id string `yaml:"id" json:"id"` // ID On bool `yaml:"on" json:"on"` // 是否启用 Name string `yaml:"name" json:"name"` // 名称 ClusterId string `yaml:"clusterId" json:"clusterId"` // 集群ID ClusterSecret string `yaml:"clusterSecret" json:"clusterSecret"` // 集群秘钥 ClusterAddr string `yaml:"clusterAddr" json:"clusterAddr"` // 集群通讯地址 Role NodeRole `yaml:"role" json:"role"` // 角色 }
节点配置
func SharedNodeConfig ¶ added in v0.1.4
func SharedNodeConfig() *NodeConfig
取得当前节点配置 如果为nil,表示尚未配置集群
type PageConfig ¶ added in v0.1.2
type PageConfig struct { On bool `yaml:"on" json:"on"` // TODO Status []string `yaml:"status" json:"status"` // 响应支持40x, 50x, 3x2 URL string `yaml:"url" json:"url"` // URL NewStatus int `yaml:"newStatus" json:"newStatus"` // 新状态码 // contains filtered or unexported fields }
特殊页面配置
type RequestGroup ¶ added in v0.1.2
type RequestGroup struct { BackendList `yaml:",inline"` Id string `yaml:"id" json:"id"` // ID Name string `yaml:"name" json:"name"` // 名称 Cond []*shared.RequestCond `yaml:"conds" json:"conds"` // 匹配条件 IPRanges []*shared.IPRangeConfig `yaml:"ipRanges" json:"ipRanges"` // IP范围 IsDefault bool `yaml:"isDefault" json:"isDefault"` // 是否为默认分组 RequestHeaders []*shared.HeaderConfig `yaml:"requestHeaders" json:"requestHeaders"` // 请求Header ResponseHeaders []*shared.HeaderConfig `yaml:"responseHeaders" json:"responseHeaders"` // 响应Header // contains filtered or unexported fields }
请求条件分组
func (*RequestGroup) AddCond ¶ added in v0.1.2
func (this *RequestGroup) AddCond(cond *shared.RequestCond)
添加匹配条件
func (*RequestGroup) AddIPRange ¶ added in v0.1.2
func (this *RequestGroup) AddIPRange(ipRange *shared.IPRangeConfig)
添加IP范围
func (*RequestGroup) AddRequestHeader ¶ added in v0.1.2
func (this *RequestGroup) AddRequestHeader(header *shared.HeaderConfig)
添加请求Header
func (*RequestGroup) AddResponseHeader ¶ added in v0.1.2
func (this *RequestGroup) AddResponseHeader(header *shared.HeaderConfig)
添加响应Header
func (*RequestGroup) HasFilters ¶ added in v0.1.2
func (this *RequestGroup) HasFilters() bool
判断是否有过滤条件
func (*RequestGroup) HasRequestHeaders ¶ added in v0.1.2
func (this *RequestGroup) HasRequestHeaders() bool
判断是否有请求Header
func (*RequestGroup) HasResponseHeaders ¶ added in v0.1.2
func (this *RequestGroup) HasResponseHeaders() bool
判断是否有响应Header
func (*RequestGroup) Match ¶ added in v0.1.2
func (this *RequestGroup) Match(formatter func(source string) string) bool
判断匹配
type RewriteList ¶
type RewriteList struct {
Rewrite []*RewriteRule `yaml:"rewrite" json:"rewrite"`
}
RewriteList定义
func (*RewriteList) AddRewriteRule ¶
func (this *RewriteList) AddRewriteRule(rewrite *RewriteRule)
添加Rewrite
func (*RewriteList) AllRewriteRules ¶
func (this *RewriteList) AllRewriteRules() []*RewriteRule
取得所有的Rewrite
func (*RewriteList) FindRewriteRule ¶
func (this *RewriteList) FindRewriteRule(rewriteId string) *RewriteRule
根据ID查找Rewrite
func (*RewriteList) RemoveRewriteRule ¶
func (this *RewriteList) RemoveRewriteRule(rewriteId string)
删除Rewrite
type RewriteListInterface ¶
type RewriteListInterface interface { // 校验 ValidateRewriteRules() error // 取得所有的Rewrite AllRewriteRules() []*RewriteRule // 根据ID查找Rewrite FindRewriteRule(rewriteId string) *RewriteRule // 添加Rewrite AddRewriteRule(rewrite *RewriteRule) // 删除Rewrite RemoveRewriteRule(rewriteId string) }
RewriteList接口
type RewriteRule ¶
type RewriteRule struct { shared.HeaderList `yaml:",inline"` On bool `yaml:"on" json:"on"` // 是否开启 Id string `yaml:"id" json:"id"` // ID // 开启的条件 // 语法为:cond param operator value 比如: // - cond ${status} gte 200 // - cond ${arg.name} eq lily // - cond ${requestPath} regexp .*\.png Cond []*shared.RequestCond `yaml:"cond" json:"cond"` // 规则 // 语法为:pattern regexp 比如: // - pattern ^/article/(\d+).html Pattern string `yaml:"pattern" json:"pattern"` // 要替换成的URL // 支持反向引用:${0}, ${1}, ...,也支持?P<NAME>语法 // - 如果以 proxy:// 开头,表示目标为代理,首先会尝试作为代理ID请求,如果找不到,会尝试作为代理Host请求 Replace string `yaml:"replace" json:"replace"` // 选项 // @TODO 使用具体的语义化的字段代替 Flags []string `yaml:"flags" json:"flags"` FlagOptions maps.Map `yaml:"flagOptions" json:"flagOptions"` // flag => options map IsBreak bool `yaml:"isBreak" json:"isBreak"` // 终止向下解析 IsPermanent bool `yaml:"isPermanent" json:"isPermanent"` // 是否持久性跳转 ProxyHost string `yaml:"host" json:"host"` // 代理模式下重写后的Host // contains filtered or unexported fields }
重写规则定义
参考 - http://nginx.org/en/docs/http/ngx_http_rewrite_module.html - https://httpd.apache.org/docs/current/mod/mod_rewrite.html - https://httpd.apache.org/docs/2.4/rewrite/flags.html
func (*RewriteRule) AddFlag ¶
func (this *RewriteRule) AddFlag(flag string, options maps.Map)
添加Flag
func (*RewriteRule) IsExternalURL ¶
func (this *RewriteRule) IsExternalURL(url string) bool
判断是否是外部URL
func (*RewriteRule) Match ¶
func (this *RewriteRule) Match(requestPath string, formatter func(source string) string) (replace string, varMapping map[string]string, matched bool)
对某个请求执行规则
func (*RewriteRule) RefersProxy ¶ added in v0.1.2
func (this *RewriteRule) RefersProxy(proxyId string) bool
是否在引用某个代理
type SSLCertConfig ¶ added in v0.1.4
type SSLCertConfig struct { Id string `yaml:"id" json:"id"` On bool `yaml:"on" json:"on"` Description string `yaml:"description" json:"description"` // 说明 CertFile string `yaml:"certFile" json:"certFile"` KeyFile string `yaml:"keyFile" json:"keyFile"` IsLocal bool `yaml:"isLocal" json:"isLocal"` // 是否为本地文件 TaskId string `yaml:"taskId" json:"taskId"` // 生成证书任务ID ServerName string `yaml:"serverName" json:"serverName"` // 证书使用的主机名,在请求TLS服务器时需要 IsCA bool `yaml:"isCA" json:"isCA"` // 是否为CA证书 // contains filtered or unexported fields }
SSL证书
func NewSSLCertConfig ¶ added in v0.1.4
func NewSSLCertConfig(certFile string, keyFile string) *SSLCertConfig
获取新的SSL证书
func (*SSLCertConfig) CertObject ¶ added in v0.1.4
func (this *SSLCertConfig) CertObject() *tls.Certificate
获取证书对象
func (*SSLCertConfig) DNSNames ¶ added in v0.1.7
func (this *SSLCertConfig) DNSNames() []string
证书中的域名
func (*SSLCertConfig) DeleteFiles ¶ added in v0.1.4
func (this *SSLCertConfig) DeleteFiles() error
删除文件
func (*SSLCertConfig) FindShared ¶ added in v0.1.7
func (this *SSLCertConfig) FindShared() *SSLCertConfig
查找共享的证书
func (*SSLCertConfig) FullCertPath ¶ added in v0.1.4
func (this *SSLCertConfig) FullCertPath() string
证书文件路径
func (*SSLCertConfig) FullKeyPath ¶ added in v0.1.4
func (this *SSLCertConfig) FullKeyPath() string
密钥文件路径
func (*SSLCertConfig) MatchDomain ¶ added in v0.1.4
func (this *SSLCertConfig) MatchDomain(domain string) bool
校验是否匹配某个域名
func (*SSLCertConfig) MatchKeyword ¶ added in v0.1.7
func (this *SSLCertConfig) MatchKeyword(keyword string) (matched bool, name string, tags []string)
匹配关键词
func (*SSLCertConfig) ReadCert ¶ added in v0.1.7
func (this *SSLCertConfig) ReadCert() ([]byte, error)
读取证书文件
func (*SSLCertConfig) ReadKey ¶ added in v0.1.7
func (this *SSLCertConfig) ReadKey() ([]byte, error)
读取密钥文件
func (*SSLCertConfig) TimeAfter ¶ added in v0.1.7
func (this *SSLCertConfig) TimeAfter() time.Time
结束时间
func (*SSLCertConfig) TimeBefore ¶ added in v0.1.7
func (this *SSLCertConfig) TimeBefore() time.Time
开始时间
type SSLCertList ¶ added in v0.1.7
type SSLCertList struct { Certs []*SSLCertConfig `yaml:"certs" json:"certs"` // 证书 Tasks []*SSLCertTask `yaml:"tasks" json:"tasks"` // 任务 }
公共的SSL证书列表
func SharedSSLCertList ¶ added in v0.1.7
func SharedSSLCertList() *SSLCertList
获取证书列表实例 一定会返回不为nil的值
func (*SSLCertList) AddCert ¶ added in v0.1.7
func (this *SSLCertList) AddCert(cert *SSLCertConfig)
添加证书
func (*SSLCertList) AddTask ¶ added in v0.1.7
func (this *SSLCertList) AddTask(task *SSLCertTask)
添加任务
func (*SSLCertList) FindCert ¶ added in v0.1.7
func (this *SSLCertList) FindCert(certId string) *SSLCertConfig
查找证书
func (*SSLCertList) FindTask ¶ added in v0.1.7
func (this *SSLCertList) FindTask(taskId string) *SSLCertTask
查找任务
func (*SSLCertList) RemoveCert ¶ added in v0.1.7
func (this *SSLCertList) RemoveCert(certId string)
删除证书
func (*SSLCertList) RemoveTask ¶ added in v0.1.7
func (this *SSLCertList) RemoveTask(taskId string)
删除任务
type SSLCertTask ¶ added in v0.1.5
type SSLCertTask struct { Id string `yaml:"id" json:"id"` // ID On bool `yaml:"on" json:"on"` // 是否启用 RunAt int64 `yaml:"runAt" json:"runAt"` // 运行时间 RunError string `yaml:"runError" json:"runError"` // 运行错误 Request *ACMERequest `yaml:"request" json:"request"` // ACME信息 }
证书生成任务
type SSLClientAuthType ¶ added in v0.1.7
type SSLClientAuthType = int
认证类型
const ( SSLClientAuthTypeNoClientCert SSLClientAuthType = 0 SSLClientAuthTypeRequestClientCert SSLClientAuthType = 1 SSLClientAuthTypeRequireAnyClientCert SSLClientAuthType = 2 SSLClientAuthTypeVerifyClientCertIfGiven SSLClientAuthType = 3 SSLClientAuthTypeRequireAndVerifyClientCert SSLClientAuthType = 4 )
type SSLConfig ¶
type SSLConfig struct { On bool `yaml:"on" json:"on"` // 是否开启 Certificate string `yaml:"certificate" json:"certificate"` // 证书文件, deprecated in v0.1.4 CertificateKey string `yaml:"certificateKey" json:"certificateKey"` // 密钥, deprecated in v0.1.4 Certs []*SSLCertConfig `yaml:"certs" json:"certs"` CertTasks []*SSLCertTask `yaml:"certTasks" json:"certTasks"` ClientAuthType SSLClientAuthType `yaml:"clientAuthType" json:"clientAuthType"` // 客户端认证类型 ClientCACertIds []string `yaml:"clientCACertIds" json:"clientCACertIds"` // 客户端认证CA Listen []string `yaml:"listen" json:"listen"` // 网络地址 MinVersion TLSVersion `yaml:"minVersion" json:"minVersion"` // 支持的最小版本 CipherSuites []TLSCipherSuite `yaml:"cipherSuites" json:"cipherSuites"` // 加密算法套件 HSTS *HSTSConfig `yaml:"hsts2" json:"hsts"` // HSTS配置,yaml之所以使用hsts2,是因为要和以前的版本分开 HTTP2Disabled bool `yaml:"http2Disabled" json:"http2Disabled"` // 是否禁用HTTP2 // contains filtered or unexported fields }
SSL配置
func (*SSLConfig) AddCert ¶ added in v0.1.5
func (this *SSLConfig) AddCert(cert *SSLCertConfig)
添加证书
func (*SSLConfig) AddCertTask ¶ added in v0.1.5
func (this *SSLConfig) AddCertTask(certTask *SSLCertTask)
添加证书任务
func (*SSLConfig) ContainsFile ¶ added in v0.1.4
是否包含某个证书或密钥路径
func (*SSLConfig) FindCert ¶ added in v0.1.4
func (this *SSLConfig) FindCert(certId string) *SSLCertConfig
查找单个证书配置
func (*SSLConfig) FindCertTask ¶ added in v0.1.5
func (this *SSLConfig) FindCertTask(certTaskId string) *SSLCertTask
查找证书任务
func (*SSLConfig) FirstCert ¶ added in v0.1.4
func (this *SSLConfig) FirstCert() *tls.Certificate
取得第一个证书
func (*SSLConfig) MatchDomain ¶ added in v0.1.3
func (this *SSLConfig) MatchDomain(domain string) (cert *tls.Certificate, ok bool)
校验是否匹配某个域名
func (*SSLConfig) RemoveCertTask ¶ added in v0.1.5
删除证书任务
func (*SSLConfig) TLSCipherSuites ¶ added in v0.1.3
套件
func (*SSLConfig) TLSMinVersion ¶ added in v0.1.3
取得最小版本
type SchedulingConfig ¶
type SchedulingConfig struct { Code string `yaml:"code" json:"code"` // 类型 Options maps.Map `yaml:"options" json:"options"` // 选项 }
调度算法配置
type ServerConfig ¶
type ServerConfig struct { shared.HeaderList `yaml:",inline"` FastcgiList `yaml:",inline"` RewriteList `yaml:",inline"` BackendList `yaml:",inline"` On bool `yaml:"on" json:"on"` Id string `yaml:"id" json:"id"` // ID TeaVersion string `yaml:"teaVersion" json:"teaVersion"` // Tea版本 Description string `yaml:"description" json:"description"` // 描述 Name []string `yaml:"name" json:"name"` // 域名 Http bool `yaml:"http" json:"http"` // 是否支持HTTP RedirectToHttps bool `yaml:"redirectToHttps" json:"redirectToHttps"` // 是否自动跳转到Https IsDefault bool `yaml:"isDefault" json:"isDefault"` // 是否默认的服务,找不到匹配域名时有限使用此配置 // 监听地址 Listen []string `yaml:"listen" json:"listen"` Root string `yaml:"root" json:"root"` // 资源根目录 Index []string `yaml:"index" json:"index"` // 默认文件 Charset string `yaml:"charset" json:"charset"` // 字符集 Locations []*LocationConfig `yaml:"locations" json:"locations"` // 地址配置 MaxBodySize string `yaml:"maxBodySize" json:"maxBodySize"` // 请求body最大尺寸 GzipLevel1 uint8 `yaml:"gzipLevel" json:"gzipLevel"` // deprecated in v0.1.8: Gzip压缩级别 GzipMinLength1 string `yaml:"gzipMinLength" json:"gzipMinLength"` // deprecated in v0.1.8: 需要压缩的最小内容尺寸 Gzip *GzipConfig `yaml:"gzip" json:"gzip"` // 访问日志 AccessLog []*AccessLogConfig `yaml:"accessLog" json:"accessLog"` // 访问日志配置 DisableAccessLog1 bool `yaml:"disableAccessLog" json:"disableAccessLog"` // deprecated: 是否禁用访问日志 AccessLogFields1 []int `yaml:"accessLogFields" json:"accessLogFields"` // deprecated: 访问日志保留的字段,如果为nil,则表示没有设置 // 统计 DisableStat bool `yaml:"disableStat" json:"disableStat"` // 是否禁用统计 // SSL SSL *SSLConfig `yaml:"ssl" json:"ssl"` // TCP,如果有此配置的说明为TCP代理 TCP *TCPConfig `yaml:"tcp" json:"tcp"` // 参考:http://nginx.org/en/docs/http/ngx_http_access_module.html Allow []string `yaml:"allow" json:"allow"` //TODO Deny []string `yaml:"deny" json:"deny"` //TODO Filename string `yaml:"filename" json:"filename"` // 配置文件名 Proxy string `yaml:"proxy" json:"proxy"` // 代理配置 TODO CachePolicy string `yaml:"cachePolicy" json:"cachePolicy"` // 缓存策略 CacheOn bool `yaml:"cacheOn" json:"cacheOn"` // 缓存是否打开 WAFOn bool `yaml:"wafOn" json:"wafOn"` // 是否启用 WafId string `yaml:"wafId" json:"wafId"` // WAF ID // API相关 API *api.APIConfig `yaml:"api" json:"api"` // API配置 // 看板 RealtimeBoard *Board `yaml:"realtimeBoard" json:"realtimeBoard"` // 即时看板 StatBoard *Board `yaml:"statBoard" json:"statBoard"` // 统计看板 StatItems []string `yaml:"statItems" json:"statItems"` // 统计指标 // 是否开启静态文件加速 CacheStatic bool `yaml:"cacheStatic" json:"cacheStatic"` // 请求分组 RequestGroups []*RequestGroup `yaml:"requestGroups" json:"requestGroups"` // 请求条件分组 Pages []*PageConfig `yaml:"pages" json:"pages"` // 特殊页,更高级的需求应该通过Location来设置 Shutdown *ShutdownConfig `yaml:"shutdown" json:"shutdown"` // 关闭页 ShutdownPageOn1 bool `yaml:"shutdownPageOn" json:"shutdownPageOn"` // deprecated: v0.1.8, 是否开启临时关闭页面 ShutdownPage1 string `yaml:"shutdownPage" json:"shutdownPage"` // deprecated: v0.1.8, 临时关闭页面 Version int `yaml:"version" json:"version"` // 版本 // 隧道相关 Tunnel *TunnelConfig `yaml:"tunnel" json:"tunnel"` // 通知设置 NoticeSetting map[notices.NoticeLevel][]*notices.NoticeReceiver `yaml:"noticeSetting" json:"noticeSetting"` // 通知条目设置 NoticeItems struct { BackendDown *notices.Item `yaml:"backendDown" json:"backendDown"` BackendUp *notices.Item `yaml:"backendUp" json:"backendUp"` } `yaml:"noticeItems" json:"noticeItems"` // contains filtered or unexported fields }
服务配置
func LoadServerConfigsFromDir ¶
func LoadServerConfigsFromDir(dirPath string) []*ServerConfig
从目录中加载配置
func NewServerConfigFromFile ¶
func NewServerConfigFromFile(filename string) (*ServerConfig, error)
从配置文件中读取配置信息
func (*ServerConfig) AddLocation ¶
func (this *ServerConfig) AddLocation(location *LocationConfig)
添加路径规则
func (*ServerConfig) AddNoticeReceiver ¶ added in v0.1.8
func (this *ServerConfig) AddNoticeReceiver(level notices.NoticeLevel, receiver *notices.NoticeReceiver)
添加通知接收者
func (*ServerConfig) AddPage ¶ added in v0.1.2
func (this *ServerConfig) AddPage(page *PageConfig)
添加Page
func (*ServerConfig) AddRequestGroup ¶ added in v0.1.2
func (this *ServerConfig) AddRequestGroup(group *RequestGroup)
添加请求分组
func (*ServerConfig) AddStatItem ¶ added in v0.1.9
func (this *ServerConfig) AddStatItem(item string)
统计指标
func (*ServerConfig) CachePolicyObject ¶
func (this *ServerConfig) CachePolicyObject() *shared.CachePolicy
缓存策略
func (*ServerConfig) CloneState ¶ added in v0.1.6
func (this *ServerConfig) CloneState(oldServer *ServerConfig)
克隆运行时状态
func (*ServerConfig) FindAllNoticeReceivers ¶ added in v0.1.8
func (this *ServerConfig) FindAllNoticeReceivers(level ...notices.NoticeLevel) []*notices.NoticeReceiver
查找一个或多个级别对应的接收者,并合并相同的接收者
func (*ServerConfig) FindBackendList ¶
func (this *ServerConfig) FindBackendList(locationId string, websocket bool) (backendList BackendListInterface, err error)
查找后端服务器列表
func (*ServerConfig) FindCerts ¶ added in v0.1.7
func (this *ServerConfig) FindCerts(certId string) (result []*SSLCertConfig)
查找证书
func (*ServerConfig) FindFastcgiList ¶
func (this *ServerConfig) FindFastcgiList(locationId string) (fastcgiList FastcgiListInterface, err error)
查找FastcgiList
func (*ServerConfig) FindHeaderList ¶
func (this *ServerConfig) FindHeaderList(locationId string, backendId string, rewriteId string, fastcgiId string) (headerList shared.HeaderListInterface, err error)
查找HeaderList
func (*ServerConfig) FindLocation ¶
func (this *ServerConfig) FindLocation(locationId string) *LocationConfig
根据Id查找Location
func (*ServerConfig) FindRequestGroup ¶ added in v0.1.2
func (this *ServerConfig) FindRequestGroup(groupId string) *RequestGroup
查找请求分组
func (*ServerConfig) FindRewriteList ¶
func (this *ServerConfig) FindRewriteList(locationId string) (rewriteList RewriteListInterface, err error)
查找重写规则
func (*ServerConfig) LocationAtIndex ¶
func (this *ServerConfig) LocationAtIndex(index int) *LocationConfig
获取某个位置上的配置
func (*ServerConfig) MatchKeyword ¶ added in v0.1.7
func (this *ServerConfig) MatchKeyword(keyword string) (matched bool, name string, tags []string)
检查是否匹配关键词
func (*ServerConfig) MatchName ¶
func (this *ServerConfig) MatchName(name string) (matchedName string, matched bool)
判断是否和域名匹配
func (*ServerConfig) MatchRequestGroup ¶ added in v0.1.2
func (this *ServerConfig) MatchRequestGroup(formatter func(source string) string) *RequestGroup
使用请求匹配分组
func (*ServerConfig) MoveLocation ¶ added in v0.1.2
func (this *ServerConfig) MoveLocation(fromIndex int, toIndex int)
移动位置
func (*ServerConfig) NextBackend ¶ added in v0.1.2
func (this *ServerConfig) NextBackend(call *shared.RequestCall) *BackendConfig
取得下一个可用的后端服务
func (*ServerConfig) NextBackendIgnore ¶ added in v0.1.6
func (this *ServerConfig) NextBackendIgnore(call *shared.RequestCall, backendIds []string) *BackendConfig
取得下一个可用的后端服务,并排除某个后端
func (*ServerConfig) RefersProxy ¶ added in v0.1.2
func (this *ServerConfig) RefersProxy(proxyId string) (description string, referred bool)
是否在引用某个代理
func (*ServerConfig) RemoveLocation ¶
func (this *ServerConfig) RemoveLocation(locationId string)
删除Location
func (*ServerConfig) RemoveNoticeReceiver ¶ added in v0.1.8
func (this *ServerConfig) RemoveNoticeReceiver(level notices.NoticeLevel, receiverId string)
删除通知接收者
func (*ServerConfig) RemoveRequestGroup ¶ added in v0.1.2
func (this *ServerConfig) RemoveRequestGroup(groupId string)
删除请求分组
func (*ServerConfig) RemoveStatItem ¶ added in v0.1.9
func (this *ServerConfig) RemoveStatItem(item string)
删除统计指标
func (*ServerConfig) SetupNoticeItems ¶ added in v0.1.8
func (this *ServerConfig) SetupNoticeItems()
设置通知
func (*ServerConfig) SetupNoticeItemsFromRequest ¶ added in v0.1.8
func (this *ServerConfig) SetupNoticeItemsFromRequest(req *http.Request)
从请求中构建通知设置
func (*ServerConfig) SetupScheduling ¶ added in v0.1.2
func (this *ServerConfig) SetupScheduling(isBackup bool)
设置调度算法
type ServerList ¶
type ServerList struct {
Files []string `yaml:"files" json:"files"`
}
Server列表
func (*ServerList) FindAllServers ¶
func (this *ServerList) FindAllServers() []*ServerConfig
查找所有Servers
type ShutdownConfig ¶ added in v0.1.9
type ShutdownConfig struct { On bool `yaml:"on" json:"on"` URL string `yaml:"url" json:"url"` Status int `yaml:"status" json:"status"` }
关闭页面配置
type TCPConfig ¶ added in v0.1.6
type TCPConfig struct { TCPOn bool `yaml:"tcpOn" json:"tcpOn"` // 是否开启TCP ReadBufferSize int `yaml:"readBufferSize" json:"readBufferSize"` // 读缓冲区尺寸,默认4K WriteBufferSize int `yaml:"writeBufferSize" json:"writeBufferSize"` // 写缓冲区尺寸,默认4K }
TCP代理配置
type TimePast ¶ added in v0.1.7
type TimePast = string
常用时间范围
const ( TimePast5m TimePast = "past5m" TimePast15m TimePast = "past15m" TimePast1h TimePast = "past1h" TimePast6h TimePast = "past6h" TimePast12h TimePast = "past12h" TimePast24h TimePast = "past24h" TimePast1d TimePast = "past1d" TimePast2d TimePast = "past2d" TimePast7d TimePast = "past7d" TimePast30d TimePast = "past30d" )
type TunnelConfig ¶ added in v0.1.5
type TunnelConfig struct { Id string `yaml:"id" json:"id"` // ID On bool `yaml:"on" json:"on"` // 是否启用 Endpoint string `yaml:"endpoint" json:"endpoint"` // 终端地址 Secret string `yaml:"secret" json:"secret"` // 连接用的密钥 TLS bool `yaml:"tls" json:"tls"` // 是否支持TLS TODO 暂时没有实现 Certs []*SSLCertConfig `yaml:"certs" json:"certs"` // TLS证书 TODO 暂时没有实现 // contains filtered or unexported fields }
网络隧道定义
func (*TunnelConfig) AddError ¶ added in v0.1.5
func (this *TunnelConfig) AddError(err string)
设置错误信息
func (*TunnelConfig) SetIsActive ¶ added in v0.1.5
func (this *TunnelConfig) SetIsActive(isActive bool)
设置是否已启动
type WAFList ¶ added in v0.1.3
type WAFList struct {
Files []string `yaml:"files" json:"files"`
}
WAF列表
func (*WAFList) FindAllConfigs ¶ added in v0.1.3
查找所有WAF配置
type WebConfig ¶ added in v0.1.9
type WebConfig struct { TeaGo.ServerConfig `yaml:",inline"` CertId string `yaml:"certId" json:"certId"` // 代理全局中的证书 }
Web 配置
type WebsocketConfig ¶
type WebsocketConfig struct { // 后端服务器列表 BackendList `yaml:",inline"` On bool `yaml:"on" json:"on"` // 是否开启 // 握手超时时间 HandshakeTimeout string `yaml:"handshakeTimeout" json:"handshakeTimeout"` // 允许的域名,支持 www.example.com, example.com, .example.com, *.example.com AllowAllOrigins bool `yaml:"allowAllOrigins" json:"allowAllOrigins"` Origins []string `yaml:"origins" json:"origins"` // 转发方式 ForwardMode WebsocketForwardMode `yaml:"forwardMode" json:"forwardMode"` // contains filtered or unexported fields }
websocket设置
func (*WebsocketConfig) AddRequestGroup ¶ added in v0.1.2
func (this *WebsocketConfig) AddRequestGroup(group *RequestGroup)
添加请求分组
func (*WebsocketConfig) CloneState ¶ added in v0.1.6
func (this *WebsocketConfig) CloneState(oldWebsocket *WebsocketConfig)
克隆运行时状态
func (*WebsocketConfig) ForwardModeSummary ¶
func (this *WebsocketConfig) ForwardModeSummary() maps.Map
转发模式名称
func (*WebsocketConfig) HandshakeTimeoutDuration ¶
func (this *WebsocketConfig) HandshakeTimeoutDuration() time.Duration
获取握手超时时间
func (*WebsocketConfig) MatchOrigin ¶
func (this *WebsocketConfig) MatchOrigin(origin string) bool
匹配域名
func (*WebsocketConfig) MatchRequestGroup ¶ added in v0.1.2
func (this *WebsocketConfig) MatchRequestGroup(formatter func(source string) string) *RequestGroup
使用请求匹配分组
func (*WebsocketConfig) NextBackend ¶ added in v0.1.2
func (this *WebsocketConfig) NextBackend(call *shared.RequestCall) *BackendConfig
取得下一个可用的后端服务
func (*WebsocketConfig) SetupScheduling ¶ added in v0.1.2
func (this *WebsocketConfig) SetupScheduling(isBackup bool)
设置调度算法
type WildcardStatus ¶ added in v0.1.2
可能含有x字母的状态码
func NewWildcardStatus ¶ added in v0.1.2
func NewWildcardStatus(status string) *WildcardStatus
获取新对象
func (*WildcardStatus) Match ¶ added in v0.1.2
func (this *WildcardStatus) Match(status int) bool
判断匹配
Source Files ¶
- access_log_config.go
- access_log_storage_policy.go
- access_log_storage_policy_list.go
- backend.go
- backend_events.go
- backend_ftp.go
- backend_list.go
- board.go
- board_chart.go
- cache_config.go
- fastcgi.go
- fastcgi_list.go
- gzip.go
- ip_range_list.go
- location.go
- location_pattern_types.go
- mime_type_rule.go
- node.go
- node_role.go
- page.go
- request_group.go
- rewrite_list.go
- rewrite_rule.go
- scheduling.go
- server.go
- server_list.go
- shutdown.go
- ssl.go
- ssl_acme_dns_provider.go
- ssl_acme_dns_record.go
- ssl_acme_local_user.go
- ssl_acme_local_user_list.go
- ssl_acme_request.go
- ssl_acme_user.go
- ssl_auth.go
- ssl_cert.go
- ssl_cert_list.go
- ssl_cert_task.go
- ssl_go_1.12.go
- ssl_hsts.go
- tcp_config.go
- time_past.go
- tunnel.go
- waf_list.go
- web.go
- websocket.go
- websocket_forward.go
- wildcard_status.go