增加proto相关注释

This commit is contained in:
GoEdgeLab
2022-07-20 18:14:57 +08:00
parent e23071476d
commit b8c210cbf5
18 changed files with 3588 additions and 3117 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -13,6 +13,7 @@ import (
"io/ioutil"
"path/filepath"
"regexp"
"strings"
)
type ServiceInfo struct {
@@ -36,9 +37,15 @@ type MessageInfo struct {
Doc string `json:"doc"`
}
type LinkInfo struct {
Name string `json:"name"`
Content string `json:"content"`
}
type RPCList struct {
Services []*ServiceInfo `json:"services"`
Messages []*MessageInfo `json:"messages"`
Links []*LinkInfo `json:"links"`
}
func readComments(data []byte) string {
@@ -67,134 +74,135 @@ func main() {
flag.BoolVar(&quiet, "quiet", false, "")
flag.Parse()
var dirs = []string{Tea.Root + "/../pkg/rpc/protos/", Tea.Root + "/../pkg/rpc/protos/models"}
var services = []*ServiceInfo{}
var messages = []*MessageInfo{}
for _, dir := range dirs {
func(dir string) {
dir = filepath.Clean(dir)
{
var dirs = []string{Tea.Root + "/../pkg/rpc/protos/", Tea.Root + "/../pkg/rpc/protos/models"}
for _, dir := range dirs {
func(dir string) {
dir = filepath.Clean(dir)
files, err := filepath.Glob(dir + "/*.proto")
if err != nil {
fmt.Println("[ERROR]list proto files failed: " + err.Error())
return
}
files, err := filepath.Glob(dir + "/*.proto")
if err != nil {
fmt.Println("[ERROR]list proto files failed: " + err.Error())
return
}
for _, path := range files {
func(path string) {
data, err := ioutil.ReadFile(path)
if err != nil {
fmt.Println("[ERROR]" + err.Error())
return
}
for _, path := range files {
func(path string) {
data, err := ioutil.ReadFile(path)
if err != nil {
fmt.Println("[ERROR]" + err.Error())
return
}
// 先将rpc代码替换成临时代码
var methodCodeMap = map[string][]byte{} // code => method
var methodIndex = 0
var methodReg = regexp.MustCompile(`rpc\s+(\w+)\s*\(\s*(\w+)\s*\)\s*returns\s*\(\s*(\w+)\s*\)\s*;`)
data = methodReg.ReplaceAllFunc(data, func(methodData []byte) []byte {
methodIndex++
var code = "METHOD" + types.String(methodIndex)
methodCodeMap[code] = methodData
return []byte("\n" + code)
})
// 先将rpc代码替换成临时代码
var methodCodeMap = map[string][]byte{} // code => method
var methodIndex = 0
var methodReg = regexp.MustCompile(`rpc\s+(\w+)\s*\(\s*(\w+)\s*\)\s*returns\s*\(\s*(\w+)\s*\)\s*;`)
data = methodReg.ReplaceAllFunc(data, func(methodData []byte) []byte {
methodIndex++
var code = "METHOD" + types.String(methodIndex)
methodCodeMap[code] = methodData
return []byte("\n" + code)
})
// 服务列表
// TODO 这里需要改进一下,当前实现方法如果方法注释里有括号(}),就会导致部分方法解析不到
var serviceNameReg = regexp.MustCompile(`(?sU)\n\s*service\s+(\w+)\s*\{(.+)}`)
var serviceMatches = serviceNameReg.FindAllSubmatch(data, -1)
var serviceNamePositions = serviceNameReg.FindAllIndex(data, -1)
for serviceMatchIndex, serviceMatch := range serviceMatches {
var serviceName = string(serviceMatch[1])
var serviceNamePosition = serviceNamePositions[serviceMatchIndex][0]
var comment = readComments(data[:serviceNamePosition])
// 服务列表
// TODO 这里需要改进一下,当前实现方法如果方法注释里有括号(}),就会导致部分方法解析不到
var serviceNameReg = regexp.MustCompile(`(?sU)\n\s*service\s+(\w+)\s*\{(.+)}`)
var serviceMatches = serviceNameReg.FindAllSubmatch(data, -1)
var serviceNamePositions = serviceNameReg.FindAllIndex(data, -1)
for serviceMatchIndex, serviceMatch := range serviceMatches {
var serviceName = string(serviceMatch[1])
var serviceNamePosition = serviceNamePositions[serviceMatchIndex][0]
var comment = readComments(data[:serviceNamePosition])
// 方法列表
var methods = []*MethodInfo{}
var serviceData = serviceMatch[2]
var methodCodeReg = regexp.MustCompile(`\b(METHOD\d+)\b`)
var methodCodeMatches = methodCodeReg.FindAllSubmatch(serviceData, -1)
var methodCodePositions = methodCodeReg.FindAllIndex(serviceData, -1)
for methodMatchIndex, methodMatch := range methodCodeMatches {
var methodCode = string(methodMatch[1])
var methodData = methodCodeMap[methodCode]
var methodPieces = methodReg.FindSubmatch(methodData)
var methodCodePosition = methodCodePositions[methodMatchIndex]
// 方法列表
var methods = []*MethodInfo{}
var serviceData = serviceMatch[2]
var methodCodeReg = regexp.MustCompile(`\b(METHOD\d+)\b`)
var methodCodeMatches = methodCodeReg.FindAllSubmatch(serviceData, -1)
var methodCodePositions = methodCodeReg.FindAllIndex(serviceData, -1)
for methodMatchIndex, methodMatch := range methodCodeMatches {
var methodCode = string(methodMatch[1])
var methodData = methodCodeMap[methodCode]
var methodPieces = methodReg.FindSubmatch(methodData)
var methodCodePosition = methodCodePositions[methodMatchIndex]
methods = append(methods, &MethodInfo{
Name: string(methodPieces[1]),
RequestMessageName: string(methodPieces[2]),
ResponseMessageName: string(methodPieces[3]),
Code: string(methodData),
Doc: readComments(serviceData[:methodCodePosition[0]]),
methods = append(methods, &MethodInfo{
Name: string(methodPieces[1]),
RequestMessageName: string(methodPieces[2]),
ResponseMessageName: string(methodPieces[3]),
Code: string(methodData),
Doc: readComments(serviceData[:methodCodePosition[0]]),
})
}
services = append(services, &ServiceInfo{
Name: serviceName,
Methods: methods,
Filename: filepath.Base(path),
Doc: comment,
})
}
services = append(services, &ServiceInfo{
Name: serviceName,
Methods: methods,
Filename: filepath.Base(path),
Doc: comment,
})
}
// 消息列表
var topMessageCodeMap = map[string][]byte{} // code => message
var allMessageCodeMap = map[string][]byte{}
var messageCodeIndex = 0
var messagesReg = regexp.MustCompile(`(?sU)\n\s*message\s+(\w+)\s*\{([^{}]+)\n\s*}`)
var firstMessagesReg = regexp.MustCompile(`message\s+(\w+)`)
var messageCodeREG = regexp.MustCompile(`MESSAGE\d+`)
for {
var hasMessage = false
data = messagesReg.ReplaceAllFunc(data, func(messageData []byte) []byte {
messageCodeIndex++
hasMessage = true
// 是否包含子Message
var subMatches = messageCodeREG.FindAllSubmatch(messageData, -1)
for _, subMatch := range subMatches {
var subMatchCode = string(subMatch[0])
delete(topMessageCodeMap, subMatchCode)
}
var code = "MESSAGE" + types.String(messageCodeIndex)
topMessageCodeMap[code] = messageData
allMessageCodeMap[code] = messageData
return []byte("\n" + code)
})
if !hasMessage {
break
}
}
for messageCode, messageData := range topMessageCodeMap {
// 替换其中的子Message
// 消息列表
var topMessageCodeMap = map[string][]byte{} // code => message
var allMessageCodeMap = map[string][]byte{}
var messageCodeIndex = 0
var messagesReg = regexp.MustCompile(`(?sU)\n\s*message\s+(\w+)\s*\{([^{}]+)\n\s*}`)
var firstMessagesReg = regexp.MustCompile(`message\s+(\w+)`)
var messageCodeREG = regexp.MustCompile(`MESSAGE\d+`)
for {
if messageCodeREG.Match(messageData) {
messageData = messageCodeREG.ReplaceAllFunc(messageData, func(messageCodeData []byte) []byte {
return allMessageCodeMap[string(messageCodeData)]
})
} else {
var hasMessage = false
data = messagesReg.ReplaceAllFunc(data, func(messageData []byte) []byte {
messageCodeIndex++
hasMessage = true
// 是否包含子Message
var subMatches = messageCodeREG.FindAllSubmatch(messageData, -1)
for _, subMatch := range subMatches {
var subMatchCode = string(subMatch[0])
delete(topMessageCodeMap, subMatchCode)
}
var code = "MESSAGE" + types.String(messageCodeIndex)
topMessageCodeMap[code] = messageData
allMessageCodeMap[code] = messageData
return []byte("\n" + code)
})
if !hasMessage {
break
}
}
// 注释
var index = bytes.Index(data, []byte(messageCode))
var messageName = string(firstMessagesReg.FindSubmatch(messageData)[1])
messages = append(messages, &MessageInfo{
Name: messageName,
Code: string(bytes.TrimSpace(messageData)),
Doc: readComments(data[:index]),
})
}
}(path)
}
}(dir)
for messageCode, messageData := range topMessageCodeMap {
// 替换其中的子Message
for {
if messageCodeREG.Match(messageData) {
messageData = messageCodeREG.ReplaceAllFunc(messageData, func(messageCodeData []byte) []byte {
return allMessageCodeMap[string(messageCodeData)]
})
} else {
break
}
}
// 注释
var index = bytes.Index(data, []byte(messageCode))
var messageName = string(firstMessagesReg.FindSubmatch(messageData)[1])
messages = append(messages, &MessageInfo{
Name: messageName,
Code: string(bytes.TrimSpace(messageData)),
Doc: readComments(data[:index]),
})
}
}(path)
}
}(dir)
}
}
var countServices = len(services)
@@ -204,9 +212,45 @@ func main() {
countMethods += len(service.Methods)
}
// 链接
var links = []*LinkInfo{}
// json links
{
var dirs = []string{Tea.Root + "/../pkg/rpc/jsons"}
for _, dir := range dirs {
func(dir string) {
dir = filepath.Clean(dir)
files, err := filepath.Glob(dir + "/*.md")
if err != nil {
fmt.Println("[ERROR]list .md files failed: " + err.Error())
return
}
for _, path := range files {
func(path string) {
var name = strings.TrimSuffix(filepath.Base(path), ".md")
data, err := ioutil.ReadFile(path)
if err != nil {
fmt.Println("[ERROR]read '" + path + "' failed: " + err.Error())
return
}
links = append(links, &LinkInfo{
Name: "json:" + name,
Content: string(data),
})
}(path)
}
}(dir)
}
}
var rpcList = &RPCList{
Services: services,
Messages: messages,
Links: links,
}
jsonData, err := json.MarshalIndent(rpcList, "", " ")
if err != nil {

View File

@@ -66,35 +66,33 @@ func TestRouteRangeIPRange_Contains(t *testing.T) {
// reverse ipv4
{
var r = &RouteRangeIPRange{
IPFrom: "192.168.1.100",
IPTo: "192.168.3.200",
IsReverse: true,
IPFrom: "192.168.1.100",
IPTo: "192.168.3.200",
}
err := r.Init()
if err != nil {
t.Fatal(err)
}
a.IsFalse(r.Contains(net.ParseIP("aaa")))
a.IsFalse(r.Contains(net.ParseIP("192.168.1.200")))
a.IsFalse(r.Contains(net.ParseIP("192.168.3.200")))
a.IsTrue(r.Contains(net.ParseIP("192.168.4.1")))
a.IsTrue(r.Contains(net.ParseIP("192.168.1.200")))
a.IsTrue(r.Contains(net.ParseIP("192.168.3.200")))
a.IsFalse(r.Contains(net.ParseIP("192.168.4.1")))
}
// reverse cidr
{
var r = &RouteRangeCIDR{
CIDR: "192.168.2.1/24",
IsReverse: true,
CIDR: "192.168.2.1/24",
}
err := r.Init()
if err != nil {
t.Fatal(err)
}
a.IsFalse(r.Contains(net.ParseIP("aaa")))
a.IsFalse(r.Contains(net.ParseIP("192.168.2.1")))
a.IsFalse(r.Contains(net.ParseIP("192.168.2.254")))
a.IsFalse(r.Contains(net.ParseIP("192.168.2.100")))
a.IsTrue(r.Contains(net.ParseIP("192.168.3.1")))
a.IsTrue(r.Contains(net.ParseIP("192.168.1.1")))
a.IsTrue(r.Contains(net.ParseIP("192.168.2.1")))
a.IsTrue(r.Contains(net.ParseIP("192.168.2.254")))
a.IsTrue(r.Contains(net.ParseIP("192.168.2.100")))
a.IsFalse(r.Contains(net.ParseIP("192.168.3.1")))
a.IsFalse(r.Contains(net.ParseIP("192.168.1.1")))
}
}

View File

@@ -0,0 +1,43 @@
# 访问日志引用
## 定义
~~~json
{
"isPrior": "是否覆盖父级应用",
"isOn": "是否启用配置",
"fields": ["字段1", "字段2", ...] // 可以留空
"status1": "是否启用状态1xx",
"status2": "是否启用状态2xx",
"status3": "是否启用状态3xx",
"status4": "是否启用状态4xx",
"status5": "是否启用状态5xx",
"enableClientClosed": "是否记录客户端关闭事件",
"firewallOnly": "是否只记录防火墙WAF相关日志"
}
~~~
### 字段值
* `1` - 请求Header
* `2` - 响应Header
* `3` - 请求URL参数
* `4` - Cookie
* `5` - 扩展信息
* `6` - Referer
* `7` - UserAgent
* `8` - 请求Body
* `9` - 响应Body目前不支持
## 示例
~~~json
{
"isPrior": true,
"isOn": true,
"fields": [],
"status1": true,
"status2": true,
"status3": true,
"status4": true,
"status5": true,
"enableClientClosed": true,
"firewallOnly": true
}
~~~

View File

@@ -0,0 +1,92 @@
# HTTP缓存配置
## 定义
~~~json
{
"isPrior": "是否覆盖上级配置",
"isOn": "是否启用配置",
"addStatusHeader": "是否增加命中状态HeaderX-Cache",
"addAgeHeader": "是否增加Age Header",
"enableCacheControlMaxAge": "是否支持Cache-Control: max-age=...",
"disablePolicyRefs": "是否停用策略中定义的条件",
"purgeIsOn": "是否允许使用Purge方法清理",
"purgeKey": "Purge时使用的X-Edge-Purge-Key",
"stale": "陈旧缓存使用策略",
"cacheRefs": ["缓存条件1", "缓存条件2", ...]
}
~~~
其中:
* `缓存条件` - 参考 {json:http_cache_ref}
## 示例
### 无缓存条件
~~~json
{
"isPrior": true,
"isOn": true,
"addStatusHeader": true,
"addAgeHeader": true,
"enableCacheControlMaxAge": true,
"disablePolicyRefs": false,
"purgeIsOn": false,
"purgeKey": "",
"stale": null,
"cacheRefs": []
}
~~~
### 加入缓存条件
~~~json
{
"isPrior": true,
"isOn": true,
"addStatusHeader": true,
"addAgeHeader": true,
"enableCacheControlMaxAge": true,
"disablePolicyRefs": false,
"purgeIsOn": false,
"purgeKey": "",
"stale": null,
"cacheRefs": [
{
"id": 0,
"isOn": true,
"key": "${scheme}://${host}${requestPath}${isArgs}${args}",
"life": {"count": 2, "unit": "hour"},
"status": [200],
"maxSize": {"count": 32, "unit": "mb"},
"minSize": {"count": 0, "unit": "kb"},
"skipCacheControlValues": ["private", "no-cache", "no-store"],
"skipSetCookie": true,
"enableRequestCachePragma": false,
"conds": {
"isOn": true,
"connector": "or",
"groups": [
{
"isOn": true,
"connector": "and",
"conds": [
{
"type": "url-extension",
"isRequest": true,
"param": "${requestPathExtension}",
"operator": "in",
"value": "[\".css\",\".png\",\".js\",\".woff2\"]",
"isReverse": false,
"isCaseInsensitive": false,
"typeName": "URL扩展名"
}
],
"isReverse": false,
"description": ""
}
]
},
"allowChunkedEncoding": true,
"allowPartialContent": false,
"isReverse": false,
"methods": []
}
]
}
~~~

View File

@@ -0,0 +1,91 @@
# 缓存条件设置
## 定义
~~~json
{
"isOn": "是否启用配置",
"key": "每个缓存的Key规则里面可以有变量",
"life": "缓存时长",
"expiresTime": "客户端过期时间",
"status": ["缓存的状态码1", "缓存的状态码2", ...],
"minSize": "能够缓存的最小尺寸",
"maxSize": "能够缓存的最大尺寸",
"methods": ["支持的请求方法1", "支持的请求方法2", ...],
"skipCacheControlValues": "可以跳过的响应的Cache-Control值",
"skipSetCookie": "是否跳过响应的Set-Cookie Header",
"enableRequestCachePragma": "是否支持客户端的Pragma: no-cache",
"allowChunkedEncoding": "是否允许分片内容",
"allowPartialContent": "支持分段内容缓存",
"conds": "请求条件",
"isReverse": "是否为反向条件,反向条件的不缓存"
}
~~~
## 示例
~~~json
{
"isOn": true,
"key": "${scheme}://${host}${requestURI}",
"life": {
"count": 1,
"unit": "day"
},
"expiresTime": {
"isPrior": true,
"isOn": true,
"overwrite": true,
"autoCalculate": false,
"duration": {
"count": 1,
"unit": "day"
}
},
"status": [
200
],
"minSize": {
"count": 0,
"unit": "kb"
},
"maxSize": {
"count": 32,
"unit": "mb"
},
"methods": [],
"skipCacheControlValues": [
"private",
"no-cache",
"no-store"
],
"skipSetCookie": true,
"enableRequestCachePragma": false,
"allowChunkedEncoding": true,
"allowPartialContent": false,
"conds": {
"isOn": true,
"connector": "or",
"groups": [
{
"isOn": true,
"connector": "and",
"conds": [
{
"type": "url-extension",
"isRequest": true,
"param": "${requestPathExtension}",
"operator": "in",
"value": "[\".css\",\".png\",\".js\",\".woff2\"]",
"isReverse": false,
"isCaseInsensitive": false,
"typeName": "URL扩展名"
}
],
"isReverse": false,
"description": ""
}
]
},
"cachePolicy": null,
"isReverse": false,
"id": 1
}
~~~

View File

@@ -0,0 +1,18 @@
# HTTP防火墙即WAF引用
## 定义
~~~json
{
"isPrior": "是否覆盖上级配置",
"isOn": "是否启用配置",
"firewallPolicyId": "WAF策略ID"
}
~~~
## 示例
~~~json
{
"isPrior": true,
"isOn": true,
"firewallPolicyId": 123
}
~~~

View File

@@ -0,0 +1,31 @@
# HTTP获取客户端IP地址方式配置
## 定义
~~~json
{
"isPrior": "是否覆盖父级应用",
"isOn": "是否启用配置",
"value": "自定义值变量",
"isCustomized": "是否自定义"
}
~~~
## 示例
### 不启用自定义
~~~json
{
"isPrior": false,
"isOn": false,
"value": "",
"isCustomized": false
}
~~~
### 启用自定义
~~~json
{
"isPrior": true,
"isOn": true,
"value": "${remoteAddr}",
"isCustomized": true
}
~~~

View File

@@ -0,0 +1,16 @@
# 统计引用
## 定义
~~~json
{
"isPrior": "是否覆盖父级配置",
"isOn": "是否启用配置"
}
~~~
## 示例
~~~json
{
"isPrior": true,
"isOn": true
}
~~~

View File

@@ -0,0 +1,21 @@
# WebSocket引用
## 定义
~~~json
{
"isPrior": "是否覆盖上级配置true|false",
"isOn": "是否启用true|false",
"websocketId": "Websocket配置ID"
}
~~~
其中:
* `Websocket配置ID` - 需要调用 `HTTPWebsocketService.CreateHTTPWebsocketRequest()` 生成
## 示例
~~~json
{
"isPrior": true,
"isOn": true,
"websocketId": 123
}
~~~

View File

@@ -0,0 +1,9 @@
# 域名信息
## 示例
~~~json
{
"name": "example.com",
"type": "full"
}
~~~

View File

@@ -0,0 +1,48 @@
# 域名信息列表
## 定义
~~~
[ 域名信息1, 域名信息2, ... ]
~~~
其中 `域名信息N` 等是单个域名信息定义,具体请参考 {json:server_name}
## 示例
### 示例1单个域名
~~~json
[
{
"name": "example.com",
"type": "full"
}
]
~~~
### 示例2多个域名
~~~json
[
{
"name": "example.com",
"type": "full"
},
{
"name": "google.com",
"type": "full"
},
{
"name": "facebook.com",
"type": "full"
}
]
~~~
### 示例3域名合集
域名合集效果跟多个域名是一样的,只不过在界面上以一个目录的形式呈现。
~~~json
[
{
"name": "",
"type": "full",
"subNames": ["example.com", "google.com", "facebook.com"]
}
]
~~~

View File

@@ -0,0 +1,18 @@
# SSL证书引用
## 示例
~~~
[
{
"isOn": true,
"certId": 12345
},
{
"isOn": true,
"certId": 12346
}
]
~~~
其中:
* `certId` - 证书的ID

View File

@@ -489,7 +489,7 @@ type UpdateHTTPWebRemoteAddrRequest struct {
unknownFields protoimpl.UnknownFields
HttpWebId int64 `protobuf:"varint,1,opt,name=httpWebId,proto3" json:"httpWebId,omitempty"`
RemoteAddrJSON []byte `protobuf:"bytes,2,opt,name=remoteAddrJSON,proto3" json:"remoteAddrJSON,omitempty"`
RemoteAddrJSON []byte `protobuf:"bytes,2,opt,name=remoteAddrJSON,proto3" json:"remoteAddrJSON,omitempty"` // @link json:http_remote_addr_config
}
func (x *UpdateHTTPWebRemoteAddrRequest) Reset() {
@@ -825,7 +825,7 @@ type UpdateHTTPWebAccessLogRequest struct {
unknownFields protoimpl.UnknownFields
HttpWebId int64 `protobuf:"varint,1,opt,name=httpWebId,proto3" json:"httpWebId,omitempty"`
AccessLogJSON []byte `protobuf:"bytes,2,opt,name=accessLogJSON,proto3" json:"accessLogJSON,omitempty"`
AccessLogJSON []byte `protobuf:"bytes,2,opt,name=accessLogJSON,proto3" json:"accessLogJSON,omitempty"` // @link json:http_access_log_ref
}
func (x *UpdateHTTPWebAccessLogRequest) Reset() {
@@ -881,7 +881,7 @@ type UpdateHTTPWebStatRequest struct {
unknownFields protoimpl.UnknownFields
HttpWebId int64 `protobuf:"varint,1,opt,name=httpWebId,proto3" json:"httpWebId,omitempty"`
StatJSON []byte `protobuf:"bytes,2,opt,name=statJSON,proto3" json:"statJSON,omitempty"`
StatJSON []byte `protobuf:"bytes,2,opt,name=statJSON,proto3" json:"statJSON,omitempty"` // @link json:http_stat_stat_ref
}
func (x *UpdateHTTPWebStatRequest) Reset() {
@@ -937,7 +937,7 @@ type UpdateHTTPWebCacheRequest struct {
unknownFields protoimpl.UnknownFields
HttpWebId int64 `protobuf:"varint,1,opt,name=httpWebId,proto3" json:"httpWebId,omitempty"`
CacheJSON []byte `protobuf:"bytes,2,opt,name=cacheJSON,proto3" json:"cacheJSON,omitempty"`
CacheJSON []byte `protobuf:"bytes,2,opt,name=cacheJSON,proto3" json:"cacheJSON,omitempty"` // @link json:http_cache_config
}
func (x *UpdateHTTPWebCacheRequest) Reset() {
@@ -993,7 +993,7 @@ type UpdateHTTPWebFirewallRequest struct {
unknownFields protoimpl.UnknownFields
HttpWebId int64 `protobuf:"varint,1,opt,name=httpWebId,proto3" json:"httpWebId,omitempty"`
FirewallJSON []byte `protobuf:"bytes,2,opt,name=firewallJSON,proto3" json:"firewallJSON,omitempty"`
FirewallJSON []byte `protobuf:"bytes,2,opt,name=firewallJSON,proto3" json:"firewallJSON,omitempty"` // @link json:http_firewall_ref
}
func (x *UpdateHTTPWebFirewallRequest) Reset() {
@@ -1161,7 +1161,7 @@ type UpdateHTTPWebWebsocketRequest struct {
unknownFields protoimpl.UnknownFields
HttpWebId int64 `protobuf:"varint,1,opt,name=httpWebId,proto3" json:"httpWebId,omitempty"`
WebsocketJSON []byte `protobuf:"bytes,2,opt,name=websocketJSON,proto3" json:"websocketJSON,omitempty"`
WebsocketJSON []byte `protobuf:"bytes,2,opt,name=websocketJSON,proto3" json:"websocketJSON,omitempty"` // @link json:http_websocket_ref
}
func (x *UpdateHTTPWebWebsocketRequest) Reset() {

View File

@@ -41,7 +41,7 @@ type CreateServerRequest struct {
Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"`
Description string `protobuf:"bytes,5,opt,name=description,proto3" json:"description,omitempty"`
// 配置相关
ServerNamesJON []byte `protobuf:"bytes,8,opt,name=serverNamesJON,proto3" json:"serverNamesJON,omitempty"`
ServerNamesJON []byte `protobuf:"bytes,8,opt,name=serverNamesJON,proto3" json:"serverNamesJON,omitempty"` // @link json:server_names
HttpJSON []byte `protobuf:"bytes,9,opt,name=httpJSON,proto3" json:"httpJSON,omitempty"`
HttpsJSON []byte `protobuf:"bytes,10,opt,name=httpsJSON,proto3" json:"httpsJSON,omitempty"`
TcpJSON []byte `protobuf:"bytes,11,opt,name=tcpJSON,proto3" json:"tcpJSON,omitempty"`

View File

@@ -150,7 +150,7 @@ message UpdateHTTPWebWebPRequest {
// 更改RemoteAddr配置
message UpdateHTTPWebRemoteAddrRequest {
int64 httpWebId = 1;
bytes remoteAddrJSON = 2;
bytes remoteAddrJSON = 2; // @link json:http_remote_addr_config
}
// 更改字符集配置
@@ -186,25 +186,25 @@ message UpdateHTTPWebPagesRequest {
// 更改访问日志配置
message UpdateHTTPWebAccessLogRequest {
int64 httpWebId = 1;
bytes accessLogJSON = 2;
bytes accessLogJSON = 2; // @link json:http_access_log_ref
}
// 更改统计配置
message UpdateHTTPWebStatRequest {
int64 httpWebId = 1;
bytes statJSON = 2;
bytes statJSON = 2; // @link json:http_stat_stat_ref
}
// 更改缓存配置
message UpdateHTTPWebCacheRequest {
int64 httpWebId = 1;
bytes cacheJSON = 2;
bytes cacheJSON = 2; // @link json:http_cache_config
}
// 更改防火墙设置
message UpdateHTTPWebFirewallRequest {
int64 httpWebId = 1;
bytes firewallJSON = 2;
bytes firewallJSON = 2; // @link json:http_firewall_ref
}
// 更改路径规则配置
@@ -222,7 +222,7 @@ message UpdateHTTPWebRedirectToHTTPSRequest {
// 更改Websocket设置
message UpdateHTTPWebWebsocketRequest {
int64 httpWebId = 1;
bytes websocketJSON = 2;
bytes websocketJSON = 2; // @link json:http_websocket_ref
}
// 更改Fastcgi设置

View File

@@ -165,7 +165,7 @@ message CreateServerRequest {
string description = 5;
// 配置相关
bytes serverNamesJON = 8;
bytes serverNamesJON = 8; // @link json:server_names
bytes httpJSON = 9;
bytes httpsJSON = 10;
bytes tcpJSON = 11;

View File

@@ -12,7 +12,7 @@ type HTTPCacheConfig struct {
AddStatusHeader bool `yaml:"addStatusHeader" json:"addStatusHeader"` // 是否增加命中状态HeaderX-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"` // 停用策略中定义的条件
DisablePolicyRefs bool `yaml:"disablePolicyRefs" json:"disablePolicyRefs"` // 是否停用策略中定义的条件
PurgeIsOn bool `yaml:"purgeIsOn" json:"purgeIsOn"` // 是否允许使用Purge方法清理
PurgeKey string `yaml:"purgeKey" json:"purgeKey"` // Purge时使用的X-Edge-Purge-Key