mirror of
				https://github.com/TeaOSLab/EdgeCommon.git
				synced 2025-11-04 05:00:24 +08:00 
			
		
		
		
	增加proto相关注释
This commit is contained in:
		
							
								
								
									
										5998
									
								
								build/rpc.json
									
									
									
									
									
								
							
							
						
						
									
										5998
									
								
								build/rpc.json
									
									
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -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,11 +74,11 @@ 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{}
 | 
			
		||||
 | 
			
		||||
	{
 | 
			
		||||
		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)
 | 
			
		||||
@@ -196,6 +203,7 @@ func main() {
 | 
			
		||||
				}
 | 
			
		||||
			}(dir)
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	var countServices = len(services)
 | 
			
		||||
	var countMethods = 0
 | 
			
		||||
@@ -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 {
 | 
			
		||||
 
 | 
			
		||||
@@ -68,33 +68,31 @@ func TestRouteRangeIPRange_Contains(t *testing.T) {
 | 
			
		||||
		var r = &RouteRangeIPRange{
 | 
			
		||||
			IPFrom: "192.168.1.100",
 | 
			
		||||
			IPTo:   "192.168.3.200",
 | 
			
		||||
			IsReverse: true,
 | 
			
		||||
		}
 | 
			
		||||
		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,
 | 
			
		||||
		}
 | 
			
		||||
		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")))
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										43
									
								
								pkg/rpc/jsons/http_access_log_ref.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										43
									
								
								pkg/rpc/jsons/http_access_log_ref.md
									
									
									
									
									
										Normal 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
 | 
			
		||||
}
 | 
			
		||||
~~~
 | 
			
		||||
							
								
								
									
										92
									
								
								pkg/rpc/jsons/http_cache_config.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										92
									
								
								pkg/rpc/jsons/http_cache_config.md
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,92 @@
 | 
			
		||||
# HTTP缓存配置
 | 
			
		||||
## 定义
 | 
			
		||||
~~~json
 | 
			
		||||
{
 | 
			
		||||
  "isPrior": "是否覆盖上级配置",
 | 
			
		||||
  "isOn": "是否启用配置",
 | 
			
		||||
  "addStatusHeader": "是否增加命中状态Header(X-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": []
 | 
			
		||||
	}
 | 
			
		||||
  ]
 | 
			
		||||
}
 | 
			
		||||
~~~
 | 
			
		||||
							
								
								
									
										91
									
								
								pkg/rpc/jsons/http_cache_ref.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										91
									
								
								pkg/rpc/jsons/http_cache_ref.md
									
									
									
									
									
										Normal 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
 | 
			
		||||
}
 | 
			
		||||
~~~
 | 
			
		||||
							
								
								
									
										18
									
								
								pkg/rpc/jsons/http_firewall_ref.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								pkg/rpc/jsons/http_firewall_ref.md
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,18 @@
 | 
			
		||||
# HTTP防火墙(即WAF)引用
 | 
			
		||||
## 定义
 | 
			
		||||
~~~json
 | 
			
		||||
{
 | 
			
		||||
  "isPrior": "是否覆盖上级配置",
 | 
			
		||||
  "isOn": "是否启用配置",
 | 
			
		||||
  "firewallPolicyId": "WAF策略ID"
 | 
			
		||||
}
 | 
			
		||||
~~~
 | 
			
		||||
 | 
			
		||||
## 示例
 | 
			
		||||
~~~json
 | 
			
		||||
{
 | 
			
		||||
  "isPrior": true,
 | 
			
		||||
  "isOn": true,
 | 
			
		||||
  "firewallPolicyId": 123
 | 
			
		||||
}
 | 
			
		||||
~~~
 | 
			
		||||
							
								
								
									
										31
									
								
								pkg/rpc/jsons/http_remote_addr_config.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								pkg/rpc/jsons/http_remote_addr_config.md
									
									
									
									
									
										Normal 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
 | 
			
		||||
}
 | 
			
		||||
~~~
 | 
			
		||||
							
								
								
									
										16
									
								
								pkg/rpc/jsons/http_stat_stat_ref.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								pkg/rpc/jsons/http_stat_stat_ref.md
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,16 @@
 | 
			
		||||
