mirror of
https://github.com/TeaOSLab/EdgeCommon.git
synced 2026-03-29 12:55:37 +08:00
多处增加是否独立配置选项
This commit is contained in:
@@ -2,7 +2,8 @@ package serverconfigs
|
||||
|
||||
// 代理访问日志配置
|
||||
type HTTPAccessLogRef struct {
|
||||
IsOn bool `yaml:"isOn" json:"isOn"`
|
||||
IsPrior bool `yaml:"isPrior" json:"isPrior"` // 是否覆盖
|
||||
IsOn bool `yaml:"isOn" json:"isOn"` // 是否启用
|
||||
|
||||
Fields []int `yaml:"fields" json:"fields"` // 记录的字段
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package serverconfigs
|
||||
|
||||
type HTTPCacheRef struct {
|
||||
IsPrior bool `yaml:"isPrior" json:"isPrior"` // 是否覆盖
|
||||
IsOn bool `yaml:"isOn" json:"isOn"` // 是否开启
|
||||
CachePolicyId int64 `yaml:"cachePolicyId" json:"cachePolicyId"` // 缓存策略ID
|
||||
}
|
||||
|
||||
7
pkg/serverconfigs/http_charset_config.go
Normal file
7
pkg/serverconfigs/http_charset_config.go
Normal file
@@ -0,0 +1,7 @@
|
||||
package serverconfigs
|
||||
|
||||
type HTTPCharsetConfig struct {
|
||||
IsPrior bool `yaml:"isPrior" json:"isPrior"` // 是否覆盖
|
||||
IsOn bool `yaml:"isOn" json:"isOn"` // 是否启用
|
||||
Charset string `yaml:"charset" json:"charset"` // 字符集
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package serverconfigs
|
||||
|
||||
type HTTPFirewallRef struct {
|
||||
IsPrior bool `yaml:"isPrior" json:"isPrior"`
|
||||
IsOn bool `yaml:"isOn" json:"isOn"`
|
||||
FirewallPolicyId int64 `yaml:"firewallPolicyId" json:"firewallPolicyId"`
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package serverconfigs
|
||||
|
||||
type HTTPGzipRef struct {
|
||||
IsOn bool `yaml:"isOn" json:"isOn"`
|
||||
GzipId int64 `yaml:"gzipId" json:"gzipId"`
|
||||
IsPrior bool `yaml:"isPrior" json:"isPrior"` // 是否覆盖
|
||||
IsOn bool `yaml:"isOn" json:"isOn"` // 是否开启
|
||||
GzipId int64 `yaml:"gzipId" json:"gzipId"` // 使用的配置ID
|
||||
}
|
||||
|
||||
@@ -3,5 +3,6 @@ package serverconfigs
|
||||
// 跳转到HTTPS配置
|
||||
// TODO 支持跳转的状态码选择
|
||||
type HTTPRedirectToHTTPSConfig struct {
|
||||
IsOn bool `yaml:"isOn" json:"isOn"`
|
||||
IsPrior bool `yaml:"isPrior" json:"isPrior"` // 是否覆盖
|
||||
IsOn bool `yaml:"isOn" json:"isOn"` // 是否开启
|
||||
}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
package serverconfigs
|
||||
|
||||
type HTTPStatRef struct {
|
||||
IsOn bool `yaml:"isOn" json:"isOn"` // 是否开启
|
||||
IsPrior bool `yaml:"isPrior" json:"isPrior"` // 是否覆盖
|
||||
IsOn bool `yaml:"isOn" json:"isOn"` // 是否开启
|
||||
}
|
||||
|
||||
func (this *HTTPStatRef) Init() error {
|
||||
|
||||
@@ -3,27 +3,30 @@ package serverconfigs
|
||||
import "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared"
|
||||
|
||||
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"` // 路径规则应用
|
||||
GzipRef *HTTPGzipRef `yaml:"gzipRef" json:"gzipRef"`
|
||||
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"` // 路径规则应用
|
||||
GzipRef *HTTPGzipRef `yaml:"gzipRef" json:"gzipRef"` // Gzip引用
|
||||
Gzip *HTTPGzipConfig `yaml:"gzip" json:"gzip"` // Gzip配置
|
||||
Charset string `yaml:"charset" json:"charset"` // 字符编码
|
||||
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 string `yaml:"root" json:"root"` // 资源根目录 TODO
|
||||
Indexes []string `yaml:"indexes" json:"indexes"` // 默认首页文件
|
||||
MaxRequestBodySize string `yaml:"maxRequestBodySize" json:"maxRequestBodySize"` // 请求body最大尺寸
|
||||
RequestHeaders *shared.HTTPHeaderPolicy `yaml:"requestHeaders" json:"requestHeaders"` // 请求Header
|
||||
ResponseHeaders *shared.HTTPHeaderPolicy `yaml:"responseHeaders" json:"responseHeaders"` // 响应Header`
|
||||
AccessLogRef *HTTPAccessLogRef `yaml:"accessLog" json:"accessLog"` // 访问日志配置
|
||||
StatRef *HTTPStatRef `yaml:"statRef" json:"statRef"` // 统计配置
|
||||
CacheRef *HTTPCacheRef `yaml:"cacheRef" json:"cacheRef"` // 缓存配置
|
||||
FirewallRef *HTTPFirewallRef `yaml:"firewallRef" json:"firewallRef"` // 防火墙设置
|
||||
WebsocketRef *HTTPWebsocketRef `yaml:"websocketRef" json:"websocketRef"` // Websocket应用配置
|
||||
Websocket *HTTPWebsocketConfig `yaml:"websocket" json:"websocket"` // Websocket配置
|
||||
|
||||
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策略
|
||||
}
|
||||
|
||||
func (this *HTTPWebConfig) Init() error {
|
||||
|
||||
@@ -9,7 +9,8 @@ import (
|
||||
|
||||
// websocket设置
|
||||
type HTTPWebsocketConfig struct {
|
||||
IsOn bool `yaml:"isOn" json:"isOn"` // 是否开启
|
||||
Id int64 `yaml:"id" json:"id"` // ID
|
||||
IsOn bool `yaml:"isOn" json:"isOn"` // 是否开启
|
||||
|
||||
// 握手超时时间
|
||||
HandshakeTimeout *shared.TimeDuration `yaml:"handshakeTimeout" json:"handshakeTimeout"`
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package serverconfigs
|
||||
|
||||
type HTTPWebsocketRef struct {
|
||||
IsPrior bool `yaml:"isPrior" json:"isPrior"`
|
||||
IsOn bool `yaml:"isOn" json:"isOn"`
|
||||
WebsocketId int64 `yaml:"websocketId" json:"websocketIs"`
|
||||
WebsocketId int64 `yaml:"websocketId" json:"websocketId"`
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package serverconfigs
|
||||
|
||||
// 反向代理引用
|
||||
type ReverseProxyRef struct {
|
||||
IsPrior bool `yaml:"isPrior" json:"isPrior"` // 是否覆盖
|
||||
IsOn bool `yaml:"isOn" json:"isOn"` // 是否启用
|
||||
ReverseProxyId int64 `yaml:"reverseProxyId" json:"reverseProxyId"` // 反向代理ID
|
||||
}
|
||||
|
||||
7
pkg/serverconfigs/shared/http_header_policy_ref.go
Normal file
7
pkg/serverconfigs/shared/http_header_policy_ref.go
Normal file
@@ -0,0 +1,7 @@
|
||||
package shared
|
||||
|
||||
type HTTPHeaderPolicyRef struct {
|
||||
IsPrior bool `yaml:"isPrior" json:"isPrior"`
|
||||
IsOn bool `yaml:"isOn" json:"isOn"`
|
||||
HeaderPolicyId int64 `yaml:"headerPolicyId" json:"headerPolicyId"`
|
||||
}
|
||||
@@ -2,8 +2,10 @@ package shared
|
||||
|
||||
// HeaderList定义
|
||||
type HTTPHeaderPolicy struct {
|
||||
Id int64 `yaml:"id" json:"id"`
|
||||
IsOn bool `yaml:"isOn" json:"isOn"` // TODO
|
||||
Id int64 `yaml:"id" json:"id"` // ID
|
||||
Name string `yaml:"name" json:"name"` // 名称 TODO
|
||||
IsOn bool `yaml:"isOn" json:"isOn"` // 是否启用 TODO
|
||||
Description string `yaml:"description" json:"description"` // 描述 TODO
|
||||
|
||||
AddHeaders []*HTTPHeaderConfig `yaml:"addHeaders" json:"addHeaders"` // TODO
|
||||
AddTrailers []*HTTPHeaderConfig `yaml:"addTrailers" json:"addTrailers"` // TODO
|
||||
|
||||
Reference in New Issue
Block a user