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"
 | 
						"io/ioutil"
 | 
				
			||||||
	"path/filepath"
 | 
						"path/filepath"
 | 
				
			||||||
	"regexp"
 | 
						"regexp"
 | 
				
			||||||
 | 
						"strings"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type ServiceInfo struct {
 | 
					type ServiceInfo struct {
 | 
				
			||||||
@@ -36,9 +37,15 @@ type MessageInfo struct {
 | 
				
			|||||||
	Doc  string `json:"doc"`
 | 
						Doc  string `json:"doc"`
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					type LinkInfo struct {
 | 
				
			||||||
 | 
						Name    string `json:"name"`
 | 
				
			||||||
 | 
						Content string `json:"content"`
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type RPCList struct {
 | 
					type RPCList struct {
 | 
				
			||||||
	Services []*ServiceInfo `json:"services"`
 | 
						Services []*ServiceInfo `json:"services"`
 | 
				
			||||||
	Messages []*MessageInfo `json:"messages"`
 | 
						Messages []*MessageInfo `json:"messages"`
 | 
				
			||||||
 | 
						Links    []*LinkInfo    `json:"links"`
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func readComments(data []byte) string {
 | 
					func readComments(data []byte) string {
 | 
				
			||||||
@@ -67,134 +74,135 @@ func main() {
 | 
				
			|||||||
	flag.BoolVar(&quiet, "quiet", false, "")
 | 
						flag.BoolVar(&quiet, "quiet", false, "")
 | 
				
			||||||
	flag.Parse()
 | 
						flag.Parse()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	var dirs = []string{Tea.Root + "/../pkg/rpc/protos/", Tea.Root + "/../pkg/rpc/protos/models"}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	var services = []*ServiceInfo{}
 | 
						var services = []*ServiceInfo{}
 | 
				
			||||||
	var messages = []*MessageInfo{}
 | 
						var messages = []*MessageInfo{}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, dir := range dirs {
 | 
						{
 | 
				
			||||||
		func(dir string) {
 | 
							var dirs = []string{Tea.Root + "/../pkg/rpc/protos/", Tea.Root + "/../pkg/rpc/protos/models"}
 | 
				
			||||||
			dir = filepath.Clean(dir)
 | 
							for _, dir := range dirs {
 | 
				
			||||||
 | 
								func(dir string) {
 | 
				
			||||||
 | 
									dir = filepath.Clean(dir)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			files, err := filepath.Glob(dir + "/*.proto")
 | 
									files, err := filepath.Glob(dir + "/*.proto")
 | 
				
			||||||
			if err != nil {
 | 
									if err != nil {
 | 
				
			||||||
				fmt.Println("[ERROR]list proto files failed: " + err.Error())
 | 
										fmt.Println("[ERROR]list proto files failed: " + err.Error())
 | 
				
			||||||
				return
 | 
										return
 | 
				
			||||||
			}
 | 
									}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			for _, path := range files {
 | 
									for _, path := range files {
 | 
				
			||||||
				func(path string) {
 | 
										func(path string) {
 | 
				
			||||||
					data, err := ioutil.ReadFile(path)
 | 
											data, err := ioutil.ReadFile(path)
 | 
				
			||||||
					if err != nil {
 | 
											if err != nil {
 | 
				
			||||||
						fmt.Println("[ERROR]" + err.Error())
 | 
												fmt.Println("[ERROR]" + err.Error())
 | 
				
			||||||
						return
 | 
												return
 | 
				
			||||||
					}
 | 
											}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
					// 先将rpc代码替换成临时代码
 | 
											// 先将rpc代码替换成临时代码
 | 
				
			||||||
					var methodCodeMap = map[string][]byte{} // code => method
 | 
											var methodCodeMap = map[string][]byte{} // code => method
 | 
				
			||||||
					var methodIndex = 0
 | 
											var methodIndex = 0
 | 
				
			||||||
					var methodReg = regexp.MustCompile(`rpc\s+(\w+)\s*\(\s*(\w+)\s*\)\s*returns\s*\(\s*(\w+)\s*\)\s*;`)
 | 
											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 {
 | 
											data = methodReg.ReplaceAllFunc(data, func(methodData []byte) []byte {
 | 
				
			||||||
						methodIndex++
 | 
												methodIndex++
 | 
				
			||||||
						var code = "METHOD" + types.String(methodIndex)
 | 
												var code = "METHOD" + types.String(methodIndex)
 | 
				
			||||||
						methodCodeMap[code] = methodData
 | 
												methodCodeMap[code] = methodData
 | 
				
			||||||
						return []byte("\n" + code)
 | 
												return []byte("\n" + code)
 | 
				
			||||||
					})
 | 
											})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
					// 服务列表
 | 
											// 服务列表
 | 
				
			||||||
					// TODO 这里需要改进一下,当前实现方法如果方法注释里有括号(}),就会导致部分方法解析不到
 | 
											// TODO 这里需要改进一下,当前实现方法如果方法注释里有括号(}),就会导致部分方法解析不到
 | 
				
			||||||
					var serviceNameReg = regexp.MustCompile(`(?sU)\n\s*service\s+(\w+)\s*\{(.+)}`)
 | 
											var serviceNameReg = regexp.MustCompile(`(?sU)\n\s*service\s+(\w+)\s*\{(.+)}`)
 | 
				
			||||||
					var serviceMatches = serviceNameReg.FindAllSubmatch(data, -1)
 | 
											var serviceMatches = serviceNameReg.FindAllSubmatch(data, -1)
 | 
				
			||||||
					var serviceNamePositions = serviceNameReg.FindAllIndex(data, -1)
 | 
											var serviceNamePositions = serviceNameReg.FindAllIndex(data, -1)
 | 
				
			||||||
					for serviceMatchIndex, serviceMatch := range serviceMatches {
 | 
											for serviceMatchIndex, serviceMatch := range serviceMatches {
 | 
				
			||||||
						var serviceName = string(serviceMatch[1])
 | 
												var serviceName = string(serviceMatch[1])
 | 
				
			||||||
						var serviceNamePosition = serviceNamePositions[serviceMatchIndex][0]
 | 
												var serviceNamePosition = serviceNamePositions[serviceMatchIndex][0]
 | 
				
			||||||
						var comment = readComments(data[:serviceNamePosition])
 | 
												var comment = readComments(data[:serviceNamePosition])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
						// 方法列表
 | 
												// 方法列表
 | 
				
			||||||
						var methods = []*MethodInfo{}
 | 
												var methods = []*MethodInfo{}
 | 
				
			||||||
						var serviceData = serviceMatch[2]
 | 
												var serviceData = serviceMatch[2]
 | 
				
			||||||
						var methodCodeReg = regexp.MustCompile(`\b(METHOD\d+)\b`)
 | 
												var methodCodeReg = regexp.MustCompile(`\b(METHOD\d+)\b`)
 | 
				
			||||||
						var methodCodeMatches = methodCodeReg.FindAllSubmatch(serviceData, -1)
 | 
												var methodCodeMatches = methodCodeReg.FindAllSubmatch(serviceData, -1)
 | 
				
			||||||
						var methodCodePositions = methodCodeReg.FindAllIndex(serviceData, -1)
 | 
												var methodCodePositions = methodCodeReg.FindAllIndex(serviceData, -1)
 | 
				
			||||||
						for methodMatchIndex, methodMatch := range methodCodeMatches {
 | 
												for methodMatchIndex, methodMatch := range methodCodeMatches {
 | 
				
			||||||
							var methodCode = string(methodMatch[1])
 | 
													var methodCode = string(methodMatch[1])
 | 
				
			||||||
							var methodData = methodCodeMap[methodCode]
 | 
													var methodData = methodCodeMap[methodCode]
 | 
				
			||||||
							var methodPieces = methodReg.FindSubmatch(methodData)
 | 
													var methodPieces = methodReg.FindSubmatch(methodData)
 | 
				
			||||||
							var methodCodePosition = methodCodePositions[methodMatchIndex]
 | 
													var methodCodePosition = methodCodePositions[methodMatchIndex]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
							methods = append(methods, &MethodInfo{
 | 
													methods = append(methods, &MethodInfo{
 | 
				
			||||||
								Name:                string(methodPieces[1]),
 | 
														Name:                string(methodPieces[1]),
 | 
				
			||||||
								RequestMessageName:  string(methodPieces[2]),
 | 
														RequestMessageName:  string(methodPieces[2]),
 | 
				
			||||||
								ResponseMessageName: string(methodPieces[3]),
 | 
														ResponseMessageName: string(methodPieces[3]),
 | 
				
			||||||
								Code:                string(methodData),
 | 
														Code:                string(methodData),
 | 
				
			||||||
								Doc:                 readComments(serviceData[:methodCodePosition[0]]),
 | 
														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,
 | 
											var topMessageCodeMap = map[string][]byte{} // code => message
 | 
				
			||||||
							Methods:  methods,
 | 
											var allMessageCodeMap = map[string][]byte{}
 | 
				
			||||||
							Filename: filepath.Base(path),
 | 
											var messageCodeIndex = 0
 | 
				
			||||||
							Doc:      comment,
 | 
											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+`)
 | 
				
			||||||
 | 
					 | 
				
			||||||
					// 消息列表
 | 
					 | 
				
			||||||
					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
 | 
					 | 
				
			||||||
						for {
 | 
											for {
 | 
				
			||||||
							if messageCodeREG.Match(messageData) {
 | 
												var hasMessage = false
 | 
				
			||||||
								messageData = messageCodeREG.ReplaceAllFunc(messageData, func(messageCodeData []byte) []byte {
 | 
					
 | 
				
			||||||
									return allMessageCodeMap[string(messageCodeData)]
 | 
												data = messagesReg.ReplaceAllFunc(data, func(messageData []byte) []byte {
 | 
				
			||||||
								})
 | 
													messageCodeIndex++
 | 
				
			||||||
							} else {
 | 
													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
 | 
													break
 | 
				
			||||||
							}
 | 
												}
 | 
				
			||||||
						}
 | 
											}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
						// 注释
 | 
											for messageCode, messageData := range topMessageCodeMap {
 | 
				
			||||||
						var index = bytes.Index(data, []byte(messageCode))
 | 
												// 替换其中的子Message
 | 
				
			||||||
						var messageName = string(firstMessagesReg.FindSubmatch(messageData)[1])
 | 
												for {
 | 
				
			||||||
						messages = append(messages, &MessageInfo{
 | 
													if messageCodeREG.Match(messageData) {
 | 
				
			||||||
							Name: messageName,
 | 
														messageData = messageCodeREG.ReplaceAllFunc(messageData, func(messageCodeData []byte) []byte {
 | 
				
			||||||
							Code: string(bytes.TrimSpace(messageData)),
 | 
															return allMessageCodeMap[string(messageCodeData)]
 | 
				
			||||||
							Doc:  readComments(data[:index]),
 | 
														})
 | 
				
			||||||
						})
 | 
													} else {
 | 
				
			||||||
					}
 | 
														break
 | 
				
			||||||
				}(path)
 | 
													}
 | 
				
			||||||
			}
 | 
												}
 | 
				
			||||||
		}(dir)
 | 
					
 | 
				
			||||||
 | 
												// 注释
 | 
				
			||||||
 | 
												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)
 | 
						var countServices = len(services)
 | 
				
			||||||
@@ -204,9 +212,45 @@ func main() {
 | 
				
			|||||||
		countMethods += len(service.Methods)
 | 
							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{
 | 
						var rpcList = &RPCList{
 | 
				
			||||||
		Services: services,
 | 
							Services: services,
 | 
				
			||||||
		Messages: messages,
 | 
							Messages: messages,
 | 
				
			||||||
 | 
							Links:    links,
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	jsonData, err := json.MarshalIndent(rpcList, "", "  ")
 | 
						jsonData, err := json.MarshalIndent(rpcList, "", "  ")
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -66,35 +66,33 @@ func TestRouteRangeIPRange_Contains(t *testing.T) {
 | 
				
			|||||||
	// reverse ipv4
 | 
						// reverse ipv4
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		var r = &RouteRangeIPRange{
 | 
							var r = &RouteRangeIPRange{
 | 
				
			||||||
			IPFrom:    "192.168.1.100",
 | 
								IPFrom: "192.168.1.100",
 | 
				
			||||||
			IPTo:      "192.168.3.200",
 | 
								IPTo:   "192.168.3.200",
 | 
				
			||||||
			IsReverse: true,
 | 
					 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		err := r.Init()
 | 
							err := r.Init()
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			t.Fatal(err)
 | 
								t.Fatal(err)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		a.IsFalse(r.Contains(net.ParseIP("aaa")))
 | 
							a.IsFalse(r.Contains(net.ParseIP("aaa")))
 | 
				
			||||||
		a.IsFalse(r.Contains(net.ParseIP("192.168.1.200")))
 | 
							a.IsTrue(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.3.200")))
 | 
				
			||||||
		a.IsTrue(r.Contains(net.ParseIP("192.168.4.1")))
 | 
							a.IsFalse(r.Contains(net.ParseIP("192.168.4.1")))
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// reverse cidr
 | 
						// reverse cidr
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		var r = &RouteRangeCIDR{
 | 
							var r = &RouteRangeCIDR{
 | 
				
			||||||
			CIDR:      "192.168.2.1/24",
 | 
								CIDR: "192.168.2.1/24",
 | 
				
			||||||
			IsReverse: true,
 | 
					 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		err := r.Init()
 | 
							err := r.Init()
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			t.Fatal(err)
 | 
								t.Fatal(err)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		a.IsFalse(r.Contains(net.ParseIP("aaa")))
 | 
							a.IsFalse(r.Contains(net.ParseIP("aaa")))
 | 
				
			||||||
		a.IsFalse(r.Contains(net.ParseIP("192.168.2.1")))
 | 
							a.IsTrue(r.Contains(net.ParseIP("192.168.2.1")))
 | 
				
			||||||
		a.IsFalse(r.Contains(net.ParseIP("192.168.2.254")))
 | 
							a.IsTrue(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.2.100")))
 | 
				
			||||||
		a.IsTrue(r.Contains(net.ParseIP("192.168.3.1")))
 | 
							a.IsFalse(r.Contains(net.ParseIP("192.168.3.1")))
 | 
				
			||||||
		a.IsTrue(r.Contains(net.ParseIP("192.168.1.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
 | 
						unknownFields protoimpl.UnknownFields
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	HttpWebId      int64  `protobuf:"varint,1,opt,name=httpWebId,proto3" json:"httpWebId,omitempty"`
 | 
						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() {
 | 
					func (x *UpdateHTTPWebRemoteAddrRequest) Reset() {
 | 
				
			||||||
@@ -825,7 +825,7 @@ type UpdateHTTPWebAccessLogRequest struct {
 | 
				
			|||||||
	unknownFields protoimpl.UnknownFields
 | 
						unknownFields protoimpl.UnknownFields
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	HttpWebId     int64  `protobuf:"varint,1,opt,name=httpWebId,proto3" json:"httpWebId,omitempty"`
 | 
						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() {
 | 
					func (x *UpdateHTTPWebAccessLogRequest) Reset() {
 | 
				
			||||||
@@ -881,7 +881,7 @@ type UpdateHTTPWebStatRequest struct {
 | 
				
			|||||||
	unknownFields protoimpl.UnknownFields
 | 
						unknownFields protoimpl.UnknownFields
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	HttpWebId int64  `protobuf:"varint,1,opt,name=httpWebId,proto3" json:"httpWebId,omitempty"`
 | 
						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() {
 | 
					func (x *UpdateHTTPWebStatRequest) Reset() {
 | 
				
			||||||
@@ -937,7 +937,7 @@ type UpdateHTTPWebCacheRequest struct {
 | 
				
			|||||||
	unknownFields protoimpl.UnknownFields
 | 
						unknownFields protoimpl.UnknownFields
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	HttpWebId int64  `protobuf:"varint,1,opt,name=httpWebId,proto3" json:"httpWebId,omitempty"`
 | 
						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() {
 | 
					func (x *UpdateHTTPWebCacheRequest) Reset() {
 | 
				
			||||||
@@ -993,7 +993,7 @@ type UpdateHTTPWebFirewallRequest struct {
 | 
				
			|||||||
	unknownFields protoimpl.UnknownFields
 | 
						unknownFields protoimpl.UnknownFields
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	HttpWebId    int64  `protobuf:"varint,1,opt,name=httpWebId,proto3" json:"httpWebId,omitempty"`
 | 
						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() {
 | 
					func (x *UpdateHTTPWebFirewallRequest) Reset() {
 | 
				
			||||||
@@ -1161,7 +1161,7 @@ type UpdateHTTPWebWebsocketRequest struct {
 | 
				
			|||||||
	unknownFields protoimpl.UnknownFields
 | 
						unknownFields protoimpl.UnknownFields
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	HttpWebId     int64  `protobuf:"varint,1,opt,name=httpWebId,proto3" json:"httpWebId,omitempty"`
 | 
						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() {
 | 
					func (x *UpdateHTTPWebWebsocketRequest) Reset() {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -41,7 +41,7 @@ type CreateServerRequest struct {
 | 
				
			|||||||
	Name        string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"`
 | 
						Name        string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"`
 | 
				
			||||||
	Description string `protobuf:"bytes,5,opt,name=description,proto3" json:"description,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"`
 | 
						HttpJSON         []byte  `protobuf:"bytes,9,opt,name=httpJSON,proto3" json:"httpJSON,omitempty"`
 | 
				
			||||||
	HttpsJSON        []byte  `protobuf:"bytes,10,opt,name=httpsJSON,proto3" json:"httpsJSON,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"`
 | 
						TcpJSON          []byte  `protobuf:"bytes,11,opt,name=tcpJSON,proto3" json:"tcpJSON,omitempty"`
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -150,7 +150,7 @@ message UpdateHTTPWebWebPRequest {
 | 
				
			|||||||
// 更改RemoteAddr配置
 | 
					// 更改RemoteAddr配置
 | 
				
			||||||
message UpdateHTTPWebRemoteAddrRequest {
 | 
					message UpdateHTTPWebRemoteAddrRequest {
 | 
				
			||||||
	int64 httpWebId = 1;
 | 
						int64 httpWebId = 1;
 | 
				
			||||||
	bytes remoteAddrJSON = 2;
 | 
						bytes remoteAddrJSON = 2; // @link json:http_remote_addr_config
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// 更改字符集配置
 | 
					// 更改字符集配置
 | 
				
			||||||
@@ -186,25 +186,25 @@ message UpdateHTTPWebPagesRequest {
 | 
				
			|||||||
// 更改访问日志配置
 | 
					// 更改访问日志配置
 | 
				
			||||||
message UpdateHTTPWebAccessLogRequest {
 | 
					message UpdateHTTPWebAccessLogRequest {
 | 
				
			||||||
	int64 httpWebId = 1;
 | 
						int64 httpWebId = 1;
 | 
				
			||||||
	bytes accessLogJSON = 2;
 | 
						bytes accessLogJSON = 2; // @link json:http_access_log_ref
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// 更改统计配置
 | 
					// 更改统计配置
 | 
				
			||||||
message UpdateHTTPWebStatRequest {
 | 
					message UpdateHTTPWebStatRequest {
 | 
				
			||||||
	int64 httpWebId = 1;
 | 
						int64 httpWebId = 1;
 | 
				
			||||||
	bytes statJSON = 2;
 | 
						bytes statJSON = 2; // @link json:http_stat_stat_ref
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// 更改缓存配置
 | 
					// 更改缓存配置
 | 
				
			||||||
message UpdateHTTPWebCacheRequest {
 | 
					message UpdateHTTPWebCacheRequest {
 | 
				
			||||||
	int64 httpWebId = 1;
 | 
						int64 httpWebId = 1;
 | 
				
			||||||
	bytes cacheJSON = 2;
 | 
						bytes cacheJSON = 2; // @link json:http_cache_config
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// 更改防火墙设置
 | 
					// 更改防火墙设置
 | 
				
			||||||
message UpdateHTTPWebFirewallRequest {
 | 
					message UpdateHTTPWebFirewallRequest {
 | 
				
			||||||
	int64 httpWebId = 1;
 | 
						int64 httpWebId = 1;
 | 
				
			||||||
	bytes firewallJSON = 2;
 | 
						bytes firewallJSON = 2; // @link json:http_firewall_ref
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// 更改路径规则配置
 | 
					// 更改路径规则配置
 | 
				
			||||||
@@ -222,7 +222,7 @@ message UpdateHTTPWebRedirectToHTTPSRequest {
 | 
				
			|||||||
// 更改Websocket设置
 | 
					// 更改Websocket设置
 | 
				
			||||||
message UpdateHTTPWebWebsocketRequest {
 | 
					message UpdateHTTPWebWebsocketRequest {
 | 
				
			||||||
	int64 httpWebId = 1;
 | 
						int64 httpWebId = 1;
 | 
				
			||||||
	bytes websocketJSON = 2;
 | 
						bytes websocketJSON = 2; // @link json:http_websocket_ref
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// 更改Fastcgi设置
 | 
					// 更改Fastcgi设置
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -165,7 +165,7 @@ message CreateServerRequest {
 | 
				
			|||||||
	string description = 5;
 | 
						string description = 5;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// 配置相关
 | 
						// 配置相关
 | 
				
			||||||
	bytes serverNamesJON = 8;
 | 
						bytes serverNamesJON = 8; // @link json:server_names
 | 
				
			||||||
	bytes httpJSON = 9;
 | 
						bytes httpJSON = 9;
 | 
				
			||||||
	bytes httpsJSON = 10;
 | 
						bytes httpsJSON = 10;
 | 
				
			||||||
	bytes tcpJSON = 11;
 | 
						bytes tcpJSON = 11;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -12,7 +12,7 @@ type HTTPCacheConfig struct {
 | 
				
			|||||||
	AddStatusHeader          bool `yaml:"addStatusHeader" json:"addStatusHeader"`                   // 是否增加命中状态Header(X-Cache)
 | 
						AddStatusHeader          bool `yaml:"addStatusHeader" json:"addStatusHeader"`                   // 是否增加命中状态Header(X-Cache)
 | 
				
			||||||
	AddAgeHeader             bool `yaml:"addAgeHeader" json:"addAgeHeader"`                         // 是否增加Age Header
 | 
						AddAgeHeader             bool `yaml:"addAgeHeader" json:"addAgeHeader"`                         // 是否增加Age Header
 | 
				
			||||||
	EnableCacheControlMaxAge bool `yaml:"enableCacheControlMaxAge" json:"enableCacheControlMaxAge"` // 是否支持Cache-Control: max-age=...
 | 
						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方法清理
 | 
						PurgeIsOn bool   `yaml:"purgeIsOn" json:"purgeIsOn"` // 是否允许使用Purge方法清理
 | 
				
			||||||
	PurgeKey  string `yaml:"purgeKey" json:"purgeKey"`   // Purge时使用的X-Edge-Purge-Key
 | 
						PurgeKey  string `yaml:"purgeKey" json:"purgeKey"`   // Purge时使用的X-Edge-Purge-Key
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user