# 统计引用
 | 
			
		||||
## 定义
 | 
			
		||||
~~~json
 | 
			
		||||
{
 | 
			
		||||
  "isPrior": "是否覆盖父级配置",
 | 
			
		||||
  "isOn": "是否启用配置"
 | 
			
		||||
}
 | 
			
		||||
~~~
 | 
			
		||||
 | 
			
		||||
## 示例
 | 
			
		||||
~~~json
 | 
			
		||||
{
 | 
			
		||||
  "isPrior": true,
 | 
			
		||||
  "isOn": true
 | 
			
		||||
}
 | 
			
		||||
~~~
 | 
			
		||||
							
								
								
									
										21
									
								
								pkg/rpc/jsons/http_websocket_ref.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								pkg/rpc/jsons/http_websocket_ref.md
									
									
									
									
									
										Normal 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
 | 
			
		||||
}
 | 
			
		||||
~~~
 | 
			
		||||
							
								
								
									
										9
									
								
								pkg/rpc/jsons/server_name.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								pkg/rpc/jsons/server_name.md
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,9 @@
 | 
			
		||||
# 域名信息
 | 
			
		||||
 | 
			
		||||
## 示例
 | 
			
		||||
~~~json
 | 
			
		||||
{
 | 
			
		||||
  "name": "example.com",
 | 
			
		||||
  "type": "full"
 | 
			
		||||
}
 | 
			
		||||
~~~
 | 
			
		||||
							
								
								
									
										48
									
								
								pkg/rpc/jsons/server_names.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										48
									
								
								pkg/rpc/jsons/server_names.md
									
									
									
									
									
										Normal 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"]
 | 
			
		||||
  	}
 | 
			
		||||
]
 | 
			
		||||
~~~
 | 
			
		||||
							
								
								
									
										18
									
								
								pkg/rpc/jsons/ssl_cert_refs.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								pkg/rpc/jsons/ssl_cert_refs.md
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,18 @@
 | 
			
		||||
# SSL证书引用
 | 
			
		||||
 | 
			
		||||
## 示例
 | 
			
		||||
~~~
 | 
			
		||||
[
 | 
			
		||||
  {
 | 
			
		||||
    "isOn": true,
 | 
			
		||||
    "certId": 12345
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "isOn": true,
 | 
			
		||||
    "certId": 12346
 | 
			
		||||
  }
 | 
			
		||||
]
 | 
			
		||||
~~~
 | 
			
		||||
 | 
			
		||||
其中:
 | 
			
		||||
* `certId` - 证书的ID
 | 
			
		||||
@@ -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() {
 | 
			
		||||
 
 | 
			
		||||
@@ -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"`
 | 
			
		||||
 
 | 
			
		||||
@@ -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设置
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 
 | 
			
		||||
@@ -12,7 +12,7 @@ type HTTPCacheConfig struct {
 | 
			
		||||
	AddStatusHeader          bool `yaml:"addStatusHeader" json:"addStatusHeader"`                   // 是否增加命中状态Header(X-Cache)
 | 
			
		||||
	AddAgeHeader             bool `yaml:"addAgeHeader" json:"addAgeHeader"`                         // 是否增加Age Header
 | 
			
		||||
	EnableCacheControlMaxAge bool `yaml:"enableCacheControlMaxAge" json:"enableCacheControlMaxAge"` // 是否支持Cache-Control: max-age=...
 | 
			
		||||
	DisablePolicyRefs        bool `yaml:"disablePolicyRefs" json:"disablePolicyRefs"`               // 停用策略中定义的条件
 | 
			
		||||
	DisablePolicyRefs        bool `yaml:"disablePolicyRefs" json:"disablePolicyRefs"`               // 是否停用策略中定义的条件
 | 
			
		||||
 | 
			
		||||
	PurgeIsOn bool   `yaml:"purgeIsOn" json:"purgeIsOn"` // 是否允许使用Purge方法清理
 | 
			
		||||
	PurgeKey  string `yaml:"purgeKey" json:"purgeKey"`   // Purge时使用的X-Edge-Purge-Key
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user