Compare commits
136 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f725f3bb07 | ||
|
|
f3db0d5b69 | ||
|
|
b6fe3df3d6 | ||
|
|
5c885050fa | ||
|
|
b54c44bfb9 | ||
|
|
78664a9218 | ||
|
|
def814ff5c | ||
|
|
1bf13d381d | ||
|
|
2975ba8701 | ||
|
|
14759c3621 | ||
|
|
5ae65edd0a | ||
|
|
184d6f97bf | ||
|
|
8972acdfd7 | ||
|
|
a957903b98 | ||
|
|
b029c1e95a | ||
|
|
095ff97149 | ||
|
|
d00ebb31aa | ||
|
|
1c7f51c5e0 | ||
|
|
acc70669f1 | ||
|
|
2add42a284 | ||
|
|
225d03a65f | ||
|
|
f851212a55 | ||
|
|
199794a63a | ||
|
|
49129ea227 | ||
|
|
91b865dd23 | ||
|
|
0e311496b6 | ||
|
|
ed0f627ae4 | ||
|
|
569f27918a | ||
|
|
ec02d83ee6 | ||
|
|
debf4a5249 | ||
|
|
4ddc1ac89f | ||
|
|
507457dec1 | ||
|
|
525429bbb0 | ||
|
|
25e33ac1ee | ||
|
|
f428cb2de9 | ||
|
|
86070bc8aa | ||
|
|
afef00b473 | ||
|
|
812e9482af | ||
|
|
fa5dc80426 | ||
|
|
76b6a5c847 | ||
|
|
a19b738d73 | ||
|
|
526d72fd99 | ||
|
|
7ea8189c19 | ||
|
|
c453222774 | ||
|
|
905163880c | ||
|
|
ac106ca4f0 | ||
|
|
262dcf0c8d | ||
|
|
f6b3a0b829 | ||
|
|
ac7ab51dbb | ||
|
|
41ea2d0dda | ||
|
|
a4b68cd21c | ||
|
|
70d864191e | ||
|
|
9fdbaf92cc | ||
|
|
a75e57a8f7 | ||
|
|
9b187dadbe | ||
|
|
3ab783bbd0 | ||
|
|
0e95a5a4bc | ||
|
|
dcec62a1a2 | ||
|
|
9117af3021 | ||
|
|
65095d1290 | ||
|
|
380bf3e1c2 | ||
|
|
0090cf1e30 | ||
|
|
a24cbe43b6 | ||
|
|
0976b35357 | ||
|
|
84f8a7192e | ||
|
|
22479278b9 | ||
|
|
f27a55c2b6 | ||
|
|
106bd2ae87 | ||
|
|
ef4eb23226 | ||
|
|
d9a2284936 | ||
|
|
62027e95b2 | ||
|
|
551cb2f3c1 | ||
|
|
75dcaa7e7e | ||
|
|
c6952e794a | ||
|
|
7ad94bff2f | ||
|
|
20469e0487 | ||
|
|
4834cb2886 | ||
|
|
1f33bcfee7 | ||
|
|
8f8e769ead | ||
|
|
03296c7530 | ||
|
|
fecfb0f888 | ||
|
|
5e277de82b | ||
|
|
de4366bbc3 | ||
|
|
a8d38937e3 | ||
|
|
0ea04c9883 | ||
|
|
85553bf5d9 | ||
|
|
24f8ccb166 | ||
|
|
fb0b1d42ef | ||
|
|
38005406b0 | ||
|
|
6aee09b22b | ||
|
|
8c450a9b43 | ||
|
|
a660815df7 | ||
|
|
2b6d749566 | ||
|
|
dd900700e9 | ||
|
|
032b171025 | ||
|
|
ab005caa4a | ||
|
|
8e91af92ae | ||
|
|
97575e29a1 | ||
|
|
146b57216a | ||
|
|
2cdb0b9758 | ||
|
|
a6355914b2 | ||
|
|
fdcb83cc5f | ||
|
|
57bffa2cda | ||
|
|
e7189948f2 | ||
|
|
59a3a90d99 | ||
|
|
5619d0e026 | ||
|
|
21d58764cc | ||
|
|
2e17fc4368 | ||
|
|
4e921330db | ||
|
|
83423c1450 | ||
|
|
9d011f4982 | ||
|
|
6369458877 | ||
|
|
f855996d53 | ||
|
|
e75248ad6b | ||
|
|
8ccbe99fbc | ||
|
|
977358a3ab | ||
|
|
67154237fb | ||
|
|
d71b545971 | ||
|
|
7908d70750 | ||
|
|
8722c8a34a | ||
|
|
7488d0b334 | ||
|
|
d86f2bc1a4 | ||
|
|
6c1514cad7 | ||
|
|
c132bd9c1e | ||
|
|
f733282b48 | ||
|
|
4396b0fe74 | ||
|
|
04ab37ce23 | ||
|
|
01ca35f6a9 | ||
|
|
1c337ec40e | ||
|
|
aebafacda2 | ||
|
|
59b93bfbe1 | ||
|
|
eccc56369b | ||
|
|
75221eb855 | ||
|
|
b8d45ab42e | ||
|
|
bc2c6a56ed | ||
|
|
1becfdcd67 |
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
*_plus.go
|
||||||
|
*_plus_test.go
|
||||||
29
LICENSE
Normal file
29
LICENSE
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
BSD 3-Clause License
|
||||||
|
|
||||||
|
Copyright (c) 2020, LiuXiangChao
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
1. Redistributions of source code must retain the above copyright notice, this
|
||||||
|
list of conditions and the following disclaimer.
|
||||||
|
|
||||||
|
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer in the documentation
|
||||||
|
and/or other materials provided with the distribution.
|
||||||
|
|
||||||
|
3. Neither the name of the copyright holder nor the names of its
|
||||||
|
contributors may be used to endorse or promote products derived from
|
||||||
|
this software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||||
|
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||||
|
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
@@ -1,5 +1,23 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
echo "starting ..."
|
||||||
|
|
||||||
#rm -f ../pkg/rpc/pb/*.pb.go
|
#rm -f ../pkg/rpc/pb/*.pb.go
|
||||||
|
|
||||||
protoc --go_out=plugins=grpc:../pkg/rpc --proto_path=../pkg/rpc/protos ../pkg/rpc/protos/*.proto
|
protoc --go_out=plugins=grpc:../pkg/rpc --proto_path=../pkg/rpc/protos ../pkg/rpc/protos/*.proto
|
||||||
protoc --go_out=plugins=grpc:../pkg/rpc --proto_path=../pkg/rpc/protos ../pkg/rpc/protos/models/*.proto
|
RESULT=$?
|
||||||
|
if [ "${RESULT}" != "0" ]; then
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
RESULT=`protoc --go_out=plugins=grpc:../pkg/rpc --proto_path=../pkg/rpc/protos ../pkg/rpc/protos/models/*.proto`
|
||||||
|
RESULT=$?
|
||||||
|
if [ "${RESULT}" != "0" ]; then
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# generate rpc.json
|
||||||
|
./proto-json.sh --quiet
|
||||||
|
|
||||||
|
echo "ok"
|
||||||
3
build/proto-json.sh
Executable file
3
build/proto-json.sh
Executable file
@@ -0,0 +1,3 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
go run ../cmd/proto-json/main.go $1
|
||||||
18719
build/rpc.json
Normal file
18719
build/rpc.json
Normal file
File diff suppressed because it is too large
Load Diff
407
cmd/proto-json/main.go
Normal file
407
cmd/proto-json/main.go
Normal file
@@ -0,0 +1,407 @@
|
|||||||
|
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"encoding/json"
|
||||||
|
"flag"
|
||||||
|
"fmt"
|
||||||
|
"github.com/iwind/TeaGo/Tea"
|
||||||
|
_ "github.com/iwind/TeaGo/bootstrap"
|
||||||
|
"github.com/iwind/TeaGo/logs"
|
||||||
|
"github.com/iwind/TeaGo/types"
|
||||||
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
"regexp"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
type ServiceInfo struct {
|
||||||
|
Name string `json:"name"`
|
||||||
|
Methods []*MethodInfo `json:"methods"`
|
||||||
|
Filename string `json:"filename"`
|
||||||
|
Doc string `json:"doc"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type MethodInfo struct {
|
||||||
|
Name string `json:"name"`
|
||||||
|
RequestMessageName string `json:"requestMessageName"`
|
||||||
|
ResponseMessageName string `json:"responseMessageName"`
|
||||||
|
Code string `json:"code"`
|
||||||
|
Doc string `json:"doc"`
|
||||||
|
Roles []string `json:"roles"`
|
||||||
|
IsDeprecated bool `json:"isDeprecated"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type MessageInfo struct {
|
||||||
|
Name string `json:"name"`
|
||||||
|
Code string `json:"code"`
|
||||||
|
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 {
|
||||||
|
var lines = bytes.Split(data, []byte{'\n'})
|
||||||
|
var comments = [][]byte{}
|
||||||
|
for i := len(lines) - 1; i >= 0; i-- {
|
||||||
|
var line = bytes.TrimLeft(lines[i], " \t")
|
||||||
|
if len(line) == 0 {
|
||||||
|
comments = append([][]byte{{' '}}, comments...)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if bytes.HasPrefix(line, []byte("//")) {
|
||||||
|
line = bytes.TrimSpace(bytes.TrimLeft(line, "/"))
|
||||||
|
comments = append([][]byte{line}, comments...)
|
||||||
|
} else {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return string(bytes.TrimSpace(bytes.Join(comments, []byte{'\n'})))
|
||||||
|
}
|
||||||
|
|
||||||
|
func removeDuplicates(s []string) []string {
|
||||||
|
if len(s) == 0 {
|
||||||
|
return s
|
||||||
|
}
|
||||||
|
var m = map[string]bool{}
|
||||||
|
var result = []string{}
|
||||||
|
for _, item := range s {
|
||||||
|
_, ok := m[item]
|
||||||
|
if ok {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
result = append(result, item)
|
||||||
|
m[item] = true
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
// 生成JSON格式API列表
|
||||||
|
func main() {
|
||||||
|
var quiet = false
|
||||||
|
flag.BoolVar(&quiet, "quiet", false, "")
|
||||||
|
flag.Parse()
|
||||||
|
|
||||||
|
var methodRolesMap = map[string][]string{} // method => roles
|
||||||
|
{
|
||||||
|
var rootDir = filepath.Clean(Tea.Root + "/../../EdgeAPI/internal/rpc/services")
|
||||||
|
entries, err := os.ReadDir(rootDir)
|
||||||
|
if err != nil {
|
||||||
|
logs.Println("[ERROR]read api services from '" + rootDir + "' failed: " + err.Error())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
var rootDirs = []string{rootDir}
|
||||||
|
|
||||||
|
for _, entry := range entries {
|
||||||
|
if entry.IsDir() {
|
||||||
|
rootDirs = append(rootDirs, rootDir+string(os.PathSeparator)+entry.Name())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, rootDir := range rootDirs {
|
||||||
|
files, err := filepath.Glob(rootDir + "/service_*.go")
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println("[ERROR]list service implementation files failed: " + err.Error())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
var methodNameReg = regexp.MustCompile(`func\s*\(\w+\s+\*\s*(\w+Service)\)\s*(\w+)\s*\(`) // $1: serviceName, $2 methodName
|
||||||
|
for _, file := range files {
|
||||||
|
data, err := os.ReadFile(file)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println("[ERROR]read file '" + file + "' failed: " + err.Error())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
var sourceCode = string(data)
|
||||||
|
|
||||||
|
var locList = methodNameReg.FindAllStringIndex(sourceCode, -1)
|
||||||
|
for index, loc := range locList {
|
||||||
|
var methodSource = ""
|
||||||
|
if index == len(locList)-1 { // last one
|
||||||
|
methodSource = sourceCode[loc[0]:]
|
||||||
|
} else {
|
||||||
|
methodSource = sourceCode[loc[0]:locList[index+1][0]]
|
||||||
|
}
|
||||||
|
|
||||||
|
// 方法名
|
||||||
|
var submatch = methodNameReg.FindStringSubmatch(methodSource)
|
||||||
|
if len(submatch) == 0 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
var serviceName = submatch[1]
|
||||||
|
if serviceName == "BaseService" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
var methodName = submatch[2]
|
||||||
|
if methodName[0] < 'A' || methodName[0] > 'Z' {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
var roles = []string{}
|
||||||
|
if strings.Contains(methodSource, ".ValidateNode(") {
|
||||||
|
roles = append(roles, "node")
|
||||||
|
}
|
||||||
|
if strings.Contains(methodSource, ".ValidateUserNode(") {
|
||||||
|
roles = append(roles, "user")
|
||||||
|
}
|
||||||
|
if strings.Contains(methodSource, ".ValidateAdmin(") {
|
||||||
|
roles = append(roles, "admin")
|
||||||
|
}
|
||||||
|
if strings.Contains(methodSource, ".ValidateAdminAndUser(") {
|
||||||
|
roles = append(roles, "admin", "user")
|
||||||
|
}
|
||||||
|
if strings.Contains(methodSource, ".ValidateNSNode(") {
|
||||||
|
roles = append(roles, "dns")
|
||||||
|
}
|
||||||
|
if strings.Contains(methodSource, ".ValidateMonitorNode(") {
|
||||||
|
roles = append(roles, "monitor")
|
||||||
|
}
|
||||||
|
if strings.Contains(methodSource, "rpcutils.UserTypeDNS") {
|
||||||
|
roles = append(roles, "dns")
|
||||||
|
}
|
||||||
|
if strings.Contains(methodSource, "rpcutils.UserTypeUser") {
|
||||||
|
roles = append(roles, "user")
|
||||||
|
}
|
||||||
|
if strings.Contains(methodSource, "rpcutils.UserTypeNode") {
|
||||||
|
roles = append(roles, "node")
|
||||||
|
}
|
||||||
|
if strings.Contains(methodSource, "rpcutils.UserTypeMonitor") {
|
||||||
|
roles = append(roles, "monitor")
|
||||||
|
}
|
||||||
|
if strings.Contains(methodSource, "rpcutils.UserTypeReport") {
|
||||||
|
roles = append(roles, "report")
|
||||||
|
}
|
||||||
|
if strings.Contains(methodSource, "rpcutils.UserTypeCluster") {
|
||||||
|
roles = append(roles, "cluster")
|
||||||
|
}
|
||||||
|
if strings.Contains(methodSource, "rpcutils.UserTypeAdmin") {
|
||||||
|
roles = append(roles, "admin")
|
||||||
|
}
|
||||||
|
|
||||||
|
methodRolesMap[strings.ToLower(methodName)] = removeDuplicates(roles)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
|
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) {
|
||||||
|
var filename = filepath.Base(path)
|
||||||
|
if filename == "service_authority_key.proto" || filename == "service_authority_node.proto" {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
data, err := os.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(`(?s)rpc\s+(\w+)\s*\(\s*(\w+)\s*\)\s*returns\s*\(\s*(\w+)\s*\)\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])
|
||||||
|
|
||||||
|
// 方法列表
|
||||||
|
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 roles = methodRolesMap[strings.ToLower(string(methodPieces[1]))]
|
||||||
|
if roles == nil {
|
||||||
|
roles = []string{}
|
||||||
|
}
|
||||||
|
|
||||||
|
methods = append(methods, &MethodInfo{
|
||||||
|
Name: string(methodPieces[1]),
|
||||||
|
RequestMessageName: string(methodPieces[2]),
|
||||||
|
ResponseMessageName: string(methodPieces[3]),
|
||||||
|
IsDeprecated: strings.Contains(string(methodPieces[4]), "deprecated"),
|
||||||
|
Code: string(methodData),
|
||||||
|
Doc: readComments(serviceData[:methodCodePosition[0]]),
|
||||||
|
Roles: roles,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
services = append(services, &ServiceInfo{
|
||||||
|
Name: serviceName,
|
||||||
|
Methods: methods,
|
||||||
|
Filename: filename,
|
||||||
|
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
|
||||||
|
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)
|
||||||
|
var countMethods = 0
|
||||||
|
var countMessages = len(messages)
|
||||||
|
for _, service := range services {
|
||||||
|
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 := os.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 {
|
||||||
|
fmt.Println("[ERROR]marshal to json failed: " + err.Error())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
var jsonFile = Tea.Root + "/rpc.json"
|
||||||
|
err = os.WriteFile(jsonFile, jsonData, 0666)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println("[ERROR]write json to file failed: " + err.Error())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if !quiet {
|
||||||
|
fmt.Println("services:", countServices, "methods:", countMethods, "messages:", countMessages)
|
||||||
|
fmt.Println("===")
|
||||||
|
fmt.Println("generated " + filepath.Base(jsonFile) + " successfully")
|
||||||
|
}
|
||||||
|
}
|
||||||
11
go.mod
11
go.mod
@@ -1,15 +1,18 @@
|
|||||||
module github.com/TeaOSLab/EdgeCommon
|
module github.com/TeaOSLab/EdgeCommon
|
||||||
|
|
||||||
go 1.15
|
go 1.18
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/cespare/xxhash/v2 v2.1.1
|
|
||||||
github.com/golang/protobuf v1.5.2
|
github.com/golang/protobuf v1.5.2
|
||||||
github.com/iwind/TeaGo v0.0.0-20220304043459-0dd944a5b475
|
github.com/iwind/TeaGo v0.0.0-20220304043459-0dd944a5b475
|
||||||
golang.org/x/net v0.0.0-20220225172249-27dd8689420f
|
golang.org/x/net v0.0.0-20220225172249-27dd8689420f
|
||||||
golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8 // indirect
|
|
||||||
google.golang.org/genproto v0.0.0-20220317150908-0efb43f6373e // indirect
|
|
||||||
google.golang.org/grpc v1.45.0
|
google.golang.org/grpc v1.45.0
|
||||||
google.golang.org/protobuf v1.27.1
|
google.golang.org/protobuf v1.27.1
|
||||||
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b
|
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b
|
||||||
)
|
)
|
||||||
|
|
||||||
|
require (
|
||||||
|
golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8 // indirect
|
||||||
|
golang.org/x/text v0.3.7 // indirect
|
||||||
|
google.golang.org/genproto v0.0.0-20220317150908-0efb43f6373e // indirect
|
||||||
|
)
|
||||||
|
|||||||
10
go.sum
10
go.sum
@@ -7,7 +7,6 @@ github.com/DataDog/sketches-go v0.0.0-20190923095040-43f19ad77ff7/go.mod h1:Q5Db
|
|||||||
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
|
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
|
||||||
github.com/benbjohnson/clock v1.0.3/go.mod h1:bGMdMPoPVvcYyt1gHDf4J2KE153Yf9BuiUKYMaxlTDM=
|
github.com/benbjohnson/clock v1.0.3/go.mod h1:bGMdMPoPVvcYyt1gHDf4J2KE153Yf9BuiUKYMaxlTDM=
|
||||||
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
||||||
github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY=
|
|
||||||
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||||
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
||||||
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
|
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
|
||||||
@@ -137,14 +136,9 @@ golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7w
|
|||||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|
||||||
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|
||||||
golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9 h1:nhht2DYV/Sn3qOayu8lM+cU1ii9sTLUeBQwQQfUHtrs=
|
|
||||||
golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|
||||||
golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8 h1:OH54vjqzRWmbJ62fjuhxy7AxFFgoHN0/DPc/UrL8cAs=
|
golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8 h1:OH54vjqzRWmbJ62fjuhxy7AxFFgoHN0/DPc/UrL8cAs=
|
||||||
golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
|
||||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
@@ -168,8 +162,6 @@ google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98
|
|||||||
google.golang.org/genproto v0.0.0-20191009194640-548a555dbc03/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
|
google.golang.org/genproto v0.0.0-20191009194640-548a555dbc03/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
|
||||||
google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
||||||
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
|
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
|
||||||
google.golang.org/genproto v0.0.0-20220303160752-862486edd9cc h1:fb/ViRpv3ln/LvbqZtTpoOd1YQDNH12gaGZreoSFovE=
|
|
||||||
google.golang.org/genproto v0.0.0-20220303160752-862486edd9cc/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI=
|
|
||||||
google.golang.org/genproto v0.0.0-20220317150908-0efb43f6373e h1:fNKDNuUyC4WH+inqDMpfXDdfvwfYILbsX+oskGZ8hxg=
|
google.golang.org/genproto v0.0.0-20220317150908-0efb43f6373e h1:fNKDNuUyC4WH+inqDMpfXDdfvwfYILbsX+oskGZ8hxg=
|
||||||
google.golang.org/genproto v0.0.0-20220317150908-0efb43f6373e/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E=
|
google.golang.org/genproto v0.0.0-20220317150908-0efb43f6373e/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E=
|
||||||
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
|
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
|
||||||
@@ -179,8 +171,6 @@ google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8
|
|||||||
google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
|
google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
|
||||||
google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0=
|
google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0=
|
||||||
google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU=
|
google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU=
|
||||||
google.golang.org/grpc v1.44.0 h1:weqSxi/TMs1SqFRMHCtBgXRs8k3X39QIDEZ0pRcttUg=
|
|
||||||
google.golang.org/grpc v1.44.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU=
|
|
||||||
google.golang.org/grpc v1.45.0 h1:NEpgUqV3Z+ZjkqMsxMg11IaDrXY4RY6CQukSGK0uI1M=
|
google.golang.org/grpc v1.45.0 h1:NEpgUqV3Z+ZjkqMsxMg11IaDrXY4RY6CQukSGK0uI1M=
|
||||||
google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ=
|
google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ=
|
||||||
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
||||||
|
|||||||
@@ -2,27 +2,71 @@ package configutils
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"github.com/cespare/xxhash/v2"
|
"math/big"
|
||||||
"math"
|
|
||||||
"net"
|
"net"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
// IP2Long 将IP转换为整型
|
// IPString2Long 将IP转换为整型
|
||||||
// 注意IPv6没有顺序
|
// 注意IPv6没有顺序
|
||||||
func IP2Long(ip string) uint64 {
|
func IPString2Long(ip string) uint64 {
|
||||||
if len(ip) == 0 {
|
if len(ip) == 0 {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
s := net.ParseIP(ip)
|
var netIP = net.ParseIP(ip)
|
||||||
if len(s) == 0 {
|
if len(netIP) == 0 {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
return IP2Long(netIP)
|
||||||
|
}
|
||||||
|
|
||||||
|
// IP2Long 将IP对象转换为整型
|
||||||
|
func IP2Long(netIP net.IP) uint64 {
|
||||||
|
if len(netIP) == 0 {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
if strings.Contains(ip, ":") {
|
var b4 = netIP.To4()
|
||||||
return math.MaxUint32 + xxhash.Sum64(s)
|
if b4 != nil {
|
||||||
|
return uint64(binary.BigEndian.Uint32(b4.To4()))
|
||||||
}
|
}
|
||||||
return uint64(binary.BigEndian.Uint32(s.To4()))
|
|
||||||
|
var i = big.NewInt(0)
|
||||||
|
i.SetBytes(netIP.To16())
|
||||||
|
return i.Uint64()
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsIPv4 检查是否为IPv4
|
||||||
|
func IsIPv4(netIP net.IP) bool {
|
||||||
|
if len(netIP) == 0 {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return netIP.To4() != nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsIPv6 检查是否为IPv6
|
||||||
|
func IsIPv6(netIP net.IP) bool {
|
||||||
|
if len(netIP) == 0 {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return netIP.To4() == nil && netIP.To16() != nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// IPVersion 获取IP版本号
|
||||||
|
func IPVersion(netIP net.IP) int {
|
||||||
|
if len(netIP) == 0 {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
if netIP.To4() != nil {
|
||||||
|
return 4
|
||||||
|
}
|
||||||
|
|
||||||
|
if netIP.To16() != nil {
|
||||||
|
return 6
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
// ParseCIDR 计算CIDR最大值
|
// ParseCIDR 计算CIDR最大值
|
||||||
|
|||||||
@@ -1,11 +1,41 @@
|
|||||||
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
|
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
|
||||||
|
|
||||||
package configutils
|
package configutils_test
|
||||||
|
|
||||||
import "testing"
|
import (
|
||||||
|
"fmt"
|
||||||
|
"github.com/TeaOSLab/EdgeCommon/pkg/configutils"
|
||||||
|
"github.com/iwind/TeaGo/assert"
|
||||||
|
"net"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
func TestParseCIDR(t *testing.T) {
|
func TestParseCIDR(t *testing.T) {
|
||||||
t.Log(ParseCIDR("192.168.1.1/32"))
|
t.Log(configutils.ParseCIDR("192.168.1.1/32"))
|
||||||
t.Log(ParseCIDR("192.168.1.1/24"))
|
t.Log(configutils.ParseCIDR("192.168.1.1/24"))
|
||||||
t.Log(ParseCIDR("192.168.1.1/16"))
|
t.Log(configutils.ParseCIDR("192.168.1.1/16"))
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestIPString2Long(t *testing.T) {
|
||||||
|
for _, ip := range []string{"127.0.0.1", "192.168.1.100", "::1", "fd00:6868:6868:0:10ac:d056:3bf6:7452", "fd00:6868:6868:0:10ac:d056:3bf6:7453", "2001:0db8:85a3:0000:0000:8a2e:0370:7334", "wrong ip"} {
|
||||||
|
t.Log(fmt.Sprintf("%42s", ip), "=>", configutils.IPString2Long(ip))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestIsIPv4(t *testing.T) {
|
||||||
|
t.Log(configutils.IsIPv4(net.ParseIP("192.168.1.100")))
|
||||||
|
t.Log(configutils.IsIPv4(net.ParseIP("::1")))
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestIsIPv6(t *testing.T) {
|
||||||
|
t.Log(configutils.IsIPv6(net.ParseIP("192.168.1.100")))
|
||||||
|
t.Log(configutils.IsIPv6(net.ParseIP("::1")))
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestIPVersion(t *testing.T) {
|
||||||
|
var a = assert.NewAssertion(t)
|
||||||
|
a.IsTrue(configutils.IPVersion(net.ParseIP("192.168.1.100")) == 4)
|
||||||
|
a.IsTrue(configutils.IPVersion(net.ParseIP("1.2.3")) == 0)
|
||||||
|
a.IsTrue(configutils.IPVersion(net.ParseIP("::1")) == 6)
|
||||||
|
a.IsTrue(configutils.IPVersion(net.ParseIP("2001:0db8:85a3:0000:0000:8a2e:0370:7334")) == 6)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,8 +14,18 @@ var variableMapping = map[string][]interface{}{} // source => [holder1, ...]
|
|||||||
var variableLocker = sync.RWMutex{}
|
var variableLocker = sync.RWMutex{}
|
||||||
var regexpNamedVariable = regexp.MustCompile(`\${[\w.-]+}`)
|
var regexpNamedVariable = regexp.MustCompile(`\${[\w.-]+}`)
|
||||||
|
|
||||||
|
var stringBuilderPool = sync.Pool{
|
||||||
|
New: func() interface{} {
|
||||||
|
return &strings.Builder{}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
// ParseVariables 分析变量
|
// ParseVariables 分析变量
|
||||||
func ParseVariables(source string, replacer func(varName string) (value string)) string {
|
func ParseVariables(source string, replacer func(varName string) (value string)) string {
|
||||||
|
if len(source) == 0 {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
variableLocker.RLock()
|
variableLocker.RLock()
|
||||||
holders, found := variableMapping[source]
|
holders, found := variableMapping[source]
|
||||||
variableLocker.RUnlock()
|
variableLocker.RUnlock()
|
||||||
@@ -42,16 +52,18 @@ func ParseVariables(source string, replacer func(varName string) (value string))
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 多个占位时,使用Builder
|
// 多个占位时,使用Builder
|
||||||
result := strings.Builder{}
|
var builder = stringBuilderPool.Get().(*strings.Builder)
|
||||||
|
builder.Reset()
|
||||||
|
defer stringBuilderPool.Put(builder)
|
||||||
for _, h := range holders {
|
for _, h := range holders {
|
||||||
holder, ok := h.(VariableHolder)
|
holder, ok := h.(VariableHolder)
|
||||||
if ok {
|
if ok {
|
||||||
result.WriteString(replacer(string(holder)))
|
builder.WriteString(replacer(string(holder)))
|
||||||
} else {
|
} else {
|
||||||
result.Write(h.([]byte))
|
builder.Write(h.([]byte))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result.String()
|
return builder.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
// ParseVariablesFromHolders 从占位中分析变量
|
// ParseVariablesFromHolders 从占位中分析变量
|
||||||
@@ -92,5 +104,8 @@ func ParseHolders(source string) (holders VariableHolders) {
|
|||||||
|
|
||||||
// HasVariables 判断是否有变量
|
// HasVariables 判断是否有变量
|
||||||
func HasVariables(source string) bool {
|
func HasVariables(source string) bool {
|
||||||
|
if len(source) == 0 {
|
||||||
|
return false
|
||||||
|
}
|
||||||
return regexpNamedVariable.MatchString(source)
|
return regexpNamedVariable.MatchString(source)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,6 +53,8 @@ func BenchmarkParseVariables(b *testing.B) {
|
|||||||
return "Lu"
|
return "Lu"
|
||||||
})
|
})
|
||||||
|
|
||||||
|
b.ResetTimer()
|
||||||
|
|
||||||
for i := 0; i < b.N; i++ {
|
for i := 0; i < b.N; i++ {
|
||||||
_ = ParseVariables("hello, ${name}, ${age}, ${gender}, ${home}, world", func(s string) string {
|
_ = ParseVariables("hello, ${name}, ${age}, ${gender}, ${home}, world", func(s string) string {
|
||||||
return "Lu"
|
return "Lu"
|
||||||
@@ -95,3 +97,11 @@ func BenchmarkParseNoVariables(b *testing.B) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func BenchmarkParseEmpty(b *testing.B) {
|
||||||
|
for i := 0; i < b.N; i++ {
|
||||||
|
_ = ParseVariables("", func(s string) string {
|
||||||
|
return "Lu"
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -2,11 +2,11 @@ package configutils
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"gopkg.in/yaml.v3"
|
"gopkg.in/yaml.v3"
|
||||||
"io/ioutil"
|
"os"
|
||||||
)
|
)
|
||||||
|
|
||||||
func UnmarshalYamlFile(file string, ptr interface{}) error {
|
func UnmarshalYamlFile(file string, ptr interface{}) error {
|
||||||
data, err := ioutil.ReadFile(file)
|
data, err := os.ReadFile(file)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,8 +2,10 @@ package dnsconfigs
|
|||||||
|
|
||||||
// ClusterDNSConfig 集群的DNS设置
|
// ClusterDNSConfig 集群的DNS设置
|
||||||
type ClusterDNSConfig struct {
|
type ClusterDNSConfig struct {
|
||||||
CNameRecords []string `yaml:"cnameRecords" json:"cnameRecords"` // 自动加入的CNAME
|
CNameRecords []string `yaml:"cnameRecords" json:"cnameRecords"` // 自动加入的CNAME
|
||||||
TTL int32 `yaml:"ttl" json:"ttl"` // 默认TTL,各个DNS服务商对记录的TTL的限制各有不同
|
TTL int32 `yaml:"ttl" json:"ttl"` // 默认TTL,各个DNS服务商对记录的TTL的限制各有不同
|
||||||
|
CNameAsDomain bool `yaml:"cnameAsDomain" json:"cnameAsDomain"` // 是否可以像域名一样直接访问CNAME
|
||||||
|
IncludingLnNodes bool `yaml:"includingLnNodes" json:"includingLnNodes"` // 是否包含Ln节点
|
||||||
|
|
||||||
NodesAutoSync bool `yaml:"nodesAutoSync" json:"nodesAutoSync"` // 是否自动同步节点状态
|
NodesAutoSync bool `yaml:"nodesAutoSync" json:"nodesAutoSync"` // 是否自动同步节点状态
|
||||||
ServersAutoSync bool `yaml:"serversAutoSync" json:"serversAutoSync"` // 是否自动同步服务状态
|
ServersAutoSync bool `yaml:"serversAutoSync" json:"serversAutoSync"` // 是否自动同步服务状态
|
||||||
|
|||||||
10
pkg/dnsconfigs/consts.go
Normal file
10
pkg/dnsconfigs/consts.go
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
|
||||||
|
|
||||||
|
package dnsconfigs
|
||||||
|
|
||||||
|
type NSDomainStatus = string
|
||||||
|
|
||||||
|
const (
|
||||||
|
NSDomainStatusNone = "none"
|
||||||
|
NSDomainStatusVerified = "verified"
|
||||||
|
)
|
||||||
37
pkg/dnsconfigs/defaults.go
Normal file
37
pkg/dnsconfigs/defaults.go
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
|
||||||
|
|
||||||
|
package dnsconfigs
|
||||||
|
|
||||||
|
import "github.com/iwind/TeaGo/maps"
|
||||||
|
|
||||||
|
// 一组系统默认值
|
||||||
|
// 修改单个IP相关限制值时要考虑到NAT中每个IP会代表很多个主机,并非1对1的关系
|
||||||
|
|
||||||
|
const (
|
||||||
|
DefaultMaxThreads = 20000 // 单节点最大线程数
|
||||||
|
DefaultMaxThreadsMin = 1000 // 单节点最大线程数最小值
|
||||||
|
DefaultMaxThreadsMax = 100_000 // 单节点最大线程数最大值
|
||||||
|
|
||||||
|
DefaultTCPMaxConnections = 100_000 // 单节点TCP最大连接数
|
||||||
|
DefaultTCPMaxConnectionsPerIP = 1000 // 单IP最大连接数
|
||||||
|
DefaultTCPMinConnectionsPerIP = 5 // 单IP最小连接数
|
||||||
|
|
||||||
|
DefaultTCPNewConnectionsMinutelyRate = 500 // 单IP连接速率限制(按分钟)
|
||||||
|
DefaultTCPNewConnectionsMinMinutelyRate = 3 // 单IP最小连接速率
|
||||||
|
|
||||||
|
DefaultTCPNewConnectionsSecondlyRate = 300 // 单IP连接速率限制(按秒)
|
||||||
|
DefaultTCPNewConnectionsMinSecondlyRate = 3 // 单IP最小连接速率
|
||||||
|
|
||||||
|
DefaultTCPLinger = 3 // 单节点TCP Linger值
|
||||||
|
DefaultTLSHandshakeTimeout = 3 // TLS握手超时时间
|
||||||
|
)
|
||||||
|
|
||||||
|
var DefaultConfigs = maps.Map{
|
||||||
|
"tcpMaxConnections": DefaultTCPMaxConnections,
|
||||||
|
"tcpMaxConnectionsPerIP": DefaultTCPMaxConnectionsPerIP,
|
||||||
|
"tcpMinConnectionsPerIP": DefaultTCPMinConnectionsPerIP,
|
||||||
|
"tcpNewConnectionsMinutelyRate": DefaultTCPNewConnectionsMinutelyRate,
|
||||||
|
"tcpNewConnectionsMinMinutelyRate": DefaultTCPNewConnectionsMinMinutelyRate,
|
||||||
|
"tcpNewConnectionsSecondlyRate": DefaultTCPNewConnectionsSecondlyRate,
|
||||||
|
"tcpNewConnectionsMinSecondlyRate": DefaultTCPNewConnectionsMinSecondlyRate,
|
||||||
|
}
|
||||||
@@ -2,15 +2,25 @@
|
|||||||
|
|
||||||
package dnsconfigs
|
package dnsconfigs
|
||||||
|
|
||||||
import "fmt"
|
import (
|
||||||
|
"fmt"
|
||||||
|
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
|
||||||
|
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/ddosconfigs"
|
||||||
|
)
|
||||||
|
|
||||||
type NSNodeConfig struct {
|
type NSNodeConfig struct {
|
||||||
Id int64 `yaml:"id" json:"id"`
|
Id int64 `yaml:"id" json:"id"`
|
||||||
NodeId string `yaml:"nodeId" json:"nodeId"`
|
NodeId string `yaml:"nodeId" json:"nodeId"`
|
||||||
Secret string `yaml:"secret" json:"secret"`
|
Secret string `yaml:"secret" json:"secret"`
|
||||||
ClusterId int64 `yaml:"clusterId" json:"clusterId"`
|
ClusterId int64 `yaml:"clusterId" json:"clusterId"`
|
||||||
AccessLogRef *NSAccessLogRef `yaml:"accessLogRef" json:"accessLogRef"`
|
AccessLogRef *NSAccessLogRef `yaml:"accessLogRef" json:"accessLogRef"`
|
||||||
RecursionConfig *RecursionConfig `yaml:"recursionConfig" json:"recursionConfig"`
|
RecursionConfig *RecursionConfig `yaml:"recursionConfig" json:"recursionConfig"`
|
||||||
|
DDoSProtection *ddosconfigs.ProtectionConfig `yaml:"ddosProtection" json:"ddosProtection"`
|
||||||
|
AllowedIPs []string `yaml:"allowedIPs" json:"allowedIPs"`
|
||||||
|
|
||||||
|
TCP *serverconfigs.TCPProtocolConfig `yaml:"tcp" json:"tcp"` // TCP配置
|
||||||
|
TLS *serverconfigs.TLSProtocolConfig `yaml:"tls" json:"tls"` // TLS配置
|
||||||
|
UDP *serverconfigs.UDPProtocolConfig `yaml:"udp" json:"udp"` // UDP配置
|
||||||
|
|
||||||
paddedId string
|
paddedId string
|
||||||
}
|
}
|
||||||
@@ -26,6 +36,46 @@ func (this *NSNodeConfig) Init() error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 递归DNS
|
||||||
|
if this.RecursionConfig != nil {
|
||||||
|
err := this.RecursionConfig.Init()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// DDoS
|
||||||
|
if this.DDoSProtection != nil {
|
||||||
|
err := this.DDoSProtection.Init()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// tcp
|
||||||
|
if this.TCP != nil {
|
||||||
|
err := this.TCP.Init()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// tls
|
||||||
|
if this.TLS != nil {
|
||||||
|
err := this.TLS.Init()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// udp
|
||||||
|
if this.UDP != nil {
|
||||||
|
err := this.UDP.Init()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,3 +16,7 @@ type RecursionConfig struct {
|
|||||||
AllowDomains []string `json:"allowDomains"`
|
AllowDomains []string `json:"allowDomains"`
|
||||||
DenyDomains []string `json:"denyDomains"`
|
DenyDomains []string `json:"denyDomains"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *RecursionConfig) Init() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|||||||
@@ -2,31 +2,107 @@
|
|||||||
|
|
||||||
package dnsconfigs
|
package dnsconfigs
|
||||||
|
|
||||||
import "github.com/TeaOSLab/EdgeCommon/pkg/configutils"
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"errors"
|
||||||
|
"github.com/TeaOSLab/EdgeCommon/pkg/configutils"
|
||||||
|
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared"
|
||||||
|
"github.com/iwind/TeaGo/maps"
|
||||||
|
"net"
|
||||||
|
)
|
||||||
|
|
||||||
type RouteRangeType = string
|
type RouteRangeType = string
|
||||||
|
|
||||||
const (
|
const (
|
||||||
RouteRangeTypeIP RouteRangeType = "ipRange"
|
RouteRangeTypeIP RouteRangeType = "ipRange" // IP范围
|
||||||
|
RouteRangeTypeCIDR RouteRangeType = "cidr" // CIDR
|
||||||
|
RouteRangeTypeRegion RouteRangeType = "region" // 区域
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func AllRouteRangeTypes() []*shared.Definition {
|
||||||
|
return []*shared.Definition{
|
||||||
|
{
|
||||||
|
Name: "IP范围",
|
||||||
|
Code: RouteRangeTypeIP,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Name: "CIDR",
|
||||||
|
Code: RouteRangeTypeCIDR,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Name: "区域",
|
||||||
|
Code: RouteRangeTypeRegion,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// RouteRegionResolver 解析IP接口
|
||||||
|
type RouteRegionResolver interface {
|
||||||
|
Resolve(ip net.IP) (countryId int64, provinceId int64, cityId int64, providerId int64)
|
||||||
|
}
|
||||||
|
|
||||||
|
// RouteRangeInterface 线路范围接口
|
||||||
type RouteRangeInterface interface {
|
type RouteRangeInterface interface {
|
||||||
|
// Init 初始化
|
||||||
Init() error
|
Init() error
|
||||||
Contains(ip uint64) bool
|
|
||||||
|
// Contains 判断是否包含
|
||||||
|
Contains(ip net.IP) bool
|
||||||
|
|
||||||
|
// SetRegionResolver 设置IP解析接口
|
||||||
|
SetRegionResolver(resolver RouteRegionResolver)
|
||||||
|
|
||||||
|
// IsExcluding 是否为排除
|
||||||
|
IsExcluding() bool
|
||||||
|
}
|
||||||
|
|
||||||
|
type BaseRouteRange struct {
|
||||||
|
IsReverse bool `json:"isReverse"`
|
||||||
|
|
||||||
|
routeRegionResolver RouteRegionResolver
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *BaseRouteRange) SetRegionResolver(resolver RouteRegionResolver) {
|
||||||
|
this.routeRegionResolver = resolver
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *BaseRouteRange) IsExcluding() bool {
|
||||||
|
return this.IsReverse
|
||||||
}
|
}
|
||||||
|
|
||||||
// RouteRangeIPRange IP范围配置
|
// RouteRangeIPRange IP范围配置
|
||||||
|
// IPv4和IPv6不能混用
|
||||||
type RouteRangeIPRange struct {
|
type RouteRangeIPRange struct {
|
||||||
|
BaseRouteRange
|
||||||
|
|
||||||
IPFrom string `json:"ipFrom"`
|
IPFrom string `json:"ipFrom"`
|
||||||
IPTo string `json:"ipTo"`
|
IPTo string `json:"ipTo"`
|
||||||
|
|
||||||
ipFromLong uint64
|
ipFromLong uint64
|
||||||
ipToLong uint64
|
ipToLong uint64
|
||||||
|
|
||||||
|
ipVersion int // 4|6
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *RouteRangeIPRange) Init() error {
|
func (this *RouteRangeIPRange) Init() error {
|
||||||
this.ipFromLong = configutils.IP2Long(this.IPFrom)
|
var ipFrom = net.ParseIP(this.IPFrom)
|
||||||
this.ipToLong = configutils.IP2Long(this.IPTo)
|
var ipTo = net.ParseIP(this.IPTo)
|
||||||
|
if ipFrom == nil {
|
||||||
|
return errors.New("invalid ipFrom '" + this.IPFrom + "'")
|
||||||
|
}
|
||||||
|
if ipTo == nil {
|
||||||
|
return errors.New("invalid ipTo '" + this.IPTo + "'")
|
||||||
|
}
|
||||||
|
|
||||||
|
var ipFromVersion = configutils.IPVersion(ipFrom)
|
||||||
|
var ipToVersion = configutils.IPVersion(ipTo)
|
||||||
|
if ipFromVersion != ipToVersion {
|
||||||
|
return errors.New("ipFrom and ipTo version are not same")
|
||||||
|
}
|
||||||
|
this.ipVersion = ipFromVersion
|
||||||
|
|
||||||
|
this.ipFromLong = configutils.IP2Long(ipFrom)
|
||||||
|
this.ipToLong = configutils.IP2Long(ipTo)
|
||||||
|
|
||||||
if this.ipFromLong > this.ipToLong {
|
if this.ipFromLong > this.ipToLong {
|
||||||
this.ipFromLong, this.ipToLong = this.ipToLong, this.ipFromLong
|
this.ipFromLong, this.ipToLong = this.ipToLong, this.ipFromLong
|
||||||
@@ -35,6 +111,152 @@ func (this *RouteRangeIPRange) Init() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *RouteRangeIPRange) Contains(ip uint64) bool {
|
func (this *RouteRangeIPRange) Contains(netIP net.IP) bool {
|
||||||
return this.ipFromLong <= ip && this.ipToLong >= ip
|
if len(netIP) == 0 {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
var version = configutils.IPVersion(netIP)
|
||||||
|
if version != this.ipVersion {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
var ipLong = configutils.IP2Long(netIP)
|
||||||
|
return ipLong >= this.ipFromLong && ipLong <= this.ipToLong
|
||||||
|
}
|
||||||
|
|
||||||
|
// RouteRangeCIDR CIDR范围配置
|
||||||
|
type RouteRangeCIDR struct {
|
||||||
|
BaseRouteRange
|
||||||
|
|
||||||
|
CIDR string `json:"cidr"`
|
||||||
|
|
||||||
|
cidr *net.IPNet
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *RouteRangeCIDR) Init() error {
|
||||||
|
_, ipNet, err := net.ParseCIDR(this.CIDR)
|
||||||
|
if err != nil {
|
||||||
|
return errors.New("parse cidr failed: " + err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
this.cidr = ipNet
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *RouteRangeCIDR) Contains(netIP net.IP) bool {
|
||||||
|
if netIP == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
if this.cidr == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.cidr.Contains(netIP)
|
||||||
|
}
|
||||||
|
|
||||||
|
// RouteRangeRegion 区域范围
|
||||||
|
// country:ID, province:ID, city:ID, isp:ID
|
||||||
|
type RouteRangeRegion struct {
|
||||||
|
BaseRouteRange
|
||||||
|
|
||||||
|
Regions []*routeRegion `json:"regions"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *RouteRangeRegion) Init() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *RouteRangeRegion) Contains(netIP net.IP) bool {
|
||||||
|
if this.routeRegionResolver == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(this.Regions) == 0 {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
countryId, provinceId, cityId, providerId := this.routeRegionResolver.Resolve(netIP)
|
||||||
|
if countryId <= 0 && provinceId <= 0 && cityId <= 0 && providerId <= 0 {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, region := range this.Regions {
|
||||||
|
if region.Id <= 0 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
switch region.Type {
|
||||||
|
case "country":
|
||||||
|
if region.Id == countryId {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
case "province":
|
||||||
|
if region.Id == provinceId {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
case "city":
|
||||||
|
if region.Id == cityId {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
case "isp":
|
||||||
|
if region.Id == providerId {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
type routeRegion struct {
|
||||||
|
Type string `json:"type"` // country|province|city|isp
|
||||||
|
Id int64 `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// InitRangesFromJSON 从JSON中初始化线路范围
|
||||||
|
func InitRangesFromJSON(rangesJSON []byte) (ranges []RouteRangeInterface, err error) {
|
||||||
|
if len(rangesJSON) == 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
var rangeMaps = []maps.Map{}
|
||||||
|
err = json.Unmarshal(rangesJSON, &rangeMaps)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
for _, rangeMap := range rangeMaps {
|
||||||
|
var rangeType = rangeMap.GetString("type")
|
||||||
|
paramsJSON, err := json.Marshal(rangeMap.Get("params"))
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
var r RouteRangeInterface
|
||||||
|
|
||||||
|
switch rangeType {
|
||||||
|
case RouteRangeTypeIP:
|
||||||
|
r = &RouteRangeIPRange{}
|
||||||
|
case RouteRangeTypeCIDR:
|
||||||
|
r = &RouteRangeCIDR{}
|
||||||
|
case RouteRangeTypeRegion:
|
||||||
|
r = &RouteRangeRegion{}
|
||||||
|
default:
|
||||||
|
return nil, errors.New("invalid route line type '" + rangeType + "'")
|
||||||
|
}
|
||||||
|
|
||||||
|
err = json.Unmarshal(paramsJSON, r)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
err = r.Init()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
ranges = append(ranges, r)
|
||||||
|
}
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
98
pkg/dnsconfigs/route_ranges_test.go
Normal file
98
pkg/dnsconfigs/route_ranges_test.go
Normal file
@@ -0,0 +1,98 @@
|
|||||||
|
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
|
||||||
|
|
||||||
|
package dnsconfigs
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/iwind/TeaGo/assert"
|
||||||
|
"net"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestRouteRangeIPRange_Contains(t *testing.T) {
|
||||||
|
var a = assert.NewAssertion(t)
|
||||||
|
|
||||||
|
// ipv4
|
||||||
|
{
|
||||||
|
var r = &RouteRangeIPRange{
|
||||||
|
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.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")))
|
||||||
|
a.IsFalse(r.Contains(net.ParseIP("::1")))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ipv6
|
||||||
|
{
|
||||||
|
var prefix = "1:2:3:4:5:6"
|
||||||
|
var r = &RouteRangeIPRange{
|
||||||
|
IPFrom: prefix + ":1:8",
|
||||||
|
IPTo: prefix + ":5:10",
|
||||||
|
}
|
||||||
|
err := r.Init()
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
a.IsFalse(r.Contains(net.ParseIP("aaa")))
|
||||||
|
a.IsTrue(r.Contains(net.ParseIP(prefix + ":3:4")))
|
||||||
|
a.IsTrue(r.Contains(net.ParseIP(prefix + ":5:9")))
|
||||||
|
a.IsTrue(r.Contains(net.ParseIP(prefix + ":5:10")))
|
||||||
|
a.IsTrue(r.Contains(net.ParseIP(prefix + ":4:8")))
|
||||||
|
a.IsFalse(r.Contains(net.ParseIP(prefix + ":5:11")))
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
var r = &RouteRangeCIDR{
|
||||||
|
CIDR: "192.168.2.1/24",
|
||||||
|
}
|
||||||
|
err := r.Init()
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
a.IsFalse(r.Contains(net.ParseIP("aaa")))
|
||||||
|
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")))
|
||||||
|
}
|
||||||
|
|
||||||
|
// reverse ipv4
|
||||||
|
{
|
||||||
|
var r = &RouteRangeIPRange{
|
||||||
|
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.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",
|
||||||
|
}
|
||||||
|
err := r.Init()
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
a.IsFalse(r.Contains(net.ParseIP("aaa")))
|
||||||
|
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")))
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
package dnsconfigs
|
package dnsconfigs
|
||||||
|
|
||||||
|
type RouteCode = string
|
||||||
|
|
||||||
type Route struct {
|
type Route struct {
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Code string `json:"code"`
|
Code string `json:"code"`
|
||||||
@@ -105,6 +107,12 @@ var AllDefaultISPRoutes = []*Route{
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const (
|
||||||
|
ChinaProvinceCodeHK RouteCode = "china:province:hk"
|
||||||
|
ChinaProvinceCodeMO RouteCode = "china:province:mo"
|
||||||
|
ChinaProvinceCodeTW RouteCode = "china:province:tw"
|
||||||
|
)
|
||||||
|
|
||||||
// AllDefaultChinaProvinceRoutes 中国地域线路
|
// AllDefaultChinaProvinceRoutes 中国地域线路
|
||||||
var AllDefaultChinaProvinceRoutes = []*Route{
|
var AllDefaultChinaProvinceRoutes = []*Route{
|
||||||
{
|
{
|
||||||
@@ -120,12 +128,12 @@ var AllDefaultChinaProvinceRoutes = []*Route{
|
|||||||
{
|
{
|
||||||
Name: "河北省",
|
Name: "河北省",
|
||||||
Code: "china:province:heibei",
|
Code: "china:province:heibei",
|
||||||
AliasNames: []string{"河北省"},
|
AliasNames: []string{"河北省", "河北"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "山西省",
|
Name: "山西省",
|
||||||
Code: "china:province:shanxi",
|
Code: "china:province:shanxi",
|
||||||
AliasNames: []string{"山西省"},
|
AliasNames: []string{"山西省", "山西"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "内蒙古自治区",
|
Name: "内蒙古自治区",
|
||||||
@@ -135,17 +143,17 @@ var AllDefaultChinaProvinceRoutes = []*Route{
|
|||||||
{
|
{
|
||||||
Name: "辽宁省",
|
Name: "辽宁省",
|
||||||
Code: "china:province:liaoning",
|
Code: "china:province:liaoning",
|
||||||
AliasNames: []string{"辽宁省"},
|
AliasNames: []string{"辽宁省", "辽宁"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "吉林省",
|
Name: "吉林省",
|
||||||
Code: "china:jilin",
|
Code: "china:jilin",
|
||||||
AliasNames: []string{"吉林省"},
|
AliasNames: []string{"吉林省", "吉林"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "黑龙江省",
|
Name: "黑龙江省",
|
||||||
Code: "china:province:heilongjiang",
|
Code: "china:province:heilongjiang",
|
||||||
AliasNames: []string{"黑龙江省"},
|
AliasNames: []string{"黑龙江省", "黑龙江"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "上海市",
|
Name: "上海市",
|
||||||
@@ -155,52 +163,52 @@ var AllDefaultChinaProvinceRoutes = []*Route{
|
|||||||
{
|
{
|
||||||
Name: "江苏省",
|
Name: "江苏省",
|
||||||
Code: "china:province:jiangsu",
|
Code: "china:province:jiangsu",
|
||||||
AliasNames: []string{"江苏省"},
|
AliasNames: []string{"江苏省", "江苏"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "浙江省",
|
Name: "浙江省",
|
||||||
Code: "china:province:zhejiang",
|
Code: "china:province:zhejiang",
|
||||||
AliasNames: []string{"浙江省"},
|
AliasNames: []string{"浙江省", "浙江"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "安徽省",
|
Name: "安徽省",
|
||||||
Code: "china:province:anhui",
|
Code: "china:province:anhui",
|
||||||
AliasNames: []string{"安徽省"},
|
AliasNames: []string{"安徽省", "安徽"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "福建省",
|
Name: "福建省",
|
||||||
Code: "china:province:fujian",
|
Code: "china:province:fujian",
|
||||||
AliasNames: []string{"福建省"},
|
AliasNames: []string{"福建省", "福建"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "江西省",
|
Name: "江西省",
|
||||||
Code: "china:province:jiangxi",
|
Code: "china:province:jiangxi",
|
||||||
AliasNames: []string{"江西省"},
|
AliasNames: []string{"江西省", "江西"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "山东省",
|
Name: "山东省",
|
||||||
Code: "china:province:shandong",
|
Code: "china:province:shandong",
|
||||||
AliasNames: []string{"山东省"},
|
AliasNames: []string{"山东省", "山东"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "河南省",
|
Name: "河南省",
|
||||||
Code: "china:province:henan",
|
Code: "china:province:henan",
|
||||||
AliasNames: []string{"河南省"},
|
AliasNames: []string{"河南省", "河南"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "湖北省",
|
Name: "湖北省",
|
||||||
Code: "china:province:hubei",
|
Code: "china:province:hubei",
|
||||||
AliasNames: []string{"湖北省"},
|
AliasNames: []string{"湖北省", "湖北"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "湖南省",
|
Name: "湖南省",
|
||||||
Code: "china:province:hunan",
|
Code: "china:province:hunan",
|
||||||
AliasNames: []string{"湖南省"},
|
AliasNames: []string{"湖南省", "湖南"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "广东省",
|
Name: "广东省",
|
||||||
Code: "china:province:guangdong",
|
Code: "china:province:guangdong",
|
||||||
AliasNames: []string{"广东省"},
|
AliasNames: []string{"广东省", "广东"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "广西壮族自治区",
|
Name: "广西壮族自治区",
|
||||||
@@ -210,7 +218,7 @@ var AllDefaultChinaProvinceRoutes = []*Route{
|
|||||||
{
|
{
|
||||||
Name: "海南省",
|
Name: "海南省",
|
||||||
Code: "china:province:hainan",
|
Code: "china:province:hainan",
|
||||||
AliasNames: []string{"海南省"},
|
AliasNames: []string{"海南省", "海南"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "重庆市",
|
Name: "重庆市",
|
||||||
@@ -220,17 +228,17 @@ var AllDefaultChinaProvinceRoutes = []*Route{
|
|||||||
{
|
{
|
||||||
Name: "四川省",
|
Name: "四川省",
|
||||||
Code: "china:province:sichuan",
|
Code: "china:province:sichuan",
|
||||||
AliasNames: []string{"四川省"},
|
AliasNames: []string{"四川省", "四川"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "贵州省",
|
Name: "贵州省",
|
||||||
Code: "china:province:guizhou",
|
Code: "china:province:guizhou",
|
||||||
AliasNames: []string{"贵州省"},
|
AliasNames: []string{"贵州省", "贵州"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "云南省",
|
Name: "云南省",
|
||||||
Code: "china:province:yunnan",
|
Code: "china:province:yunnan",
|
||||||
AliasNames: []string{"云南省"},
|
AliasNames: []string{"云南省", "云南"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "西藏自治区",
|
Name: "西藏自治区",
|
||||||
@@ -240,17 +248,17 @@ var AllDefaultChinaProvinceRoutes = []*Route{
|
|||||||
{
|
{
|
||||||
Name: "陕西省",
|
Name: "陕西省",
|
||||||
Code: "china:province:shaanxi",
|
Code: "china:province:shaanxi",
|
||||||
AliasNames: []string{"陕西省"},
|
AliasNames: []string{"陕西省", "陕西"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "甘肃省",
|
Name: "甘肃省",
|
||||||
Code: "china:province:gansu",
|
Code: "china:province:gansu",
|
||||||
AliasNames: []string{"甘肃省"},
|
AliasNames: []string{"甘肃省", "甘肃"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "青海省",
|
Name: "青海省",
|
||||||
Code: "china:province:qinghai",
|
Code: "china:province:qinghai",
|
||||||
AliasNames: []string{"青海省"},
|
AliasNames: []string{"青海省", "青海"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "宁夏回族自治区",
|
Name: "宁夏回族自治区",
|
||||||
@@ -264,29 +272,63 @@ var AllDefaultChinaProvinceRoutes = []*Route{
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "香港特别行政区",
|
Name: "香港特别行政区",
|
||||||
Code: "china:province:hk",
|
Code: ChinaProvinceCodeHK,
|
||||||
AliasNames: []string{"香港特别行政区", "香港"},
|
AliasNames: []string{"香港特别行政区", "香港"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "澳门特别行政区",
|
Name: "澳门特别行政区",
|
||||||
Code: "china:province:mo",
|
Code: ChinaProvinceCodeMO,
|
||||||
AliasNames: []string{"澳门特别行政区", "澳门"},
|
AliasNames: []string{"澳门特别行政区", "澳门"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "台湾省",
|
Name: "台湾省",
|
||||||
Code: "china:province:tw",
|
Code: ChinaProvinceCodeTW,
|
||||||
AliasNames: []string{"台湾省"},
|
AliasNames: []string{"台湾省", "台湾"},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const (
|
||||||
|
WorldRegionCodeChina RouteCode = "world:CN"
|
||||||
|
WorldRegionCodeHK RouteCode = "world:CN:hk"
|
||||||
|
WorldRegionCodeMO RouteCode = "world:CN:mo"
|
||||||
|
WorldRegionCodeTW RouteCode = "world:CN:tw"
|
||||||
|
WorldRegionCodeChinaMainland RouteCode = "world:CN:mainland"
|
||||||
|
WorldRegionCodeChinaAbroad RouteCode = "world:CN:abroad"
|
||||||
|
)
|
||||||
|
|
||||||
// AllDefaultWorldRegionRoutes 世界地域线路
|
// AllDefaultWorldRegionRoutes 世界地域线路
|
||||||
// 参考:https://zh.wikipedia.org/wiki/%E5%9C%8B%E5%AE%B6%E5%9C%B0%E5%8D%80%E4%BB%A3%E7%A2%BC
|
// 参考:https://zh.wikipedia.org/wiki/%E5%9C%8B%E5%AE%B6%E5%9C%B0%E5%8D%80%E4%BB%A3%E7%A2%BC
|
||||||
var AllDefaultWorldRegionRoutes = []*Route{
|
var AllDefaultWorldRegionRoutes = []*Route{
|
||||||
{
|
{
|
||||||
Name: "中国",
|
Name: "中国全境",
|
||||||
Code: "world:CN",
|
Code: WorldRegionCodeChina,
|
||||||
AliasNames: []string{"中国"},
|
AliasNames: []string{"中国"},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
Name: "中国香港",
|
||||||
|
Code: WorldRegionCodeHK,
|
||||||
|
AliasNames: []string{"中国香港地区"},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Name: "中国澳门",
|
||||||
|
Code: WorldRegionCodeMO,
|
||||||
|
AliasNames: []string{"中国澳门地区"},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Name: "中国台湾",
|
||||||
|
Code: WorldRegionCodeTW,
|
||||||
|
AliasNames: []string{"中国台湾地区"},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Name: "中国大陆",
|
||||||
|
Code: WorldRegionCodeChinaMainland,
|
||||||
|
AliasNames: []string{"中国大陆大区"},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Name: "海外",
|
||||||
|
Code: WorldRegionCodeChinaAbroad,
|
||||||
|
AliasNames: []string{"中国海外地区"},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
Name: "蒙古",
|
Name: "蒙古",
|
||||||
Code: "world:MN",
|
Code: "world:MN",
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ func TestRoutes_Markdown(t *testing.T) {
|
|||||||
case 0:
|
case 0:
|
||||||
markdown += "## 默认线路\n"
|
markdown += "## 默认线路\n"
|
||||||
case 1:
|
case 1:
|
||||||
markdown += "## 中国地区\n"
|
markdown += "## 中国省市\n"
|
||||||
case 2:
|
case 2:
|
||||||
markdown += "## 运营商\n"
|
markdown += "## 运营商\n"
|
||||||
case 3:
|
case 3:
|
||||||
|
|||||||
1
pkg/iplibrary/.gitignore
vendored
Normal file
1
pkg/iplibrary/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
ip.db
|
||||||
86
pkg/iplibrary/default_ip_library.go
Normal file
86
pkg/iplibrary/default_ip_library.go
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
|
||||||
|
|
||||||
|
package iplibrary
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"compress/gzip"
|
||||||
|
_ "embed"
|
||||||
|
"net"
|
||||||
|
)
|
||||||
|
|
||||||
|
//go:embed internal-ip-library.db
|
||||||
|
var ipLibraryData []byte
|
||||||
|
|
||||||
|
var defaultLibrary = NewIPLibrary()
|
||||||
|
|
||||||
|
func DefaultIPLibraryData() []byte {
|
||||||
|
return ipLibraryData
|
||||||
|
}
|
||||||
|
|
||||||
|
func InitDefault() error {
|
||||||
|
defaultLibrary.reader = nil
|
||||||
|
return defaultLibrary.InitFromData(ipLibraryData)
|
||||||
|
}
|
||||||
|
|
||||||
|
func Lookup(ip net.IP) *QueryResult {
|
||||||
|
return defaultLibrary.Lookup(ip)
|
||||||
|
}
|
||||||
|
|
||||||
|
func LookupIP(ip string) *QueryResult {
|
||||||
|
return defaultLibrary.LookupIP(ip)
|
||||||
|
}
|
||||||
|
|
||||||
|
type IPLibrary struct {
|
||||||
|
reader *Reader
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewIPLibrary() *IPLibrary {
|
||||||
|
return &IPLibrary{}
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewIPLibraryWithReader(reader *Reader) *IPLibrary {
|
||||||
|
return &IPLibrary{reader: reader}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *IPLibrary) InitFromData(data []byte) error {
|
||||||
|
if len(data) == 0 || this.reader != nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
var reader = bytes.NewReader(data)
|
||||||
|
gzipReader, err := gzip.NewReader(reader)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer func() {
|
||||||
|
_ = gzipReader.Close()
|
||||||
|
}()
|
||||||
|
|
||||||
|
libReader, err := NewReader(gzipReader)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
this.reader = libReader
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *IPLibrary) Lookup(ip net.IP) *QueryResult {
|
||||||
|
if this.reader == nil {
|
||||||
|
return &QueryResult{}
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = this.reader.Lookup(ip)
|
||||||
|
if result == nil {
|
||||||
|
result = &QueryResult{}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *IPLibrary) LookupIP(ip string) *QueryResult {
|
||||||
|
if this.reader == nil {
|
||||||
|
return &QueryResult{}
|
||||||
|
}
|
||||||
|
return this.Lookup(net.ParseIP(ip))
|
||||||
|
}
|
||||||
91
pkg/iplibrary/default_ip_library_test.go
Normal file
91
pkg/iplibrary/default_ip_library_test.go
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
|
||||||
|
|
||||||
|
package iplibrary_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"github.com/TeaOSLab/EdgeCommon/pkg/iplibrary"
|
||||||
|
"net"
|
||||||
|
"runtime"
|
||||||
|
"runtime/debug"
|
||||||
|
"testing"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestIPLibrary_Init(t *testing.T) {
|
||||||
|
var lib = iplibrary.NewIPLibrary()
|
||||||
|
|
||||||
|
err := lib.InitFromData(iplibrary.DefaultIPLibraryData())
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestIPLibrary_Lookup(t *testing.T) {
|
||||||
|
var stat1 = &runtime.MemStats{}
|
||||||
|
runtime.ReadMemStats(stat1)
|
||||||
|
|
||||||
|
var lib = iplibrary.NewIPLibrary()
|
||||||
|
|
||||||
|
var before = time.Now()
|
||||||
|
|
||||||
|
err := lib.InitFromData(iplibrary.DefaultIPLibraryData())
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
var costMs = time.Since(before).Seconds() * 1000
|
||||||
|
runtime.GC()
|
||||||
|
debug.FreeOSMemory()
|
||||||
|
|
||||||
|
var stat2 = &runtime.MemStats{}
|
||||||
|
runtime.ReadMemStats(stat2)
|
||||||
|
|
||||||
|
t.Log((stat2.Alloc-stat1.Alloc)/1024/1024, "M", fmt.Sprintf("%.2f", costMs), "ms")
|
||||||
|
|
||||||
|
for _, ip := range []string{
|
||||||
|
"127.0.0.1",
|
||||||
|
"8.8.8.8",
|
||||||
|
"4.4.4.4",
|
||||||
|
"202.96.0.20",
|
||||||
|
"66.249.66.69",
|
||||||
|
"2222", // wrong ip
|
||||||
|
"2406:8c00:0:3401:133:18:168:70", // ipv6
|
||||||
|
} {
|
||||||
|
var result = lib.Lookup(net.ParseIP(ip))
|
||||||
|
t.Log(ip, "=>", result.IsOk(), "[", result.CountryName(), result.CountryId(), "][", result.ProvinceName(), result.ProvinceId(), "][", result.TownName(), result.TownId(), "][", result.ProviderName(), result.ProviderId(), "]")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestIPLibrary_LookupIP(t *testing.T) {
|
||||||
|
var lib = iplibrary.NewIPLibrary()
|
||||||
|
err := lib.InitFromData(iplibrary.DefaultIPLibraryData())
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, ip := range []string{
|
||||||
|
"66.249.66.69",
|
||||||
|
} {
|
||||||
|
var result = lib.LookupIP(ip)
|
||||||
|
if result.IsOk() {
|
||||||
|
t.Log(ip, "=>", result.IsOk(), "[", result.CountryName(), result.CountryId(), "][", result.ProvinceName(), result.ProvinceId(), "][", result.TownName(), result.TownId(), "][", result.ProviderName(), result.ProviderId(), "]")
|
||||||
|
} else {
|
||||||
|
t.Log(ip, "=>", result.IsOk())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func BenchmarkIPLibrary_Lookup(b *testing.B) {
|
||||||
|
var lib = iplibrary.NewIPLibrary()
|
||||||
|
err := lib.InitFromData(iplibrary.DefaultIPLibraryData())
|
||||||
|
if err != nil {
|
||||||
|
b.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
b.ResetTimer()
|
||||||
|
|
||||||
|
for i := 0; i < b.N; i++ {
|
||||||
|
_ = lib.LookupIP("66.249.66.69")
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
pkg/iplibrary/internal-ip-library.db
Normal file
BIN
pkg/iplibrary/internal-ip-library.db
Normal file
Binary file not shown.
51
pkg/iplibrary/ip_item.go
Normal file
51
pkg/iplibrary/ip_item.go
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
|
||||||
|
|
||||||
|
package iplibrary
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"encoding/binary"
|
||||||
|
"github.com/iwind/TeaGo/types"
|
||||||
|
)
|
||||||
|
|
||||||
|
type ipItem struct {
|
||||||
|
IPFrom uint64
|
||||||
|
IPTo uint64
|
||||||
|
|
||||||
|
Region *ipRegion
|
||||||
|
}
|
||||||
|
|
||||||
|
type ipRegion struct {
|
||||||
|
CountryId uint32
|
||||||
|
ProvinceId uint32
|
||||||
|
CityId uint32
|
||||||
|
TownId uint32
|
||||||
|
ProviderId uint32
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *ipItem) AsBinary() ([]byte, error) {
|
||||||
|
var buf = &bytes.Buffer{}
|
||||||
|
err := binary.Write(buf, binary.BigEndian, this)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return buf.Bytes(), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func HashRegion(countryId uint32, provinceId uint32, cityId uint32, townId uint32, providerId uint32) string {
|
||||||
|
var providerHash = ""
|
||||||
|
if providerId > 0 {
|
||||||
|
providerHash = "_" + types.String(providerId)
|
||||||
|
}
|
||||||
|
|
||||||
|
if townId > 0 {
|
||||||
|
return "t" + types.String(townId) + providerHash
|
||||||
|
}
|
||||||
|
if cityId > 0 {
|
||||||
|
return "c" + types.String(cityId) + providerHash
|
||||||
|
}
|
||||||
|
if provinceId > 0 {
|
||||||
|
return "p" + types.String(provinceId) + providerHash
|
||||||
|
}
|
||||||
|
return "a" + types.String(countryId) + providerHash
|
||||||
|
}
|
||||||
95
pkg/iplibrary/meta.go
Normal file
95
pkg/iplibrary/meta.go
Normal file
@@ -0,0 +1,95 @@
|
|||||||
|
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
|
||||||
|
|
||||||
|
package iplibrary
|
||||||
|
|
||||||
|
type Country struct {
|
||||||
|
Id uint32 `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Codes []string `json:"codes"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type Province struct {
|
||||||
|
Id uint32 `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Codes []string `json:"codes"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type City struct {
|
||||||
|
Id uint32 `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Codes []string `json:"codes"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type Town struct {
|
||||||
|
Id uint32 `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Codes []string `json:"codes"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type Provider struct {
|
||||||
|
Id uint32 `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Codes []string `json:"codes"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type Meta struct {
|
||||||
|
Version int `json:"version"` // IP库版本
|
||||||
|
Code string `json:"code"` // 代号,用来区分不同的IP库
|
||||||
|
Author string `json:"author"`
|
||||||
|
Countries []*Country `json:"countries"`
|
||||||
|
Provinces []*Province `json:"provinces"`
|
||||||
|
Cities []*City `json:"cities"`
|
||||||
|
Towns []*Town `json:"towns"`
|
||||||
|
Providers []*Provider `json:"providers"`
|
||||||
|
CreatedAt int64 `json:"createdAt"`
|
||||||
|
|
||||||
|
countryMap map[uint32]*Country // id => *Country
|
||||||
|
provinceMap map[uint32]*Province // id => *Province
|
||||||
|
cityMap map[uint32]*City // id => *City
|
||||||
|
townMap map[uint32]*Town // id => *Town
|
||||||
|
providerMap map[uint32]*Provider // id => *Provider
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *Meta) Init() {
|
||||||
|
this.countryMap = map[uint32]*Country{}
|
||||||
|
this.provinceMap = map[uint32]*Province{}
|
||||||
|
this.cityMap = map[uint32]*City{}
|
||||||
|
this.townMap = map[uint32]*Town{}
|
||||||
|
this.providerMap = map[uint32]*Provider{}
|
||||||
|
|
||||||
|
for _, country := range this.Countries {
|
||||||
|
this.countryMap[country.Id] = country
|
||||||
|
}
|
||||||
|
for _, province := range this.Provinces {
|
||||||
|
this.provinceMap[province.Id] = province
|
||||||
|
}
|
||||||
|
for _, city := range this.Cities {
|
||||||
|
this.cityMap[city.Id] = city
|
||||||
|
}
|
||||||
|
for _, town := range this.Towns {
|
||||||
|
this.townMap[town.Id] = town
|
||||||
|
}
|
||||||
|
for _, provider := range this.Providers {
|
||||||
|
this.providerMap[provider.Id] = provider
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *Meta) CountryWithId(countryId uint32) *Country {
|
||||||
|
return this.countryMap[countryId]
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *Meta) ProvinceWithId(provinceId uint32) *Province {
|
||||||
|
return this.provinceMap[provinceId]
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *Meta) CityWithId(cityId uint32) *City {
|
||||||
|
return this.cityMap[cityId]
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *Meta) TownWithId(townId uint32) *Town {
|
||||||
|
return this.townMap[townId]
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *Meta) ProviderWithId(providerId uint32) *Provider {
|
||||||
|
return this.providerMap[providerId]
|
||||||
|
}
|
||||||
3
pkg/iplibrary/meta_test.go
Normal file
3
pkg/iplibrary/meta_test.go
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
|
||||||
|
|
||||||
|
package iplibrary_test
|
||||||
64
pkg/iplibrary/parser.go
Normal file
64
pkg/iplibrary/parser.go
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
|
||||||
|
|
||||||
|
package iplibrary
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"errors"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Parser struct {
|
||||||
|
config *ParserConfig
|
||||||
|
|
||||||
|
data []byte
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewParser(config *ParserConfig) (*Parser, error) {
|
||||||
|
if config == nil {
|
||||||
|
config = &ParserConfig{}
|
||||||
|
}
|
||||||
|
|
||||||
|
if config.Template == nil {
|
||||||
|
return nil, errors.New("template must not be nil")
|
||||||
|
}
|
||||||
|
|
||||||
|
return &Parser{
|
||||||
|
config: config,
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *Parser) Write(data []byte) {
|
||||||
|
this.data = append(this.data, data...)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *Parser) Parse() error {
|
||||||
|
if len(this.data) == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
for {
|
||||||
|
var index = bytes.IndexByte(this.data, '\n')
|
||||||
|
if index >= 0 {
|
||||||
|
var line = this.data[:index+1]
|
||||||
|
values, found := this.config.Template.Extract(string(line), this.config.EmptyValues)
|
||||||
|
if found {
|
||||||
|
if this.config.Iterator != nil {
|
||||||
|
err := this.config.Iterator(values)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 防止错误信息太长
|
||||||
|
if len(line) > 256 {
|
||||||
|
line = line[:256]
|
||||||
|
}
|
||||||
|
return errors.New("invalid line '" + string(line) + "'")
|
||||||
|
}
|
||||||
|
|
||||||
|
this.data = this.data[index+1:]
|
||||||
|
} else {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
9
pkg/iplibrary/parser_config.go
Normal file
9
pkg/iplibrary/parser_config.go
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
|
||||||
|
|
||||||
|
package iplibrary
|
||||||
|
|
||||||
|
type ParserConfig struct {
|
||||||
|
Template *Template
|
||||||
|
EmptyValues []string
|
||||||
|
Iterator func(values map[string]string) error
|
||||||
|
}
|
||||||
54
pkg/iplibrary/parser_reader.go
Normal file
54
pkg/iplibrary/parser_reader.go
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
|
||||||
|
|
||||||
|
package iplibrary
|
||||||
|
|
||||||
|
import (
|
||||||
|
"errors"
|
||||||
|
"io"
|
||||||
|
)
|
||||||
|
|
||||||
|
type ReaderParser struct {
|
||||||
|
reader io.Reader
|
||||||
|
rawParser *Parser
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewReaderParser(reader io.Reader, config *ParserConfig) (*ReaderParser, error) {
|
||||||
|
if config == nil {
|
||||||
|
config = &ParserConfig{}
|
||||||
|
}
|
||||||
|
|
||||||
|
if config.Template == nil {
|
||||||
|
return nil, errors.New("template must not be nil")
|
||||||
|
}
|
||||||
|
|
||||||
|
parser, err := NewParser(config)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return &ReaderParser{
|
||||||
|
reader: reader,
|
||||||
|
rawParser: parser,
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *ReaderParser) Parse() error {
|
||||||
|
var buf = make([]byte, 1024)
|
||||||
|
for {
|
||||||
|
n, err := this.reader.Read(buf)
|
||||||
|
if n > 0 {
|
||||||
|
this.rawParser.Write(buf[:n])
|
||||||
|
parseErr := this.rawParser.Parse()
|
||||||
|
if parseErr != nil {
|
||||||
|
return parseErr
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if err != nil {
|
||||||
|
if err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
62
pkg/iplibrary/parser_reader_test.go
Normal file
62
pkg/iplibrary/parser_reader_test.go
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
|
||||||
|
|
||||||
|
package iplibrary_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"github.com/TeaOSLab/EdgeCommon/pkg/iplibrary"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestNewReaderParser(t *testing.T) {
|
||||||
|
template, err := iplibrary.NewTemplate("${ipFrom}|${ipTo}|${country}|${any}|${province}|${city}|${provider}")
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
var buf = &bytes.Buffer{}
|
||||||
|
buf.WriteString(`8.45.160.0|8.45.161.255|美国|0|华盛顿|西雅图|Level3
|
||||||
|
8.45.162.0|8.45.162.255|美国|0|马萨诸塞|0|Level3
|
||||||
|
8.45.163.0|8.45.164.255|美国|0|俄勒冈|0|Level3
|
||||||
|
8.45.165.0|8.45.165.255|美国|0|华盛顿|0|Level3
|
||||||
|
8.45.166.0|8.45.167.255|美国|0|华盛顿|西雅图|Level3
|
||||||
|
8.45.168.0|8.127.255.255|美国|0|0|0|Level3
|
||||||
|
8.128.0.0|8.128.3.255|中国|0|上海|上海市|阿里巴巴
|
||||||
|
8.128.4.0|8.128.255.255|中国|0|0|0|阿里巴巴
|
||||||
|
8.129.0.0|8.129.255.255|中国|0|广东省|深圳市|阿里云
|
||||||
|
8.130.0.0|8.130.55.255|中国|0|北京|北京市|阿里云
|
||||||
|
8.130.56.0|8.131.255.255|中国|0|北京|北京市|阿里巴巴
|
||||||
|
8.132.0.0|8.133.255.255|中国|0|上海|上海市|阿里巴巴
|
||||||
|
8.134.0.0|8.134.20.63|中国|0|0|0|阿里云
|
||||||
|
8.134.20.64|8.134.79.255|中国|0|广东省|深圳市|阿里云
|
||||||
|
8.134.80.0|8.191.255.255|中国|0|0|0|阿里巴巴
|
||||||
|
8.192.0.0|8.192.0.255|美国|0|0|0|Level3
|
||||||
|
8.192.1.0|8.192.1.255|美国|0|马萨诸塞|波士顿|Level3
|
||||||
|
8.192.2.0|8.207.255.255|美国|0|0|0|Level3
|
||||||
|
8.208.0.0|8.208.127.255|英国|0|伦敦|伦敦|阿里云
|
||||||
|
8.208.128.0|8.208.255.255|英国|0|伦敦|伦敦|阿里巴巴
|
||||||
|
8.209.0.0|8.209.15.255|俄罗斯|0|莫斯科|莫斯科|阿里云
|
||||||
|
8.209.16.0|8.209.31.255|俄罗斯|0|莫斯科|莫斯科|阿里巴巴
|
||||||
|
8.209.32.0|8.209.32.15|中国|0|台湾省|台北|阿里云
|
||||||
|
8.209.32.16|8.209.32.255|中国|0|台湾省|台北|阿里巴巴
|
||||||
|
8.209.33.0|8.209.34.255|中国|0|台湾省|台北|阿里云
|
||||||
|
8.209.35.0|8.209.35.255|中国|0|台湾省|台北|阿里巴巴`)
|
||||||
|
|
||||||
|
var count int
|
||||||
|
parser, err := iplibrary.NewReaderParser(buf, &iplibrary.ParserConfig{
|
||||||
|
Template: template,
|
||||||
|
EmptyValues: []string{"0"},
|
||||||
|
Iterator: func(values map[string]string) error {
|
||||||
|
count++
|
||||||
|
t.Log(count, values)
|
||||||
|
return nil
|
||||||
|
},
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
err = parser.Parse()
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
44
pkg/iplibrary/parser_test.go
Normal file
44
pkg/iplibrary/parser_test.go
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
|
||||||
|
|
||||||
|
package iplibrary_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/TeaOSLab/EdgeCommon/pkg/iplibrary"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestNewParser(t *testing.T) {
|
||||||
|
template, err := iplibrary.NewTemplate("${ipFrom}|${ipTo}|${country}|${any}|${province}|${city}|${provider}")
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
parser, err := iplibrary.NewParser(&iplibrary.ParserConfig{
|
||||||
|
Template: template,
|
||||||
|
EmptyValues: []string{"0"},
|
||||||
|
Iterator: func(values map[string]string) error {
|
||||||
|
t.Log(values)
|
||||||
|
return nil
|
||||||
|
},
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
parser.Write([]byte(`0.0.0.0|0.255.255.255|0|0|0|内网IP|内网IP
|
||||||
|
1.0.0.0|1.0.0.255|澳大利亚|0|0|0|0
|
||||||
|
1.0.1.0|1.0.3.255|中国|0|福建省|福州市|电信
|
||||||
|
1.0.4.0|1.0.7.255|澳大利亚|0|维多利亚|墨尔本|0
|
||||||
|
1.0.8.0|1.0.15.255|中国|0|广东省|广州市|电信
|
||||||
|
1.0.16.0|1.0.31.255|日本|0|0|0|0
|
||||||
|
1.0.32.0|1.0.63.255|中国|0|广东省|广州市|电信
|
||||||
|
1.0.64.0|1.0.79.255|日本|0|广岛县|0|0
|
||||||
|
1.0.80.0|1.0.127.255|日本|0|冈山县|0|0
|
||||||
|
1.0.128.0|1.0.128.255|泰国|0|清莱府|0|TOT
|
||||||
|
1.0.129.0|1.0.132.191|泰国|0|曼谷|曼谷|TOT`))
|
||||||
|
|
||||||
|
err = parser.Parse()
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
233
pkg/iplibrary/reader.go
Normal file
233
pkg/iplibrary/reader.go
Normal file
@@ -0,0 +1,233 @@
|
|||||||
|
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
|
||||||
|
|
||||||
|
package iplibrary
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"encoding/json"
|
||||||
|
"errors"
|
||||||
|
"github.com/TeaOSLab/EdgeCommon/pkg/configutils"
|
||||||
|
"github.com/iwind/TeaGo/types"
|
||||||
|
"io"
|
||||||
|
"net"
|
||||||
|
"sort"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Reader struct {
|
||||||
|
meta *Meta
|
||||||
|
|
||||||
|
regionMap map[string]*ipRegion
|
||||||
|
|
||||||
|
ipV4Items []*ipItem
|
||||||
|
ipV6Items []*ipItem
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewReader(reader io.Reader) (*Reader, error) {
|
||||||
|
var libReader = &Reader{
|
||||||
|
regionMap: map[string]*ipRegion{},
|
||||||
|
}
|
||||||
|
err := libReader.load(reader)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return libReader, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *Reader) load(reader io.Reader) error {
|
||||||
|
var buf = make([]byte, 1024)
|
||||||
|
var metaLine = []byte{}
|
||||||
|
var metaLineFound = false
|
||||||
|
var dataBuf = []byte{}
|
||||||
|
for {
|
||||||
|
n, err := reader.Read(buf)
|
||||||
|
if n > 0 {
|
||||||
|
var data = buf[:n]
|
||||||
|
dataBuf = append(dataBuf, data...)
|
||||||
|
if metaLineFound {
|
||||||
|
left, err := this.parse(dataBuf)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
dataBuf = left
|
||||||
|
} else {
|
||||||
|
var index = bytes.IndexByte(dataBuf, '\n')
|
||||||
|
if index > 0 {
|
||||||
|
metaLine = dataBuf[:index]
|
||||||
|
dataBuf = dataBuf[index+1:]
|
||||||
|
metaLineFound = true
|
||||||
|
var meta = &Meta{}
|
||||||
|
err = json.Unmarshal(metaLine, &meta)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
meta.Init()
|
||||||
|
this.meta = meta
|
||||||
|
|
||||||
|
left, err := this.parse(dataBuf)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
dataBuf = left
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if err != nil {
|
||||||
|
if err != io.EOF {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sort.Slice(this.ipV4Items, func(i, j int) bool {
|
||||||
|
var from0 = this.ipV4Items[i].IPFrom
|
||||||
|
var to0 = this.ipV4Items[i].IPTo
|
||||||
|
var from1 = this.ipV4Items[j].IPFrom
|
||||||
|
var to1 = this.ipV4Items[j].IPTo
|
||||||
|
if from0 == from1 {
|
||||||
|
return to0 < to1
|
||||||
|
}
|
||||||
|
return from0 < from1
|
||||||
|
})
|
||||||
|
|
||||||
|
sort.Slice(this.ipV6Items, func(i, j int) bool {
|
||||||
|
var from0 = this.ipV6Items[i].IPFrom
|
||||||
|
var to0 = this.ipV6Items[i].IPTo
|
||||||
|
var from1 = this.ipV6Items[j].IPFrom
|
||||||
|
var to1 = this.ipV6Items[j].IPTo
|
||||||
|
if from0 == from1 {
|
||||||
|
return to0 < to1
|
||||||
|
}
|
||||||
|
return from0 < from1
|
||||||
|
})
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *Reader) Lookup(ip net.IP) *QueryResult {
|
||||||
|
if ip == nil {
|
||||||
|
return &QueryResult{}
|
||||||
|
}
|
||||||
|
|
||||||
|
var ipLong = configutils.IP2Long(ip)
|
||||||
|
var isV4 = configutils.IsIPv4(ip)
|
||||||
|
var resultItem *ipItem
|
||||||
|
if isV4 {
|
||||||
|
sort.Search(len(this.ipV4Items), func(i int) bool {
|
||||||
|
var item = this.ipV4Items[i]
|
||||||
|
if item.IPFrom <= ipLong {
|
||||||
|
if item.IPTo >= ipLong {
|
||||||
|
resultItem = item
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
sort.Search(len(this.ipV6Items), func(i int) bool {
|
||||||
|
var item = this.ipV6Items[i]
|
||||||
|
if item.IPFrom <= ipLong {
|
||||||
|
if item.IPTo >= ipLong {
|
||||||
|
resultItem = item
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
return &QueryResult{
|
||||||
|
item: resultItem,
|
||||||
|
meta: this.meta,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *Reader) Meta() *Meta {
|
||||||
|
return this.meta
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *Reader) IPv4Items() []*ipItem {
|
||||||
|
return this.ipV4Items
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *Reader) IPv6Items() []*ipItem {
|
||||||
|
return this.ipV6Items
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *Reader) parse(data []byte) (left []byte, err error) {
|
||||||
|
if len(data) == 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
for {
|
||||||
|
var index = bytes.IndexByte(data, '\n')
|
||||||
|
if index >= 0 {
|
||||||
|
var line = data[:index]
|
||||||
|
var pieces = strings.Split(string(line), "|")
|
||||||
|
if len(pieces) != 8 {
|
||||||
|
return nil, errors.New("invalid ip definition '" + string(line) + "'")
|
||||||
|
}
|
||||||
|
|
||||||
|
var version = pieces[0]
|
||||||
|
if len(version) == 0 {
|
||||||
|
version = "4"
|
||||||
|
}
|
||||||
|
|
||||||
|
if version != "4" && version != "6" {
|
||||||
|
return nil, errors.New("invalid ip version '" + string(line) + "'")
|
||||||
|
}
|
||||||
|
|
||||||
|
var ipFrom uint64
|
||||||
|
var ipTo uint64
|
||||||
|
if len(pieces[2]) == 0 {
|
||||||
|
pieces[2] = pieces[1]
|
||||||
|
ipFrom = types.Uint64(pieces[1])
|
||||||
|
ipTo = types.Uint64(pieces[2])
|
||||||
|
} else {
|
||||||
|
ipFrom = types.Uint64(pieces[1])
|
||||||
|
ipTo = types.Uint64(pieces[2]) + ipFrom
|
||||||
|
}
|
||||||
|
|
||||||
|
var countryId = types.Uint32(pieces[3])
|
||||||
|
var provinceId = types.Uint32(pieces[4])
|
||||||
|
var cityId = types.Uint32(pieces[5])
|
||||||
|
var townId = types.Uint32(pieces[6])
|
||||||
|
var providerId = types.Uint32(pieces[7])
|
||||||
|
var hash = HashRegion(countryId, provinceId, cityId, townId, providerId)
|
||||||
|
|
||||||
|
region, ok := this.regionMap[hash]
|
||||||
|
if !ok {
|
||||||
|
region = &ipRegion{
|
||||||
|
CountryId: countryId,
|
||||||
|
ProvinceId: provinceId,
|
||||||
|
CityId: cityId,
|
||||||
|
TownId: townId,
|
||||||
|
ProviderId: providerId,
|
||||||
|
}
|
||||||
|
this.regionMap[hash] = region
|
||||||
|
}
|
||||||
|
|
||||||
|
if version == "4" {
|
||||||
|
this.ipV4Items = append(this.ipV4Items, &ipItem{
|
||||||
|
IPFrom: ipFrom,
|
||||||
|
IPTo: ipTo,
|
||||||
|
Region: region,
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.ipV6Items = append(this.ipV6Items, &ipItem{
|
||||||
|
IPFrom: ipFrom,
|
||||||
|
IPTo: ipTo,
|
||||||
|
Region: region,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
data = data[index+1:]
|
||||||
|
} else {
|
||||||
|
left = data
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
55
pkg/iplibrary/reader_file.go
Normal file
55
pkg/iplibrary/reader_file.go
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
|
||||||
|
|
||||||
|
package iplibrary
|
||||||
|
|
||||||
|
import (
|
||||||
|
"compress/gzip"
|
||||||
|
"errors"
|
||||||
|
"io"
|
||||||
|
"net"
|
||||||
|
"os"
|
||||||
|
)
|
||||||
|
|
||||||
|
type FileReader struct {
|
||||||
|
rawReader *Reader
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewFileReader(path string) (*FileReader, error) {
|
||||||
|
fp, err := os.Open(path)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
defer func() {
|
||||||
|
_ = fp.Close()
|
||||||
|
}()
|
||||||
|
|
||||||
|
return NewFileDataReader(fp)
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewFileDataReader(dataReader io.Reader) (*FileReader, error) {
|
||||||
|
gzReader, err := gzip.NewReader(dataReader)
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.New("create gzip reader failed: " + err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
reader, err := NewReader(gzReader)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return &FileReader{
|
||||||
|
rawReader: reader,
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *FileReader) Meta() *Meta {
|
||||||
|
return this.rawReader.meta
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *FileReader) Lookup(ip net.IP) *QueryResult {
|
||||||
|
return this.rawReader.Lookup(ip)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *FileReader) RawReader() *Reader {
|
||||||
|
return this.rawReader
|
||||||
|
}
|
||||||
51
pkg/iplibrary/reader_file_test.go
Normal file
51
pkg/iplibrary/reader_file_test.go
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
|
||||||
|
|
||||||
|
package iplibrary_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"github.com/TeaOSLab/EdgeCommon/pkg/iplibrary"
|
||||||
|
"github.com/iwind/TeaGo/maps"
|
||||||
|
"net"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestNewFileReader(t *testing.T) {
|
||||||
|
reader, err := iplibrary.NewFileReader("./ip")
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, ip := range []string{
|
||||||
|
"127.0.0.1",
|
||||||
|
"192.168.0.1",
|
||||||
|
"192.168.0.150",
|
||||||
|
"8.8.8.8",
|
||||||
|
"111.197.165.199",
|
||||||
|
"175.178.206.125",
|
||||||
|
} {
|
||||||
|
var result = reader.Lookup(net.ParseIP(ip))
|
||||||
|
if result.IsOk() {
|
||||||
|
var data = maps.Map{
|
||||||
|
"countryId": result.CountryId(),
|
||||||
|
"countryName": result.CountryName(),
|
||||||
|
"provinceId": result.ProvinceId(),
|
||||||
|
"provinceName": result.ProvinceName(),
|
||||||
|
"cityId": result.CityId(),
|
||||||
|
"cityName": result.CityName(),
|
||||||
|
"townId": result.TownId(),
|
||||||
|
"townName": result.TownName(),
|
||||||
|
"providerId": result.ProviderId(),
|
||||||
|
"providerName": result.ProviderName(),
|
||||||
|
"summary": result.Summary(),
|
||||||
|
}
|
||||||
|
dataJSON, err := json.MarshalIndent(data, "", " ")
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
t.Log(ip, "=>", string(dataJSON))
|
||||||
|
} else {
|
||||||
|
t.Log(ip+":", "not found")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
191
pkg/iplibrary/reader_result.go
Normal file
191
pkg/iplibrary/reader_result.go
Normal file
@@ -0,0 +1,191 @@
|
|||||||
|
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
|
||||||
|
|
||||||
|
package iplibrary
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/iwind/TeaGo/lists"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
type QueryResult struct {
|
||||||
|
item *ipItem
|
||||||
|
meta *Meta
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *QueryResult) IsOk() bool {
|
||||||
|
return this.item != nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *QueryResult) CountryId() int64 {
|
||||||
|
if this.item != nil {
|
||||||
|
return int64(this.item.Region.CountryId)
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *QueryResult) CountryName() string {
|
||||||
|
if this.item == nil {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
if this.item.Region.CountryId > 0 {
|
||||||
|
var country = this.meta.CountryWithId(this.item.Region.CountryId)
|
||||||
|
if country != nil {
|
||||||
|
return country.Name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *QueryResult) CountryCodes() []string {
|
||||||
|
if this.item == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
if this.item.Region.CountryId > 0 {
|
||||||
|
var country = this.meta.CountryWithId(this.item.Region.CountryId)
|
||||||
|
if country != nil {
|
||||||
|
return country.Codes
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *QueryResult) ProvinceId() int64 {
|
||||||
|
if this.item != nil {
|
||||||
|
return int64(this.item.Region.ProvinceId)
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *QueryResult) ProvinceName() string {
|
||||||
|
if this.item == nil {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
if this.item.Region.ProvinceId > 0 {
|
||||||
|
var province = this.meta.ProvinceWithId(this.item.Region.ProvinceId)
|
||||||
|
if province != nil {
|
||||||
|
return province.Name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *QueryResult) ProvinceCodes() []string {
|
||||||
|
if this.item == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
if this.item.Region.ProvinceId > 0 {
|
||||||
|
var province = this.meta.ProvinceWithId(this.item.Region.ProvinceId)
|
||||||
|
if province != nil {
|
||||||
|
return province.Codes
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *QueryResult) CityId() int64 {
|
||||||
|
if this.item != nil {
|
||||||
|
return int64(this.item.Region.CityId)
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *QueryResult) CityName() string {
|
||||||
|
if this.item == nil {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
if this.item.Region.CityId > 0 {
|
||||||
|
var city = this.meta.CityWithId(this.item.Region.CityId)
|
||||||
|
if city != nil {
|
||||||
|
return city.Name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *QueryResult) TownId() int64 {
|
||||||
|
if this.item != nil {
|
||||||
|
return int64(this.item.Region.TownId)
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *QueryResult) TownName() string {
|
||||||
|
if this.item == nil {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
if this.item.Region.TownId > 0 {
|
||||||
|
var town = this.meta.TownWithId(this.item.Region.TownId)
|
||||||
|
if town != nil {
|
||||||
|
return town.Name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *QueryResult) ProviderId() int64 {
|
||||||
|
if this.item != nil {
|
||||||
|
return int64(this.item.Region.ProviderId)
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *QueryResult) ProviderName() string {
|
||||||
|
if this.item == nil {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
if this.item.Region.ProviderId > 0 {
|
||||||
|
var provider = this.meta.ProviderWithId(this.item.Region.ProviderId)
|
||||||
|
if provider != nil {
|
||||||
|
return provider.Name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *QueryResult) ProviderCodes() []string {
|
||||||
|
if this.item == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
if this.item.Region.ProviderId > 0 {
|
||||||
|
var provider = this.meta.ProviderWithId(this.item.Region.ProviderId)
|
||||||
|
if provider != nil {
|
||||||
|
return provider.Codes
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *QueryResult) Summary() string {
|
||||||
|
if this.item == nil {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
var pieces = []string{}
|
||||||
|
var countryName = this.CountryName()
|
||||||
|
var provinceName = this.ProvinceName()
|
||||||
|
var cityName = this.CityName()
|
||||||
|
var townName = this.TownName()
|
||||||
|
var providerName = this.ProviderName()
|
||||||
|
|
||||||
|
if len(countryName) > 0 {
|
||||||
|
pieces = append(pieces, countryName)
|
||||||
|
}
|
||||||
|
if len(provinceName) > 0 && !lists.ContainsString(pieces, provinceName) {
|
||||||
|
pieces = append(pieces, provinceName)
|
||||||
|
}
|
||||||
|
if len(cityName) > 0 && !lists.ContainsString(pieces, cityName) && !lists.ContainsString(pieces, strings.TrimSuffix(cityName, "市")) {
|
||||||
|
pieces = append(pieces, cityName)
|
||||||
|
}
|
||||||
|
if len(townName) > 0 && !lists.ContainsString(pieces, townName) && !lists.ContainsString(pieces, strings.TrimSuffix(townName, "县")) {
|
||||||
|
pieces = append(pieces, cityName)
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(providerName) > 0 && !lists.ContainsString(pieces, providerName) {
|
||||||
|
if len(pieces) > 0 {
|
||||||
|
pieces = append(pieces, "|")
|
||||||
|
}
|
||||||
|
pieces = append(pieces, providerName)
|
||||||
|
}
|
||||||
|
|
||||||
|
return strings.Join(pieces, " ")
|
||||||
|
}
|
||||||
149
pkg/iplibrary/reader_test.go
Normal file
149
pkg/iplibrary/reader_test.go
Normal file
@@ -0,0 +1,149 @@
|
|||||||
|
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
|
||||||
|
|
||||||
|
package iplibrary_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"github.com/TeaOSLab/EdgeCommon/pkg/iplibrary"
|
||||||
|
"github.com/iwind/TeaGo/rands"
|
||||||
|
"github.com/iwind/TeaGo/types"
|
||||||
|
timeutil "github.com/iwind/TeaGo/utils/time"
|
||||||
|
"net"
|
||||||
|
"runtime"
|
||||||
|
"testing"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestNewReader(t *testing.T) {
|
||||||
|
var buf = &bytes.Buffer{}
|
||||||
|
var writer = iplibrary.NewWriter(buf, &iplibrary.Meta{
|
||||||
|
Author: "GoEdge <https://goedge.cn>",
|
||||||
|
})
|
||||||
|
|
||||||
|
err := writer.WriteMeta()
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
err = writer.Write("192.168.1.100", "192.168.1.100", 1, 200, 300, 400, 500)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
err = writer.Write("192.168.2.100", "192.168.3.100", 2, 201, 301, 401, 501)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
err = writer.Write("192.168.3.101", "192.168.3.101", 3, 201, 301, 401, 501)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
err = writer.Write("192.168.0.101", "192.168.0.200", 4, 201, 301, 401, 501)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
err = writer.Write("::1", "::5", 5, 201, 301, 401, 501)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**var n = func() string {
|
||||||
|
return types.String(rands.Int(0, 255))
|
||||||
|
}
|
||||||
|
|
||||||
|
for i := 0; i < 1_000_000; i++ {
|
||||||
|
err = writer.Write(n()+"."+n()+"."+n()+"."+n(), n()+"."+n()+"."+n()+"."+n(), int64(i)+100, 201, 301, 401, 501)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
}**/
|
||||||
|
|
||||||
|
var stat = &runtime.MemStats{}
|
||||||
|
runtime.ReadMemStats(stat)
|
||||||
|
reader, err := iplibrary.NewReader(buf)
|
||||||
|
|
||||||
|
var stat2 = &runtime.MemStats{}
|
||||||
|
runtime.ReadMemStats(stat2)
|
||||||
|
t.Log((stat2.Alloc-stat.Alloc)/1024/1024, "M")
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
t.Log("version:", reader.Meta().Version, "author:", reader.Meta().Author, "createdTime:", timeutil.FormatTime("Y-m-d H:i:s", reader.Meta().CreatedAt))
|
||||||
|
|
||||||
|
if len(reader.IPv4Items()) < 10 {
|
||||||
|
t.Log("===")
|
||||||
|
for _, item := range reader.IPv4Items() {
|
||||||
|
t.Logf("%+v", item)
|
||||||
|
}
|
||||||
|
t.Log("===")
|
||||||
|
}
|
||||||
|
if len(reader.IPv6Items()) < 10 {
|
||||||
|
t.Log("===")
|
||||||
|
for _, item := range reader.IPv6Items() {
|
||||||
|
t.Logf("%+v", item)
|
||||||
|
}
|
||||||
|
t.Log("===")
|
||||||
|
}
|
||||||
|
|
||||||
|
var before = time.Now()
|
||||||
|
for _, ip := range []string{
|
||||||
|
"192.168.0.1",
|
||||||
|
"192.168.0.150",
|
||||||
|
"192.168.1.100",
|
||||||
|
"192.168.2.100",
|
||||||
|
"192.168.3.50",
|
||||||
|
"192.168.0.150",
|
||||||
|
"192.168.4.80",
|
||||||
|
"::3",
|
||||||
|
"::8",
|
||||||
|
} {
|
||||||
|
var result = reader.Lookup(net.ParseIP(ip))
|
||||||
|
if result.IsOk() {
|
||||||
|
t.Log(ip+":", "countryId:", result.CountryId())
|
||||||
|
} else {
|
||||||
|
t.Log(ip+":", "not found")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
t.Log(time.Since(before).Seconds()*1000, "ms")
|
||||||
|
}
|
||||||
|
|
||||||
|
func BenchmarkNewReader(b *testing.B) {
|
||||||
|
runtime.GOMAXPROCS(1)
|
||||||
|
|
||||||
|
var buf = &bytes.Buffer{}
|
||||||
|
var writer = iplibrary.NewWriter(buf, &iplibrary.Meta{
|
||||||
|
Author: "GoEdge <https://goedge.cn>",
|
||||||
|
})
|
||||||
|
|
||||||
|
err := writer.WriteMeta()
|
||||||
|
if err != nil {
|
||||||
|
b.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
var n = func() string {
|
||||||
|
return types.String(rands.Int(0, 255))
|
||||||
|
}
|
||||||
|
|
||||||
|
for i := 0; i < 1_000_000; i++ {
|
||||||
|
err = writer.Write(n()+"."+n()+"."+n()+"."+n(), n()+"."+n()+"."+n()+"."+n(), int64(i)+100, 201, 301, 401, 501)
|
||||||
|
if err != nil {
|
||||||
|
b.Fatal(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
reader, err := iplibrary.NewReader(buf)
|
||||||
|
if err != nil {
|
||||||
|
b.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
b.ResetTimer()
|
||||||
|
|
||||||
|
for i := 0; i < b.N; i++ {
|
||||||
|
var ip = "192.168.1.100"
|
||||||
|
reader.Lookup(net.ParseIP(ip))
|
||||||
|
}
|
||||||
|
}
|
||||||
75
pkg/iplibrary/template.go
Normal file
75
pkg/iplibrary/template.go
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
|
||||||
|
|
||||||
|
package iplibrary
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/iwind/TeaGo/lists"
|
||||||
|
"regexp"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Template struct {
|
||||||
|
templateString string
|
||||||
|
reg *regexp.Regexp
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewTemplate(templateString string) (*Template, error) {
|
||||||
|
var t = &Template{
|
||||||
|
templateString: templateString,
|
||||||
|
}
|
||||||
|
err := t.init()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return t, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *Template) init() error {
|
||||||
|
var template = regexp.QuoteMeta(this.templateString)
|
||||||
|
var keywordReg = regexp.MustCompile(`\\\$\\{(\w+)\\}`)
|
||||||
|
template = keywordReg.ReplaceAllStringFunc(template, func(keyword string) string {
|
||||||
|
var matches = keywordReg.FindStringSubmatch(keyword)
|
||||||
|
if len(matches) > 1 {
|
||||||
|
switch matches[1] {
|
||||||
|
case "ipFrom", "ipTo", "country", "province", "city", "town", "provider":
|
||||||
|
return "(?P<" + matches[1] + ">.*)"
|
||||||
|
}
|
||||||
|
return ".*"
|
||||||
|
}
|
||||||
|
|
||||||
|
return keyword
|
||||||
|
})
|
||||||
|
reg, err := regexp.Compile(template)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
this.reg = reg
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *Template) Extract(text string, emptyValues []string) (values map[string]string, ok bool) {
|
||||||
|
var matches = this.reg.FindStringSubmatch(text)
|
||||||
|
if len(matches) == 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
values = map[string]string{}
|
||||||
|
for index, name := range this.reg.SubexpNames() {
|
||||||
|
if len(name) == 0 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
var v = matches[index]
|
||||||
|
if name != "ipFrom" && name != "ipTo" && (v == "0" || v == "无" || v == "空" || lists.ContainsString(emptyValues, v)) {
|
||||||
|
v = ""
|
||||||
|
}
|
||||||
|
values[name] = v
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, keyword := range []string{"ipFrom", "ipTo", "country", "province", "city", "town", "provider"} {
|
||||||
|
_, hasKeyword := values[keyword]
|
||||||
|
if !hasKeyword {
|
||||||
|
values[keyword] = ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ok = true
|
||||||
|
return
|
||||||
|
}
|
||||||
25
pkg/iplibrary/template_test.go
Normal file
25
pkg/iplibrary/template_test.go
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
|
||||||
|
|
||||||
|
package iplibrary_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/TeaOSLab/EdgeCommon/pkg/iplibrary"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestNewTemplate(t *testing.T) {
|
||||||
|
template, err := iplibrary.NewTemplate("${ipFrom}|${ipTo}|${country}|${any}|${province}|${city}|${provider}")
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
for _, s := range []string{
|
||||||
|
"42.0.32.0|42.0.63.255|中国|0|广东省|广州市|电信",
|
||||||
|
"42.0.32.0|42.0.63.255|中国|0|广东省|广州市|电信\n123",
|
||||||
|
"42.0.32.0|42.0.63.255|中国||广东省|广州市|电信",
|
||||||
|
"42.0.32.0|42.0.63.255|中国|0||广州市|电信",
|
||||||
|
"42.0.32.0|42.0.63.255|中国|0|广东省|广州市",
|
||||||
|
} {
|
||||||
|
values, _ := template.Extract(s, []string{})
|
||||||
|
t.Log(s, "=>\n", values)
|
||||||
|
}
|
||||||
|
}
|
||||||
268
pkg/iplibrary/updater.go
Normal file
268
pkg/iplibrary/updater.go
Normal file
@@ -0,0 +1,268 @@
|
|||||||
|
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
|
||||||
|
|
||||||
|
package iplibrary
|
||||||
|
|
||||||
|
import (
|
||||||
|
"errors"
|
||||||
|
"google.golang.org/grpc/codes"
|
||||||
|
"google.golang.org/grpc/status"
|
||||||
|
"io"
|
||||||
|
"os"
|
||||||
|
"strings"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
type UpdaterSource interface {
|
||||||
|
// DataDir 文件目录
|
||||||
|
DataDir() string
|
||||||
|
|
||||||
|
// FindLatestFile 检查最新的IP库文件
|
||||||
|
FindLatestFile() (code string, fileId int64, err error)
|
||||||
|
|
||||||
|
// DownloadFile 下载文件
|
||||||
|
DownloadFile(fileId int64, writer io.Writer) error
|
||||||
|
|
||||||
|
// LogInfo 普通日志
|
||||||
|
LogInfo(message string)
|
||||||
|
|
||||||
|
// LogError 错误日志
|
||||||
|
LogError(err error)
|
||||||
|
}
|
||||||
|
|
||||||
|
type Updater struct {
|
||||||
|
source UpdaterSource
|
||||||
|
|
||||||
|
currentCode string
|
||||||
|
ticker *time.Ticker
|
||||||
|
|
||||||
|
isUpdating bool
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewUpdater(source UpdaterSource, interval time.Duration) *Updater {
|
||||||
|
return &Updater{
|
||||||
|
source: source,
|
||||||
|
ticker: time.NewTicker(interval),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *Updater) Start() {
|
||||||
|
// 初始化
|
||||||
|
err := this.Init()
|
||||||
|
if err != nil {
|
||||||
|
this.source.LogError(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 先运行一次
|
||||||
|
err = this.Loop()
|
||||||
|
if err != nil {
|
||||||
|
this.source.LogError(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 开始定时运行
|
||||||
|
for range this.ticker.C {
|
||||||
|
err = this.Loop()
|
||||||
|
if err != nil {
|
||||||
|
this.source.LogError(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *Updater) Init() error {
|
||||||
|
// 检查当前正在使用的IP库
|
||||||
|
var path = this.source.DataDir() + "/ip-library.db"
|
||||||
|
fp, err := os.Open(path)
|
||||||
|
if err != nil {
|
||||||
|
if os.IsNotExist(err) {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
return errors.New("read ip library file failed '" + err.Error() + "'")
|
||||||
|
}
|
||||||
|
defer func() {
|
||||||
|
_ = fp.Close()
|
||||||
|
}()
|
||||||
|
|
||||||
|
return this.loadFile(fp)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *Updater) Loop() error {
|
||||||
|
if this.isUpdating {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
this.isUpdating = true
|
||||||
|
|
||||||
|
defer func() {
|
||||||
|
this.isUpdating = false
|
||||||
|
}()
|
||||||
|
|
||||||
|
code, fileId, err := this.source.FindLatestFile()
|
||||||
|
if err != nil {
|
||||||
|
// 不提示连接错误
|
||||||
|
if this.isConnError(err) {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if len(code) == 0 || fileId <= 0 {
|
||||||
|
// 还原到内置IP库
|
||||||
|
if len(this.currentCode) > 0 {
|
||||||
|
this.currentCode = ""
|
||||||
|
this.source.LogInfo("resetting to default ip library ...")
|
||||||
|
|
||||||
|
var defaultPath = this.source.DataDir() + "/ip-library.db"
|
||||||
|
_, err = os.Stat(defaultPath)
|
||||||
|
if err == nil {
|
||||||
|
err = os.Remove(defaultPath)
|
||||||
|
if err != nil {
|
||||||
|
this.source.LogError(errors.New("can not remove default 'ip-library.db'"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
err = InitDefault()
|
||||||
|
if err != nil {
|
||||||
|
this.source.LogError(errors.New("initialize default ip library failed: " + err.Error()))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// 下载
|
||||||
|
if this.currentCode == code {
|
||||||
|
// 不再重复下载
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查是否存在
|
||||||
|
var dir = this.source.DataDir()
|
||||||
|
var path = dir + "/ip-" + code + ".db"
|
||||||
|
stat, err := os.Stat(path)
|
||||||
|
if err == nil && !stat.IsDir() && stat.Size() > 0 {
|
||||||
|
fp, err := os.Open(path)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
defer func() {
|
||||||
|
_ = fp.Close()
|
||||||
|
}()
|
||||||
|
|
||||||
|
err = this.loadFile(fp)
|
||||||
|
if err != nil {
|
||||||
|
// 尝试删除
|
||||||
|
_ = os.Remove(path)
|
||||||
|
} else {
|
||||||
|
this.currentCode = code
|
||||||
|
|
||||||
|
// 拷贝到 ip-library.db
|
||||||
|
err = this.createDefaultFile(path, dir)
|
||||||
|
if err != nil {
|
||||||
|
this.source.LogError(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// write to file
|
||||||
|
fp, err := os.OpenFile(path, os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0666)
|
||||||
|
if err != nil {
|
||||||
|
return errors.New("create ip library file failed: " + err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
var isOk = false
|
||||||
|
defer func() {
|
||||||
|
if !isOk {
|
||||||
|
_ = os.Remove(path)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
|
err = this.source.DownloadFile(fileId, fp)
|
||||||
|
if err != nil {
|
||||||
|
_ = fp.Close()
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
err = fp.Close()
|
||||||
|
if err != nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// load library from file
|
||||||
|
fp, err = os.Open(path)
|
||||||
|
if err != nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
err = this.loadFile(fp)
|
||||||
|
_ = fp.Close()
|
||||||
|
if err != nil {
|
||||||
|
return errors.New("load file failed: " + err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
isOk = true
|
||||||
|
this.currentCode = code
|
||||||
|
|
||||||
|
// 拷贝到 ip-library.db
|
||||||
|
err = this.createDefaultFile(path, dir)
|
||||||
|
if err != nil {
|
||||||
|
this.source.LogError(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *Updater) loadFile(fp *os.File) error {
|
||||||
|
this.source.LogInfo("load ip library from '" + fp.Name() + "' ...")
|
||||||
|
|
||||||
|
fileReader, err := NewFileDataReader(fp)
|
||||||
|
if err != nil {
|
||||||
|
return errors.New("load ip library from reader failed: " + err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
var reader = fileReader.RawReader()
|
||||||
|
defaultLibrary = NewIPLibraryWithReader(reader)
|
||||||
|
this.currentCode = reader.Meta().Code
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *Updater) createDefaultFile(sourcePath string, dir string) error {
|
||||||
|
sourceFp, err := os.Open(sourcePath)
|
||||||
|
if err != nil {
|
||||||
|
return errors.New("prepare to copy file to 'ip-library.db' failed: " + err.Error())
|
||||||
|
}
|
||||||
|
defer func() {
|
||||||
|
_ = sourceFp.Close()
|
||||||
|
}()
|
||||||
|
|
||||||
|
dstFp, err := os.Create(dir + "/ip-library.db")
|
||||||
|
if err != nil {
|
||||||
|
return errors.New("prepare to copy file to 'ip-library.db' failed: " + err.Error())
|
||||||
|
}
|
||||||
|
defer func() {
|
||||||
|
_ = dstFp.Close()
|
||||||
|
}()
|
||||||
|
_, err = io.Copy(dstFp, sourceFp)
|
||||||
|
if err != nil {
|
||||||
|
return errors.New("copy file to 'ip-library.db' failed: " + err.Error())
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// isConnError 是否为连接错误
|
||||||
|
func (this *Updater) isConnError(err error) bool {
|
||||||
|
if err == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查是否为连接错误
|
||||||
|
statusErr, ok := status.FromError(err)
|
||||||
|
if ok {
|
||||||
|
var errorCode = statusErr.Code()
|
||||||
|
return errorCode == codes.Unavailable || errorCode == codes.Canceled
|
||||||
|
}
|
||||||
|
|
||||||
|
if strings.Contains(err.Error(), "code = Canceled") {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
53
pkg/iplibrary/updater_test.go
Normal file
53
pkg/iplibrary/updater_test.go
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
|
||||||
|
|
||||||
|
package iplibrary_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/TeaOSLab/EdgeCommon/pkg/iplibrary"
|
||||||
|
"github.com/iwind/TeaGo/Tea"
|
||||||
|
_ "github.com/iwind/TeaGo/bootstrap"
|
||||||
|
"io"
|
||||||
|
"testing"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
type updaterSource struct {
|
||||||
|
t *testing.T
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *updaterSource) DataDir() string {
|
||||||
|
return Tea.Root + "/data"
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *updaterSource) FindLatestFile() (code string, fileId int64, err error) {
|
||||||
|
return "CODE", 1, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *updaterSource) DownloadFile(fileId int64, writer io.Writer) error {
|
||||||
|
this.t.Log("downloading file:", fileId, "writer:", writer)
|
||||||
|
_, err := writer.Write(iplibrary.DefaultIPLibraryData())
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *updaterSource) LogInfo(message string) {
|
||||||
|
this.t.Log(message)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *updaterSource) LogError(err error) {
|
||||||
|
this.t.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestNewUpdater(t *testing.T) {
|
||||||
|
var updater = iplibrary.NewUpdater(&updaterSource{
|
||||||
|
t: t,
|
||||||
|
}, 1*time.Minute)
|
||||||
|
err := updater.Init()
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
err = updater.Loop()
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
9
pkg/iplibrary/version.go
Normal file
9
pkg/iplibrary/version.go
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
|
||||||
|
|
||||||
|
package iplibrary
|
||||||
|
|
||||||
|
type Version = int
|
||||||
|
|
||||||
|
const (
|
||||||
|
Version1 Version = 1
|
||||||
|
)
|
||||||
161
pkg/iplibrary/writer.go
Normal file
161
pkg/iplibrary/writer.go
Normal file
@@ -0,0 +1,161 @@
|
|||||||
|
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
|
||||||
|
|
||||||
|
package iplibrary
|
||||||
|
|
||||||
|
import (
|
||||||
|
"crypto/md5"
|
||||||
|
"encoding/json"
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
"github.com/TeaOSLab/EdgeCommon/pkg/configutils"
|
||||||
|
"github.com/iwind/TeaGo/types"
|
||||||
|
"hash"
|
||||||
|
"io"
|
||||||
|
"net"
|
||||||
|
"strings"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
type hashWriter struct {
|
||||||
|
rawWriter io.Writer
|
||||||
|
hash hash.Hash
|
||||||
|
}
|
||||||
|
|
||||||
|
func newHashWriter(writer io.Writer) *hashWriter {
|
||||||
|
return &hashWriter{
|
||||||
|
rawWriter: writer,
|
||||||
|
hash: md5.New(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *hashWriter) Write(p []byte) (n int, err error) {
|
||||||
|
n, err = this.rawWriter.Write(p)
|
||||||
|
this.hash.Write(p)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *hashWriter) Sum() string {
|
||||||
|
return fmt.Sprintf("%x", this.hash.Sum(nil))
|
||||||
|
}
|
||||||
|
|
||||||
|
type Writer struct {
|
||||||
|
writer *hashWriter
|
||||||
|
meta *Meta
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewWriter(writer io.Writer, meta *Meta) *Writer {
|
||||||
|
if meta == nil {
|
||||||
|
meta = &Meta{}
|
||||||
|
}
|
||||||
|
meta.Version = Version1
|
||||||
|
meta.CreatedAt = time.Now().Unix()
|
||||||
|
|
||||||
|
var libWriter = &Writer{
|
||||||
|
writer: newHashWriter(writer),
|
||||||
|
meta: meta,
|
||||||
|
}
|
||||||
|
return libWriter
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *Writer) WriteMeta() error {
|
||||||
|
metaJSON, err := json.Marshal(this.meta)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
_, err = this.writer.Write(metaJSON)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
_, err = this.writer.Write([]byte("\n"))
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *Writer) Write(ipFrom string, ipTo string, countryId int64, provinceId int64, cityId int64, townId int64, providerId int64) error {
|
||||||
|
// validate IP
|
||||||
|
var fromIP = net.ParseIP(ipFrom)
|
||||||
|
if fromIP == nil {
|
||||||
|
return errors.New("invalid 'ipFrom': '" + ipFrom + "'")
|
||||||
|
}
|
||||||
|
var fromIsIPv4 = configutils.IsIPv4(fromIP)
|
||||||
|
var toIP = net.ParseIP(ipTo)
|
||||||
|
if toIP == nil {
|
||||||
|
return errors.New("invalid 'ipTo': " + ipTo)
|
||||||
|
}
|
||||||
|
var toIsIPv4 = configutils.IsIPv4(toIP)
|
||||||
|
if fromIsIPv4 != toIsIPv4 {
|
||||||
|
return errors.New("'ipFrom(" + ipFrom + ")' and 'ipTo(" + ipTo + ")' should have the same IP version")
|
||||||
|
}
|
||||||
|
|
||||||
|
var pieces = []string{}
|
||||||
|
|
||||||
|
// 0
|
||||||
|
if fromIsIPv4 {
|
||||||
|
pieces = append(pieces, "")
|
||||||
|
} else {
|
||||||
|
pieces = append(pieces, "6")
|
||||||
|
}
|
||||||
|
|
||||||
|
// 1
|
||||||
|
var fromIPLong = configutils.IP2Long(fromIP)
|
||||||
|
var toIPLong = configutils.IP2Long(toIP)
|
||||||
|
|
||||||
|
if toIPLong < fromIPLong {
|
||||||
|
fromIPLong, toIPLong = toIPLong, fromIPLong
|
||||||
|
}
|
||||||
|
|
||||||
|
pieces = append(pieces, types.String(fromIPLong))
|
||||||
|
if ipFrom == ipTo {
|
||||||
|
// 2
|
||||||
|
pieces = append(pieces, "")
|
||||||
|
} else {
|
||||||
|
// 2
|
||||||
|
pieces = append(pieces, types.String(toIPLong-fromIPLong))
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3
|
||||||
|
if countryId > 0 {
|
||||||
|
pieces = append(pieces, types.String(countryId))
|
||||||
|
} else {
|
||||||
|
pieces = append(pieces, "")
|
||||||
|
}
|
||||||
|
|
||||||
|
// 4
|
||||||
|
if provinceId > 0 {
|
||||||
|
pieces = append(pieces, types.String(provinceId))
|
||||||
|
} else {
|
||||||
|
pieces = append(pieces, "")
|
||||||
|
}
|
||||||
|
|
||||||
|
// 5
|
||||||
|
if cityId > 0 {
|
||||||
|
pieces = append(pieces, types.String(cityId))
|
||||||
|
} else {
|
||||||
|
pieces = append(pieces, "")
|
||||||
|
}
|
||||||
|
|
||||||
|
// 6
|
||||||
|
if townId > 0 {
|
||||||
|
pieces = append(pieces, types.String(townId))
|
||||||
|
} else {
|
||||||
|
pieces = append(pieces, "")
|
||||||
|
}
|
||||||
|
|
||||||
|
// 7
|
||||||
|
if providerId > 0 {
|
||||||
|
pieces = append(pieces, types.String(providerId))
|
||||||
|
} else {
|
||||||
|
pieces = append(pieces, "")
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err := this.writer.Write([]byte(strings.Join(pieces, "|")))
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err = this.writer.Write([]byte("\n"))
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *Writer) Sum() string {
|
||||||
|
return this.writer.Sum()
|
||||||
|
}
|
||||||
58
pkg/iplibrary/writer_file.go
Normal file
58
pkg/iplibrary/writer_file.go
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
|
||||||
|
|
||||||
|
package iplibrary
|
||||||
|
|
||||||
|
import (
|
||||||
|
"compress/gzip"
|
||||||
|
"os"
|
||||||
|
)
|
||||||
|
|
||||||
|
type FileWriter struct {
|
||||||
|
fp *os.File
|
||||||
|
gzWriter *gzip.Writer
|
||||||
|
|
||||||
|
rawWriter *Writer
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewFileWriter(path string, meta *Meta) (*FileWriter, error) {
|
||||||
|
fp, err := os.OpenFile(path, os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0666)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
gzWriter, err := gzip.NewWriterLevel(fp, gzip.BestCompression)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
var writer = &FileWriter{
|
||||||
|
fp: fp,
|
||||||
|
gzWriter: gzWriter,
|
||||||
|
rawWriter: NewWriter(gzWriter, meta),
|
||||||
|
}
|
||||||
|
return writer, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *FileWriter) WriteMeta() error {
|
||||||
|
return this.rawWriter.WriteMeta()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *FileWriter) Write(ipFrom string, ipTo string, countryId int64, provinceId int64, cityId int64, townId int64, providerId int64) error {
|
||||||
|
return this.rawWriter.Write(ipFrom, ipTo, countryId, provinceId, cityId, townId, providerId)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *FileWriter) Sum() string {
|
||||||
|
return this.rawWriter.Sum()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *FileWriter) Close() error {
|
||||||
|
err1 := this.gzWriter.Close()
|
||||||
|
err2 := this.fp.Close()
|
||||||
|
if err1 != nil {
|
||||||
|
return err1
|
||||||
|
}
|
||||||
|
if err2 != nil {
|
||||||
|
return err2
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
56
pkg/iplibrary/writer_file_test.go
Normal file
56
pkg/iplibrary/writer_file_test.go
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
|
||||||
|
|
||||||
|
package iplibrary_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/TeaOSLab/EdgeCommon/pkg/iplibrary"
|
||||||
|
"github.com/iwind/TeaGo/rands"
|
||||||
|
"github.com/iwind/TeaGo/types"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestNewFileWriter(t *testing.T) {
|
||||||
|
writer, err := iplibrary.NewFileWriter("./internal-ip-library.db", &iplibrary.Meta{
|
||||||
|
Author: "GoEdge",
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
err = writer.WriteMeta()
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
err = writer.Write("192.168.1.100", "192.168.1.100", 100, 200, 300, 400, 500)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
err = writer.Write("192.168.2.100", "192.168.3.100", 101, 201, 301, 401, 501)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
err = writer.Write("192.168.3.101", "192.168.3.101", 101, 201, 301, 401, 501)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
var n = func() string {
|
||||||
|
return types.String(rands.Int(0, 255))
|
||||||
|
}
|
||||||
|
|
||||||
|
for i := 0; i < 1_000_000; i++ {
|
||||||
|
err = writer.Write(n()+"."+n()+"."+n()+"."+n(), n()+"."+n()+"."+n()+"."+n(), int64(i)+100, 201, 301, 401, 501)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
err = writer.Close()
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
t.Log("ok", writer.Sum())
|
||||||
|
}
|
||||||
44
pkg/iplibrary/writer_test.go
Normal file
44
pkg/iplibrary/writer_test.go
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
|
||||||
|
|
||||||
|
package iplibrary_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"github.com/TeaOSLab/EdgeCommon/pkg/iplibrary"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestNewWriter(t *testing.T) {
|
||||||
|
var buf = &bytes.Buffer{}
|
||||||
|
var writer = iplibrary.NewWriter(buf, &iplibrary.Meta{
|
||||||
|
Author: "GoEdge <https://goedge.cn>",
|
||||||
|
})
|
||||||
|
|
||||||
|
err := writer.WriteMeta()
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
err = writer.Write("192.168.1.100", "192.168.1.100", 100, 200, 300, 400, 500)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
err = writer.Write("192.168.2.100", "192.168.3.100", 101, 201, 301, 401, 501)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
err = writer.Write("192.168.3.101", "192.168.3.101", 101, 201, 301, 401, 501)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
err = writer.Write("::1", "::2", 101, 201, 301, 401, 501)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
t.Log(buf.String())
|
||||||
|
t.Log("sum:", writer.Sum())
|
||||||
|
}
|
||||||
@@ -7,10 +7,9 @@ const (
|
|||||||
MessageCodeWriteCache MessageCode = "writeCache" // 写入缓存
|
MessageCodeWriteCache MessageCode = "writeCache" // 写入缓存
|
||||||
MessageCodeReadCache MessageCode = "readCache" // 读取缓存
|
MessageCodeReadCache MessageCode = "readCache" // 读取缓存
|
||||||
MessageCodeStatCache MessageCode = "statCache" // 统计缓存
|
MessageCodeStatCache MessageCode = "statCache" // 统计缓存
|
||||||
MessageCodePurgeCache MessageCode = "purgeCache" // 删除缓存
|
|
||||||
MessageCodeCleanCache MessageCode = "cleanCache" // 清理缓存
|
MessageCodeCleanCache MessageCode = "cleanCache" // 清理缓存
|
||||||
MessageCodePreheatCache MessageCode = "preheatCache" // 预热缓存
|
|
||||||
MessageCodeCheckSystemdService MessageCode = "checkSystemdService" // 检查Systemd服务
|
MessageCodeCheckSystemdService MessageCode = "checkSystemdService" // 检查Systemd服务
|
||||||
|
MessageCodeCheckLocalFirewall MessageCode = "checkLocalFirewall" // 检查本地防火墙
|
||||||
MessageCodeNewNodeTask MessageCode = "newNodeTask" // 有新的节点任务产生
|
MessageCodeNewNodeTask MessageCode = "newNodeTask" // 有新的节点任务产生
|
||||||
MessageCodeChangeAPINode MessageCode = "changeAPINode" // 改变新的API节点
|
MessageCodeChangeAPINode MessageCode = "changeAPINode" // 改变新的API节点
|
||||||
)
|
)
|
||||||
@@ -45,30 +44,15 @@ type CleanCacheMessage struct {
|
|||||||
CachePolicyJSON []byte `json:"cachePolicyJSON"`
|
CachePolicyJSON []byte `json:"cachePolicyJSON"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// PurgeCacheMessageType 删除缓存
|
|
||||||
type PurgeCacheMessageType = string
|
|
||||||
|
|
||||||
const (
|
|
||||||
PurgeCacheMessageTypeFile PurgeCacheMessageType = "file"
|
|
||||||
PurgeCacheMessageTypeDir PurgeCacheMessageType = "dir"
|
|
||||||
)
|
|
||||||
|
|
||||||
type PurgeCacheMessage struct {
|
|
||||||
CachePolicyJSON []byte `json:"cachePolicyJSON"`
|
|
||||||
Keys []string `json:"keys"`
|
|
||||||
Type PurgeCacheMessageType `json:"type"` // 清理类型
|
|
||||||
}
|
|
||||||
|
|
||||||
// PreheatCacheMessage 预热缓存
|
|
||||||
type PreheatCacheMessage struct {
|
|
||||||
CachePolicyJSON []byte `json:"cachePolicyJSON"`
|
|
||||||
Keys []string `json:"keys"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// CheckSystemdServiceMessage Systemd服务
|
// CheckSystemdServiceMessage Systemd服务
|
||||||
type CheckSystemdServiceMessage struct {
|
type CheckSystemdServiceMessage struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CheckLocalFirewallMessage 检查本地防火墙
|
||||||
|
type CheckLocalFirewallMessage struct {
|
||||||
|
Name string `json:"name"`
|
||||||
|
}
|
||||||
|
|
||||||
// NewNodeTaskMessage 有新的节点任务
|
// NewNodeTaskMessage 有新的节点任务
|
||||||
type NewNodeTaskMessage struct {
|
type NewNodeTaskMessage struct {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,14 +2,36 @@
|
|||||||
|
|
||||||
package nodeconfigs
|
package nodeconfigs
|
||||||
|
|
||||||
|
import "github.com/iwind/TeaGo/maps"
|
||||||
|
|
||||||
// 一组系统默认值
|
// 一组系统默认值
|
||||||
|
// 修改单个IP相关限制值时要考虑到NAT中每个IP会代表很多个主机,并非1对1的关系
|
||||||
|
|
||||||
const (
|
const (
|
||||||
DefaultMaxThreads = 20000 // 单节点最大线程数
|
DefaultMaxThreads = 20000 // 单节点最大线程数
|
||||||
DefaultMaxThreadsMin = 1000 // 单节点最大线程数最小值
|
DefaultMaxThreadsMin = 1000 // 单节点最大线程数最小值
|
||||||
DefaultMaxThreadsMax = 100_000 // 单节点最大线程数最大值
|
DefaultMaxThreadsMax = 100_000 // 单节点最大线程数最大值
|
||||||
|
|
||||||
DefaultTCPMaxConnections = 100_000 // 单节点TCP最大连接数
|
DefaultTCPMaxConnections = 100_000 // 单节点TCP最大连接数
|
||||||
DefaultTCPLinger = 3 // 单节点TCP Linger值
|
DefaultTCPMaxConnectionsPerIP = 1000 // 单IP最大连接数
|
||||||
DefaultTLSHandshakeTimeout = 3 // TLS握手超时时间
|
DefaultTCPMinConnectionsPerIP = 5 // 单IP最小连接数
|
||||||
|
|
||||||
|
DefaultTCPNewConnectionsMinutelyRate = 500 // 单IP连接速率限制(按分钟)
|
||||||
|
DefaultTCPNewConnectionsMinMinutelyRate = 3 // 单IP最小连接速率
|
||||||
|
|
||||||
|
DefaultTCPNewConnectionsSecondlyRate = 300 // 单IP连接速率限制(按秒)
|
||||||
|
DefaultTCPNewConnectionsMinSecondlyRate = 3 // 单IP最小连接速率
|
||||||
|
|
||||||
|
DefaultTCPLinger = 3 // 单节点TCP Linger值
|
||||||
|
DefaultTLSHandshakeTimeout = 3 // TLS握手超时时间
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var DefaultConfigs = maps.Map{
|
||||||
|
"tcpMaxConnections": DefaultTCPMaxConnections,
|
||||||
|
"tcpMaxConnectionsPerIP": DefaultTCPMaxConnectionsPerIP,
|
||||||
|
"tcpMinConnectionsPerIP": DefaultTCPMinConnectionsPerIP,
|
||||||
|
"tcpNewConnectionsMinutelyRate": DefaultTCPNewConnectionsMinutelyRate,
|
||||||
|
"tcpNewConnectionsMinMinutelyRate": DefaultTCPNewConnectionsMinMinutelyRate,
|
||||||
|
"tcpNewConnectionsSecondlyRate": DefaultTCPNewConnectionsSecondlyRate,
|
||||||
|
"tcpNewConnectionsMinSecondlyRate": DefaultTCPNewConnectionsMinSecondlyRate,
|
||||||
|
}
|
||||||
|
|||||||
25
pkg/nodeconfigs/dns_resolver.go
Normal file
25
pkg/nodeconfigs/dns_resolver.go
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
|
||||||
|
|
||||||
|
package nodeconfigs
|
||||||
|
|
||||||
|
type DNSResolverType = string
|
||||||
|
|
||||||
|
const (
|
||||||
|
DNSResolverTypeDefault = "default"
|
||||||
|
DNSResolverTypeGoNative = "goNative"
|
||||||
|
DNSResolverTypeCGO = "cgo"
|
||||||
|
)
|
||||||
|
|
||||||
|
func DefaultDNSResolverConfig() *DNSResolverConfig {
|
||||||
|
return &DNSResolverConfig{
|
||||||
|
Type: DNSResolverTypeDefault,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
type DNSResolverConfig struct {
|
||||||
|
Type string `yaml:"type" json:"type"` // 使用Go语言内置的DNS解析器
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *DNSResolverConfig) Init() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
46
pkg/nodeconfigs/image_webp_policy.go
Normal file
46
pkg/nodeconfigs/image_webp_policy.go
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
|
||||||
|
|
||||||
|
package nodeconfigs
|
||||||
|
|
||||||
|
import "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared"
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
_ = DefaultWebPImagePolicy.Init()
|
||||||
|
}
|
||||||
|
|
||||||
|
var DefaultWebPImagePolicy = &WebPImagePolicy{
|
||||||
|
IsOn: true,
|
||||||
|
RequireCache: true,
|
||||||
|
MinLength: shared.NewSizeCapacity(0, shared.SizeCapacityUnitKB),
|
||||||
|
MaxLength: shared.NewSizeCapacity(128, shared.SizeCapacityUnitMB),
|
||||||
|
}
|
||||||
|
|
||||||
|
// WebPImagePolicy WebP策略
|
||||||
|
type WebPImagePolicy struct {
|
||||||
|
IsOn bool `yaml:"isOn" json:"isOn"` // 是否启用
|
||||||
|
RequireCache bool `yaml:"requireCache" json:"requireCache"` // 需要在缓存条件下进行
|
||||||
|
MinLength *shared.SizeCapacity `yaml:"minLength" json:"minLength"` // 最小压缩对象比如4m, 24k
|
||||||
|
MaxLength *shared.SizeCapacity `yaml:"maxLength" json:"maxLength"` // 最大压缩对象
|
||||||
|
|
||||||
|
minLength int64
|
||||||
|
maxLength int64
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *WebPImagePolicy) Init() error {
|
||||||
|
if this.MinLength != nil {
|
||||||
|
this.minLength = this.MinLength.Bytes()
|
||||||
|
}
|
||||||
|
if this.MaxLength != nil {
|
||||||
|
this.maxLength = this.MaxLength.Bytes()
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *WebPImagePolicy) MinLengthBytes() int64 {
|
||||||
|
return this.minLength
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *WebPImagePolicy) MaxLengthBytes() int64 {
|
||||||
|
return this.maxLength
|
||||||
|
}
|
||||||
@@ -1,15 +1,17 @@
|
|||||||
package nodeconfigs
|
package nodeconfigs
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"crypto/sha256"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
|
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
|
||||||
|
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/ddosconfigs"
|
||||||
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/firewallconfigs"
|
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/firewallconfigs"
|
||||||
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared"
|
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared"
|
||||||
"github.com/iwind/TeaGo/Tea"
|
"github.com/iwind/TeaGo/Tea"
|
||||||
"github.com/iwind/TeaGo/maps"
|
"github.com/iwind/TeaGo/maps"
|
||||||
"io/ioutil"
|
"os"
|
||||||
"reflect"
|
"reflect"
|
||||||
"strconv"
|
"strconv"
|
||||||
)
|
)
|
||||||
@@ -35,16 +37,21 @@ type NodeConfig struct {
|
|||||||
SupportCNAME bool `yaml:"supportCNAME" json:"supportCNAME"`
|
SupportCNAME bool `yaml:"supportCNAME" json:"supportCNAME"`
|
||||||
Version int64 `yaml:"version" json:"version"`
|
Version int64 `yaml:"version" json:"version"`
|
||||||
Name string `yaml:"name" json:"name"`
|
Name string `yaml:"name" json:"name"`
|
||||||
|
GroupId int64 `yaml:"groupId" json:"groupId"`
|
||||||
RegionId int64 `yaml:"regionId" json:"regionId"`
|
RegionId int64 `yaml:"regionId" json:"regionId"`
|
||||||
OCSPVersion int64 `yaml:"ocspVersion" json:"ocspVersion"`
|
OCSPVersion int64 `yaml:"ocspVersion" json:"ocspVersion"`
|
||||||
|
|
||||||
// 性能
|
// 性能
|
||||||
MaxCPU int32 `yaml:"maxCPU" json:"maxCPU"`
|
MaxCPU int32 `yaml:"maxCPU" json:"maxCPU"`
|
||||||
CacheDiskDir string `yaml:"cacheDiskDir" json:"cacheDiskDir"` // 文件缓存目录
|
CacheDiskDir string `yaml:"cacheDiskDir" json:"cacheDiskDir"` // 文件缓存目录
|
||||||
MaxCacheDiskCapacity *shared.SizeCapacity `yaml:"maxCacheDiskCapacity" json:"maxCacheDiskCapacity"` // 文件缓存容量
|
MaxCacheDiskCapacity *shared.SizeCapacity `yaml:"maxCacheDiskCapacity" json:"maxCacheDiskCapacity"` // 文件缓存容量
|
||||||
MaxCacheMemoryCapacity *shared.SizeCapacity `yaml:"maxCacheMemoryCapacity" json:"maxCacheMemoryCapacity"` // 内容缓存容量
|
MaxCacheMemoryCapacity *shared.SizeCapacity `yaml:"maxCacheMemoryCapacity" json:"maxCacheMemoryCapacity"` // 内容缓存容量
|
||||||
MaxThreads int `yaml:"maxThreads" json:"maxThreads"`
|
MaxThreads int `yaml:"maxThreads" json:"maxThreads"` // 最大线程数
|
||||||
TCPMaxConnections int `yaml:"tcpMaxConnections" json:"tcpMaxConnections"`
|
DDoSProtection *ddosconfigs.ProtectionConfig `yaml:"ddosProtection" json:"ddosProtection"`
|
||||||
|
|
||||||
|
// 级别
|
||||||
|
Level int32 `yaml:"level" json:"level"`
|
||||||
|
ParentNodes map[int64][]*ParentNodeConfig `yaml:"parentNodes" json:"parentNodes"` // clusterId => []*ParentNodeConfig
|
||||||
|
|
||||||
// 全局配置
|
// 全局配置
|
||||||
GlobalConfig *serverconfigs.GlobalConfig `yaml:"globalConfig" json:"globalConfig"` // 全局配置
|
GlobalConfig *serverconfigs.GlobalConfig `yaml:"globalConfig" json:"globalConfig"` // 全局配置
|
||||||
@@ -65,6 +72,18 @@ type NodeConfig struct {
|
|||||||
// 自动白名单
|
// 自动白名单
|
||||||
AllowedIPs []string `yaml:"allowedIPs" json:"allowedIPs"`
|
AllowedIPs []string `yaml:"allowedIPs" json:"allowedIPs"`
|
||||||
|
|
||||||
|
// 脚本
|
||||||
|
CommonScripts []*serverconfigs.CommonScript `yaml:"commonScripts" json:"commonScripts"`
|
||||||
|
|
||||||
|
// WebP
|
||||||
|
WebPImagePolicies map[int64]*WebPImagePolicy `yaml:"webpImagePolicies" json:"webpImagePolicies"` // clusterId => *WebPImagePolicy
|
||||||
|
|
||||||
|
// UAM相关配置
|
||||||
|
UAMPolicies map[int64]*UAMPolicy `yaml:"uamPolicies" yaml:"uamPolicies" json:"uamPolicies"` // clusterId => *UAMPolicy
|
||||||
|
|
||||||
|
// DNS
|
||||||
|
DNSResolver *DNSResolverConfig `yaml:"dnsResolver" json:"dnsResolver"`
|
||||||
|
|
||||||
paddedId string
|
paddedId string
|
||||||
|
|
||||||
// firewall
|
// firewall
|
||||||
@@ -81,6 +100,8 @@ type NodeConfig struct {
|
|||||||
|
|
||||||
// syn flood
|
// syn flood
|
||||||
synFlood *firewallconfigs.SYNFloodConfig
|
synFlood *firewallconfigs.SYNFloodConfig
|
||||||
|
|
||||||
|
secretHash string
|
||||||
}
|
}
|
||||||
|
|
||||||
// SharedNodeConfig 取得当前节点配置单例
|
// SharedNodeConfig 取得当前节点配置单例
|
||||||
@@ -92,7 +113,7 @@ func SharedNodeConfig() (*NodeConfig, error) {
|
|||||||
return sharedNodeConfig, nil
|
return sharedNodeConfig, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
data, err := ioutil.ReadFile(Tea.ConfigFile("node.json"))
|
data, err := os.ReadFile(Tea.ConfigFile("node.json"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return &NodeConfig{}, err
|
return &NodeConfig{}, err
|
||||||
}
|
}
|
||||||
@@ -143,6 +164,7 @@ func CloneNodeConfig(nodeConfig *NodeConfig) (*NodeConfig, error) {
|
|||||||
|
|
||||||
// Init 初始化
|
// Init 初始化
|
||||||
func (this *NodeConfig) Init() (err error, serverErrors []*ServerError) {
|
func (this *NodeConfig) Init() (err error, serverErrors []*ServerError) {
|
||||||
|
this.secretHash = fmt.Sprintf("%x", sha256.Sum256([]byte(this.NodeId+"@"+this.Secret)))
|
||||||
this.paddedId = fmt.Sprintf("%08d", this.Id)
|
this.paddedId = fmt.Sprintf("%08d", this.Id)
|
||||||
|
|
||||||
// servers
|
// servers
|
||||||
@@ -281,6 +303,34 @@ func (this *NodeConfig) Init() (err error, serverErrors []*ServerError) {
|
|||||||
this.allowedIPMap[allowIP] = true
|
this.allowedIPMap[allowIP] = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// webp image policy
|
||||||
|
if this.WebPImagePolicies != nil {
|
||||||
|
for _, policy := range this.WebPImagePolicies {
|
||||||
|
err = policy.Init()
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// uam policy
|
||||||
|
if this.UAMPolicies != nil {
|
||||||
|
for _, policy := range this.UAMPolicies {
|
||||||
|
err = policy.Init()
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// dns resolver
|
||||||
|
if this.DNSResolver != nil {
|
||||||
|
err = this.DNSResolver.Init()
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -353,7 +403,7 @@ func (this *NodeConfig) Save() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
return ioutil.WriteFile(Tea.ConfigFile("node.json"), data, 0777)
|
return os.WriteFile(Tea.ConfigFile("node.json"), data, 0777)
|
||||||
}
|
}
|
||||||
|
|
||||||
// PaddedId 获取填充后的ID
|
// PaddedId 获取填充后的ID
|
||||||
@@ -384,12 +434,25 @@ func (this *NodeConfig) lookupWeb(server *serverconfigs.ServerConfig, web *serve
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
if web.FirewallPolicy != nil && web.FirewallPolicy.IsOn {
|
if web.FirewallPolicy != nil && web.FirewallPolicy.IsOn {
|
||||||
// 复用节点的拦截选项设置
|
// 复用节点的选项设置
|
||||||
if web.FirewallPolicy.BlockOptions == nil && server.HTTPFirewallPolicy != nil && server.HTTPFirewallPolicy.BlockOptions != nil {
|
if server.HTTPFirewallPolicy != nil {
|
||||||
web.FirewallPolicy.BlockOptions = server.HTTPFirewallPolicy.BlockOptions
|
if (web.FirewallPolicy.BlockOptions == nil || !web.FirewallPolicy.BlockOptions.IsPrior) && server.HTTPFirewallPolicy.BlockOptions != nil {
|
||||||
|
web.FirewallPolicy.BlockOptions = server.HTTPFirewallPolicy.BlockOptions
|
||||||
|
}
|
||||||
|
if (web.FirewallPolicy.CaptchaOptions == nil || !web.FirewallPolicy.CaptchaOptions.IsPrior) && server.HTTPFirewallPolicy.CaptchaOptions != nil {
|
||||||
|
web.FirewallPolicy.CaptchaOptions = server.HTTPFirewallPolicy.CaptchaOptions
|
||||||
|
}
|
||||||
|
if (web.FirewallPolicy.SYNFlood == nil || !web.FirewallPolicy.SYNFlood.IsPrior) && server.HTTPFirewallPolicy.SYNFlood != nil {
|
||||||
|
web.FirewallPolicy.SYNFlood = server.HTTPFirewallPolicy.SYNFlood
|
||||||
|
}
|
||||||
|
if (web.FirewallPolicy.Log == nil || !web.FirewallPolicy.Log.IsPrior) && server.HTTPFirewallPolicy.Log != nil {
|
||||||
|
web.FirewallPolicy.Log = server.HTTPFirewallPolicy.Log
|
||||||
|
}
|
||||||
|
|
||||||
web.FirewallPolicy.Mode = server.HTTPFirewallPolicy.Mode
|
web.FirewallPolicy.Mode = server.HTTPFirewallPolicy.Mode
|
||||||
web.FirewallPolicy.UseLocalFirewall = server.HTTPFirewallPolicy.UseLocalFirewall
|
web.FirewallPolicy.UseLocalFirewall = server.HTTPFirewallPolicy.UseLocalFirewall
|
||||||
}
|
}
|
||||||
|
|
||||||
this.firewallPolicies = append(this.firewallPolicies, web.FirewallPolicy)
|
this.firewallPolicies = append(this.firewallPolicies, web.FirewallPolicy)
|
||||||
}
|
}
|
||||||
if len(web.Locations) > 0 {
|
if len(web.Locations) > 0 {
|
||||||
@@ -449,3 +512,24 @@ func (this *NodeConfig) UpdateCertOCSP(certId int64, ocsp []byte, expiresAt int6
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FindWebPImagePolicyWithClusterId 使用集群ID查找WebP策略
|
||||||
|
func (this *NodeConfig) FindWebPImagePolicyWithClusterId(clusterId int64) *WebPImagePolicy {
|
||||||
|
if this.WebPImagePolicies == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return this.WebPImagePolicies[clusterId]
|
||||||
|
}
|
||||||
|
|
||||||
|
// FindUAMPolicyWithClusterId 使用集群ID查找UAM策略
|
||||||
|
func (this *NodeConfig) FindUAMPolicyWithClusterId(clusterId int64) *UAMPolicy {
|
||||||
|
if this.UAMPolicies == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return this.UAMPolicies[clusterId]
|
||||||
|
}
|
||||||
|
|
||||||
|
// SecretHash 对Id和Secret的Hash计算
|
||||||
|
func (this *NodeConfig) SecretHash() string {
|
||||||
|
return this.secretHash
|
||||||
|
}
|
||||||
|
|||||||
37
pkg/nodeconfigs/node_levels.go
Normal file
37
pkg/nodeconfigs/node_levels.go
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
|
||||||
|
|
||||||
|
package nodeconfigs
|
||||||
|
|
||||||
|
type NodeLevel struct {
|
||||||
|
Name string `yaml:"name" json:"name"`
|
||||||
|
Code int `yaml:"code" json:"code"`
|
||||||
|
Description string `yaml:"description" json:"description"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func FindAllNodeLevels() []*NodeLevel {
|
||||||
|
return []*NodeLevel{
|
||||||
|
{
|
||||||
|
Name: "边缘节点",
|
||||||
|
Code: 1,
|
||||||
|
Description: "普通的边缘节点。",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Name: "L2节点",
|
||||||
|
Code: 2,
|
||||||
|
Description: "特殊的边缘节点,同时负责同组上一级节点的回源。",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func FindNodeLevel(level int) *NodeLevel {
|
||||||
|
level--
|
||||||
|
|
||||||
|
var levels = FindAllNodeLevels()
|
||||||
|
if level < 0 {
|
||||||
|
return levels[0]
|
||||||
|
}
|
||||||
|
if level < len(levels) {
|
||||||
|
return levels[level]
|
||||||
|
}
|
||||||
|
return levels[0]
|
||||||
|
}
|
||||||
10
pkg/nodeconfigs/node_parent_config.go
Normal file
10
pkg/nodeconfigs/node_parent_config.go
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
|
||||||
|
|
||||||
|
package nodeconfigs
|
||||||
|
|
||||||
|
// ParentNodeConfig 父级节点配置
|
||||||
|
type ParentNodeConfig struct {
|
||||||
|
Id int64 `yaml:"id" json:"id"`
|
||||||
|
Addrs []string `yaml:"addrs" json:"addrs"`
|
||||||
|
SecretHash string `yaml:"secretHash" json:"secretHash"`
|
||||||
|
}
|
||||||
@@ -20,10 +20,12 @@ type NodeStatus struct {
|
|||||||
DiskMaxUsagePartition string `json:"diskMaxUsagePartition"`
|
DiskMaxUsagePartition string `json:"diskMaxUsagePartition"`
|
||||||
DiskTotal uint64 `json:"diskTotal"`
|
DiskTotal uint64 `json:"diskTotal"`
|
||||||
UpdatedAt int64 `json:"updatedAt"`
|
UpdatedAt int64 `json:"updatedAt"`
|
||||||
|
Timestamp int64 `json:"timestamp"` // 当前节点时间戳
|
||||||
Load1m float64 `json:"load1m"`
|
Load1m float64 `json:"load1m"`
|
||||||
Load5m float64 `json:"load5m"`
|
Load5m float64 `json:"load5m"`
|
||||||
Load15m float64 `json:"load15m"`
|
Load15m float64 `json:"load15m"`
|
||||||
ConnectionCount int `json:"connectionCount"` // 连接数
|
ConnectionCount int `json:"connectionCount"` // 连接数
|
||||||
|
ExePath string `json:"exePath"` // 可执行文件路径
|
||||||
|
|
||||||
TrafficInBytes uint64 `json:"trafficInBytes"`
|
TrafficInBytes uint64 `json:"trafficInBytes"`
|
||||||
TrafficOutBytes uint64 `json:"trafficOutBytes"`
|
TrafficOutBytes uint64 `json:"trafficOutBytes"`
|
||||||
@@ -31,6 +33,8 @@ type NodeStatus struct {
|
|||||||
CacheTotalDiskSize int64 `json:"cacheTotalDiskSize"`
|
CacheTotalDiskSize int64 `json:"cacheTotalDiskSize"`
|
||||||
CacheTotalMemorySize int64 `json:"cacheTotalMemorySize"`
|
CacheTotalMemorySize int64 `json:"cacheTotalMemorySize"`
|
||||||
|
|
||||||
|
LocalFirewallName string `json:"localFirewallName"`
|
||||||
|
|
||||||
IsActive bool `json:"isActive"`
|
IsActive bool `json:"isActive"`
|
||||||
Error string `json:"error"`
|
Error string `json:"error"`
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
28
pkg/nodeconfigs/uam_policy.go
Normal file
28
pkg/nodeconfigs/uam_policy.go
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
|
||||||
|
|
||||||
|
package nodeconfigs
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
_ = DefaultUAMPolicy.Init()
|
||||||
|
}
|
||||||
|
|
||||||
|
var DefaultUAMPolicy = &UAMPolicy{
|
||||||
|
IsOn: true,
|
||||||
|
AllowSearchEngines: true,
|
||||||
|
DenySpiders: true,
|
||||||
|
UITitle: "",
|
||||||
|
UIBody: "",
|
||||||
|
}
|
||||||
|
|
||||||
|
type UAMPolicy struct {
|
||||||
|
IsOn bool `yaml:"isOn" json:"isOn"`
|
||||||
|
AllowSearchEngines bool `yaml:"allowSearchEngines" json:"allowSearchEngines"` // 直接跳过常见搜索引擎
|
||||||
|
DenySpiders bool `yaml:"denySpiders" json:"denySpiders"` // 拦截常见爬虫
|
||||||
|
|
||||||
|
UITitle string `yaml:"uiTitle" json:"uiTitle"` // 页面标题
|
||||||
|
UIBody string `yaml:"uiBody" json:"uiBody"` // 页面内容
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *UAMPolicy) Init() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
@@ -102,6 +102,7 @@ func (this *IPListDAO) CreateIPListForServerId(ctx context.Context, serverId int
|
|||||||
Type: listType,
|
Type: listType,
|
||||||
Name: "IP名单",
|
Name: "IP名单",
|
||||||
Code: listType,
|
Code: listType,
|
||||||
|
ServerId: serverId,
|
||||||
TimeoutJSON: nil,
|
TimeoutJSON: nil,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -6,27 +6,28 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"google.golang.org/grpc/codes"
|
"google.golang.org/grpc/codes"
|
||||||
"google.golang.org/grpc/status"
|
"google.golang.org/grpc/status"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
// HumanError 格式化GRPC相关错误
|
// HumanError 格式化GRPC相关错误
|
||||||
func HumanError(err error) error {
|
func HumanError(err error, endpoints []string, configFile string) (resultErr error, isConnError bool) {
|
||||||
if err == nil {
|
if err == nil {
|
||||||
return err
|
return err, false
|
||||||
}
|
}
|
||||||
errStatus, ok := status.FromError(err)
|
errStatus, ok := status.FromError(err)
|
||||||
if !ok {
|
if !ok {
|
||||||
return err
|
return err, false
|
||||||
}
|
}
|
||||||
switch errStatus.Code() {
|
switch errStatus.Code() {
|
||||||
case codes.InvalidArgument:
|
case codes.InvalidArgument:
|
||||||
return errors.New("错误的RPC参数:" + err.Error())
|
return errors.New("错误的RPC参数:" + err.Error()), false
|
||||||
case codes.DeadlineExceeded:
|
case codes.DeadlineExceeded:
|
||||||
return errors.New("RPC操作超时,请重试:" + err.Error())
|
return errors.New("RPC操作超时,请重试:" + err.Error()), false
|
||||||
case codes.Unimplemented:
|
case codes.Unimplemented:
|
||||||
return errors.New("请求的RPC服务或方法不存在,可能是没有升级API节点或者当前节点没有升级:" + err.Error())
|
return errors.New("请求的RPC服务或方法不存在,可能是没有升级API节点或者当前节点没有升级:" + err.Error()), false
|
||||||
case codes.Unavailable:
|
case codes.Unavailable:
|
||||||
return errors.New("RPC当前不可用,1、请确保当前节点的api.yaml配置中的地址填写正确;2、请确保API节点已启动,并检查当前节点和API节点之间的网络连接是正常的。错误信息:" + err.Error())
|
return errors.New("RPC当前不可用:<br/>1、请确认当前节点的api.yaml(<em>" + configFile + "</em>)配置中的地址(<em>" + strings.Join(endpoints, ", ") + "</em>)是否已填写正确;<br/>2、请确保API节点已启动,并检查当前节点和API节点之间的网络连接是正常的。<hr/>错误信息:" + err.Error()), true
|
||||||
}
|
}
|
||||||
|
|
||||||
return err
|
return err, false
|
||||||
}
|
}
|
||||||
|
|||||||
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
|
||||||
@@ -45,7 +45,9 @@ type APINode struct {
|
|||||||
AccessAddrsJSON []byte `protobuf:"bytes,10,opt,name=accessAddrsJSON,proto3" json:"accessAddrsJSON,omitempty"`
|
AccessAddrsJSON []byte `protobuf:"bytes,10,opt,name=accessAddrsJSON,proto3" json:"accessAddrsJSON,omitempty"`
|
||||||
AccessAddrs []string `protobuf:"bytes,11,rep,name=accessAddrs,proto3" json:"accessAddrs,omitempty"`
|
AccessAddrs []string `protobuf:"bytes,11,rep,name=accessAddrs,proto3" json:"accessAddrs,omitempty"`
|
||||||
StatusJSON []byte `protobuf:"bytes,12,opt,name=statusJSON,proto3" json:"statusJSON,omitempty"`
|
StatusJSON []byte `protobuf:"bytes,12,opt,name=statusJSON,proto3" json:"statusJSON,omitempty"`
|
||||||
|
IsPrimary bool `protobuf:"varint,16,opt,name=isPrimary,proto3" json:"isPrimary,omitempty"`
|
||||||
Debug bool `protobuf:"varint,30,opt,name=debug,proto3" json:"debug,omitempty"`
|
Debug bool `protobuf:"varint,30,opt,name=debug,proto3" json:"debug,omitempty"`
|
||||||
|
InstanceCode string `protobuf:"bytes,31,opt,name=instanceCode,proto3" json:"instanceCode,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *APINode) Reset() {
|
func (x *APINode) Reset() {
|
||||||
@@ -185,6 +187,13 @@ func (x *APINode) GetStatusJSON() []byte {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *APINode) GetIsPrimary() bool {
|
||||||
|
if x != nil {
|
||||||
|
return x.IsPrimary
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
func (x *APINode) GetDebug() bool {
|
func (x *APINode) GetDebug() bool {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Debug
|
return x.Debug
|
||||||
@@ -192,12 +201,19 @@ func (x *APINode) GetDebug() bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *APINode) GetInstanceCode() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.InstanceCode
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
var File_models_model_api_node_proto protoreflect.FileDescriptor
|
var File_models_model_api_node_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
var file_models_model_api_node_proto_rawDesc = []byte{
|
var file_models_model_api_node_proto_rawDesc = []byte{
|
||||||
0x0a, 0x1b, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x61,
|
0x0a, 0x1b, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x61,
|
||||||
0x70, 0x69, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70,
|
0x70, 0x69, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70,
|
||||||
0x62, 0x22, 0xdf, 0x03, 0x0a, 0x07, 0x41, 0x50, 0x49, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x0e, 0x0a,
|
0x62, 0x22, 0xa1, 0x04, 0x0a, 0x07, 0x41, 0x50, 0x49, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x0e, 0x0a,
|
||||||
0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a,
|
0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a,
|
||||||
0x04, 0x69, 0x73, 0x4f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x69, 0x73, 0x4f,
|
0x04, 0x69, 0x73, 0x4f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x69, 0x73, 0x4f,
|
||||||
0x6e, 0x12, 0x24, 0x0a, 0x0d, 0x6e, 0x6f, 0x64, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72,
|
0x6e, 0x12, 0x24, 0x0a, 0x0d, 0x6e, 0x6f, 0x64, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72,
|
||||||
@@ -225,10 +241,14 @@ var file_models_model_api_node_proto_rawDesc = []byte{
|
|||||||
0x63, 0x63, 0x65, 0x73, 0x73, 0x41, 0x64, 0x64, 0x72, 0x73, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x09,
|
0x63, 0x63, 0x65, 0x73, 0x73, 0x41, 0x64, 0x64, 0x72, 0x73, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x09,
|
||||||
0x52, 0x0b, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x41, 0x64, 0x64, 0x72, 0x73, 0x12, 0x1e, 0x0a,
|
0x52, 0x0b, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x41, 0x64, 0x64, 0x72, 0x73, 0x12, 0x1e, 0x0a,
|
||||||
0x0a, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x0c, 0x20, 0x01, 0x28,
|
0x0a, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x0c, 0x20, 0x01, 0x28,
|
||||||
0x0c, 0x52, 0x0a, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x4a, 0x53, 0x4f, 0x4e, 0x12, 0x14, 0x0a,
|
0x0c, 0x52, 0x0a, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x4a, 0x53, 0x4f, 0x4e, 0x12, 0x1c, 0x0a,
|
||||||
0x05, 0x64, 0x65, 0x62, 0x75, 0x67, 0x18, 0x1e, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x64, 0x65,
|
0x09, 0x69, 0x73, 0x50, 0x72, 0x69, 0x6d, 0x61, 0x72, 0x79, 0x18, 0x10, 0x20, 0x01, 0x28, 0x08,
|
||||||
0x62, 0x75, 0x67, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f,
|
0x52, 0x09, 0x69, 0x73, 0x50, 0x72, 0x69, 0x6d, 0x61, 0x72, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x64,
|
||||||
0x74, 0x6f, 0x33,
|
0x65, 0x62, 0x75, 0x67, 0x18, 0x1e, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x64, 0x65, 0x62, 0x75,
|
||||||
|
0x67, 0x12, 0x22, 0x0a, 0x0c, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x43, 0x6f, 0x64,
|
||||||
|
0x65, 0x18, 0x1f, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63,
|
||||||
|
0x65, 0x43, 0x6f, 0x64, 0x65, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70,
|
||||||
|
0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ type File struct {
|
|||||||
Size int64 `protobuf:"varint,3,opt,name=size,proto3" json:"size,omitempty"`
|
Size int64 `protobuf:"varint,3,opt,name=size,proto3" json:"size,omitempty"`
|
||||||
CreatedAt int64 `protobuf:"varint,4,opt,name=createdAt,proto3" json:"createdAt,omitempty"`
|
CreatedAt int64 `protobuf:"varint,4,opt,name=createdAt,proto3" json:"createdAt,omitempty"`
|
||||||
IsPublic bool `protobuf:"varint,5,opt,name=isPublic,proto3" json:"isPublic,omitempty"`
|
IsPublic bool `protobuf:"varint,5,opt,name=isPublic,proto3" json:"isPublic,omitempty"`
|
||||||
|
MimeType string `protobuf:"bytes,6,opt,name=mimeType,proto3" json:"mimeType,omitempty"`
|
||||||
|
Type string `protobuf:"bytes,7,opt,name=type,proto3" json:"type,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *File) Reset() {
|
func (x *File) Reset() {
|
||||||
@@ -104,11 +106,25 @@ func (x *File) GetIsPublic() bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *File) GetMimeType() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.MimeType
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *File) GetType() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Type
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
var File_models_model_file_proto protoreflect.FileDescriptor
|
var File_models_model_file_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
var file_models_model_file_proto_rawDesc = []byte{
|
var file_models_model_file_proto_rawDesc = []byte{
|
||||||
0x0a, 0x17, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x66,
|
0x0a, 0x17, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x66,
|
||||||
0x69, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, 0x80, 0x01,
|
0x69, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, 0xb0, 0x01,
|
||||||
0x0a, 0x04, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01,
|
0x0a, 0x04, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01,
|
||||||
0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61,
|
0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61,
|
||||||
0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61,
|
0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61,
|
||||||
@@ -117,6 +133,9 @@ var file_models_model_file_proto_rawDesc = []byte{
|
|||||||
0x64, 0x41, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74,
|
0x64, 0x41, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74,
|
||||||
0x65, 0x64, 0x41, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x73, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63,
|
0x65, 0x64, 0x41, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x73, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63,
|
||||||
0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x69, 0x73, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63,
|
0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x69, 0x73, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63,
|
||||||
|
0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x69, 0x6d, 0x65, 0x54, 0x79, 0x70, 0x65, 0x18, 0x06, 0x20, 0x01,
|
||||||
|
0x28, 0x09, 0x52, 0x08, 0x6d, 0x69, 0x6d, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04,
|
||||||
|
0x74, 0x79, 0x70, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65,
|
||||||
0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,13 +30,14 @@ type HTTPAccessLogPolicy struct {
|
|||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
|
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||||
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
|
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
|
||||||
IsOn bool `protobuf:"varint,3,opt,name=isOn,proto3" json:"isOn,omitempty"`
|
IsOn bool `protobuf:"varint,3,opt,name=isOn,proto3" json:"isOn,omitempty"`
|
||||||
Type string `protobuf:"bytes,4,opt,name=type,proto3" json:"type,omitempty"`
|
Type string `protobuf:"bytes,4,opt,name=type,proto3" json:"type,omitempty"`
|
||||||
OptionsJSON []byte `protobuf:"bytes,5,opt,name=optionsJSON,proto3" json:"optionsJSON,omitempty"`
|
OptionsJSON []byte `protobuf:"bytes,5,opt,name=optionsJSON,proto3" json:"optionsJSON,omitempty"`
|
||||||
CondsJSON []byte `protobuf:"bytes,6,opt,name=condsJSON,proto3" json:"condsJSON,omitempty"`
|
CondsJSON []byte `protobuf:"bytes,6,opt,name=condsJSON,proto3" json:"condsJSON,omitempty"`
|
||||||
IsPublic bool `protobuf:"varint,7,opt,name=isPublic,proto3" json:"isPublic,omitempty"`
|
IsPublic bool `protobuf:"varint,7,opt,name=isPublic,proto3" json:"isPublic,omitempty"`
|
||||||
|
FirewallOnly bool `protobuf:"varint,8,opt,name=firewallOnly,proto3" json:"firewallOnly,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *HTTPAccessLogPolicy) Reset() {
|
func (x *HTTPAccessLogPolicy) Reset() {
|
||||||
@@ -120,13 +121,20 @@ func (x *HTTPAccessLogPolicy) GetIsPublic() bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *HTTPAccessLogPolicy) GetFirewallOnly() bool {
|
||||||
|
if x != nil {
|
||||||
|
return x.FirewallOnly
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
var File_models_model_http_access_log_policy_proto protoreflect.FileDescriptor
|
var File_models_model_http_access_log_policy_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
var file_models_model_http_access_log_policy_proto_rawDesc = []byte{
|
var file_models_model_http_access_log_policy_proto_rawDesc = []byte{
|
||||||
0x0a, 0x29, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x68,
|
0x0a, 0x29, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x68,
|
||||||
0x74, 0x74, 0x70, 0x5f, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x6c, 0x6f, 0x67, 0x5f, 0x70,
|
0x74, 0x74, 0x70, 0x5f, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x6c, 0x6f, 0x67, 0x5f, 0x70,
|
||||||
0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x22,
|
0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x22,
|
||||||
0xbd, 0x01, 0x0a, 0x13, 0x48, 0x54, 0x54, 0x50, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x4c, 0x6f,
|
0xe1, 0x01, 0x0a, 0x13, 0x48, 0x54, 0x54, 0x50, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x4c, 0x6f,
|
||||||
0x67, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20,
|
0x67, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20,
|
||||||
0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18,
|
0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18,
|
||||||
0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x69,
|
0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x69,
|
||||||
@@ -137,8 +145,11 @@ var file_models_model_http_access_log_policy_proto_rawDesc = []byte{
|
|||||||
0x73, 0x4a, 0x53, 0x4f, 0x4e, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x4a, 0x53,
|
0x73, 0x4a, 0x53, 0x4f, 0x4e, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x4a, 0x53,
|
||||||
0x4f, 0x4e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x4a,
|
0x4f, 0x4e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x4a,
|
||||||
0x53, 0x4f, 0x4e, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x73, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x18,
|
0x53, 0x4f, 0x4e, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x73, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x18,
|
||||||
0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x69, 0x73, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x42,
|
0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x69, 0x73, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x12,
|
||||||
0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x22, 0x0a, 0x0c, 0x66, 0x69, 0x72, 0x65, 0x77, 0x61, 0x6c, 0x6c, 0x4f, 0x6e, 0x6c, 0x79, 0x18,
|
||||||
|
0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x66, 0x69, 0x72, 0x65, 0x77, 0x61, 0x6c, 0x6c, 0x4f,
|
||||||
|
0x6e, 0x6c, 0x79, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f,
|
||||||
|
0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|||||||
256
pkg/rpc/pb/model_http_cache_task.pb.go
Normal file
256
pkg/rpc/pb/model_http_cache_task.pb.go
Normal file
@@ -0,0 +1,256 @@
|
|||||||
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
|
// versions:
|
||||||
|
// protoc-gen-go v1.25.0
|
||||||
|
// protoc v3.19.4
|
||||||
|
// source: models/model_http_cache_task.proto
|
||||||
|
|
||||||
|
package pb
|
||||||
|
|
||||||
|
import (
|
||||||
|
proto "github.com/golang/protobuf/proto"
|
||||||
|
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||||
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
|
reflect "reflect"
|
||||||
|
sync "sync"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// Verify that this generated code is sufficiently up-to-date.
|
||||||
|
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||||
|
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||||
|
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||||
|
)
|
||||||
|
|
||||||
|
// This is a compile-time assertion that a sufficiently up-to-date version
|
||||||
|
// of the legacy proto package is being used.
|
||||||
|
const _ = proto.ProtoPackageIsVersion4
|
||||||
|
|
||||||
|
type HTTPCacheTask struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||||
|
UserId int64 `protobuf:"varint,2,opt,name=userId,proto3" json:"userId,omitempty"`
|
||||||
|
Type string `protobuf:"bytes,3,opt,name=type,proto3" json:"type,omitempty"`
|
||||||
|
KeyType string `protobuf:"bytes,4,opt,name=keyType,proto3" json:"keyType,omitempty"`
|
||||||
|
CreatedAt int64 `protobuf:"varint,5,opt,name=createdAt,proto3" json:"createdAt,omitempty"`
|
||||||
|
DoneAt int64 `protobuf:"varint,6,opt,name=doneAt,proto3" json:"doneAt,omitempty"`
|
||||||
|
IsDone bool `protobuf:"varint,7,opt,name=isDone,proto3" json:"isDone,omitempty"`
|
||||||
|
IsOk bool `protobuf:"varint,8,opt,name=isOk,proto3" json:"isOk,omitempty"`
|
||||||
|
Description string `protobuf:"bytes,9,opt,name=description,proto3" json:"description,omitempty"`
|
||||||
|
User *User `protobuf:"bytes,30,opt,name=user,proto3" json:"user,omitempty"`
|
||||||
|
HttpCacheTaskKeys []*HTTPCacheTaskKey `protobuf:"bytes,31,rep,name=httpCacheTaskKeys,proto3" json:"httpCacheTaskKeys,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *HTTPCacheTask) Reset() {
|
||||||
|
*x = HTTPCacheTask{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_models_model_http_cache_task_proto_msgTypes[0]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *HTTPCacheTask) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*HTTPCacheTask) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *HTTPCacheTask) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_models_model_http_cache_task_proto_msgTypes[0]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use HTTPCacheTask.ProtoReflect.Descriptor instead.
|
||||||
|
func (*HTTPCacheTask) Descriptor() ([]byte, []int) {
|
||||||
|
return file_models_model_http_cache_task_proto_rawDescGZIP(), []int{0}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *HTTPCacheTask) GetId() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.Id
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *HTTPCacheTask) GetUserId() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.UserId
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *HTTPCacheTask) GetType() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Type
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *HTTPCacheTask) GetKeyType() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.KeyType
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *HTTPCacheTask) GetCreatedAt() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.CreatedAt
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *HTTPCacheTask) GetDoneAt() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.DoneAt
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *HTTPCacheTask) GetIsDone() bool {
|
||||||
|
if x != nil {
|
||||||
|
return x.IsDone
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *HTTPCacheTask) GetIsOk() bool {
|
||||||
|
if x != nil {
|
||||||
|
return x.IsOk
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *HTTPCacheTask) GetDescription() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Description
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *HTTPCacheTask) GetUser() *User {
|
||||||
|
if x != nil {
|
||||||
|
return x.User
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *HTTPCacheTask) GetHttpCacheTaskKeys() []*HTTPCacheTaskKey {
|
||||||
|
if x != nil {
|
||||||
|
return x.HttpCacheTaskKeys
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
var File_models_model_http_cache_task_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
|
var file_models_model_http_cache_task_proto_rawDesc = []byte{
|
||||||
|
0x0a, 0x22, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x68,
|
||||||
|
0x74, 0x74, 0x70, 0x5f, 0x63, 0x61, 0x63, 0x68, 0x65, 0x5f, 0x74, 0x61, 0x73, 0x6b, 0x2e, 0x70,
|
||||||
|
0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x1a, 0x17, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73,
|
||||||
|
0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74,
|
||||||
|
0x6f, 0x1a, 0x26, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f,
|
||||||
|
0x68, 0x74, 0x74, 0x70, 0x5f, 0x63, 0x61, 0x63, 0x68, 0x65, 0x5f, 0x74, 0x61, 0x73, 0x6b, 0x5f,
|
||||||
|
0x6b, 0x65, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xcb, 0x02, 0x0a, 0x0d, 0x48, 0x54,
|
||||||
|
0x54, 0x50, 0x43, 0x61, 0x63, 0x68, 0x65, 0x54, 0x61, 0x73, 0x6b, 0x12, 0x0e, 0x0a, 0x02, 0x69,
|
||||||
|
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x75,
|
||||||
|
0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x75, 0x73, 0x65,
|
||||||
|
0x72, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28,
|
||||||
|
0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6b, 0x65, 0x79, 0x54, 0x79,
|
||||||
|
0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6b, 0x65, 0x79, 0x54, 0x79, 0x70,
|
||||||
|
0x65, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, 0x05,
|
||||||
|
0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12,
|
||||||
|
0x16, 0x0a, 0x06, 0x64, 0x6f, 0x6e, 0x65, 0x41, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52,
|
||||||
|
0x06, 0x64, 0x6f, 0x6e, 0x65, 0x41, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x73, 0x44, 0x6f, 0x6e,
|
||||||
|
0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x69, 0x73, 0x44, 0x6f, 0x6e, 0x65, 0x12,
|
||||||
|
0x12, 0x0a, 0x04, 0x69, 0x73, 0x4f, 0x6b, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x69,
|
||||||
|
0x73, 0x4f, 0x6b, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69,
|
||||||
|
0x6f, 0x6e, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69,
|
||||||
|
0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1c, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x1e, 0x20,
|
||||||
|
0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x04, 0x75,
|
||||||
|
0x73, 0x65, 0x72, 0x12, 0x42, 0x0a, 0x11, 0x68, 0x74, 0x74, 0x70, 0x43, 0x61, 0x63, 0x68, 0x65,
|
||||||
|
0x54, 0x61, 0x73, 0x6b, 0x4b, 0x65, 0x79, 0x73, 0x18, 0x1f, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14,
|
||||||
|
0x2e, 0x70, 0x62, 0x2e, 0x48, 0x54, 0x54, 0x50, 0x43, 0x61, 0x63, 0x68, 0x65, 0x54, 0x61, 0x73,
|
||||||
|
0x6b, 0x4b, 0x65, 0x79, 0x52, 0x11, 0x68, 0x74, 0x74, 0x70, 0x43, 0x61, 0x63, 0x68, 0x65, 0x54,
|
||||||
|
0x61, 0x73, 0x6b, 0x4b, 0x65, 0x79, 0x73, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62,
|
||||||
|
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
file_models_model_http_cache_task_proto_rawDescOnce sync.Once
|
||||||
|
file_models_model_http_cache_task_proto_rawDescData = file_models_model_http_cache_task_proto_rawDesc
|
||||||
|
)
|
||||||
|
|
||||||
|
func file_models_model_http_cache_task_proto_rawDescGZIP() []byte {
|
||||||
|
file_models_model_http_cache_task_proto_rawDescOnce.Do(func() {
|
||||||
|
file_models_model_http_cache_task_proto_rawDescData = protoimpl.X.CompressGZIP(file_models_model_http_cache_task_proto_rawDescData)
|
||||||
|
})
|
||||||
|
return file_models_model_http_cache_task_proto_rawDescData
|
||||||
|
}
|
||||||
|
|
||||||
|
var file_models_model_http_cache_task_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
|
||||||
|
var file_models_model_http_cache_task_proto_goTypes = []interface{}{
|
||||||
|
(*HTTPCacheTask)(nil), // 0: pb.HTTPCacheTask
|
||||||
|
(*User)(nil), // 1: pb.User
|
||||||
|
(*HTTPCacheTaskKey)(nil), // 2: pb.HTTPCacheTaskKey
|
||||||
|
}
|
||||||
|
var file_models_model_http_cache_task_proto_depIdxs = []int32{
|
||||||
|
1, // 0: pb.HTTPCacheTask.user:type_name -> pb.User
|
||||||
|
2, // 1: pb.HTTPCacheTask.httpCacheTaskKeys:type_name -> pb.HTTPCacheTaskKey
|
||||||
|
2, // [2:2] is the sub-list for method output_type
|
||||||
|
2, // [2:2] is the sub-list for method input_type
|
||||||
|
2, // [2:2] is the sub-list for extension type_name
|
||||||
|
2, // [2:2] is the sub-list for extension extendee
|
||||||
|
0, // [0:2] is the sub-list for field type_name
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() { file_models_model_http_cache_task_proto_init() }
|
||||||
|
func file_models_model_http_cache_task_proto_init() {
|
||||||
|
if File_models_model_http_cache_task_proto != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
file_models_model_user_proto_init()
|
||||||
|
file_models_model_http_cache_task_key_proto_init()
|
||||||
|
if !protoimpl.UnsafeEnabled {
|
||||||
|
file_models_model_http_cache_task_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*HTTPCacheTask); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
type x struct{}
|
||||||
|
out := protoimpl.TypeBuilder{
|
||||||
|
File: protoimpl.DescBuilder{
|
||||||
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
|
RawDescriptor: file_models_model_http_cache_task_proto_rawDesc,
|
||||||
|
NumEnums: 0,
|
||||||
|
NumMessages: 1,
|
||||||
|
NumExtensions: 0,
|
||||||
|
NumServices: 0,
|
||||||
|
},
|
||||||
|
GoTypes: file_models_model_http_cache_task_proto_goTypes,
|
||||||
|
DependencyIndexes: file_models_model_http_cache_task_proto_depIdxs,
|
||||||
|
MessageInfos: file_models_model_http_cache_task_proto_msgTypes,
|
||||||
|
}.Build()
|
||||||
|
File_models_model_http_cache_task_proto = out.File
|
||||||
|
file_models_model_http_cache_task_proto_rawDesc = nil
|
||||||
|
file_models_model_http_cache_task_proto_goTypes = nil
|
||||||
|
file_models_model_http_cache_task_proto_depIdxs = nil
|
||||||
|
}
|
||||||
225
pkg/rpc/pb/model_http_cache_task_key.pb.go
Normal file
225
pkg/rpc/pb/model_http_cache_task_key.pb.go
Normal file
@@ -0,0 +1,225 @@
|
|||||||
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
|
// versions:
|
||||||
|
// protoc-gen-go v1.25.0
|
||||||
|
// protoc v3.19.4
|
||||||
|
// source: models/model_http_cache_task_key.proto
|
||||||
|
|
||||||
|
package pb
|
||||||
|
|
||||||
|
import (
|
||||||
|
proto "github.com/golang/protobuf/proto"
|
||||||
|
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||||
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
|
reflect "reflect"
|
||||||
|
sync "sync"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// Verify that this generated code is sufficiently up-to-date.
|
||||||
|
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||||
|
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||||
|
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||||
|
)
|
||||||
|
|
||||||
|
// This is a compile-time assertion that a sufficiently up-to-date version
|
||||||
|
// of the legacy proto package is being used.
|
||||||
|
const _ = proto.ProtoPackageIsVersion4
|
||||||
|
|
||||||
|
type HTTPCacheTaskKey struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||||
|
TaskId int64 `protobuf:"varint,2,opt,name=taskId,proto3" json:"taskId,omitempty"`
|
||||||
|
Key string `protobuf:"bytes,3,opt,name=key,proto3" json:"key,omitempty"`
|
||||||
|
Type string `protobuf:"bytes,4,opt,name=type,proto3" json:"type,omitempty"`
|
||||||
|
KeyType string `protobuf:"bytes,5,opt,name=keyType,proto3" json:"keyType,omitempty"`
|
||||||
|
IsDone bool `protobuf:"varint,6,opt,name=isDone,proto3" json:"isDone,omitempty"` // 是否已完成
|
||||||
|
IsDoing bool `protobuf:"varint,9,opt,name=isDoing,proto3" json:"isDoing,omitempty"` // 是否执行中
|
||||||
|
ErrorsJSON []byte `protobuf:"bytes,7,opt,name=errorsJSON,proto3" json:"errorsJSON,omitempty"`
|
||||||
|
NodeClusterId int64 `protobuf:"varint,8,opt,name=nodeClusterId,proto3" json:"nodeClusterId,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *HTTPCacheTaskKey) Reset() {
|
||||||
|
*x = HTTPCacheTaskKey{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_models_model_http_cache_task_key_proto_msgTypes[0]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *HTTPCacheTaskKey) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*HTTPCacheTaskKey) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *HTTPCacheTaskKey) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_models_model_http_cache_task_key_proto_msgTypes[0]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use HTTPCacheTaskKey.ProtoReflect.Descriptor instead.
|
||||||
|
func (*HTTPCacheTaskKey) Descriptor() ([]byte, []int) {
|
||||||
|
return file_models_model_http_cache_task_key_proto_rawDescGZIP(), []int{0}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *HTTPCacheTaskKey) GetId() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.Id
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *HTTPCacheTaskKey) GetTaskId() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.TaskId
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *HTTPCacheTaskKey) GetKey() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Key
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *HTTPCacheTaskKey) GetType() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Type
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *HTTPCacheTaskKey) GetKeyType() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.KeyType
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *HTTPCacheTaskKey) GetIsDone() bool {
|
||||||
|
if x != nil {
|
||||||
|
return x.IsDone
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *HTTPCacheTaskKey) GetIsDoing() bool {
|
||||||
|
if x != nil {
|
||||||
|
return x.IsDoing
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *HTTPCacheTaskKey) GetErrorsJSON() []byte {
|
||||||
|
if x != nil {
|
||||||
|
return x.ErrorsJSON
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *HTTPCacheTaskKey) GetNodeClusterId() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.NodeClusterId
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
var File_models_model_http_cache_task_key_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
|
var file_models_model_http_cache_task_key_proto_rawDesc = []byte{
|
||||||
|
0x0a, 0x26, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x68,
|
||||||
|
0x74, 0x74, 0x70, 0x5f, 0x63, 0x61, 0x63, 0x68, 0x65, 0x5f, 0x74, 0x61, 0x73, 0x6b, 0x5f, 0x6b,
|
||||||
|
0x65, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, 0xf2, 0x01, 0x0a,
|
||||||
|
0x10, 0x48, 0x54, 0x54, 0x50, 0x43, 0x61, 0x63, 0x68, 0x65, 0x54, 0x61, 0x73, 0x6b, 0x4b, 0x65,
|
||||||
|
0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69,
|
||||||
|
0x64, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28,
|
||||||
|
0x03, 0x52, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79,
|
||||||
|
0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x74,
|
||||||
|
0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12,
|
||||||
|
0x18, 0x0a, 0x07, 0x6b, 0x65, 0x79, 0x54, 0x79, 0x70, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09,
|
||||||
|
0x52, 0x07, 0x6b, 0x65, 0x79, 0x54, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x73, 0x44,
|
||||||
|
0x6f, 0x6e, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x69, 0x73, 0x44, 0x6f, 0x6e,
|
||||||
|
0x65, 0x12, 0x18, 0x0a, 0x07, 0x69, 0x73, 0x44, 0x6f, 0x69, 0x6e, 0x67, 0x18, 0x09, 0x20, 0x01,
|
||||||
|
0x28, 0x08, 0x52, 0x07, 0x69, 0x73, 0x44, 0x6f, 0x69, 0x6e, 0x67, 0x12, 0x1e, 0x0a, 0x0a, 0x65,
|
||||||
|
0x72, 0x72, 0x6f, 0x72, 0x73, 0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0c, 0x52,
|
||||||
|
0x0a, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x4a, 0x53, 0x4f, 0x4e, 0x12, 0x24, 0x0a, 0x0d, 0x6e,
|
||||||
|
0x6f, 0x64, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x49, 0x64, 0x18, 0x08, 0x20, 0x01,
|
||||||
|
0x28, 0x03, 0x52, 0x0d, 0x6e, 0x6f, 0x64, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x49,
|
||||||
|
0x64, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||||
|
0x33,
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
file_models_model_http_cache_task_key_proto_rawDescOnce sync.Once
|
||||||
|
file_models_model_http_cache_task_key_proto_rawDescData = file_models_model_http_cache_task_key_proto_rawDesc
|
||||||
|
)
|
||||||
|
|
||||||
|
func file_models_model_http_cache_task_key_proto_rawDescGZIP() []byte {
|
||||||
|
file_models_model_http_cache_task_key_proto_rawDescOnce.Do(func() {
|
||||||
|
file_models_model_http_cache_task_key_proto_rawDescData = protoimpl.X.CompressGZIP(file_models_model_http_cache_task_key_proto_rawDescData)
|
||||||
|
})
|
||||||
|
return file_models_model_http_cache_task_key_proto_rawDescData
|
||||||
|
}
|
||||||
|
|
||||||
|
var file_models_model_http_cache_task_key_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
|
||||||
|
var file_models_model_http_cache_task_key_proto_goTypes = []interface{}{
|
||||||
|
(*HTTPCacheTaskKey)(nil), // 0: pb.HTTPCacheTaskKey
|
||||||
|
}
|
||||||
|
var file_models_model_http_cache_task_key_proto_depIdxs = []int32{
|
||||||
|
0, // [0:0] is the sub-list for method output_type
|
||||||
|
0, // [0:0] is the sub-list for method input_type
|
||||||
|
0, // [0:0] is the sub-list for extension type_name
|
||||||
|
0, // [0:0] is the sub-list for extension extendee
|
||||||
|
0, // [0:0] is the sub-list for field type_name
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() { file_models_model_http_cache_task_key_proto_init() }
|
||||||
|
func file_models_model_http_cache_task_key_proto_init() {
|
||||||
|
if File_models_model_http_cache_task_key_proto != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if !protoimpl.UnsafeEnabled {
|
||||||
|
file_models_model_http_cache_task_key_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*HTTPCacheTaskKey); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
type x struct{}
|
||||||
|
out := protoimpl.TypeBuilder{
|
||||||
|
File: protoimpl.DescBuilder{
|
||||||
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
|
RawDescriptor: file_models_model_http_cache_task_key_proto_rawDesc,
|
||||||
|
NumEnums: 0,
|
||||||
|
NumMessages: 1,
|
||||||
|
NumExtensions: 0,
|
||||||
|
NumServices: 0,
|
||||||
|
},
|
||||||
|
GoTypes: file_models_model_http_cache_task_key_proto_goTypes,
|
||||||
|
DependencyIndexes: file_models_model_http_cache_task_key_proto_depIdxs,
|
||||||
|
MessageInfos: file_models_model_http_cache_task_key_proto_msgTypes,
|
||||||
|
}.Build()
|
||||||
|
File_models_model_http_cache_task_key_proto = out.File
|
||||||
|
file_models_model_http_cache_task_key_proto_rawDesc = nil
|
||||||
|
file_models_model_http_cache_task_key_proto_goTypes = nil
|
||||||
|
file_models_model_http_cache_task_key_proto_depIdxs = nil
|
||||||
|
}
|
||||||
205
pkg/rpc/pb/model_ip_library_artifact.pb.go
Normal file
205
pkg/rpc/pb/model_ip_library_artifact.pb.go
Normal file
@@ -0,0 +1,205 @@
|
|||||||
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
|
// versions:
|
||||||
|
// protoc-gen-go v1.25.0
|
||||||
|
// protoc v3.19.4
|
||||||
|
// source: models/model_ip_library_artifact.proto
|
||||||
|
|
||||||
|
package pb
|
||||||
|
|
||||||
|
import (
|
||||||
|
proto "github.com/golang/protobuf/proto"
|
||||||
|
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||||
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
|
reflect "reflect"
|
||||||
|
sync "sync"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// Verify that this generated code is sufficiently up-to-date.
|
||||||
|
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||||
|
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||||
|
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||||
|
)
|
||||||
|
|
||||||
|
// This is a compile-time assertion that a sufficiently up-to-date version
|
||||||
|
// of the legacy proto package is being used.
|
||||||
|
const _ = proto.ProtoPackageIsVersion4
|
||||||
|
|
||||||
|
type IPLibraryArtifact struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||||
|
FileId int64 `protobuf:"varint,2,opt,name=fileId,proto3" json:"fileId,omitempty"`
|
||||||
|
CreatedAt int64 `protobuf:"varint,3,opt,name=createdAt,proto3" json:"createdAt,omitempty"`
|
||||||
|
MetaJSON []byte `protobuf:"bytes,4,opt,name=metaJSON,proto3" json:"metaJSON,omitempty"`
|
||||||
|
IsPublic bool `protobuf:"varint,5,opt,name=isPublic,proto3" json:"isPublic,omitempty"`
|
||||||
|
Name string `protobuf:"bytes,6,opt,name=name,proto3" json:"name,omitempty"`
|
||||||
|
Code string `protobuf:"bytes,7,opt,name=code,proto3" json:"code,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *IPLibraryArtifact) Reset() {
|
||||||
|
*x = IPLibraryArtifact{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_models_model_ip_library_artifact_proto_msgTypes[0]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *IPLibraryArtifact) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*IPLibraryArtifact) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *IPLibraryArtifact) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_models_model_ip_library_artifact_proto_msgTypes[0]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use IPLibraryArtifact.ProtoReflect.Descriptor instead.
|
||||||
|
func (*IPLibraryArtifact) Descriptor() ([]byte, []int) {
|
||||||
|
return file_models_model_ip_library_artifact_proto_rawDescGZIP(), []int{0}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *IPLibraryArtifact) GetId() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.Id
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *IPLibraryArtifact) GetFileId() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.FileId
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *IPLibraryArtifact) GetCreatedAt() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.CreatedAt
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *IPLibraryArtifact) GetMetaJSON() []byte {
|
||||||
|
if x != nil {
|
||||||
|
return x.MetaJSON
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *IPLibraryArtifact) GetIsPublic() bool {
|
||||||
|
if x != nil {
|
||||||
|
return x.IsPublic
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *IPLibraryArtifact) GetName() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Name
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *IPLibraryArtifact) GetCode() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Code
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
var File_models_model_ip_library_artifact_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
|
var file_models_model_ip_library_artifact_proto_rawDesc = []byte{
|
||||||
|
0x0a, 0x26, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x69,
|
||||||
|
0x70, 0x5f, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x5f, 0x61, 0x72, 0x74, 0x69, 0x66, 0x61,
|
||||||
|
0x63, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, 0xb9, 0x01, 0x0a,
|
||||||
|
0x11, 0x49, 0x50, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x41, 0x72, 0x74, 0x69, 0x66, 0x61,
|
||||||
|
0x63, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02,
|
||||||
|
0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x69, 0x6c, 0x65, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01,
|
||||||
|
0x28, 0x03, 0x52, 0x06, 0x66, 0x69, 0x6c, 0x65, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x72,
|
||||||
|
0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x63,
|
||||||
|
0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61,
|
||||||
|
0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61,
|
||||||
|
0x4a, 0x53, 0x4f, 0x4e, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x73, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63,
|
||||||
|
0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x69, 0x73, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63,
|
||||||
|
0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04,
|
||||||
|
0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x07, 0x20, 0x01,
|
||||||
|
0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62,
|
||||||
|
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
file_models_model_ip_library_artifact_proto_rawDescOnce sync.Once
|
||||||
|
file_models_model_ip_library_artifact_proto_rawDescData = file_models_model_ip_library_artifact_proto_rawDesc
|
||||||
|
)
|
||||||
|
|
||||||
|
func file_models_model_ip_library_artifact_proto_rawDescGZIP() []byte {
|
||||||
|
file_models_model_ip_library_artifact_proto_rawDescOnce.Do(func() {
|
||||||
|
file_models_model_ip_library_artifact_proto_rawDescData = protoimpl.X.CompressGZIP(file_models_model_ip_library_artifact_proto_rawDescData)
|
||||||
|
})
|
||||||
|
return file_models_model_ip_library_artifact_proto_rawDescData
|
||||||
|
}
|
||||||
|
|
||||||
|
var file_models_model_ip_library_artifact_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
|
||||||
|
var file_models_model_ip_library_artifact_proto_goTypes = []interface{}{
|
||||||
|
(*IPLibraryArtifact)(nil), // 0: pb.IPLibraryArtifact
|
||||||
|
}
|
||||||
|
var file_models_model_ip_library_artifact_proto_depIdxs = []int32{
|
||||||
|
0, // [0:0] is the sub-list for method output_type
|
||||||
|
0, // [0:0] is the sub-list for method input_type
|
||||||
|
0, // [0:0] is the sub-list for extension type_name
|
||||||
|
0, // [0:0] is the sub-list for extension extendee
|
||||||
|
0, // [0:0] is the sub-list for field type_name
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() { file_models_model_ip_library_artifact_proto_init() }
|
||||||
|
func file_models_model_ip_library_artifact_proto_init() {
|
||||||
|
if File_models_model_ip_library_artifact_proto != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if !protoimpl.UnsafeEnabled {
|
||||||
|
file_models_model_ip_library_artifact_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*IPLibraryArtifact); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
type x struct{}
|
||||||
|
out := protoimpl.TypeBuilder{
|
||||||
|
File: protoimpl.DescBuilder{
|
||||||
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
|
RawDescriptor: file_models_model_ip_library_artifact_proto_rawDesc,
|
||||||
|
NumEnums: 0,
|
||||||
|
NumMessages: 1,
|
||||||
|
NumExtensions: 0,
|
||||||
|
NumServices: 0,
|
||||||
|
},
|
||||||
|
GoTypes: file_models_model_ip_library_artifact_proto_goTypes,
|
||||||
|
DependencyIndexes: file_models_model_ip_library_artifact_proto_depIdxs,
|
||||||
|
MessageInfos: file_models_model_ip_library_artifact_proto_msgTypes,
|
||||||
|
}.Build()
|
||||||
|
File_models_model_ip_library_artifact_proto = out.File
|
||||||
|
file_models_model_ip_library_artifact_proto_rawDesc = nil
|
||||||
|
file_models_model_ip_library_artifact_proto_goTypes = nil
|
||||||
|
file_models_model_ip_library_artifact_proto_depIdxs = nil
|
||||||
|
}
|
||||||
532
pkg/rpc/pb/model_ip_library_file.pb.go
Normal file
532
pkg/rpc/pb/model_ip_library_file.pb.go
Normal file
@@ -0,0 +1,532 @@
|
|||||||
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
|
// versions:
|
||||||
|
// protoc-gen-go v1.25.0
|
||||||
|
// protoc v3.19.4
|
||||||
|
// source: models/model_ip_library_file.proto
|
||||||
|
|
||||||
|
package pb
|
||||||
|
|
||||||
|
import (
|
||||||
|
proto "github.com/golang/protobuf/proto"
|
||||||
|
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||||
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
|
reflect "reflect"
|
||||||
|
sync "sync"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// Verify that this generated code is sufficiently up-to-date.
|
||||||
|
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||||
|
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||||
|
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||||
|
)
|
||||||
|
|
||||||
|
// This is a compile-time assertion that a sufficiently up-to-date version
|
||||||
|
// of the legacy proto package is being used.
|
||||||
|
const _ = proto.ProtoPackageIsVersion4
|
||||||
|
|
||||||
|
type IPLibraryFile struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||||
|
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
|
||||||
|
FileId int64 `protobuf:"varint,3,opt,name=fileId,proto3" json:"fileId,omitempty"`
|
||||||
|
Template string `protobuf:"bytes,4,opt,name=template,proto3" json:"template,omitempty"`
|
||||||
|
EmptyValues []string `protobuf:"bytes,5,rep,name=emptyValues,proto3" json:"emptyValues,omitempty"`
|
||||||
|
GeneratedFileId int64 `protobuf:"varint,6,opt,name=generatedFileId,proto3" json:"generatedFileId,omitempty"`
|
||||||
|
GeneratedAt int64 `protobuf:"varint,7,opt,name=generatedAt,proto3" json:"generatedAt,omitempty"`
|
||||||
|
IsFinished bool `protobuf:"varint,8,opt,name=isFinished,proto3" json:"isFinished,omitempty"`
|
||||||
|
CreatedAt int64 `protobuf:"varint,9,opt,name=createdAt,proto3" json:"createdAt,omitempty"`
|
||||||
|
CountryNames []string `protobuf:"bytes,10,rep,name=countryNames,proto3" json:"countryNames,omitempty"`
|
||||||
|
Provinces []*IPLibraryFile_Province `protobuf:"bytes,11,rep,name=provinces,proto3" json:"provinces,omitempty"`
|
||||||
|
Cities []*IPLibraryFile_City `protobuf:"bytes,12,rep,name=cities,proto3" json:"cities,omitempty"`
|
||||||
|
Towns []*IPLibraryFile_Town `protobuf:"bytes,13,rep,name=towns,proto3" json:"towns,omitempty"`
|
||||||
|
ProviderNames []string `protobuf:"bytes,14,rep,name=providerNames,proto3" json:"providerNames,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *IPLibraryFile) Reset() {
|
||||||
|
*x = IPLibraryFile{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_models_model_ip_library_file_proto_msgTypes[0]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *IPLibraryFile) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*IPLibraryFile) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *IPLibraryFile) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_models_model_ip_library_file_proto_msgTypes[0]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use IPLibraryFile.ProtoReflect.Descriptor instead.
|
||||||
|
func (*IPLibraryFile) Descriptor() ([]byte, []int) {
|
||||||
|
return file_models_model_ip_library_file_proto_rawDescGZIP(), []int{0}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *IPLibraryFile) GetId() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.Id
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *IPLibraryFile) GetName() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Name
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *IPLibraryFile) GetFileId() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.FileId
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *IPLibraryFile) GetTemplate() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Template
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *IPLibraryFile) GetEmptyValues() []string {
|
||||||
|
if x != nil {
|
||||||
|
return x.EmptyValues
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *IPLibraryFile) GetGeneratedFileId() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.GeneratedFileId
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *IPLibraryFile) GetGeneratedAt() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.GeneratedAt
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *IPLibraryFile) GetIsFinished() bool {
|
||||||
|
if x != nil {
|
||||||
|
return x.IsFinished
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *IPLibraryFile) GetCreatedAt() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.CreatedAt
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *IPLibraryFile) GetCountryNames() []string {
|
||||||
|
if x != nil {
|
||||||
|
return x.CountryNames
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *IPLibraryFile) GetProvinces() []*IPLibraryFile_Province {
|
||||||
|
if x != nil {
|
||||||
|
return x.Provinces
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *IPLibraryFile) GetCities() []*IPLibraryFile_City {
|
||||||
|
if x != nil {
|
||||||
|
return x.Cities
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *IPLibraryFile) GetTowns() []*IPLibraryFile_Town {
|
||||||
|
if x != nil {
|
||||||
|
return x.Towns
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *IPLibraryFile) GetProviderNames() []string {
|
||||||
|
if x != nil {
|
||||||
|
return x.ProviderNames
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type IPLibraryFile_Province struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
CountryName string `protobuf:"bytes,1,opt,name=countryName,proto3" json:"countryName,omitempty"`
|
||||||
|
ProvinceName string `protobuf:"bytes,2,opt,name=provinceName,proto3" json:"provinceName,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *IPLibraryFile_Province) Reset() {
|
||||||
|
*x = IPLibraryFile_Province{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_models_model_ip_library_file_proto_msgTypes[1]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *IPLibraryFile_Province) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*IPLibraryFile_Province) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *IPLibraryFile_Province) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_models_model_ip_library_file_proto_msgTypes[1]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use IPLibraryFile_Province.ProtoReflect.Descriptor instead.
|
||||||
|
func (*IPLibraryFile_Province) Descriptor() ([]byte, []int) {
|
||||||
|
return file_models_model_ip_library_file_proto_rawDescGZIP(), []int{0, 0}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *IPLibraryFile_Province) GetCountryName() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.CountryName
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *IPLibraryFile_Province) GetProvinceName() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.ProvinceName
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
type IPLibraryFile_City struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
CountryName string `protobuf:"bytes,1,opt,name=countryName,proto3" json:"countryName,omitempty"`
|
||||||
|
ProvinceName string `protobuf:"bytes,2,opt,name=provinceName,proto3" json:"provinceName,omitempty"`
|
||||||
|
CityName string `protobuf:"bytes,3,opt,name=cityName,proto3" json:"cityName,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *IPLibraryFile_City) Reset() {
|
||||||
|
*x = IPLibraryFile_City{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_models_model_ip_library_file_proto_msgTypes[2]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *IPLibraryFile_City) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*IPLibraryFile_City) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *IPLibraryFile_City) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_models_model_ip_library_file_proto_msgTypes[2]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use IPLibraryFile_City.ProtoReflect.Descriptor instead.
|
||||||
|
func (*IPLibraryFile_City) Descriptor() ([]byte, []int) {
|
||||||
|
return file_models_model_ip_library_file_proto_rawDescGZIP(), []int{0, 1}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *IPLibraryFile_City) GetCountryName() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.CountryName
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *IPLibraryFile_City) GetProvinceName() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.ProvinceName
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *IPLibraryFile_City) GetCityName() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.CityName
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
type IPLibraryFile_Town struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
CountryName string `protobuf:"bytes,1,opt,name=countryName,proto3" json:"countryName,omitempty"`
|
||||||
|
ProvinceName string `protobuf:"bytes,2,opt,name=provinceName,proto3" json:"provinceName,omitempty"`
|
||||||
|
CityName string `protobuf:"bytes,3,opt,name=cityName,proto3" json:"cityName,omitempty"`
|
||||||
|
TownName string `protobuf:"bytes,4,opt,name=townName,proto3" json:"townName,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *IPLibraryFile_Town) Reset() {
|
||||||
|
*x = IPLibraryFile_Town{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_models_model_ip_library_file_proto_msgTypes[3]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *IPLibraryFile_Town) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*IPLibraryFile_Town) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *IPLibraryFile_Town) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_models_model_ip_library_file_proto_msgTypes[3]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use IPLibraryFile_Town.ProtoReflect.Descriptor instead.
|
||||||
|
func (*IPLibraryFile_Town) Descriptor() ([]byte, []int) {
|
||||||
|
return file_models_model_ip_library_file_proto_rawDescGZIP(), []int{0, 2}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *IPLibraryFile_Town) GetCountryName() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.CountryName
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *IPLibraryFile_Town) GetProvinceName() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.ProvinceName
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *IPLibraryFile_Town) GetCityName() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.CityName
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *IPLibraryFile_Town) GetTownName() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.TownName
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
var File_models_model_ip_library_file_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
|
var file_models_model_ip_library_file_proto_rawDesc = []byte{
|
||||||
|
0x0a, 0x22, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x69,
|
||||||
|
0x70, 0x5f, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x2e, 0x70,
|
||||||
|
0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, 0xb8, 0x06, 0x0a, 0x0d, 0x49, 0x50, 0x4c,
|
||||||
|
0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64,
|
||||||
|
0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61,
|
||||||
|
0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16,
|
||||||
|
0x0a, 0x06, 0x66, 0x69, 0x6c, 0x65, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06,
|
||||||
|
0x66, 0x69, 0x6c, 0x65, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61,
|
||||||
|
0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61,
|
||||||
|
0x74, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65,
|
||||||
|
0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0b, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x56, 0x61,
|
||||||
|
0x6c, 0x75, 0x65, 0x73, 0x12, 0x28, 0x0a, 0x0f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65,
|
||||||
|
0x64, 0x46, 0x69, 0x6c, 0x65, 0x49, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0f, 0x67,
|
||||||
|
0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x46, 0x69, 0x6c, 0x65, 0x49, 0x64, 0x12, 0x20,
|
||||||
|
0x0a, 0x0b, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, 0x07, 0x20,
|
||||||
|
0x01, 0x28, 0x03, 0x52, 0x0b, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74,
|
||||||
|
0x12, 0x1e, 0x0a, 0x0a, 0x69, 0x73, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x18, 0x08,
|
||||||
|
0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x69, 0x73, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64,
|
||||||
|
0x12, 0x1c, 0x0a, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, 0x09, 0x20,
|
||||||
|
0x01, 0x28, 0x03, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x22,
|
||||||
|
0x0a, 0x0c, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x18, 0x0a,
|
||||||
|
0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x4e, 0x61, 0x6d,
|
||||||
|
0x65, 0x73, 0x12, 0x38, 0x0a, 0x09, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x6e, 0x63, 0x65, 0x73, 0x18,
|
||||||
|
0x0b, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x70, 0x62, 0x2e, 0x49, 0x50, 0x4c, 0x69, 0x62,
|
||||||
|
0x72, 0x61, 0x72, 0x79, 0x46, 0x69, 0x6c, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x6e, 0x63,
|
||||||
|
0x65, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x6e, 0x63, 0x65, 0x73, 0x12, 0x2e, 0x0a, 0x06,
|
||||||
|
0x63, 0x69, 0x74, 0x69, 0x65, 0x73, 0x18, 0x0c, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x70,
|
||||||
|
0x62, 0x2e, 0x49, 0x50, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x46, 0x69, 0x6c, 0x65, 0x2e,
|
||||||
|
0x43, 0x69, 0x74, 0x79, 0x52, 0x06, 0x63, 0x69, 0x74, 0x69, 0x65, 0x73, 0x12, 0x2c, 0x0a, 0x05,
|
||||||
|
0x74, 0x6f, 0x77, 0x6e, 0x73, 0x18, 0x0d, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x70, 0x62,
|
||||||
|
0x2e, 0x49, 0x50, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x46, 0x69, 0x6c, 0x65, 0x2e, 0x54,
|
||||||
|
0x6f, 0x77, 0x6e, 0x52, 0x05, 0x74, 0x6f, 0x77, 0x6e, 0x73, 0x12, 0x24, 0x0a, 0x0d, 0x70, 0x72,
|
||||||
|
0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x18, 0x0e, 0x20, 0x03, 0x28,
|
||||||
|
0x09, 0x52, 0x0d, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x73,
|
||||||
|
0x1a, 0x50, 0x0a, 0x08, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x6e, 0x63, 0x65, 0x12, 0x20, 0x0a, 0x0b,
|
||||||
|
0x63, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||||
|
0x09, 0x52, 0x0b, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x22,
|
||||||
|
0x0a, 0x0c, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x6e, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02,
|
||||||
|
0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x6e, 0x63, 0x65, 0x4e, 0x61,
|
||||||
|
0x6d, 0x65, 0x1a, 0x68, 0x0a, 0x04, 0x43, 0x69, 0x74, 0x79, 0x12, 0x20, 0x0a, 0x0b, 0x63, 0x6f,
|
||||||
|
0x75, 0x6e, 0x74, 0x72, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||||
|
0x0b, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x22, 0x0a, 0x0c,
|
||||||
|
0x70, 0x72, 0x6f, 0x76, 0x69, 0x6e, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01,
|
||||||
|
0x28, 0x09, 0x52, 0x0c, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x6e, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65,
|
||||||
|
0x12, 0x1a, 0x0a, 0x08, 0x63, 0x69, 0x74, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01,
|
||||||
|
0x28, 0x09, 0x52, 0x08, 0x63, 0x69, 0x74, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x1a, 0x84, 0x01, 0x0a,
|
||||||
|
0x04, 0x54, 0x6f, 0x77, 0x6e, 0x12, 0x20, 0x0a, 0x0b, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79,
|
||||||
|
0x4e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x6f, 0x75, 0x6e,
|
||||||
|
0x74, 0x72, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x22, 0x0a, 0x0c, 0x70, 0x72, 0x6f, 0x76, 0x69,
|
||||||
|
0x6e, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x70,
|
||||||
|
0x72, 0x6f, 0x76, 0x69, 0x6e, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x63,
|
||||||
|
0x69, 0x74, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63,
|
||||||
|
0x69, 0x74, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x74, 0x6f, 0x77, 0x6e, 0x4e,
|
||||||
|
0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x6f, 0x77, 0x6e, 0x4e,
|
||||||
|
0x61, 0x6d, 0x65, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f,
|
||||||
|
0x74, 0x6f, 0x33,
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
file_models_model_ip_library_file_proto_rawDescOnce sync.Once
|
||||||
|
file_models_model_ip_library_file_proto_rawDescData = file_models_model_ip_library_file_proto_rawDesc
|
||||||
|
)
|
||||||
|
|
||||||
|
func file_models_model_ip_library_file_proto_rawDescGZIP() []byte {
|
||||||
|
file_models_model_ip_library_file_proto_rawDescOnce.Do(func() {
|
||||||
|
file_models_model_ip_library_file_proto_rawDescData = protoimpl.X.CompressGZIP(file_models_model_ip_library_file_proto_rawDescData)
|
||||||
|
})
|
||||||
|
return file_models_model_ip_library_file_proto_rawDescData
|
||||||
|
}
|
||||||
|
|
||||||
|
var file_models_model_ip_library_file_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
|
||||||
|
var file_models_model_ip_library_file_proto_goTypes = []interface{}{
|
||||||
|
(*IPLibraryFile)(nil), // 0: pb.IPLibraryFile
|
||||||
|
(*IPLibraryFile_Province)(nil), // 1: pb.IPLibraryFile.Province
|
||||||
|
(*IPLibraryFile_City)(nil), // 2: pb.IPLibraryFile.City
|
||||||
|
(*IPLibraryFile_Town)(nil), // 3: pb.IPLibraryFile.Town
|
||||||
|
}
|
||||||
|
var file_models_model_ip_library_file_proto_depIdxs = []int32{
|
||||||
|
1, // 0: pb.IPLibraryFile.provinces:type_name -> pb.IPLibraryFile.Province
|
||||||
|
2, // 1: pb.IPLibraryFile.cities:type_name -> pb.IPLibraryFile.City
|
||||||
|
3, // 2: pb.IPLibraryFile.towns:type_name -> pb.IPLibraryFile.Town
|
||||||
|
3, // [3:3] is the sub-list for method output_type
|
||||||
|
3, // [3:3] is the sub-list for method input_type
|
||||||
|
3, // [3:3] is the sub-list for extension type_name
|
||||||
|
3, // [3:3] is the sub-list for extension extendee
|
||||||
|
0, // [0:3] is the sub-list for field type_name
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() { file_models_model_ip_library_file_proto_init() }
|
||||||
|
func file_models_model_ip_library_file_proto_init() {
|
||||||
|
if File_models_model_ip_library_file_proto != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if !protoimpl.UnsafeEnabled {
|
||||||
|
file_models_model_ip_library_file_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*IPLibraryFile); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file_models_model_ip_library_file_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*IPLibraryFile_Province); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file_models_model_ip_library_file_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*IPLibraryFile_City); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file_models_model_ip_library_file_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*IPLibraryFile_Town); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
type x struct{}
|
||||||
|
out := protoimpl.TypeBuilder{
|
||||||
|
File: protoimpl.DescBuilder{
|
||||||
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
|
RawDescriptor: file_models_model_ip_library_file_proto_rawDesc,
|
||||||
|
NumEnums: 0,
|
||||||
|
NumMessages: 4,
|
||||||
|
NumExtensions: 0,
|
||||||
|
NumServices: 0,
|
||||||
|
},
|
||||||
|
GoTypes: file_models_model_ip_library_file_proto_goTypes,
|
||||||
|
DependencyIndexes: file_models_model_ip_library_file_proto_depIdxs,
|
||||||
|
MessageInfos: file_models_model_ip_library_file_proto_msgTypes,
|
||||||
|
}.Build()
|
||||||
|
File_models_model_ip_library_file_proto = out.File
|
||||||
|
file_models_model_ip_library_file_proto_rawDesc = nil
|
||||||
|
file_models_model_ip_library_file_proto_goTypes = nil
|
||||||
|
file_models_model_ip_library_file_proto_depIdxs = nil
|
||||||
|
}
|
||||||
@@ -31,16 +31,17 @@ type MetricItem struct {
|
|||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
|
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||||
IsOn bool `protobuf:"varint,2,opt,name=isOn,proto3" json:"isOn,omitempty"`
|
IsOn bool `protobuf:"varint,2,opt,name=isOn,proto3" json:"isOn,omitempty"`
|
||||||
Code string `protobuf:"bytes,3,opt,name=code,proto3" json:"code,omitempty"`
|
Code string `protobuf:"bytes,3,opt,name=code,proto3" json:"code,omitempty"`
|
||||||
Category string `protobuf:"bytes,4,opt,name=category,proto3" json:"category,omitempty"`
|
Category string `protobuf:"bytes,4,opt,name=category,proto3" json:"category,omitempty"`
|
||||||
Name string `protobuf:"bytes,5,opt,name=name,proto3" json:"name,omitempty"`
|
Name string `protobuf:"bytes,5,opt,name=name,proto3" json:"name,omitempty"`
|
||||||
Keys []string `protobuf:"bytes,6,rep,name=keys,proto3" json:"keys,omitempty"`
|
Keys []string `protobuf:"bytes,6,rep,name=keys,proto3" json:"keys,omitempty"`
|
||||||
Period int32 `protobuf:"varint,7,opt,name=period,proto3" json:"period,omitempty"`
|
Period int32 `protobuf:"varint,7,opt,name=period,proto3" json:"period,omitempty"`
|
||||||
PeriodUnit string `protobuf:"bytes,8,opt,name=periodUnit,proto3" json:"periodUnit,omitempty"`
|
PeriodUnit string `protobuf:"bytes,8,opt,name=periodUnit,proto3" json:"periodUnit,omitempty"`
|
||||||
Value string `protobuf:"bytes,10,opt,name=value,proto3" json:"value,omitempty"`
|
ExpiresPeriod int32 `protobuf:"varint,12,opt,name=expiresPeriod,proto3" json:"expiresPeriod,omitempty"`
|
||||||
IsPublic bool `protobuf:"varint,11,opt,name=isPublic,proto3" json:"isPublic,omitempty"`
|
Value string `protobuf:"bytes,10,opt,name=value,proto3" json:"value,omitempty"`
|
||||||
|
IsPublic bool `protobuf:"varint,11,opt,name=isPublic,proto3" json:"isPublic,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *MetricItem) Reset() {
|
func (x *MetricItem) Reset() {
|
||||||
@@ -131,6 +132,13 @@ func (x *MetricItem) GetPeriodUnit() string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *MetricItem) GetExpiresPeriod() int32 {
|
||||||
|
if x != nil {
|
||||||
|
return x.ExpiresPeriod
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
func (x *MetricItem) GetValue() string {
|
func (x *MetricItem) GetValue() string {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Value
|
return x.Value
|
||||||
@@ -150,7 +158,7 @@ var File_models_model_metric_item_proto protoreflect.FileDescriptor
|
|||||||
var file_models_model_metric_item_proto_rawDesc = []byte{
|
var file_models_model_metric_item_proto_rawDesc = []byte{
|
||||||
0x0a, 0x1e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x6d,
|
0x0a, 0x1e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x6d,
|
||||||
0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x69, 0x74, 0x65, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||||
0x12, 0x02, 0x70, 0x62, 0x22, 0xf2, 0x01, 0x0a, 0x0a, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x49,
|
0x12, 0x02, 0x70, 0x62, 0x22, 0x98, 0x02, 0x0a, 0x0a, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x49,
|
||||||
0x74, 0x65, 0x6d, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52,
|
0x74, 0x65, 0x6d, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52,
|
||||||
0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x73, 0x4f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28,
|
0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x73, 0x4f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28,
|
||||||
0x08, 0x52, 0x04, 0x69, 0x73, 0x4f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18,
|
0x08, 0x52, 0x04, 0x69, 0x73, 0x4f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18,
|
||||||
@@ -162,11 +170,13 @@ var file_models_model_metric_item_proto_rawDesc = []byte{
|
|||||||
0x16, 0x0a, 0x06, 0x70, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52,
|
0x16, 0x0a, 0x06, 0x70, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52,
|
||||||
0x06, 0x70, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x70, 0x65, 0x72, 0x69, 0x6f,
|
0x06, 0x70, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x70, 0x65, 0x72, 0x69, 0x6f,
|
||||||
0x64, 0x55, 0x6e, 0x69, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x70, 0x65, 0x72,
|
0x64, 0x55, 0x6e, 0x69, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x70, 0x65, 0x72,
|
||||||
0x69, 0x6f, 0x64, 0x55, 0x6e, 0x69, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65,
|
0x69, 0x6f, 0x64, 0x55, 0x6e, 0x69, 0x74, 0x12, 0x24, 0x0a, 0x0d, 0x65, 0x78, 0x70, 0x69, 0x72,
|
||||||
0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1a, 0x0a,
|
0x65, 0x73, 0x50, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0d,
|
||||||
0x08, 0x69, 0x73, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x08, 0x52,
|
0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x73, 0x50, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x12, 0x14, 0x0a,
|
||||||
0x08, 0x69, 0x73, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70,
|
0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61,
|
||||||
0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x6c, 0x75, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x73, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x18,
|
||||||
|
0x0b, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x69, 0x73, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x42,
|
||||||
|
0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|||||||
@@ -49,6 +49,8 @@ type Node struct {
|
|||||||
MaxCacheDiskCapacity *SizeCapacity `protobuf:"bytes,17,opt,name=maxCacheDiskCapacity,proto3" json:"maxCacheDiskCapacity,omitempty"`
|
MaxCacheDiskCapacity *SizeCapacity `protobuf:"bytes,17,opt,name=maxCacheDiskCapacity,proto3" json:"maxCacheDiskCapacity,omitempty"`
|
||||||
MaxCacheMemoryCapacity *SizeCapacity `protobuf:"bytes,18,opt,name=maxCacheMemoryCapacity,proto3" json:"maxCacheMemoryCapacity,omitempty"`
|
MaxCacheMemoryCapacity *SizeCapacity `protobuf:"bytes,18,opt,name=maxCacheMemoryCapacity,proto3" json:"maxCacheMemoryCapacity,omitempty"`
|
||||||
CacheDiskDir string `protobuf:"bytes,19,opt,name=cacheDiskDir,proto3" json:"cacheDiskDir,omitempty"`
|
CacheDiskDir string `protobuf:"bytes,19,opt,name=cacheDiskDir,proto3" json:"cacheDiskDir,omitempty"`
|
||||||
|
Level int32 `protobuf:"varint,20,opt,name=level,proto3" json:"level,omitempty"`
|
||||||
|
LnAddrs []string `protobuf:"bytes,21,rep,name=lnAddrs,proto3" json:"lnAddrs,omitempty"` // Ln访问地址
|
||||||
NodeCluster *NodeCluster `protobuf:"bytes,32,opt,name=nodeCluster,proto3" json:"nodeCluster,omitempty"` // 主集群
|
NodeCluster *NodeCluster `protobuf:"bytes,32,opt,name=nodeCluster,proto3" json:"nodeCluster,omitempty"` // 主集群
|
||||||
NodeLogin *NodeLogin `protobuf:"bytes,33,opt,name=nodeLogin,proto3" json:"nodeLogin,omitempty"`
|
NodeLogin *NodeLogin `protobuf:"bytes,33,opt,name=nodeLogin,proto3" json:"nodeLogin,omitempty"`
|
||||||
InstallStatus *NodeInstallStatus `protobuf:"bytes,34,opt,name=installStatus,proto3" json:"installStatus,omitempty"`
|
InstallStatus *NodeInstallStatus `protobuf:"bytes,34,opt,name=installStatus,proto3" json:"installStatus,omitempty"`
|
||||||
@@ -223,6 +225,20 @@ func (x *Node) GetCacheDiskDir() string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *Node) GetLevel() int32 {
|
||||||
|
if x != nil {
|
||||||
|
return x.Level
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Node) GetLnAddrs() []string {
|
||||||
|
if x != nil {
|
||||||
|
return x.LnAddrs
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func (x *Node) GetNodeCluster() *NodeCluster {
|
func (x *Node) GetNodeCluster() *NodeCluster {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.NodeCluster
|
return x.NodeCluster
|
||||||
@@ -281,6 +297,7 @@ type BasicNode struct {
|
|||||||
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
|
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
|
||||||
IsOn bool `protobuf:"varint,3,opt,name=isOn,proto3" json:"isOn,omitempty"`
|
IsOn bool `protobuf:"varint,3,opt,name=isOn,proto3" json:"isOn,omitempty"`
|
||||||
IsUp bool `protobuf:"varint,4,opt,name=isUp,proto3" json:"isUp,omitempty"`
|
IsUp bool `protobuf:"varint,4,opt,name=isUp,proto3" json:"isUp,omitempty"`
|
||||||
|
Level int32 `protobuf:"varint,5,opt,name=level,proto3" json:"level,omitempty"`
|
||||||
NodeCluster *NodeCluster `protobuf:"bytes,30,opt,name=nodeCluster,proto3" json:"nodeCluster,omitempty"` // 主集群
|
NodeCluster *NodeCluster `protobuf:"bytes,30,opt,name=nodeCluster,proto3" json:"nodeCluster,omitempty"` // 主集群
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -344,6 +361,13 @@ func (x *BasicNode) GetIsUp() bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *BasicNode) GetLevel() int32 {
|
||||||
|
if x != nil {
|
||||||
|
return x.Level
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
func (x *BasicNode) GetNodeCluster() *NodeCluster {
|
func (x *BasicNode) GetNodeCluster() *NodeCluster {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.NodeCluster
|
return x.NodeCluster
|
||||||
@@ -372,7 +396,7 @@ var file_models_model_node_proto_rawDesc = []byte{
|
|||||||
0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x64, 0x6e, 0x73, 0x5f, 0x72, 0x6f, 0x75, 0x74, 0x65,
|
0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x64, 0x6e, 0x73, 0x5f, 0x72, 0x6f, 0x75, 0x74, 0x65,
|
||||||
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d,
|
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d,
|
||||||
0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x5f, 0x63, 0x61, 0x70, 0x61, 0x63, 0x69,
|
0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x5f, 0x63, 0x61, 0x70, 0x61, 0x63, 0x69,
|
||||||
0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xf8, 0x07, 0x0a, 0x04, 0x4e, 0x6f, 0x64,
|
0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xa8, 0x08, 0x0a, 0x04, 0x4e, 0x6f, 0x64,
|
||||||
0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69,
|
0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69,
|
||||||
0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
|
0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||||
0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x4a,
|
0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x4a,
|
||||||
@@ -412,7 +436,10 @@ var file_models_model_node_proto_rawDesc = []byte{
|
|||||||
0x79, 0x52, 0x16, 0x6d, 0x61, 0x78, 0x43, 0x61, 0x63, 0x68, 0x65, 0x4d, 0x65, 0x6d, 0x6f, 0x72,
|
0x79, 0x52, 0x16, 0x6d, 0x61, 0x78, 0x43, 0x61, 0x63, 0x68, 0x65, 0x4d, 0x65, 0x6d, 0x6f, 0x72,
|
||||||
0x79, 0x43, 0x61, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x12, 0x22, 0x0a, 0x0c, 0x63, 0x61, 0x63,
|
0x79, 0x43, 0x61, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x12, 0x22, 0x0a, 0x0c, 0x63, 0x61, 0x63,
|
||||||
0x68, 0x65, 0x44, 0x69, 0x73, 0x6b, 0x44, 0x69, 0x72, 0x18, 0x13, 0x20, 0x01, 0x28, 0x09, 0x52,
|
0x68, 0x65, 0x44, 0x69, 0x73, 0x6b, 0x44, 0x69, 0x72, 0x18, 0x13, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||||
0x0c, 0x63, 0x61, 0x63, 0x68, 0x65, 0x44, 0x69, 0x73, 0x6b, 0x44, 0x69, 0x72, 0x12, 0x31, 0x0a,
|
0x0c, 0x63, 0x61, 0x63, 0x68, 0x65, 0x44, 0x69, 0x73, 0x6b, 0x44, 0x69, 0x72, 0x12, 0x14, 0x0a,
|
||||||
|
0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x14, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6c, 0x65,
|
||||||
|
0x76, 0x65, 0x6c, 0x12, 0x18, 0x0a, 0x07, 0x6c, 0x6e, 0x41, 0x64, 0x64, 0x72, 0x73, 0x18, 0x15,
|
||||||
|
0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x6c, 0x6e, 0x41, 0x64, 0x64, 0x72, 0x73, 0x12, 0x31, 0x0a,
|
||||||
0x0b, 0x6e, 0x6f, 0x64, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x18, 0x20, 0x20, 0x01,
|
0x0b, 0x6e, 0x6f, 0x64, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x18, 0x20, 0x20, 0x01,
|
||||||
0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x43, 0x6c, 0x75, 0x73,
|
0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x43, 0x6c, 0x75, 0x73,
|
||||||
0x74, 0x65, 0x72, 0x52, 0x0b, 0x6e, 0x6f, 0x64, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72,
|
0x74, 0x65, 0x72, 0x52, 0x0b, 0x6e, 0x6f, 0x64, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72,
|
||||||
@@ -436,16 +463,18 @@ var file_models_model_node_proto_rawDesc = []byte{
|
|||||||
0x73, 0x74, 0x65, 0x72, 0x73, 0x18, 0x26, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x62,
|
0x73, 0x74, 0x65, 0x72, 0x73, 0x18, 0x26, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x62,
|
||||||
0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x52, 0x15, 0x73, 0x65,
|
0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x52, 0x15, 0x73, 0x65,
|
||||||
0x63, 0x6f, 0x6e, 0x64, 0x61, 0x72, 0x79, 0x4e, 0x6f, 0x64, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74,
|
0x63, 0x6f, 0x6e, 0x64, 0x61, 0x72, 0x79, 0x4e, 0x6f, 0x64, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74,
|
||||||
0x65, 0x72, 0x73, 0x22, 0x8a, 0x01, 0x0a, 0x09, 0x42, 0x61, 0x73, 0x69, 0x63, 0x4e, 0x6f, 0x64,
|
0x65, 0x72, 0x73, 0x22, 0xa0, 0x01, 0x0a, 0x09, 0x42, 0x61, 0x73, 0x69, 0x63, 0x4e, 0x6f, 0x64,
|
||||||
0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69,
|
0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69,
|
||||||
0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
|
0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||||
0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x73, 0x4f, 0x6e, 0x18, 0x03, 0x20,
|
0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x73, 0x4f, 0x6e, 0x18, 0x03, 0x20,
|
||||||
0x01, 0x28, 0x08, 0x52, 0x04, 0x69, 0x73, 0x4f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x73, 0x55,
|
0x01, 0x28, 0x08, 0x52, 0x04, 0x69, 0x73, 0x4f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x73, 0x55,
|
||||||
0x70, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x69, 0x73, 0x55, 0x70, 0x12, 0x31, 0x0a,
|
0x70, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x69, 0x73, 0x55, 0x70, 0x12, 0x14, 0x0a,
|
||||||
0x0b, 0x6e, 0x6f, 0x64, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x18, 0x1e, 0x20, 0x01,
|
0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6c, 0x65,
|
||||||
0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x43, 0x6c, 0x75, 0x73,
|
0x76, 0x65, 0x6c, 0x12, 0x31, 0x0a, 0x0b, 0x6e, 0x6f, 0x64, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74,
|
||||||
0x74, 0x65, 0x72, 0x52, 0x0b, 0x6e, 0x6f, 0x64, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72,
|
0x65, 0x72, 0x18, 0x1e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x6f,
|
||||||
0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x64, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x52, 0x0b, 0x6e, 0x6f, 0x64, 0x65, 0x43,
|
||||||
|
0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06,
|
||||||
|
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|||||||
@@ -30,23 +30,22 @@ type NodeCluster struct {
|
|||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
|
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||||
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
|
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
|
||||||
CreatedAt int64 `protobuf:"varint,3,opt,name=createdAt,proto3" json:"createdAt,omitempty"`
|
CreatedAt int64 `protobuf:"varint,3,opt,name=createdAt,proto3" json:"createdAt,omitempty"`
|
||||||
NodeGrantId int64 `protobuf:"varint,4,opt,name=nodeGrantId,proto3" json:"nodeGrantId,omitempty"`
|
NodeGrantId int64 `protobuf:"varint,4,opt,name=nodeGrantId,proto3" json:"nodeGrantId,omitempty"`
|
||||||
InstallDir string `protobuf:"bytes,5,opt,name=installDir,proto3" json:"installDir,omitempty"`
|
InstallDir string `protobuf:"bytes,5,opt,name=installDir,proto3" json:"installDir,omitempty"`
|
||||||
UniqueId string `protobuf:"bytes,6,opt,name=uniqueId,proto3" json:"uniqueId,omitempty"`
|
UniqueId string `protobuf:"bytes,6,opt,name=uniqueId,proto3" json:"uniqueId,omitempty"`
|
||||||
Secret string `protobuf:"bytes,7,opt,name=secret,proto3" json:"secret,omitempty"`
|
Secret string `protobuf:"bytes,7,opt,name=secret,proto3" json:"secret,omitempty"`
|
||||||
DnsName string `protobuf:"bytes,8,opt,name=dnsName,proto3" json:"dnsName,omitempty"`
|
DnsName string `protobuf:"bytes,8,opt,name=dnsName,proto3" json:"dnsName,omitempty"`
|
||||||
DnsDomainId int64 `protobuf:"varint,9,opt,name=dnsDomainId,proto3" json:"dnsDomainId,omitempty"`
|
DnsDomainId int64 `protobuf:"varint,9,opt,name=dnsDomainId,proto3" json:"dnsDomainId,omitempty"`
|
||||||
HttpCachePolicyId int64 `protobuf:"varint,10,opt,name=httpCachePolicyId,proto3" json:"httpCachePolicyId,omitempty"`
|
HttpCachePolicyId int64 `protobuf:"varint,10,opt,name=httpCachePolicyId,proto3" json:"httpCachePolicyId,omitempty"`
|
||||||
HttpFirewallPolicyId int64 `protobuf:"varint,11,opt,name=httpFirewallPolicyId,proto3" json:"httpFirewallPolicyId,omitempty"`
|
HttpFirewallPolicyId int64 `protobuf:"varint,11,opt,name=httpFirewallPolicyId,proto3" json:"httpFirewallPolicyId,omitempty"`
|
||||||
IsOn bool `protobuf:"varint,12,opt,name=isOn,proto3" json:"isOn,omitempty"`
|
IsOn bool `protobuf:"varint,12,opt,name=isOn,proto3" json:"isOn,omitempty"`
|
||||||
TimeZone string `protobuf:"bytes,13,opt,name=timeZone,proto3" json:"timeZone,omitempty"`
|
TimeZone string `protobuf:"bytes,13,opt,name=timeZone,proto3" json:"timeZone,omitempty"`
|
||||||
NodeMaxThreads int32 `protobuf:"varint,14,opt,name=nodeMaxThreads,proto3" json:"nodeMaxThreads,omitempty"`
|
NodeMaxThreads int32 `protobuf:"varint,14,opt,name=nodeMaxThreads,proto3" json:"nodeMaxThreads,omitempty"`
|
||||||
NodeTCPMaxConnections int32 `protobuf:"varint,15,opt,name=nodeTCPMaxConnections,proto3" json:"nodeTCPMaxConnections,omitempty"`
|
AutoOpenPorts bool `protobuf:"varint,16,opt,name=autoOpenPorts,proto3" json:"autoOpenPorts,omitempty"`
|
||||||
AutoOpenPorts bool `protobuf:"varint,16,opt,name=autoOpenPorts,proto3" json:"autoOpenPorts,omitempty"`
|
IsPinned bool `protobuf:"varint,17,opt,name=isPinned,proto3" json:"isPinned,omitempty"`
|
||||||
IsPinned bool `protobuf:"varint,17,opt,name=isPinned,proto3" json:"isPinned,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *NodeCluster) Reset() {
|
func (x *NodeCluster) Reset() {
|
||||||
@@ -179,13 +178,6 @@ func (x *NodeCluster) GetNodeMaxThreads() int32 {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *NodeCluster) GetNodeTCPMaxConnections() int32 {
|
|
||||||
if x != nil {
|
|
||||||
return x.NodeTCPMaxConnections
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *NodeCluster) GetAutoOpenPorts() bool {
|
func (x *NodeCluster) GetAutoOpenPorts() bool {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.AutoOpenPorts
|
return x.AutoOpenPorts
|
||||||
@@ -205,7 +197,7 @@ var File_models_model_node_cluster_proto protoreflect.FileDescriptor
|
|||||||
var file_models_model_node_cluster_proto_rawDesc = []byte{
|
var file_models_model_node_cluster_proto_rawDesc = []byte{
|
||||||
0x0a, 0x1f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x6e,
|
0x0a, 0x1f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x6e,
|
||||||
0x6f, 0x64, 0x65, 0x5f, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74,
|
0x6f, 0x64, 0x65, 0x5f, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74,
|
||||||
0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, 0xb3, 0x04, 0x0a, 0x0b, 0x4e, 0x6f, 0x64, 0x65, 0x43, 0x6c,
|
0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, 0xfd, 0x03, 0x0a, 0x0b, 0x4e, 0x6f, 0x64, 0x65, 0x43, 0x6c,
|
||||||
0x75, 0x73, 0x74, 0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
|
0x75, 0x73, 0x74, 0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||||
0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20,
|
0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20,
|
||||||
0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x72, 0x65,
|
0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x72, 0x65,
|
||||||
@@ -233,15 +225,12 @@ var file_models_model_node_cluster_proto_rawDesc = []byte{
|
|||||||
0x09, 0x52, 0x08, 0x74, 0x69, 0x6d, 0x65, 0x5a, 0x6f, 0x6e, 0x65, 0x12, 0x26, 0x0a, 0x0e, 0x6e,
|
0x09, 0x52, 0x08, 0x74, 0x69, 0x6d, 0x65, 0x5a, 0x6f, 0x6e, 0x65, 0x12, 0x26, 0x0a, 0x0e, 0x6e,
|
||||||
0x6f, 0x64, 0x65, 0x4d, 0x61, 0x78, 0x54, 0x68, 0x72, 0x65, 0x61, 0x64, 0x73, 0x18, 0x0e, 0x20,
|
0x6f, 0x64, 0x65, 0x4d, 0x61, 0x78, 0x54, 0x68, 0x72, 0x65, 0x61, 0x64, 0x73, 0x18, 0x0e, 0x20,
|
||||||
0x01, 0x28, 0x05, 0x52, 0x0e, 0x6e, 0x6f, 0x64, 0x65, 0x4d, 0x61, 0x78, 0x54, 0x68, 0x72, 0x65,
|
0x01, 0x28, 0x05, 0x52, 0x0e, 0x6e, 0x6f, 0x64, 0x65, 0x4d, 0x61, 0x78, 0x54, 0x68, 0x72, 0x65,
|
||||||
0x61, 0x64, 0x73, 0x12, 0x34, 0x0a, 0x15, 0x6e, 0x6f, 0x64, 0x65, 0x54, 0x43, 0x50, 0x4d, 0x61,
|
0x61, 0x64, 0x73, 0x12, 0x24, 0x0a, 0x0d, 0x61, 0x75, 0x74, 0x6f, 0x4f, 0x70, 0x65, 0x6e, 0x50,
|
||||||
0x78, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x0f, 0x20, 0x01,
|
0x6f, 0x72, 0x74, 0x73, 0x18, 0x10, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x61, 0x75, 0x74, 0x6f,
|
||||||
0x28, 0x05, 0x52, 0x15, 0x6e, 0x6f, 0x64, 0x65, 0x54, 0x43, 0x50, 0x4d, 0x61, 0x78, 0x43, 0x6f,
|
0x4f, 0x70, 0x65, 0x6e, 0x50, 0x6f, 0x72, 0x74, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x73, 0x50,
|
||||||
0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x24, 0x0a, 0x0d, 0x61, 0x75, 0x74,
|
0x69, 0x6e, 0x6e, 0x65, 0x64, 0x18, 0x11, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x69, 0x73, 0x50,
|
||||||
0x6f, 0x4f, 0x70, 0x65, 0x6e, 0x50, 0x6f, 0x72, 0x74, 0x73, 0x18, 0x10, 0x20, 0x01, 0x28, 0x08,
|
0x69, 0x6e, 0x6e, 0x65, 0x64, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70,
|
||||||
0x52, 0x0d, 0x61, 0x75, 0x74, 0x6f, 0x4f, 0x70, 0x65, 0x6e, 0x50, 0x6f, 0x72, 0x74, 0x73, 0x12,
|
0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
0x1a, 0x0a, 0x08, 0x69, 0x73, 0x50, 0x69, 0x6e, 0x6e, 0x65, 0x64, 0x18, 0x11, 0x20, 0x01, 0x28,
|
|
||||||
0x08, 0x52, 0x08, 0x69, 0x73, 0x50, 0x69, 0x6e, 0x6e, 0x65, 0x64, 0x42, 0x06, 0x5a, 0x04, 0x2e,
|
|
||||||
0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ type NodeIPAddress struct {
|
|||||||
IsUp bool `protobuf:"varint,10,opt,name=isUp,proto3" json:"isUp,omitempty"`
|
IsUp bool `protobuf:"varint,10,opt,name=isUp,proto3" json:"isUp,omitempty"`
|
||||||
Role string `protobuf:"bytes,12,opt,name=role,proto3" json:"role,omitempty"`
|
Role string `protobuf:"bytes,12,opt,name=role,proto3" json:"role,omitempty"`
|
||||||
BackupIP string `protobuf:"bytes,13,opt,name=backupIP,proto3" json:"backupIP,omitempty"`
|
BackupIP string `protobuf:"bytes,13,opt,name=backupIP,proto3" json:"backupIP,omitempty"`
|
||||||
|
IsHealthy bool `protobuf:"varint,14,opt,name=isHealthy,proto3" json:"isHealthy,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *NodeIPAddress) Reset() {
|
func (x *NodeIPAddress) Reset() {
|
||||||
@@ -161,12 +162,19 @@ func (x *NodeIPAddress) GetBackupIP() string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *NodeIPAddress) GetIsHealthy() bool {
|
||||||
|
if x != nil {
|
||||||
|
return x.IsHealthy
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
var File_models_model_node_ip_address_proto protoreflect.FileDescriptor
|
var File_models_model_node_ip_address_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
var file_models_model_node_ip_address_proto_rawDesc = []byte{
|
var file_models_model_node_ip_address_proto_rawDesc = []byte{
|
||||||
0x0a, 0x22, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x6e,
|
0x0a, 0x22, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x6e,
|
||||||
0x6f, 0x64, 0x65, 0x5f, 0x69, 0x70, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x2e, 0x70,
|
0x6f, 0x64, 0x65, 0x5f, 0x69, 0x70, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x2e, 0x70,
|
||||||
0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, 0x9f, 0x02, 0x0a, 0x0d, 0x4e, 0x6f, 0x64,
|
0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, 0xbd, 0x02, 0x0a, 0x0d, 0x4e, 0x6f, 0x64,
|
||||||
0x65, 0x49, 0x50, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64,
|
0x65, 0x49, 0x50, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64,
|
||||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x6f,
|
0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x6f,
|
||||||
0x64, 0x65, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x6e, 0x6f, 0x64, 0x65,
|
0x64, 0x65, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x6e, 0x6f, 0x64, 0x65,
|
||||||
@@ -184,8 +192,10 @@ var file_models_model_node_ip_address_proto_rawDesc = []byte{
|
|||||||
0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x69, 0x73, 0x55, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x72, 0x6f,
|
0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x69, 0x73, 0x55, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x72, 0x6f,
|
||||||
0x6c, 0x65, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x12, 0x1a,
|
0x6c, 0x65, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x12, 0x1a,
|
||||||
0x0a, 0x08, 0x62, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x49, 0x50, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x09,
|
0x0a, 0x08, 0x62, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x49, 0x50, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x09,
|
||||||
0x52, 0x08, 0x62, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x49, 0x50, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f,
|
0x52, 0x08, 0x62, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x49, 0x50, 0x12, 0x1c, 0x0a, 0x09, 0x69, 0x73,
|
||||||
0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x79, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x69,
|
||||||
|
0x73, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x79, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62,
|
||||||
|
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|||||||
@@ -35,6 +35,9 @@ type NSCluster struct {
|
|||||||
IsOn bool `protobuf:"varint,2,opt,name=isOn,proto3" json:"isOn,omitempty"`
|
IsOn bool `protobuf:"varint,2,opt,name=isOn,proto3" json:"isOn,omitempty"`
|
||||||
Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"`
|
Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"`
|
||||||
InstallDir string `protobuf:"bytes,4,opt,name=installDir,proto3" json:"installDir,omitempty"`
|
InstallDir string `protobuf:"bytes,4,opt,name=installDir,proto3" json:"installDir,omitempty"`
|
||||||
|
TcpJSON []byte `protobuf:"bytes,5,opt,name=tcpJSON,proto3" json:"tcpJSON,omitempty"`
|
||||||
|
TlsJSON []byte `protobuf:"bytes,6,opt,name=tlsJSON,proto3" json:"tlsJSON,omitempty"`
|
||||||
|
UdpJSON []byte `protobuf:"bytes,7,opt,name=udpJSON,proto3" json:"udpJSON,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *NSCluster) Reset() {
|
func (x *NSCluster) Reset() {
|
||||||
@@ -97,19 +100,45 @@ func (x *NSCluster) GetInstallDir() string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *NSCluster) GetTcpJSON() []byte {
|
||||||
|
if x != nil {
|
||||||
|
return x.TcpJSON
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *NSCluster) GetTlsJSON() []byte {
|
||||||
|
if x != nil {
|
||||||
|
return x.TlsJSON
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *NSCluster) GetUdpJSON() []byte {
|
||||||
|
if x != nil {
|
||||||
|
return x.UdpJSON
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
var File_models_model_ns_cluster_proto protoreflect.FileDescriptor
|
var File_models_model_ns_cluster_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
var file_models_model_ns_cluster_proto_rawDesc = []byte{
|
var file_models_model_ns_cluster_proto_rawDesc = []byte{
|
||||||
0x0a, 0x1d, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x6e,
|
0x0a, 0x1d, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x6e,
|
||||||
0x73, 0x5f, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12,
|
0x73, 0x5f, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12,
|
||||||
0x02, 0x70, 0x62, 0x22, 0x63, 0x0a, 0x09, 0x4e, 0x53, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72,
|
0x02, 0x70, 0x62, 0x22, 0xb1, 0x01, 0x0a, 0x09, 0x4e, 0x53, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65,
|
||||||
0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64,
|
0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69,
|
||||||
0x12, 0x12, 0x0a, 0x04, 0x69, 0x73, 0x4f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04,
|
0x64, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x73, 0x4f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52,
|
||||||
0x69, 0x73, 0x4f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01,
|
0x04, 0x69, 0x73, 0x4f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20,
|
||||||
0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x69, 0x6e, 0x73, 0x74,
|
0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x69, 0x6e, 0x73,
|
||||||
0x61, 0x6c, 0x6c, 0x44, 0x69, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x69, 0x6e,
|
0x74, 0x61, 0x6c, 0x6c, 0x44, 0x69, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x69,
|
||||||
0x73, 0x74, 0x61, 0x6c, 0x6c, 0x44, 0x69, 0x72, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62,
|
0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x44, 0x69, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x74, 0x63, 0x70,
|
||||||
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x74, 0x63, 0x70, 0x4a,
|
||||||
|
0x53, 0x4f, 0x4e, 0x12, 0x18, 0x0a, 0x07, 0x74, 0x6c, 0x73, 0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x06,
|
||||||
|
0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x74, 0x6c, 0x73, 0x4a, 0x53, 0x4f, 0x4e, 0x12, 0x18, 0x0a,
|
||||||
|
0x07, 0x75, 0x64, 0x70, 0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07,
|
||||||
|
0x75, 0x64, 0x70, 0x4a, 0x53, 0x4f, 0x4e, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62,
|
||||||
|
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|||||||
@@ -31,15 +31,17 @@ type NSDomain struct {
|
|||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
|
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||||
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
|
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
|
||||||
IsOn bool `protobuf:"varint,3,opt,name=isOn,proto3" json:"isOn,omitempty"`
|
IsOn bool `protobuf:"varint,3,opt,name=isOn,proto3" json:"isOn,omitempty"`
|
||||||
CreatedAt int64 `protobuf:"varint,4,opt,name=createdAt,proto3" json:"createdAt,omitempty"`
|
CreatedAt int64 `protobuf:"varint,4,opt,name=createdAt,proto3" json:"createdAt,omitempty"`
|
||||||
IsDeleted bool `protobuf:"varint,5,opt,name=isDeleted,proto3" json:"isDeleted,omitempty"`
|
IsDeleted bool `protobuf:"varint,5,opt,name=isDeleted,proto3" json:"isDeleted,omitempty"`
|
||||||
Version int64 `protobuf:"varint,6,opt,name=version,proto3" json:"version,omitempty"`
|
Version int64 `protobuf:"varint,6,opt,name=version,proto3" json:"version,omitempty"`
|
||||||
TsigJSON []byte `protobuf:"bytes,7,opt,name=tsigJSON,proto3" json:"tsigJSON,omitempty"`
|
TsigJSON []byte `protobuf:"bytes,7,opt,name=tsigJSON,proto3" json:"tsigJSON,omitempty"`
|
||||||
NsCluster *NSCluster `protobuf:"bytes,30,opt,name=nsCluster,proto3" json:"nsCluster,omitempty"`
|
NsDomainGroupIds []int64 `protobuf:"varint,8,rep,packed,name=nsDomainGroupIds,proto3" json:"nsDomainGroupIds,omitempty"`
|
||||||
User *User `protobuf:"bytes,31,opt,name=user,proto3" json:"user,omitempty"`
|
NsCluster *NSCluster `protobuf:"bytes,30,opt,name=nsCluster,proto3" json:"nsCluster,omitempty"`
|
||||||
|
User *User `protobuf:"bytes,31,opt,name=user,proto3" json:"user,omitempty"`
|
||||||
|
NsDomainGroups []*NSDomainGroup `protobuf:"bytes,32,rep,name=nsDomainGroups,proto3" json:"nsDomainGroups,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *NSDomain) Reset() {
|
func (x *NSDomain) Reset() {
|
||||||
@@ -123,6 +125,13 @@ func (x *NSDomain) GetTsigJSON() []byte {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *NSDomain) GetNsDomainGroupIds() []int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.NsDomainGroupIds
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func (x *NSDomain) GetNsCluster() *NSCluster {
|
func (x *NSDomain) GetNsCluster() *NSCluster {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.NsCluster
|
return x.NsCluster
|
||||||
@@ -137,6 +146,13 @@ func (x *NSDomain) GetUser() *User {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *NSDomain) GetNsDomainGroups() []*NSDomainGroup {
|
||||||
|
if x != nil {
|
||||||
|
return x.NsDomainGroups
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
var File_models_model_ns_domain_proto protoreflect.FileDescriptor
|
var File_models_model_ns_domain_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
var file_models_model_ns_domain_proto_rawDesc = []byte{
|
var file_models_model_ns_domain_proto_rawDesc = []byte{
|
||||||
@@ -144,25 +160,34 @@ var file_models_model_ns_domain_proto_rawDesc = []byte{
|
|||||||
0x73, 0x5f, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02,
|
0x73, 0x5f, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02,
|
||||||
0x70, 0x62, 0x1a, 0x1d, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c,
|
0x70, 0x62, 0x1a, 0x1d, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c,
|
||||||
0x5f, 0x6e, 0x73, 0x5f, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74,
|
0x5f, 0x6e, 0x73, 0x5f, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74,
|
||||||
0x6f, 0x1a, 0x17, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f,
|
0x6f, 0x1a, 0x22, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f,
|
||||||
0x75, 0x73, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xff, 0x01, 0x0a, 0x08, 0x4e,
|
0x6e, 0x73, 0x5f, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x2e,
|
||||||
0x53, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20,
|
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f,
|
||||||
0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18,
|
0x64, 0x65, 0x6c, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xe6,
|
||||||
0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x69,
|
0x02, 0x0a, 0x08, 0x4e, 0x53, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69,
|
||||||
0x73, 0x4f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x69, 0x73, 0x4f, 0x6e, 0x12,
|
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e,
|
||||||
0x1c, 0x0a, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, 0x04, 0x20, 0x01,
|
0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12,
|
||||||
0x28, 0x03, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x1c, 0x0a,
|
0x12, 0x0a, 0x04, 0x69, 0x73, 0x4f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x69,
|
||||||
0x09, 0x69, 0x73, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08,
|
0x73, 0x4f, 0x6e, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74,
|
||||||
0x52, 0x09, 0x69, 0x73, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x76,
|
0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41,
|
||||||
0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x76, 0x65,
|
0x74, 0x12, 0x1c, 0x0a, 0x09, 0x69, 0x73, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x18, 0x05,
|
||||||
0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x74, 0x73, 0x69, 0x67, 0x4a, 0x53, 0x4f,
|
0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x69, 0x73, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x12,
|
||||||
0x4e, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x74, 0x73, 0x69, 0x67, 0x4a, 0x53, 0x4f,
|
0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03,
|
||||||
0x4e, 0x12, 0x2b, 0x0a, 0x09, 0x6e, 0x73, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x18, 0x1e,
|
0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x74, 0x73, 0x69,
|
||||||
|
0x67, 0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x74, 0x73, 0x69,
|
||||||
|
0x67, 0x4a, 0x53, 0x4f, 0x4e, 0x12, 0x2a, 0x0a, 0x10, 0x6e, 0x73, 0x44, 0x6f, 0x6d, 0x61, 0x69,
|
||||||
|
0x6e, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x64, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x03, 0x52,
|
||||||
|
0x10, 0x6e, 0x73, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x64,
|
||||||
|
0x73, 0x12, 0x2b, 0x0a, 0x09, 0x6e, 0x73, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x18, 0x1e,
|
||||||
0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x53, 0x43, 0x6c, 0x75, 0x73,
|
0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x53, 0x43, 0x6c, 0x75, 0x73,
|
||||||
0x74, 0x65, 0x72, 0x52, 0x09, 0x6e, 0x73, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x12, 0x1c,
|
0x74, 0x65, 0x72, 0x52, 0x09, 0x6e, 0x73, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x12, 0x1c,
|
||||||
0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x1f, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x70,
|
0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x1f, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x70,
|
||||||
0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x42, 0x06, 0x5a, 0x04,
|
0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x12, 0x39, 0x0a, 0x0e,
|
||||||
0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x6e, 0x73, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x18, 0x20,
|
||||||
|
0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x53, 0x44, 0x6f, 0x6d, 0x61,
|
||||||
|
0x69, 0x6e, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x0e, 0x6e, 0x73, 0x44, 0x6f, 0x6d, 0x61, 0x69,
|
||||||
|
0x6e, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62,
|
||||||
|
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -179,18 +204,20 @@ func file_models_model_ns_domain_proto_rawDescGZIP() []byte {
|
|||||||
|
|
||||||
var file_models_model_ns_domain_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
|
var file_models_model_ns_domain_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
|
||||||
var file_models_model_ns_domain_proto_goTypes = []interface{}{
|
var file_models_model_ns_domain_proto_goTypes = []interface{}{
|
||||||
(*NSDomain)(nil), // 0: pb.NSDomain
|
(*NSDomain)(nil), // 0: pb.NSDomain
|
||||||
(*NSCluster)(nil), // 1: pb.NSCluster
|
(*NSCluster)(nil), // 1: pb.NSCluster
|
||||||
(*User)(nil), // 2: pb.User
|
(*User)(nil), // 2: pb.User
|
||||||
|
(*NSDomainGroup)(nil), // 3: pb.NSDomainGroup
|
||||||
}
|
}
|
||||||
var file_models_model_ns_domain_proto_depIdxs = []int32{
|
var file_models_model_ns_domain_proto_depIdxs = []int32{
|
||||||
1, // 0: pb.NSDomain.nsCluster:type_name -> pb.NSCluster
|
1, // 0: pb.NSDomain.nsCluster:type_name -> pb.NSCluster
|
||||||
2, // 1: pb.NSDomain.user:type_name -> pb.User
|
2, // 1: pb.NSDomain.user:type_name -> pb.User
|
||||||
2, // [2:2] is the sub-list for method output_type
|
3, // 2: pb.NSDomain.nsDomainGroups:type_name -> pb.NSDomainGroup
|
||||||
2, // [2:2] is the sub-list for method input_type
|
3, // [3:3] is the sub-list for method output_type
|
||||||
2, // [2:2] is the sub-list for extension type_name
|
3, // [3:3] is the sub-list for method input_type
|
||||||
2, // [2:2] is the sub-list for extension extendee
|
3, // [3:3] is the sub-list for extension type_name
|
||||||
0, // [0:2] is the sub-list for field type_name
|
3, // [3:3] is the sub-list for extension extendee
|
||||||
|
0, // [0:3] is the sub-list for field type_name
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() { file_models_model_ns_domain_proto_init() }
|
func init() { file_models_model_ns_domain_proto_init() }
|
||||||
@@ -199,6 +226,7 @@ func file_models_model_ns_domain_proto_init() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
file_models_model_ns_cluster_proto_init()
|
file_models_model_ns_cluster_proto_init()
|
||||||
|
file_models_model_ns_domain_group_proto_init()
|
||||||
file_models_model_user_proto_init()
|
file_models_model_user_proto_init()
|
||||||
if !protoimpl.UnsafeEnabled {
|
if !protoimpl.UnsafeEnabled {
|
||||||
file_models_model_ns_domain_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
file_models_model_ns_domain_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
|||||||
176
pkg/rpc/pb/model_ns_domain_group.pb.go
Normal file
176
pkg/rpc/pb/model_ns_domain_group.pb.go
Normal file
@@ -0,0 +1,176 @@
|
|||||||
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
|
// versions:
|
||||||
|
// protoc-gen-go v1.25.0
|
||||||
|
// protoc v3.19.4
|
||||||
|
// source: models/model_ns_domain_group.proto
|
||||||
|
|
||||||
|
package pb
|
||||||
|
|
||||||
|
import (
|
||||||
|
proto "github.com/golang/protobuf/proto"
|
||||||
|
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||||
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
|
reflect "reflect"
|
||||||
|
sync "sync"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// Verify that this generated code is sufficiently up-to-date.
|
||||||
|
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||||
|
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||||
|
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||||
|
)
|
||||||
|
|
||||||
|
// This is a compile-time assertion that a sufficiently up-to-date version
|
||||||
|
// of the legacy proto package is being used.
|
||||||
|
const _ = proto.ProtoPackageIsVersion4
|
||||||
|
|
||||||
|
// 域名分组
|
||||||
|
type NSDomainGroup struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||||
|
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
|
||||||
|
IsOn bool `protobuf:"varint,3,opt,name=isOn,proto3" json:"isOn,omitempty"`
|
||||||
|
UserId int64 `protobuf:"varint,4,opt,name=userId,proto3" json:"userId,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *NSDomainGroup) Reset() {
|
||||||
|
*x = NSDomainGroup{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_models_model_ns_domain_group_proto_msgTypes[0]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *NSDomainGroup) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*NSDomainGroup) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *NSDomainGroup) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_models_model_ns_domain_group_proto_msgTypes[0]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use NSDomainGroup.ProtoReflect.Descriptor instead.
|
||||||
|
func (*NSDomainGroup) Descriptor() ([]byte, []int) {
|
||||||
|
return file_models_model_ns_domain_group_proto_rawDescGZIP(), []int{0}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *NSDomainGroup) GetId() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.Id
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *NSDomainGroup) GetName() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Name
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *NSDomainGroup) GetIsOn() bool {
|
||||||
|
if x != nil {
|
||||||
|
return x.IsOn
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *NSDomainGroup) GetUserId() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.UserId
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
var File_models_model_ns_domain_group_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
|
var file_models_model_ns_domain_group_proto_rawDesc = []byte{
|
||||||
|
0x0a, 0x22, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x6e,
|
||||||
|
0x73, 0x5f, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x2e, 0x70,
|
||||||
|
0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, 0x5f, 0x0a, 0x0d, 0x4e, 0x53, 0x44, 0x6f,
|
||||||
|
0x6d, 0x61, 0x69, 0x6e, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18,
|
||||||
|
0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d,
|
||||||
|
0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a,
|
||||||
|
0x04, 0x69, 0x73, 0x4f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x69, 0x73, 0x4f,
|
||||||
|
0x6e, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28,
|
||||||
|
0x03, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70,
|
||||||
|
0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
file_models_model_ns_domain_group_proto_rawDescOnce sync.Once
|
||||||
|
file_models_model_ns_domain_group_proto_rawDescData = file_models_model_ns_domain_group_proto_rawDesc
|
||||||
|
)
|
||||||
|
|
||||||
|
func file_models_model_ns_domain_group_proto_rawDescGZIP() []byte {
|
||||||
|
file_models_model_ns_domain_group_proto_rawDescOnce.Do(func() {
|
||||||
|
file_models_model_ns_domain_group_proto_rawDescData = protoimpl.X.CompressGZIP(file_models_model_ns_domain_group_proto_rawDescData)
|
||||||
|
})
|
||||||
|
return file_models_model_ns_domain_group_proto_rawDescData
|
||||||
|
}
|
||||||
|
|
||||||
|
var file_models_model_ns_domain_group_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
|
||||||
|
var file_models_model_ns_domain_group_proto_goTypes = []interface{}{
|
||||||
|
(*NSDomainGroup)(nil), // 0: pb.NSDomainGroup
|
||||||
|
}
|
||||||
|
var file_models_model_ns_domain_group_proto_depIdxs = []int32{
|
||||||
|
0, // [0:0] is the sub-list for method output_type
|
||||||
|
0, // [0:0] is the sub-list for method input_type
|
||||||
|
0, // [0:0] is the sub-list for extension type_name
|
||||||
|
0, // [0:0] is the sub-list for extension extendee
|
||||||
|
0, // [0:0] is the sub-list for field type_name
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() { file_models_model_ns_domain_group_proto_init() }
|
||||||
|
func file_models_model_ns_domain_group_proto_init() {
|
||||||
|
if File_models_model_ns_domain_group_proto != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if !protoimpl.UnsafeEnabled {
|
||||||
|
file_models_model_ns_domain_group_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*NSDomainGroup); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
type x struct{}
|
||||||
|
out := protoimpl.TypeBuilder{
|
||||||
|
File: protoimpl.DescBuilder{
|
||||||
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
|
RawDescriptor: file_models_model_ns_domain_group_proto_rawDesc,
|
||||||
|
NumEnums: 0,
|
||||||
|
NumMessages: 1,
|
||||||
|
NumExtensions: 0,
|
||||||
|
NumServices: 0,
|
||||||
|
},
|
||||||
|
GoTypes: file_models_model_ns_domain_group_proto_goTypes,
|
||||||
|
DependencyIndexes: file_models_model_ns_domain_group_proto_depIdxs,
|
||||||
|
MessageInfos: file_models_model_ns_domain_group_proto_msgTypes,
|
||||||
|
}.Build()
|
||||||
|
File_models_model_ns_domain_group_proto = out.File
|
||||||
|
file_models_model_ns_domain_group_proto_rawDesc = nil
|
||||||
|
file_models_model_ns_domain_group_proto_goTypes = nil
|
||||||
|
file_models_model_ns_domain_group_proto_depIdxs = nil
|
||||||
|
}
|
||||||
@@ -31,19 +31,20 @@ type NSNode struct {
|
|||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
|
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||||
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
|
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
|
||||||
IsOn bool `protobuf:"varint,3,opt,name=isOn,proto3" json:"isOn,omitempty"`
|
IsOn bool `protobuf:"varint,3,opt,name=isOn,proto3" json:"isOn,omitempty"`
|
||||||
UniqueId string `protobuf:"bytes,4,opt,name=uniqueId,proto3" json:"uniqueId,omitempty"`
|
UniqueId string `protobuf:"bytes,4,opt,name=uniqueId,proto3" json:"uniqueId,omitempty"`
|
||||||
Secret string `protobuf:"bytes,5,opt,name=secret,proto3" json:"secret,omitempty"`
|
Secret string `protobuf:"bytes,5,opt,name=secret,proto3" json:"secret,omitempty"`
|
||||||
StatusJSON []byte `protobuf:"bytes,6,opt,name=statusJSON,proto3" json:"statusJSON,omitempty"`
|
StatusJSON []byte `protobuf:"bytes,6,opt,name=statusJSON,proto3" json:"statusJSON,omitempty"`
|
||||||
IsInstalled bool `protobuf:"varint,7,opt,name=isInstalled,proto3" json:"isInstalled,omitempty"`
|
IsInstalled bool `protobuf:"varint,7,opt,name=isInstalled,proto3" json:"isInstalled,omitempty"`
|
||||||
InstallDir string `protobuf:"bytes,9,opt,name=installDir,proto3" json:"installDir,omitempty"`
|
InstallDir string `protobuf:"bytes,9,opt,name=installDir,proto3" json:"installDir,omitempty"`
|
||||||
IsUp bool `protobuf:"varint,8,opt,name=isUp,proto3" json:"isUp,omitempty"`
|
IsUp bool `protobuf:"varint,8,opt,name=isUp,proto3" json:"isUp,omitempty"`
|
||||||
IsActive bool `protobuf:"varint,10,opt,name=isActive,proto3" json:"isActive,omitempty"`
|
IsActive bool `protobuf:"varint,10,opt,name=isActive,proto3" json:"isActive,omitempty"`
|
||||||
NsCluster *NSCluster `protobuf:"bytes,32,opt,name=nsCluster,proto3" json:"nsCluster,omitempty"`
|
ConnectedAPINodeIds []int64 `protobuf:"varint,11,rep,packed,name=connectedAPINodeIds,proto3" json:"connectedAPINodeIds,omitempty"`
|
||||||
NodeLogin *NodeLogin `protobuf:"bytes,33,opt,name=nodeLogin,proto3" json:"nodeLogin,omitempty"`
|
NsCluster *NSCluster `protobuf:"bytes,32,opt,name=nsCluster,proto3" json:"nsCluster,omitempty"`
|
||||||
InstallStatus *NodeInstallStatus `protobuf:"bytes,34,opt,name=installStatus,proto3" json:"installStatus,omitempty"`
|
NodeLogin *NodeLogin `protobuf:"bytes,33,opt,name=nodeLogin,proto3" json:"nodeLogin,omitempty"`
|
||||||
|
InstallStatus *NodeInstallStatus `protobuf:"bytes,34,opt,name=installStatus,proto3" json:"installStatus,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *NSNode) Reset() {
|
func (x *NSNode) Reset() {
|
||||||
@@ -148,6 +149,13 @@ func (x *NSNode) GetIsActive() bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *NSNode) GetConnectedAPINodeIds() []int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.ConnectedAPINodeIds
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func (x *NSNode) GetNsCluster() *NSCluster {
|
func (x *NSNode) GetNsCluster() *NSCluster {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.NsCluster
|
return x.NsCluster
|
||||||
@@ -180,7 +188,7 @@ var file_models_model_ns_node_proto_rawDesc = []byte{
|
|||||||
0x64, 0x65, 0x5f, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75,
|
0x64, 0x65, 0x5f, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75,
|
||||||
0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f,
|
0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f,
|
||||||
0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x6c, 0x6f, 0x67, 0x69, 0x6e,
|
0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x6c, 0x6f, 0x67, 0x69, 0x6e,
|
||||||
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x9d, 0x03, 0x0a, 0x06, 0x4e, 0x53, 0x4e, 0x6f, 0x64,
|
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xcf, 0x03, 0x0a, 0x06, 0x4e, 0x53, 0x4e, 0x6f, 0x64,
|
||||||
0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69,
|
0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69,
|
||||||
0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
|
0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||||
0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x73, 0x4f, 0x6e, 0x18, 0x03, 0x20,
|
0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x73, 0x4f, 0x6e, 0x18, 0x03, 0x20,
|
||||||
@@ -197,17 +205,20 @@ var file_models_model_ns_node_proto_rawDesc = []byte{
|
|||||||
0x12, 0x0a, 0x04, 0x69, 0x73, 0x55, 0x70, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x69,
|
0x12, 0x0a, 0x04, 0x69, 0x73, 0x55, 0x70, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x69,
|
||||||
0x73, 0x55, 0x70, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x73, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x18,
|
0x73, 0x55, 0x70, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x73, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x18,
|
||||||
0x0a, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x69, 0x73, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x12,
|
0x0a, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x69, 0x73, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x12,
|
||||||
0x2b, 0x0a, 0x09, 0x6e, 0x73, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x18, 0x20, 0x20, 0x01,
|
0x30, 0x0a, 0x13, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x65, 0x64, 0x41, 0x50, 0x49, 0x4e,
|
||||||
0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x53, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65,
|
0x6f, 0x64, 0x65, 0x49, 0x64, 0x73, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x03, 0x52, 0x13, 0x63, 0x6f,
|
||||||
0x72, 0x52, 0x09, 0x6e, 0x73, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x12, 0x2b, 0x0a, 0x09,
|
0x6e, 0x6e, 0x65, 0x63, 0x74, 0x65, 0x64, 0x41, 0x50, 0x49, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x64,
|
||||||
0x6e, 0x6f, 0x64, 0x65, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x18, 0x21, 0x20, 0x01, 0x28, 0x0b, 0x32,
|
0x73, 0x12, 0x2b, 0x0a, 0x09, 0x6e, 0x73, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x18, 0x20,
|
||||||
0x0d, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x09,
|
0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x53, 0x43, 0x6c, 0x75, 0x73,
|
||||||
0x6e, 0x6f, 0x64, 0x65, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x12, 0x3b, 0x0a, 0x0d, 0x69, 0x6e, 0x73,
|
0x74, 0x65, 0x72, 0x52, 0x09, 0x6e, 0x73, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x12, 0x2b,
|
||||||
0x74, 0x61, 0x6c, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x22, 0x20, 0x01, 0x28, 0x0b,
|
0x0a, 0x09, 0x6e, 0x6f, 0x64, 0x65, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x18, 0x21, 0x20, 0x01, 0x28,
|
||||||
0x32, 0x15, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c,
|
0x0b, 0x32, 0x0d, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x4c, 0x6f, 0x67, 0x69, 0x6e,
|
||||||
0x6c, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x0d, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c,
|
0x52, 0x09, 0x6e, 0x6f, 0x64, 0x65, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x12, 0x3b, 0x0a, 0x0d, 0x69,
|
||||||
0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06,
|
0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x22, 0x20, 0x01,
|
||||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x73, 0x74,
|
||||||
|
0x61, 0x6c, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x0d, 0x69, 0x6e, 0x73, 0x74, 0x61,
|
||||||
|
0x6c, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62,
|
||||||
|
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|||||||
@@ -30,13 +30,14 @@ type NSRecordHourlyStat struct {
|
|||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
NsClusterId int64 `protobuf:"varint,1,opt,name=nsClusterId,proto3" json:"nsClusterId,omitempty"`
|
NsClusterId int64 `protobuf:"varint,1,opt,name=nsClusterId,proto3" json:"nsClusterId,omitempty"`
|
||||||
NsNodeId int64 `protobuf:"varint,2,opt,name=nsNodeId,proto3" json:"nsNodeId,omitempty"`
|
NsNodeId int64 `protobuf:"varint,2,opt,name=nsNodeId,proto3" json:"nsNodeId,omitempty"`
|
||||||
NsDomainId int64 `protobuf:"varint,3,opt,name=nsDomainId,proto3" json:"nsDomainId,omitempty"`
|
NsDomainId int64 `protobuf:"varint,3,opt,name=nsDomainId,proto3" json:"nsDomainId,omitempty"`
|
||||||
NsRecordId int64 `protobuf:"varint,4,opt,name=nsRecordId,proto3" json:"nsRecordId,omitempty"`
|
NsRecordId int64 `protobuf:"varint,4,opt,name=nsRecordId,proto3" json:"nsRecordId,omitempty"`
|
||||||
Bytes int64 `protobuf:"varint,5,opt,name=bytes,proto3" json:"bytes,omitempty"`
|
Bytes int64 `protobuf:"varint,5,opt,name=bytes,proto3" json:"bytes,omitempty"`
|
||||||
CountRequests int64 `protobuf:"varint,6,opt,name=countRequests,proto3" json:"countRequests,omitempty"`
|
CountRequests int64 `protobuf:"varint,6,opt,name=countRequests,proto3" json:"countRequests,omitempty"`
|
||||||
CreatedAt int64 `protobuf:"varint,7,opt,name=createdAt,proto3" json:"createdAt,omitempty"`
|
CreatedAt int64 `protobuf:"varint,7,opt,name=createdAt,proto3" json:"createdAt,omitempty"`
|
||||||
|
Hour string `protobuf:"bytes,8,opt,name=hour,proto3" json:"hour,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *NSRecordHourlyStat) Reset() {
|
func (x *NSRecordHourlyStat) Reset() {
|
||||||
@@ -120,13 +121,20 @@ func (x *NSRecordHourlyStat) GetCreatedAt() int64 {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *NSRecordHourlyStat) GetHour() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Hour
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
var File_models_model_ns_record_hourly_stat_proto protoreflect.FileDescriptor
|
var File_models_model_ns_record_hourly_stat_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
var file_models_model_ns_record_hourly_stat_proto_rawDesc = []byte{
|
var file_models_model_ns_record_hourly_stat_proto_rawDesc = []byte{
|
||||||
0x0a, 0x28, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x6e,
|
0x0a, 0x28, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x6e,
|
||||||
0x73, 0x5f, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x5f, 0x68, 0x6f, 0x75, 0x72, 0x6c, 0x79, 0x5f,
|
0x73, 0x5f, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x5f, 0x68, 0x6f, 0x75, 0x72, 0x6c, 0x79, 0x5f,
|
||||||
0x73, 0x74, 0x61, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, 0xec,
|
0x73, 0x74, 0x61, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, 0x80,
|
||||||
0x01, 0x0a, 0x12, 0x4e, 0x53, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x48, 0x6f, 0x75, 0x72, 0x6c,
|
0x02, 0x0a, 0x12, 0x4e, 0x53, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x48, 0x6f, 0x75, 0x72, 0x6c,
|
||||||
0x79, 0x53, 0x74, 0x61, 0x74, 0x12, 0x20, 0x0a, 0x0b, 0x6e, 0x73, 0x43, 0x6c, 0x75, 0x73, 0x74,
|
0x79, 0x53, 0x74, 0x61, 0x74, 0x12, 0x20, 0x0a, 0x0b, 0x6e, 0x73, 0x43, 0x6c, 0x75, 0x73, 0x74,
|
||||||
0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x6e, 0x73, 0x43, 0x6c,
|
0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x6e, 0x73, 0x43, 0x6c,
|
||||||
0x75, 0x73, 0x74, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x6e, 0x73, 0x4e, 0x6f, 0x64,
|
0x75, 0x73, 0x74, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x6e, 0x73, 0x4e, 0x6f, 0x64,
|
||||||
@@ -140,8 +148,10 @@ var file_models_model_ns_record_hourly_stat_proto_rawDesc = []byte{
|
|||||||
0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03,
|
0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03,
|
||||||
0x52, 0x0d, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, 0x12,
|
0x52, 0x0d, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, 0x12,
|
||||||
0x1c, 0x0a, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, 0x07, 0x20, 0x01,
|
0x1c, 0x0a, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, 0x07, 0x20, 0x01,
|
||||||
0x28, 0x03, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x42, 0x06, 0x5a,
|
0x28, 0x03, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x12, 0x0a,
|
||||||
0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x04, 0x68, 0x6f, 0x75, 0x72, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x6f, 0x75,
|
||||||
|
0x72, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||||
|
0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|||||||
204
pkg/rpc/pb/model_order_method.pb.go
Normal file
204
pkg/rpc/pb/model_order_method.pb.go
Normal file
@@ -0,0 +1,204 @@
|
|||||||
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
|
// versions:
|
||||||
|
// protoc-gen-go v1.25.0
|
||||||
|
// protoc v3.19.4
|
||||||
|
// source: models/model_order_method.proto
|
||||||
|
|
||||||
|
package pb
|
||||||
|
|
||||||
|
import (
|
||||||
|
proto "github.com/golang/protobuf/proto"
|
||||||
|
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||||
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
|
reflect "reflect"
|
||||||
|
sync "sync"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// Verify that this generated code is sufficiently up-to-date.
|
||||||
|
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||||
|
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||||
|
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||||
|
)
|
||||||
|
|
||||||
|
// This is a compile-time assertion that a sufficiently up-to-date version
|
||||||
|
// of the legacy proto package is being used.
|
||||||
|
const _ = proto.ProtoPackageIsVersion4
|
||||||
|
|
||||||
|
// 订单支付方式
|
||||||
|
type OrderMethod struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||||
|
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
|
||||||
|
Code string `protobuf:"bytes,3,opt,name=code,proto3" json:"code,omitempty"`
|
||||||
|
Description string `protobuf:"bytes,4,opt,name=description,proto3" json:"description,omitempty"`
|
||||||
|
Url string `protobuf:"bytes,5,opt,name=url,proto3" json:"url,omitempty"`
|
||||||
|
Secret string `protobuf:"bytes,6,opt,name=secret,proto3" json:"secret,omitempty"`
|
||||||
|
IsOn bool `protobuf:"varint,7,opt,name=isOn,proto3" json:"isOn,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *OrderMethod) Reset() {
|
||||||
|
*x = OrderMethod{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_models_model_order_method_proto_msgTypes[0]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *OrderMethod) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*OrderMethod) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *OrderMethod) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_models_model_order_method_proto_msgTypes[0]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use OrderMethod.ProtoReflect.Descriptor instead.
|
||||||
|
func (*OrderMethod) Descriptor() ([]byte, []int) {
|
||||||
|
return file_models_model_order_method_proto_rawDescGZIP(), []int{0}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *OrderMethod) GetId() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.Id
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *OrderMethod) GetName() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Name
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *OrderMethod) GetCode() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Code
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *OrderMethod) GetDescription() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Description
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *OrderMethod) GetUrl() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Url
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *OrderMethod) GetSecret() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Secret
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *OrderMethod) GetIsOn() bool {
|
||||||
|
if x != nil {
|
||||||
|
return x.IsOn
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
var File_models_model_order_method_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
|
var file_models_model_order_method_proto_rawDesc = []byte{
|
||||||
|
0x0a, 0x1f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x6f,
|
||||||
|
0x72, 0x64, 0x65, 0x72, 0x5f, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x74,
|
||||||
|
0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, 0xa5, 0x01, 0x0a, 0x0b, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x4d,
|
||||||
|
0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||||
|
0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20,
|
||||||
|
0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64,
|
||||||
|
0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x20, 0x0a,
|
||||||
|
0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01,
|
||||||
|
0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12,
|
||||||
|
0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72,
|
||||||
|
0x6c, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28,
|
||||||
|
0x09, 0x52, 0x06, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x73, 0x4f,
|
||||||
|
0x6e, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x69, 0x73, 0x4f, 0x6e, 0x42, 0x06, 0x5a,
|
||||||
|
0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
file_models_model_order_method_proto_rawDescOnce sync.Once
|
||||||
|
file_models_model_order_method_proto_rawDescData = file_models_model_order_method_proto_rawDesc
|
||||||
|
)
|
||||||
|
|
||||||
|
func file_models_model_order_method_proto_rawDescGZIP() []byte {
|
||||||
|
file_models_model_order_method_proto_rawDescOnce.Do(func() {
|
||||||
|
file_models_model_order_method_proto_rawDescData = protoimpl.X.CompressGZIP(file_models_model_order_method_proto_rawDescData)
|
||||||
|
})
|
||||||
|
return file_models_model_order_method_proto_rawDescData
|
||||||
|
}
|
||||||
|
|
||||||
|
var file_models_model_order_method_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
|
||||||
|
var file_models_model_order_method_proto_goTypes = []interface{}{
|
||||||
|
(*OrderMethod)(nil), // 0: pb.OrderMethod
|
||||||
|
}
|
||||||
|
var file_models_model_order_method_proto_depIdxs = []int32{
|
||||||
|
0, // [0:0] is the sub-list for method output_type
|
||||||
|
0, // [0:0] is the sub-list for method input_type
|
||||||
|
0, // [0:0] is the sub-list for extension type_name
|
||||||
|
0, // [0:0] is the sub-list for extension extendee
|
||||||
|
0, // [0:0] is the sub-list for field type_name
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() { file_models_model_order_method_proto_init() }
|
||||||
|
func file_models_model_order_method_proto_init() {
|
||||||
|
if File_models_model_order_method_proto != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if !protoimpl.UnsafeEnabled {
|
||||||
|
file_models_model_order_method_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*OrderMethod); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
type x struct{}
|
||||||
|
out := protoimpl.TypeBuilder{
|
||||||
|
File: protoimpl.DescBuilder{
|
||||||
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
|
RawDescriptor: file_models_model_order_method_proto_rawDesc,
|
||||||
|
NumEnums: 0,
|
||||||
|
NumMessages: 1,
|
||||||
|
NumExtensions: 0,
|
||||||
|
NumServices: 0,
|
||||||
|
},
|
||||||
|
GoTypes: file_models_model_order_method_proto_goTypes,
|
||||||
|
DependencyIndexes: file_models_model_order_method_proto_depIdxs,
|
||||||
|
MessageInfos: file_models_model_order_method_proto_msgTypes,
|
||||||
|
}.Build()
|
||||||
|
File_models_model_order_method_proto = out.File
|
||||||
|
file_models_model_order_method_proto_rawDesc = nil
|
||||||
|
file_models_model_order_method_proto_goTypes = nil
|
||||||
|
file_models_model_order_method_proto_depIdxs = nil
|
||||||
|
}
|
||||||
@@ -37,6 +37,7 @@ type Origin struct {
|
|||||||
Description string `protobuf:"bytes,5,opt,name=description,proto3" json:"description,omitempty"`
|
Description string `protobuf:"bytes,5,opt,name=description,proto3" json:"description,omitempty"`
|
||||||
Domains []string `protobuf:"bytes,6,rep,name=domains,proto3" json:"domains,omitempty"`
|
Domains []string `protobuf:"bytes,6,rep,name=domains,proto3" json:"domains,omitempty"`
|
||||||
Host string `protobuf:"bytes,7,opt,name=host,proto3" json:"host,omitempty"`
|
Host string `protobuf:"bytes,7,opt,name=host,proto3" json:"host,omitempty"`
|
||||||
|
FollowPort bool `protobuf:"varint,8,opt,name=followPort,proto3" json:"followPort,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Origin) Reset() {
|
func (x *Origin) Reset() {
|
||||||
@@ -120,6 +121,13 @@ func (x *Origin) GetHost() string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *Origin) GetFollowPort() bool {
|
||||||
|
if x != nil {
|
||||||
|
return x.FollowPort
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
var File_models_model_origin_proto protoreflect.FileDescriptor
|
var File_models_model_origin_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
var file_models_model_origin_proto_rawDesc = []byte{
|
var file_models_model_origin_proto_rawDesc = []byte{
|
||||||
@@ -127,7 +135,7 @@ var file_models_model_origin_proto_rawDesc = []byte{
|
|||||||
0x72, 0x69, 0x67, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x1a,
|
0x72, 0x69, 0x67, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x1a,
|
||||||
0x22, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x6e, 0x65,
|
0x22, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x6e, 0x65,
|
||||||
0x74, 0x77, 0x6f, 0x72, 0x6b, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x2e, 0x70, 0x72,
|
0x74, 0x77, 0x6f, 0x72, 0x6b, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x2e, 0x70, 0x72,
|
||||||
0x6f, 0x74, 0x6f, 0x22, 0xb8, 0x01, 0x0a, 0x06, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x12, 0x0e,
|
0x6f, 0x74, 0x6f, 0x22, 0xd8, 0x01, 0x0a, 0x06, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x12, 0x0e,
|
||||||
0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12,
|
0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12,
|
||||||
0x0a, 0x04, 0x69, 0x73, 0x4f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x69, 0x73,
|
0x0a, 0x04, 0x69, 0x73, 0x4f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x69, 0x73,
|
||||||
0x4f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09,
|
0x4f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09,
|
||||||
@@ -138,7 +146,9 @@ var file_models_model_origin_proto_rawDesc = []byte{
|
|||||||
0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e,
|
0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e,
|
||||||
0x12, 0x18, 0x0a, 0x07, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28,
|
0x12, 0x18, 0x0a, 0x07, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28,
|
||||||
0x09, 0x52, 0x07, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x6f,
|
0x09, 0x52, 0x07, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x6f,
|
||||||
0x73, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x42, 0x06,
|
0x73, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x12, 0x1e,
|
||||||
|
0x0a, 0x0a, 0x66, 0x6f, 0x6c, 0x6c, 0x6f, 0x77, 0x50, 0x6f, 0x72, 0x74, 0x18, 0x08, 0x20, 0x01,
|
||||||
|
0x28, 0x08, 0x52, 0x0a, 0x66, 0x6f, 0x6c, 0x6c, 0x6f, 0x77, 0x50, 0x6f, 0x72, 0x74, 0x42, 0x06,
|
||||||
0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,10 +30,14 @@ type RegionCity struct {
|
|||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
|
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||||
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
|
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
|
||||||
Codes []string `protobuf:"bytes,3,rep,name=codes,proto3" json:"codes,omitempty"`
|
Codes []string `protobuf:"bytes,3,rep,name=codes,proto3" json:"codes,omitempty"`
|
||||||
RegionProvinceId int64 `protobuf:"varint,4,opt,name=regionProvinceId,proto3" json:"regionProvinceId,omitempty"`
|
RegionProvinceId int64 `protobuf:"varint,4,opt,name=regionProvinceId,proto3" json:"regionProvinceId,omitempty"`
|
||||||
|
CustomName string `protobuf:"bytes,5,opt,name=customName,proto3" json:"customName,omitempty"`
|
||||||
|
CustomCodes []string `protobuf:"bytes,6,rep,name=customCodes,proto3" json:"customCodes,omitempty"`
|
||||||
|
DisplayName string `protobuf:"bytes,7,opt,name=displayName,proto3" json:"displayName,omitempty"`
|
||||||
|
RegionProvince *RegionProvince `protobuf:"bytes,30,opt,name=regionProvince,proto3" json:"regionProvince,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *RegionCity) Reset() {
|
func (x *RegionCity) Reset() {
|
||||||
@@ -96,20 +100,60 @@ func (x *RegionCity) GetRegionProvinceId() int64 {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *RegionCity) GetCustomName() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.CustomName
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *RegionCity) GetCustomCodes() []string {
|
||||||
|
if x != nil {
|
||||||
|
return x.CustomCodes
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *RegionCity) GetDisplayName() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.DisplayName
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *RegionCity) GetRegionProvince() *RegionProvince {
|
||||||
|
if x != nil {
|
||||||
|
return x.RegionProvince
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
var File_models_model_region_city_proto protoreflect.FileDescriptor
|
var File_models_model_region_city_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
var file_models_model_region_city_proto_rawDesc = []byte{
|
var file_models_model_region_city_proto_rawDesc = []byte{
|
||||||
0x0a, 0x1e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x72,
|
0x0a, 0x1e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x72,
|
||||||
0x65, 0x67, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x69, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
0x65, 0x67, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x69, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||||
0x12, 0x02, 0x70, 0x62, 0x22, 0x72, 0x0a, 0x0a, 0x52, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x43, 0x69,
|
0x12, 0x02, 0x70, 0x62, 0x1a, 0x22, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64,
|
||||||
0x74, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02,
|
0x65, 0x6c, 0x5f, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x6e,
|
||||||
0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
|
0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x92, 0x02, 0x0a, 0x0a, 0x52, 0x65, 0x67,
|
||||||
0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x64, 0x65, 0x73, 0x18,
|
0x69, 0x6f, 0x6e, 0x43, 0x69, 0x74, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20,
|
||||||
0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x63, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x2a, 0x0a, 0x10,
|
0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18,
|
||||||
0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x6e, 0x63, 0x65, 0x49, 0x64,
|
0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x63,
|
||||||
0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x10, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x50, 0x72,
|
0x6f, 0x64, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x63, 0x6f, 0x64, 0x65,
|
||||||
0x6f, 0x76, 0x69, 0x6e, 0x63, 0x65, 0x49, 0x64, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62,
|
0x73, 0x12, 0x2a, 0x0a, 0x10, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x76, 0x69,
|
||||||
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x6e, 0x63, 0x65, 0x49, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x10, 0x72, 0x65, 0x67,
|
||||||
|
0x69, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x6e, 0x63, 0x65, 0x49, 0x64, 0x12, 0x1e, 0x0a,
|
||||||
|
0x0a, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28,
|
||||||
|
0x09, 0x52, 0x0a, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a,
|
||||||
|
0x0b, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x43, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x06, 0x20, 0x03,
|
||||||
|
0x28, 0x09, 0x52, 0x0b, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x43, 0x6f, 0x64, 0x65, 0x73, 0x12,
|
||||||
|
0x20, 0x0a, 0x0b, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x07,
|
||||||
|
0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x4e, 0x61, 0x6d,
|
||||||
|
0x65, 0x12, 0x3a, 0x0a, 0x0e, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x76, 0x69,
|
||||||
|
0x6e, 0x63, 0x65, 0x18, 0x1e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x62, 0x2e, 0x52,
|
||||||
|
0x65, 0x67, 0x69, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x6e, 0x63, 0x65, 0x52, 0x0e, 0x72,
|
||||||
|
0x65, 0x67, 0x69, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x6e, 0x63, 0x65, 0x42, 0x06, 0x5a,
|
||||||
|
0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -126,14 +170,16 @@ func file_models_model_region_city_proto_rawDescGZIP() []byte {
|
|||||||
|
|
||||||
var file_models_model_region_city_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
|
var file_models_model_region_city_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
|
||||||
var file_models_model_region_city_proto_goTypes = []interface{}{
|
var file_models_model_region_city_proto_goTypes = []interface{}{
|
||||||
(*RegionCity)(nil), // 0: pb.RegionCity
|
(*RegionCity)(nil), // 0: pb.RegionCity
|
||||||
|
(*RegionProvince)(nil), // 1: pb.RegionProvince
|
||||||
}
|
}
|
||||||
var file_models_model_region_city_proto_depIdxs = []int32{
|
var file_models_model_region_city_proto_depIdxs = []int32{
|
||||||
0, // [0:0] is the sub-list for method output_type
|
1, // 0: pb.RegionCity.regionProvince:type_name -> pb.RegionProvince
|
||||||
0, // [0:0] is the sub-list for method input_type
|
1, // [1:1] is the sub-list for method output_type
|
||||||
0, // [0:0] is the sub-list for extension type_name
|
1, // [1:1] is the sub-list for method input_type
|
||||||
0, // [0:0] is the sub-list for extension extendee
|
1, // [1:1] is the sub-list for extension type_name
|
||||||
0, // [0:0] is the sub-list for field type_name
|
1, // [1:1] is the sub-list for extension extendee
|
||||||
|
0, // [0:1] is the sub-list for field type_name
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() { file_models_model_region_city_proto_init() }
|
func init() { file_models_model_region_city_proto_init() }
|
||||||
@@ -141,6 +187,7 @@ func file_models_model_region_city_proto_init() {
|
|||||||
if File_models_model_region_city_proto != nil {
|
if File_models_model_region_city_proto != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
file_models_model_region_province_proto_init()
|
||||||
if !protoimpl.UnsafeEnabled {
|
if !protoimpl.UnsafeEnabled {
|
||||||
file_models_model_region_city_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
file_models_model_region_city_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||||
switch v := v.(*RegionCity); i {
|
switch v := v.(*RegionCity); i {
|
||||||
|
|||||||
@@ -25,15 +25,19 @@ const (
|
|||||||
// of the legacy proto package is being used.
|
// of the legacy proto package is being used.
|
||||||
const _ = proto.ProtoPackageIsVersion4
|
const _ = proto.ProtoPackageIsVersion4
|
||||||
|
|
||||||
|
// 国家/地区
|
||||||
type RegionCountry struct {
|
type RegionCountry struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
|
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||||
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
|
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
|
||||||
Codes []string `protobuf:"bytes,3,rep,name=codes,proto3" json:"codes,omitempty"`
|
Codes []string `protobuf:"bytes,3,rep,name=codes,proto3" json:"codes,omitempty"`
|
||||||
Pinyin []string `protobuf:"bytes,4,rep,name=pinyin,proto3" json:"pinyin,omitempty"`
|
Pinyin []string `protobuf:"bytes,4,rep,name=pinyin,proto3" json:"pinyin,omitempty"`
|
||||||
|
CustomName string `protobuf:"bytes,5,opt,name=customName,proto3" json:"customName,omitempty"`
|
||||||
|
CustomCodes []string `protobuf:"bytes,6,rep,name=customCodes,proto3" json:"customCodes,omitempty"`
|
||||||
|
DisplayName string `protobuf:"bytes,7,opt,name=displayName,proto3" json:"displayName,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *RegionCountry) Reset() {
|
func (x *RegionCountry) Reset() {
|
||||||
@@ -96,19 +100,46 @@ func (x *RegionCountry) GetPinyin() []string {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *RegionCountry) GetCustomName() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.CustomName
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *RegionCountry) GetCustomCodes() []string {
|
||||||
|
if x != nil {
|
||||||
|
return x.CustomCodes
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *RegionCountry) GetDisplayName() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.DisplayName
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
var File_models_model_region_country_proto protoreflect.FileDescriptor
|
var File_models_model_region_country_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
var file_models_model_region_country_proto_rawDesc = []byte{
|
var file_models_model_region_country_proto_rawDesc = []byte{
|
||||||
0x0a, 0x21, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x72,
|
0x0a, 0x21, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x72,
|
||||||
0x65, 0x67, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x2e, 0x70, 0x72,
|
0x65, 0x67, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x2e, 0x70, 0x72,
|
||||||
0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, 0x61, 0x0a, 0x0d, 0x52, 0x65, 0x67, 0x69, 0x6f,
|
0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, 0xc5, 0x01, 0x0a, 0x0d, 0x52, 0x65, 0x67, 0x69,
|
||||||
0x6e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01,
|
0x6f, 0x6e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18,
|
||||||
0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65,
|
0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d,
|
||||||
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05,
|
0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a,
|
||||||
0x63, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x63, 0x6f, 0x64,
|
0x05, 0x63, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x63, 0x6f,
|
||||||
0x65, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x69, 0x6e, 0x79, 0x69, 0x6e, 0x18, 0x04, 0x20, 0x03,
|
0x64, 0x65, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x69, 0x6e, 0x79, 0x69, 0x6e, 0x18, 0x04, 0x20,
|
||||||
0x28, 0x09, 0x52, 0x06, 0x70, 0x69, 0x6e, 0x79, 0x69, 0x6e, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f,
|
0x03, 0x28, 0x09, 0x52, 0x06, 0x70, 0x69, 0x6e, 0x79, 0x69, 0x6e, 0x12, 0x1e, 0x0a, 0x0a, 0x63,
|
||||||
0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x75, 0x73, 0x74, 0x6f, 0x6d, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||||
|
0x0a, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x63,
|
||||||
|
0x75, 0x73, 0x74, 0x6f, 0x6d, 0x43, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09,
|
||||||
|
0x52, 0x0b, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x43, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x20, 0x0a,
|
||||||
|
0x0b, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x07, 0x20, 0x01,
|
||||||
|
0x28, 0x09, 0x52, 0x0b, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x42,
|
||||||
|
0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|||||||
@@ -30,9 +30,12 @@ type RegionProvider struct {
|
|||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
|
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||||
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
|
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
|
||||||
Codes []string `protobuf:"bytes,3,rep,name=codes,proto3" json:"codes,omitempty"`
|
Codes []string `protobuf:"bytes,3,rep,name=codes,proto3" json:"codes,omitempty"`
|
||||||
|
CustomName string `protobuf:"bytes,4,opt,name=customName,proto3" json:"customName,omitempty"`
|
||||||
|
CustomCodes []string `protobuf:"bytes,5,rep,name=customCodes,proto3" json:"customCodes,omitempty"`
|
||||||
|
DisplayName string `protobuf:"bytes,6,opt,name=displayName,proto3" json:"displayName,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *RegionProvider) Reset() {
|
func (x *RegionProvider) Reset() {
|
||||||
@@ -88,18 +91,45 @@ func (x *RegionProvider) GetCodes() []string {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *RegionProvider) GetCustomName() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.CustomName
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *RegionProvider) GetCustomCodes() []string {
|
||||||
|
if x != nil {
|
||||||
|
return x.CustomCodes
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *RegionProvider) GetDisplayName() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.DisplayName
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
var File_models_model_region_provider_proto protoreflect.FileDescriptor
|
var File_models_model_region_provider_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
var file_models_model_region_provider_proto_rawDesc = []byte{
|
var file_models_model_region_provider_proto_rawDesc = []byte{
|
||||||
0x0a, 0x22, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x72,
|
0x0a, 0x22, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x72,
|
||||||
0x65, 0x67, 0x69, 0x6f, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x2e, 0x70,
|
0x65, 0x67, 0x69, 0x6f, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x2e, 0x70,
|
||||||
0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, 0x4a, 0x0a, 0x0e, 0x52, 0x65, 0x67, 0x69,
|
0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, 0xae, 0x01, 0x0a, 0x0e, 0x52, 0x65, 0x67,
|
||||||
0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64,
|
0x69, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69,
|
||||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61,
|
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e,
|
||||||
0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14,
|
0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12,
|
||||||
0x0a, 0x05, 0x63, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x63,
|
0x14, 0x0a, 0x05, 0x63, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05,
|
||||||
0x6f, 0x64, 0x65, 0x73, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72,
|
0x63, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x4e,
|
||||||
0x6f, 0x74, 0x6f, 0x33,
|
0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, 0x75, 0x73, 0x74, 0x6f,
|
||||||
|
0x6d, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x43,
|
||||||
|
0x6f, 0x64, 0x65, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x75, 0x73, 0x74,
|
||||||
|
0x6f, 0x6d, 0x43, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x69, 0x73, 0x70, 0x6c,
|
||||||
|
0x61, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x69,
|
||||||
|
0x73, 0x70, 0x6c, 0x61, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70,
|
||||||
|
0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|||||||
@@ -30,9 +30,13 @@ type RegionProvince struct {
|
|||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
|
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||||
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
|
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
|
||||||
Codes []string `protobuf:"bytes,3,rep,name=codes,proto3" json:"codes,omitempty"`
|
Codes []string `protobuf:"bytes,3,rep,name=codes,proto3" json:"codes,omitempty"`
|
||||||
|
RegionCountryId int64 `protobuf:"varint,4,opt,name=regionCountryId,proto3" json:"regionCountryId,omitempty"`
|
||||||
|
CustomName string `protobuf:"bytes,5,opt,name=customName,proto3" json:"customName,omitempty"`
|
||||||
|
CustomCodes []string `protobuf:"bytes,6,rep,name=customCodes,proto3" json:"customCodes,omitempty"`
|
||||||
|
DisplayName string `protobuf:"bytes,7,opt,name=displayName,proto3" json:"displayName,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *RegionProvince) Reset() {
|
func (x *RegionProvince) Reset() {
|
||||||
@@ -88,18 +92,55 @@ func (x *RegionProvince) GetCodes() []string {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *RegionProvince) GetRegionCountryId() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.RegionCountryId
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *RegionProvince) GetCustomName() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.CustomName
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *RegionProvince) GetCustomCodes() []string {
|
||||||
|
if x != nil {
|
||||||
|
return x.CustomCodes
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *RegionProvince) GetDisplayName() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.DisplayName
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
var File_models_model_region_province_proto protoreflect.FileDescriptor
|
var File_models_model_region_province_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
var file_models_model_region_province_proto_rawDesc = []byte{
|
var file_models_model_region_province_proto_rawDesc = []byte{
|
||||||
0x0a, 0x22, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x72,
|
0x0a, 0x22, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x72,
|
||||||
0x65, 0x67, 0x69, 0x6f, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x6e, 0x63, 0x65, 0x2e, 0x70,
|
0x65, 0x67, 0x69, 0x6f, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x6e, 0x63, 0x65, 0x2e, 0x70,
|
||||||
0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, 0x4a, 0x0a, 0x0e, 0x52, 0x65, 0x67, 0x69,
|
0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, 0xd8, 0x01, 0x0a, 0x0e, 0x52, 0x65, 0x67,
|
||||||
0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x6e, 0x63, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64,
|
0x69, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x6e, 0x63, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69,
|
||||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61,
|
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e,
|
||||||
0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14,
|
0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12,
|
||||||
0x0a, 0x05, 0x63, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x63,
|
0x14, 0x0a, 0x05, 0x63, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05,
|
||||||
0x6f, 0x64, 0x65, 0x73, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72,
|
0x63, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x28, 0x0a, 0x0f, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x43,
|
||||||
0x6f, 0x74, 0x6f, 0x33,
|
0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x49, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0f,
|
||||||
|
0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x49, 0x64, 0x12,
|
||||||
|
0x1e, 0x0a, 0x0a, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x05, 0x20,
|
||||||
|
0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x4e, 0x61, 0x6d, 0x65, 0x12,
|
||||||
|
0x20, 0x0a, 0x0b, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x43, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x06,
|
||||||
|
0x20, 0x03, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x43, 0x6f, 0x64, 0x65,
|
||||||
|
0x73, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x4e, 0x61, 0x6d, 0x65,
|
||||||
|
0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x4e,
|
||||||
|
0x61, 0x6d, 0x65, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f,
|
||||||
|
0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|||||||
222
pkg/rpc/pb/model_region_town.pb.go
Normal file
222
pkg/rpc/pb/model_region_town.pb.go
Normal file
@@ -0,0 +1,222 @@
|
|||||||
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
|
// versions:
|
||||||
|
// protoc-gen-go v1.25.0
|
||||||
|
// protoc v3.19.4
|
||||||
|
// source: models/model_region_town.proto
|
||||||
|
|
||||||
|
package pb
|
||||||
|
|
||||||
|
import (
|
||||||
|
proto "github.com/golang/protobuf/proto"
|
||||||
|
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||||
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
|
reflect "reflect"
|
||||||
|
sync "sync"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// Verify that this generated code is sufficiently up-to-date.
|
||||||
|
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||||
|
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||||
|
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||||
|
)
|
||||||
|
|
||||||
|
// This is a compile-time assertion that a sufficiently up-to-date version
|
||||||
|
// of the legacy proto package is being used.
|
||||||
|
const _ = proto.ProtoPackageIsVersion4
|
||||||
|
|
||||||
|
type RegionTown struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||||
|
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
|
||||||
|
Codes []string `protobuf:"bytes,3,rep,name=codes,proto3" json:"codes,omitempty"`
|
||||||
|
RegionCityId int64 `protobuf:"varint,4,opt,name=regionCityId,proto3" json:"regionCityId,omitempty"`
|
||||||
|
CustomName string `protobuf:"bytes,5,opt,name=customName,proto3" json:"customName,omitempty"`
|
||||||
|
CustomCodes []string `protobuf:"bytes,6,rep,name=customCodes,proto3" json:"customCodes,omitempty"`
|
||||||
|
DisplayName string `protobuf:"bytes,7,opt,name=displayName,proto3" json:"displayName,omitempty"`
|
||||||
|
RegionCity *RegionCity `protobuf:"bytes,30,opt,name=regionCity,proto3" json:"regionCity,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *RegionTown) Reset() {
|
||||||
|
*x = RegionTown{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_models_model_region_town_proto_msgTypes[0]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *RegionTown) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*RegionTown) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *RegionTown) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_models_model_region_town_proto_msgTypes[0]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use RegionTown.ProtoReflect.Descriptor instead.
|
||||||
|
func (*RegionTown) Descriptor() ([]byte, []int) {
|
||||||
|
return file_models_model_region_town_proto_rawDescGZIP(), []int{0}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *RegionTown) GetId() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.Id
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *RegionTown) GetName() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Name
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *RegionTown) GetCodes() []string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Codes
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *RegionTown) GetRegionCityId() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.RegionCityId
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *RegionTown) GetCustomName() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.CustomName
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *RegionTown) GetCustomCodes() []string {
|
||||||
|
if x != nil {
|
||||||
|
return x.CustomCodes
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *RegionTown) GetDisplayName() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.DisplayName
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *RegionTown) GetRegionCity() *RegionCity {
|
||||||
|
if x != nil {
|
||||||
|
return x.RegionCity
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
var File_models_model_region_town_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
|
var file_models_model_region_town_proto_rawDesc = []byte{
|
||||||
|
0x0a, 0x1e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x72,
|
||||||
|
0x65, 0x67, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x6f, 0x77, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||||
|
0x12, 0x02, 0x70, 0x62, 0x1a, 0x1e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64,
|
||||||
|
0x65, 0x6c, 0x5f, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x69, 0x74, 0x79, 0x2e, 0x70,
|
||||||
|
0x72, 0x6f, 0x74, 0x6f, 0x22, 0xfe, 0x01, 0x0a, 0x0a, 0x52, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x54,
|
||||||
|
0x6f, 0x77, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52,
|
||||||
|
0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28,
|
||||||
|
0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x64, 0x65, 0x73,
|
||||||
|
0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x63, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x22, 0x0a,
|
||||||
|
0x0c, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x43, 0x69, 0x74, 0x79, 0x49, 0x64, 0x18, 0x04, 0x20,
|
||||||
|
0x01, 0x28, 0x03, 0x52, 0x0c, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x43, 0x69, 0x74, 0x79, 0x49,
|
||||||
|
0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x4e, 0x61, 0x6d, 0x65, 0x18,
|
||||||
|
0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x4e, 0x61, 0x6d,
|
||||||
|
0x65, 0x12, 0x20, 0x0a, 0x0b, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x43, 0x6f, 0x64, 0x65, 0x73,
|
||||||
|
0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x43, 0x6f,
|
||||||
|
0x64, 0x65, 0x73, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x4e, 0x61,
|
||||||
|
0x6d, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61,
|
||||||
|
0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x2e, 0x0a, 0x0a, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x43,
|
||||||
|
0x69, 0x74, 0x79, 0x18, 0x1e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x52,
|
||||||
|
0x65, 0x67, 0x69, 0x6f, 0x6e, 0x43, 0x69, 0x74, 0x79, 0x52, 0x0a, 0x72, 0x65, 0x67, 0x69, 0x6f,
|
||||||
|
0x6e, 0x43, 0x69, 0x74, 0x79, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70,
|
||||||
|
0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
file_models_model_region_town_proto_rawDescOnce sync.Once
|
||||||
|
file_models_model_region_town_proto_rawDescData = file_models_model_region_town_proto_rawDesc
|
||||||
|
)
|
||||||
|
|
||||||
|
func file_models_model_region_town_proto_rawDescGZIP() []byte {
|
||||||
|
file_models_model_region_town_proto_rawDescOnce.Do(func() {
|
||||||
|
file_models_model_region_town_proto_rawDescData = protoimpl.X.CompressGZIP(file_models_model_region_town_proto_rawDescData)
|
||||||
|
})
|
||||||
|
return file_models_model_region_town_proto_rawDescData
|
||||||
|
}
|
||||||
|
|
||||||
|
var file_models_model_region_town_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
|
||||||
|
var file_models_model_region_town_proto_goTypes = []interface{}{
|
||||||
|
(*RegionTown)(nil), // 0: pb.RegionTown
|
||||||
|
(*RegionCity)(nil), // 1: pb.RegionCity
|
||||||
|
}
|
||||||
|
var file_models_model_region_town_proto_depIdxs = []int32{
|
||||||
|
1, // 0: pb.RegionTown.regionCity:type_name -> pb.RegionCity
|
||||||
|
1, // [1:1] is the sub-list for method output_type
|
||||||
|
1, // [1:1] is the sub-list for method input_type
|
||||||
|
1, // [1:1] is the sub-list for extension type_name
|
||||||
|
1, // [1:1] is the sub-list for extension extendee
|
||||||
|
0, // [0:1] is the sub-list for field type_name
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() { file_models_model_region_town_proto_init() }
|
||||||
|
func file_models_model_region_town_proto_init() {
|
||||||
|
if File_models_model_region_town_proto != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
file_models_model_region_city_proto_init()
|
||||||
|
if !protoimpl.UnsafeEnabled {
|
||||||
|
file_models_model_region_town_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*RegionTown); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
type x struct{}
|
||||||
|
out := protoimpl.TypeBuilder{
|
||||||
|
File: protoimpl.DescBuilder{
|
||||||
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
|
RawDescriptor: file_models_model_region_town_proto_rawDesc,
|
||||||
|
NumEnums: 0,
|
||||||
|
NumMessages: 1,
|
||||||
|
NumExtensions: 0,
|
||||||
|
NumServices: 0,
|
||||||
|
},
|
||||||
|
GoTypes: file_models_model_region_town_proto_goTypes,
|
||||||
|
DependencyIndexes: file_models_model_region_town_proto_depIdxs,
|
||||||
|
MessageInfos: file_models_model_region_town_proto_msgTypes,
|
||||||
|
}.Build()
|
||||||
|
File_models_model_region_town_proto = out.File
|
||||||
|
file_models_model_region_town_proto_rawDesc = nil
|
||||||
|
file_models_model_region_town_proto_goTypes = nil
|
||||||
|
file_models_model_region_town_proto_depIdxs = nil
|
||||||
|
}
|
||||||
203
pkg/rpc/pb/model_script.pb.go
Normal file
203
pkg/rpc/pb/model_script.pb.go
Normal file
@@ -0,0 +1,203 @@
|
|||||||
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
|
// versions:
|
||||||
|
// protoc-gen-go v1.25.0
|
||||||
|
// protoc v3.19.4
|
||||||
|
// source: models/model_script.proto
|
||||||
|
|
||||||
|
package pb
|
||||||
|
|
||||||
|
import (
|
||||||
|
proto "github.com/golang/protobuf/proto"
|
||||||
|
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||||
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
|
reflect "reflect"
|
||||||
|
sync "sync"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// Verify that this generated code is sufficiently up-to-date.
|
||||||
|
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||||
|
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||||
|
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||||
|
)
|
||||||
|
|
||||||
|
// This is a compile-time assertion that a sufficiently up-to-date version
|
||||||
|
// of the legacy proto package is being used.
|
||||||
|
const _ = proto.ProtoPackageIsVersion4
|
||||||
|
|
||||||
|
type Script struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||||
|
UserId int64 `protobuf:"varint,2,opt,name=userId,proto3" json:"userId,omitempty"`
|
||||||
|
IsOn bool `protobuf:"varint,3,opt,name=isOn,proto3" json:"isOn,omitempty"`
|
||||||
|
Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"`
|
||||||
|
Filename string `protobuf:"bytes,5,opt,name=filename,proto3" json:"filename,omitempty"`
|
||||||
|
Code string `protobuf:"bytes,6,opt,name=code,proto3" json:"code,omitempty"`
|
||||||
|
UpdatedAt int64 `protobuf:"varint,7,opt,name=updatedAt,proto3" json:"updatedAt,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Script) Reset() {
|
||||||
|
*x = Script{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_models_model_script_proto_msgTypes[0]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Script) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*Script) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *Script) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_models_model_script_proto_msgTypes[0]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use Script.ProtoReflect.Descriptor instead.
|
||||||
|
func (*Script) Descriptor() ([]byte, []int) {
|
||||||
|
return file_models_model_script_proto_rawDescGZIP(), []int{0}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Script) GetId() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.Id
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Script) GetUserId() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.UserId
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Script) GetIsOn() bool {
|
||||||
|
if x != nil {
|
||||||
|
return x.IsOn
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Script) GetName() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Name
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Script) GetFilename() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Filename
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Script) GetCode() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Code
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Script) GetUpdatedAt() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.UpdatedAt
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
var File_models_model_script_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
|
var file_models_model_script_proto_rawDesc = []byte{
|
||||||
|
0x0a, 0x19, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x73,
|
||||||
|
0x63, 0x72, 0x69, 0x70, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x22,
|
||||||
|
0xa6, 0x01, 0x0a, 0x06, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64,
|
||||||
|
0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73,
|
||||||
|
0x65, 0x72, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72,
|
||||||
|
0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x73, 0x4f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08,
|
||||||
|
0x52, 0x04, 0x69, 0x73, 0x4f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04,
|
||||||
|
0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x69,
|
||||||
|
0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x69,
|
||||||
|
0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x06,
|
||||||
|
0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x75, 0x70,
|
||||||
|
0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x75,
|
||||||
|
0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62,
|
||||||
|
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
file_models_model_script_proto_rawDescOnce sync.Once
|
||||||
|
file_models_model_script_proto_rawDescData = file_models_model_script_proto_rawDesc
|
||||||
|
)
|
||||||
|
|
||||||
|
func file_models_model_script_proto_rawDescGZIP() []byte {
|
||||||
|
file_models_model_script_proto_rawDescOnce.Do(func() {
|
||||||
|
file_models_model_script_proto_rawDescData = protoimpl.X.CompressGZIP(file_models_model_script_proto_rawDescData)
|
||||||
|
})
|
||||||
|
return file_models_model_script_proto_rawDescData
|
||||||
|
}
|
||||||
|
|
||||||
|
var file_models_model_script_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
|
||||||
|
var file_models_model_script_proto_goTypes = []interface{}{
|
||||||
|
(*Script)(nil), // 0: pb.Script
|
||||||
|
}
|
||||||
|
var file_models_model_script_proto_depIdxs = []int32{
|
||||||
|
0, // [0:0] is the sub-list for method output_type
|
||||||
|
0, // [0:0] is the sub-list for method input_type
|
||||||
|
0, // [0:0] is the sub-list for extension type_name
|
||||||
|
0, // [0:0] is the sub-list for extension extendee
|
||||||
|
0, // [0:0] is the sub-list for field type_name
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() { file_models_model_script_proto_init() }
|
||||||
|
func file_models_model_script_proto_init() {
|
||||||
|
if File_models_model_script_proto != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if !protoimpl.UnsafeEnabled {
|
||||||
|
file_models_model_script_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*Script); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
type x struct{}
|
||||||
|
out := protoimpl.TypeBuilder{
|
||||||
|
File: protoimpl.DescBuilder{
|
||||||
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
|
RawDescriptor: file_models_model_script_proto_rawDesc,
|
||||||
|
NumEnums: 0,
|
||||||
|
NumMessages: 1,
|
||||||
|
NumExtensions: 0,
|
||||||
|
NumServices: 0,
|
||||||
|
},
|
||||||
|
GoTypes: file_models_model_script_proto_goTypes,
|
||||||
|
DependencyIndexes: file_models_model_script_proto_depIdxs,
|
||||||
|
MessageInfos: file_models_model_script_proto_msgTypes,
|
||||||
|
}.Build()
|
||||||
|
File_models_model_script_proto = out.File
|
||||||
|
file_models_model_script_proto_rawDesc = nil
|
||||||
|
file_models_model_script_proto_goTypes = nil
|
||||||
|
file_models_model_script_proto_depIdxs = nil
|
||||||
|
}
|
||||||
@@ -56,9 +56,13 @@ type Server struct {
|
|||||||
UdpJSON []byte `protobuf:"bytes,14,opt,name=udpJSON,proto3" json:"udpJSON,omitempty"`
|
UdpJSON []byte `protobuf:"bytes,14,opt,name=udpJSON,proto3" json:"udpJSON,omitempty"`
|
||||||
WebId int64 `protobuf:"varint,15,opt,name=webId,proto3" json:"webId,omitempty"`
|
WebId int64 `protobuf:"varint,15,opt,name=webId,proto3" json:"webId,omitempty"`
|
||||||
ReverseProxyJSON []byte `protobuf:"bytes,16,opt,name=reverseProxyJSON,proto3" json:"reverseProxyJSON,omitempty"`
|
ReverseProxyJSON []byte `protobuf:"bytes,16,opt,name=reverseProxyJSON,proto3" json:"reverseProxyJSON,omitempty"`
|
||||||
|
BandwidthTime string `protobuf:"bytes,26,opt,name=bandwidthTime,proto3" json:"bandwidthTime,omitempty"`
|
||||||
|
BandwidthBytes int64 `protobuf:"varint,27,opt,name=bandwidthBytes,proto3" json:"bandwidthBytes,omitempty"`
|
||||||
NodeCluster *NodeCluster `protobuf:"bytes,30,opt,name=nodeCluster,proto3" json:"nodeCluster,omitempty"`
|
NodeCluster *NodeCluster `protobuf:"bytes,30,opt,name=nodeCluster,proto3" json:"nodeCluster,omitempty"`
|
||||||
ServerGroups []*ServerGroup `protobuf:"bytes,31,rep,name=serverGroups,proto3" json:"serverGroups,omitempty"`
|
ServerGroups []*ServerGroup `protobuf:"bytes,31,rep,name=serverGroups,proto3" json:"serverGroups,omitempty"`
|
||||||
User *User `protobuf:"bytes,32,opt,name=user,proto3" json:"user,omitempty"`
|
User *User `protobuf:"bytes,32,opt,name=user,proto3" json:"user,omitempty"`
|
||||||
|
// Deprecated: Do not use.
|
||||||
|
LatestServerDailyStat *ServerDailyStat `protobuf:"bytes,33,opt,name=latestServerDailyStat,proto3" json:"latestServerDailyStat,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Server) Reset() {
|
func (x *Server) Reset() {
|
||||||
@@ -268,6 +272,20 @@ func (x *Server) GetReverseProxyJSON() []byte {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *Server) GetBandwidthTime() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.BandwidthTime
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Server) GetBandwidthBytes() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.BandwidthBytes
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
func (x *Server) GetNodeCluster() *NodeCluster {
|
func (x *Server) GetNodeCluster() *NodeCluster {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.NodeCluster
|
return x.NodeCluster
|
||||||
@@ -289,6 +307,14 @@ func (x *Server) GetUser() *User {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Deprecated: Do not use.
|
||||||
|
func (x *Server) GetLatestServerDailyStat() *ServerDailyStat {
|
||||||
|
if x != nil {
|
||||||
|
return x.LatestServerDailyStat
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
var File_models_model_server_proto protoreflect.FileDescriptor
|
var File_models_model_server_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
var file_models_model_server_proto_rawDesc = []byte{
|
var file_models_model_server_proto_rawDesc = []byte{
|
||||||
@@ -302,67 +328,79 @@ var file_models_model_server_proto_rawDesc = []byte{
|
|||||||
0x75, 0x73, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2e, 0x6d, 0x6f, 0x64, 0x65,
|
0x75, 0x73, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2e, 0x6d, 0x6f, 0x64, 0x65,
|
||||||
0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f,
|
0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f,
|
||||||
0x6e, 0x61, 0x6d, 0x65, 0x5f, 0x61, 0x75, 0x64, 0x69, 0x74, 0x69, 0x6e, 0x67, 0x5f, 0x72, 0x65,
|
0x6e, 0x61, 0x6d, 0x65, 0x5f, 0x61, 0x75, 0x64, 0x69, 0x74, 0x69, 0x6e, 0x67, 0x5f, 0x72, 0x65,
|
||||||
0x73, 0x75, 0x6c, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xa8, 0x07, 0x0a, 0x06, 0x53,
|
0x73, 0x75, 0x6c, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x24, 0x6d, 0x6f, 0x64, 0x65,
|
||||||
0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
|
0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f,
|
||||||
0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x73, 0x4f, 0x6e, 0x18, 0x12, 0x20,
|
0x64, 0x61, 0x69, 0x6c, 0x79, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||||
0x01, 0x28, 0x08, 0x52, 0x04, 0x69, 0x73, 0x4f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70,
|
0x22, 0xc5, 0x08, 0x0a, 0x06, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69,
|
||||||
0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a,
|
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x69,
|
||||||
0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d,
|
0x73, 0x4f, 0x6e, 0x18, 0x12, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x69, 0x73, 0x4f, 0x6e, 0x12,
|
||||||
0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e,
|
0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74,
|
||||||
0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74,
|
0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28,
|
||||||
0x69, 0x6f, 0x6e, 0x12, 0x22, 0x0a, 0x0c, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x4e, 0x6f,
|
0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72,
|
||||||
0x64, 0x65, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0c, 0x69, 0x6e, 0x63, 0x6c, 0x75,
|
0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65,
|
||||||
0x64, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x22, 0x0a, 0x0c, 0x65, 0x78, 0x63, 0x6c, 0x75,
|
0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x22, 0x0a, 0x0c, 0x69, 0x6e, 0x63,
|
||||||
0x64, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0c, 0x65,
|
0x6c, 0x75, 0x64, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52,
|
||||||
0x78, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x63,
|
0x0c, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x22, 0x0a,
|
||||||
0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09,
|
0x0c, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x06, 0x20,
|
||||||
0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x64, 0x6e, 0x73,
|
0x01, 0x28, 0x0c, 0x52, 0x0c, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x4e, 0x6f, 0x64, 0x65,
|
||||||
0x4e, 0x61, 0x6d, 0x65, 0x18, 0x13, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x64, 0x6e, 0x73, 0x4e,
|
0x73, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, 0x07,
|
||||||
0x61, 0x6d, 0x65, 0x12, 0x22, 0x0a, 0x0c, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x43, 0x4e,
|
0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12,
|
||||||
0x41, 0x4d, 0x45, 0x18, 0x17, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x73, 0x75, 0x70, 0x70, 0x6f,
|
0x18, 0x0a, 0x07, 0x64, 0x6e, 0x73, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x13, 0x20, 0x01, 0x28, 0x09,
|
||||||
0x72, 0x74, 0x43, 0x4e, 0x41, 0x4d, 0x45, 0x12, 0x1e, 0x0a, 0x0a, 0x75, 0x73, 0x65, 0x72, 0x50,
|
0x52, 0x07, 0x64, 0x6e, 0x73, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x22, 0x0a, 0x0c, 0x73, 0x75, 0x70,
|
||||||
0x6c, 0x61, 0x6e, 0x49, 0x64, 0x18, 0x18, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x75, 0x73, 0x65,
|
0x70, 0x6f, 0x72, 0x74, 0x43, 0x4e, 0x41, 0x4d, 0x45, 0x18, 0x17, 0x20, 0x01, 0x28, 0x08, 0x52,
|
||||||
0x72, 0x50, 0x6c, 0x61, 0x6e, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69,
|
0x0c, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x43, 0x4e, 0x41, 0x4d, 0x45, 0x12, 0x1e, 0x0a,
|
||||||
0x67, 0x18, 0x11, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12,
|
0x0a, 0x75, 0x73, 0x65, 0x72, 0x50, 0x6c, 0x61, 0x6e, 0x49, 0x64, 0x18, 0x18, 0x20, 0x01, 0x28,
|
||||||
0x28, 0x0a, 0x0f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x4a, 0x53,
|
0x03, 0x52, 0x0a, 0x75, 0x73, 0x65, 0x72, 0x50, 0x6c, 0x61, 0x6e, 0x49, 0x64, 0x12, 0x16, 0x0a,
|
||||||
0x4f, 0x4e, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72,
|
0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x11, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x63,
|
||||||
0x4e, 0x61, 0x6d, 0x65, 0x73, 0x4a, 0x53, 0x4f, 0x4e, 0x12, 0x1e, 0x0a, 0x0a, 0x69, 0x73, 0x41,
|
0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x28, 0x0a, 0x0f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x4e,
|
||||||
0x75, 0x64, 0x69, 0x74, 0x69, 0x6e, 0x67, 0x18, 0x14, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x69,
|
0x61, 0x6d, 0x65, 0x73, 0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0f,
|
||||||
0x73, 0x41, 0x75, 0x64, 0x69, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x75, 0x64,
|
0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x4a, 0x53, 0x4f, 0x4e, 0x12,
|
||||||
0x69, 0x74, 0x69, 0x6e, 0x67, 0x41, 0x74, 0x18, 0x19, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x61,
|
0x1e, 0x0a, 0x0a, 0x69, 0x73, 0x41, 0x75, 0x64, 0x69, 0x74, 0x69, 0x6e, 0x67, 0x18, 0x14, 0x20,
|
||||||
0x75, 0x64, 0x69, 0x74, 0x69, 0x6e, 0x67, 0x41, 0x74, 0x12, 0x38, 0x0a, 0x17, 0x61, 0x75, 0x64,
|
0x01, 0x28, 0x08, 0x52, 0x0a, 0x69, 0x73, 0x41, 0x75, 0x64, 0x69, 0x74, 0x69, 0x6e, 0x67, 0x12,
|
||||||
0x69, 0x74, 0x69, 0x6e, 0x67, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x73,
|
0x1e, 0x0a, 0x0a, 0x61, 0x75, 0x64, 0x69, 0x74, 0x69, 0x6e, 0x67, 0x41, 0x74, 0x18, 0x19, 0x20,
|
||||||
0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x15, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x17, 0x61, 0x75, 0x64, 0x69,
|
0x01, 0x28, 0x03, 0x52, 0x0a, 0x61, 0x75, 0x64, 0x69, 0x74, 0x69, 0x6e, 0x67, 0x41, 0x74, 0x12,
|
||||||
0x74, 0x69, 0x6e, 0x67, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x4a,
|
0x38, 0x0a, 0x17, 0x61, 0x75, 0x64, 0x69, 0x74, 0x69, 0x6e, 0x67, 0x53, 0x65, 0x72, 0x76, 0x65,
|
||||||
0x53, 0x4f, 0x4e, 0x12, 0x44, 0x0a, 0x0e, 0x61, 0x75, 0x64, 0x69, 0x74, 0x69, 0x6e, 0x67, 0x52,
|
0x72, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x15, 0x20, 0x01, 0x28, 0x0c,
|
||||||
0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x16, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x70, 0x62,
|
0x52, 0x17, 0x61, 0x75, 0x64, 0x69, 0x74, 0x69, 0x6e, 0x67, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72,
|
||||||
0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x41, 0x75, 0x64, 0x69, 0x74,
|
0x4e, 0x61, 0x6d, 0x65, 0x73, 0x4a, 0x53, 0x4f, 0x4e, 0x12, 0x44, 0x0a, 0x0e, 0x61, 0x75, 0x64,
|
||||||
0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x0e, 0x61, 0x75, 0x64, 0x69, 0x74,
|
0x69, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x16, 0x20, 0x01, 0x28,
|
||||||
0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x68, 0x74, 0x74,
|
0x0b, 0x32, 0x1c, 0x2e, 0x70, 0x62, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x4e, 0x61, 0x6d,
|
||||||
0x70, 0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x68, 0x74, 0x74,
|
0x65, 0x41, 0x75, 0x64, 0x69, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52,
|
||||||
0x70, 0x4a, 0x53, 0x4f, 0x4e, 0x12, 0x1c, 0x0a, 0x09, 0x68, 0x74, 0x74, 0x70, 0x73, 0x4a, 0x53,
|
0x0e, 0x61, 0x75, 0x64, 0x69, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12,
|
||||||
0x4f, 0x4e, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x68, 0x74, 0x74, 0x70, 0x73, 0x4a,
|
0x1a, 0x0a, 0x08, 0x68, 0x74, 0x74, 0x70, 0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x09, 0x20, 0x01, 0x28,
|
||||||
0x53, 0x4f, 0x4e, 0x12, 0x18, 0x0a, 0x07, 0x74, 0x63, 0x70, 0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x0b,
|
0x0c, 0x52, 0x08, 0x68, 0x74, 0x74, 0x70, 0x4a, 0x53, 0x4f, 0x4e, 0x12, 0x1c, 0x0a, 0x09, 0x68,
|
||||||
0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x74, 0x63, 0x70, 0x4a, 0x53, 0x4f, 0x4e, 0x12, 0x18, 0x0a,
|
0x74, 0x74, 0x70, 0x73, 0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09,
|
||||||
0x07, 0x74, 0x6c, 0x73, 0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07,
|
0x68, 0x74, 0x74, 0x70, 0x73, 0x4a, 0x53, 0x4f, 0x4e, 0x12, 0x18, 0x0a, 0x07, 0x74, 0x63, 0x70,
|
||||||
0x74, 0x6c, 0x73, 0x4a, 0x53, 0x4f, 0x4e, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x6e, 0x69, 0x78, 0x4a,
|
0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x74, 0x63, 0x70, 0x4a,
|
||||||
0x53, 0x4f, 0x4e, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x75, 0x6e, 0x69, 0x78, 0x4a,
|
0x53, 0x4f, 0x4e, 0x12, 0x18, 0x0a, 0x07, 0x74, 0x6c, 0x73, 0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x0c,
|
||||||
0x53, 0x4f, 0x4e, 0x12, 0x18, 0x0a, 0x07, 0x75, 0x64, 0x70, 0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x0e,
|
0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x74, 0x6c, 0x73, 0x4a, 0x53, 0x4f, 0x4e, 0x12, 0x1a, 0x0a,
|
||||||
0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x75, 0x64, 0x70, 0x4a, 0x53, 0x4f, 0x4e, 0x12, 0x14, 0x0a,
|
0x08, 0x75, 0x6e, 0x69, 0x78, 0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0c, 0x52,
|
||||||
0x05, 0x77, 0x65, 0x62, 0x49, 0x64, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x77, 0x65,
|
0x08, 0x75, 0x6e, 0x69, 0x78, 0x4a, 0x53, 0x4f, 0x4e, 0x12, 0x18, 0x0a, 0x07, 0x75, 0x64, 0x70,
|
||||||
0x62, 0x49, 0x64, 0x12, 0x2a, 0x0a, 0x10, 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x50, 0x72,
|
0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x75, 0x64, 0x70, 0x4a,
|
||||||
0x6f, 0x78, 0x79, 0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x10, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x10, 0x72,
|
0x53, 0x4f, 0x4e, 0x12, 0x14, 0x0a, 0x05, 0x77, 0x65, 0x62, 0x49, 0x64, 0x18, 0x0f, 0x20, 0x01,
|
||||||
0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x4a, 0x53, 0x4f, 0x4e, 0x12,
|
0x28, 0x03, 0x52, 0x05, 0x77, 0x65, 0x62, 0x49, 0x64, 0x12, 0x2a, 0x0a, 0x10, 0x72, 0x65, 0x76,
|
||||||
0x31, 0x0a, 0x0b, 0x6e, 0x6f, 0x64, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x18, 0x1e,
|
0x65, 0x72, 0x73, 0x65, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x10, 0x20,
|
||||||
0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x43, 0x6c,
|
0x01, 0x28, 0x0c, 0x52, 0x10, 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x50, 0x72, 0x6f, 0x78,
|
||||||
0x75, 0x73, 0x74, 0x65, 0x72, 0x52, 0x0b, 0x6e, 0x6f, 0x64, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74,
|
0x79, 0x4a, 0x53, 0x4f, 0x4e, 0x12, 0x24, 0x0a, 0x0d, 0x62, 0x61, 0x6e, 0x64, 0x77, 0x69, 0x64,
|
||||||
0x65, 0x72, 0x12, 0x33, 0x0a, 0x0c, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x47, 0x72, 0x6f, 0x75,
|
0x74, 0x68, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x1a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x62, 0x61,
|
||||||
0x70, 0x73, 0x18, 0x1f, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x53, 0x65,
|
0x6e, 0x64, 0x77, 0x69, 0x64, 0x74, 0x68, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x26, 0x0a, 0x0e, 0x62,
|
||||||
0x72, 0x76, 0x65, 0x72, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x0c, 0x73, 0x65, 0x72, 0x76, 0x65,
|
0x61, 0x6e, 0x64, 0x77, 0x69, 0x64, 0x74, 0x68, 0x42, 0x79, 0x74, 0x65, 0x73, 0x18, 0x1b, 0x20,
|
||||||
0x72, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x12, 0x1c, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18,
|
0x01, 0x28, 0x03, 0x52, 0x0e, 0x62, 0x61, 0x6e, 0x64, 0x77, 0x69, 0x64, 0x74, 0x68, 0x42, 0x79,
|
||||||
0x20, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52,
|
0x74, 0x65, 0x73, 0x12, 0x31, 0x0a, 0x0b, 0x6e, 0x6f, 0x64, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74,
|
||||||
0x04, 0x75, 0x73, 0x65, 0x72, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70,
|
0x65, 0x72, 0x18, 0x1e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x6f,
|
||||||
0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x64, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x52, 0x0b, 0x6e, 0x6f, 0x64, 0x65, 0x43,
|
||||||
|
0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x12, 0x33, 0x0a, 0x0c, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72,
|
||||||
|
0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x18, 0x1f, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70,
|
||||||
|
0x62, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x0c, 0x73,
|
||||||
|
0x65, 0x72, 0x76, 0x65, 0x72, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x12, 0x1c, 0x0a, 0x04, 0x75,
|
||||||
|
0x73, 0x65, 0x72, 0x18, 0x20, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x70, 0x62, 0x2e, 0x55,
|
||||||
|
0x73, 0x65, 0x72, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x12, 0x4d, 0x0a, 0x15, 0x6c, 0x61, 0x74,
|
||||||
|
0x65, 0x73, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x44, 0x61, 0x69, 0x6c, 0x79, 0x53, 0x74,
|
||||||
|
0x61, 0x74, 0x18, 0x21, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x70, 0x62, 0x2e, 0x53, 0x65,
|
||||||
|
0x72, 0x76, 0x65, 0x72, 0x44, 0x61, 0x69, 0x6c, 0x79, 0x53, 0x74, 0x61, 0x74, 0x42, 0x02, 0x18,
|
||||||
|
0x01, 0x52, 0x15, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x44,
|
||||||
|
0x61, 0x69, 0x6c, 0x79, 0x53, 0x74, 0x61, 0x74, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62,
|
||||||
|
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -384,17 +422,19 @@ var file_models_model_server_proto_goTypes = []interface{}{
|
|||||||
(*NodeCluster)(nil), // 2: pb.NodeCluster
|
(*NodeCluster)(nil), // 2: pb.NodeCluster
|
||||||
(*ServerGroup)(nil), // 3: pb.ServerGroup
|
(*ServerGroup)(nil), // 3: pb.ServerGroup
|
||||||
(*User)(nil), // 4: pb.User
|
(*User)(nil), // 4: pb.User
|
||||||
|
(*ServerDailyStat)(nil), // 5: pb.ServerDailyStat
|
||||||
}
|
}
|
||||||
var file_models_model_server_proto_depIdxs = []int32{
|
var file_models_model_server_proto_depIdxs = []int32{
|
||||||
1, // 0: pb.Server.auditingResult:type_name -> pb.ServerNameAuditingResult
|
1, // 0: pb.Server.auditingResult:type_name -> pb.ServerNameAuditingResult
|
||||||
2, // 1: pb.Server.nodeCluster:type_name -> pb.NodeCluster
|
2, // 1: pb.Server.nodeCluster:type_name -> pb.NodeCluster
|
||||||
3, // 2: pb.Server.serverGroups:type_name -> pb.ServerGroup
|
3, // 2: pb.Server.serverGroups:type_name -> pb.ServerGroup
|
||||||
4, // 3: pb.Server.user:type_name -> pb.User
|
4, // 3: pb.Server.user:type_name -> pb.User
|
||||||
4, // [4:4] is the sub-list for method output_type
|
5, // 4: pb.Server.latestServerDailyStat:type_name -> pb.ServerDailyStat
|
||||||
4, // [4:4] is the sub-list for method input_type
|
5, // [5:5] is the sub-list for method output_type
|
||||||
4, // [4:4] is the sub-list for extension type_name
|
5, // [5:5] is the sub-list for method input_type
|
||||||
4, // [4:4] is the sub-list for extension extendee
|
5, // [5:5] is the sub-list for extension type_name
|
||||||
0, // [0:4] is the sub-list for field type_name
|
5, // [5:5] is the sub-list for extension extendee
|
||||||
|
0, // [0:5] is the sub-list for field type_name
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() { file_models_model_server_proto_init() }
|
func init() { file_models_model_server_proto_init() }
|
||||||
@@ -406,6 +446,7 @@ func file_models_model_server_proto_init() {
|
|||||||
file_models_model_server_group_proto_init()
|
file_models_model_server_group_proto_init()
|
||||||
file_models_model_user_proto_init()
|
file_models_model_user_proto_init()
|
||||||
file_models_model_server_name_auditing_result_proto_init()
|
file_models_model_server_name_auditing_result_proto_init()
|
||||||
|
file_models_model_server_daily_stat_proto_init()
|
||||||
if !protoimpl.UnsafeEnabled {
|
if !protoimpl.UnsafeEnabled {
|
||||||
file_models_model_server_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
file_models_model_server_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||||
switch v := v.(*Server); i {
|
switch v := v.(*Server); i {
|
||||||
|
|||||||
196
pkg/rpc/pb/model_server_bandwidth_stat.pb.go
Normal file
196
pkg/rpc/pb/model_server_bandwidth_stat.pb.go
Normal file
@@ -0,0 +1,196 @@
|
|||||||
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
|
// versions:
|
||||||
|
// protoc-gen-go v1.25.0
|
||||||
|
// protoc v3.19.4
|
||||||
|
// source: models/model_server_bandwidth_stat.proto
|
||||||
|
|
||||||
|
package pb
|
||||||
|
|
||||||
|
import (
|
||||||
|
proto "github.com/golang/protobuf/proto"
|
||||||
|
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||||
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
|
reflect "reflect"
|
||||||
|
sync "sync"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// Verify that this generated code is sufficiently up-to-date.
|
||||||
|
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||||
|
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||||
|
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||||
|
)
|
||||||
|
|
||||||
|
// This is a compile-time assertion that a sufficiently up-to-date version
|
||||||
|
// of the legacy proto package is being used.
|
||||||
|
const _ = proto.ProtoPackageIsVersion4
|
||||||
|
|
||||||
|
// 带宽统计数据
|
||||||
|
type ServerBandwidthStat struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||||
|
UserId int64 `protobuf:"varint,2,opt,name=userId,proto3" json:"userId,omitempty"`
|
||||||
|
ServerId int64 `protobuf:"varint,3,opt,name=serverId,proto3" json:"serverId,omitempty"`
|
||||||
|
Day string `protobuf:"bytes,4,opt,name=day,proto3" json:"day,omitempty"`
|
||||||
|
TimeAt string `protobuf:"bytes,5,opt,name=timeAt,proto3" json:"timeAt,omitempty"`
|
||||||
|
Bytes int64 `protobuf:"varint,6,opt,name=bytes,proto3" json:"bytes,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ServerBandwidthStat) Reset() {
|
||||||
|
*x = ServerBandwidthStat{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_models_model_server_bandwidth_stat_proto_msgTypes[0]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ServerBandwidthStat) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*ServerBandwidthStat) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *ServerBandwidthStat) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_models_model_server_bandwidth_stat_proto_msgTypes[0]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use ServerBandwidthStat.ProtoReflect.Descriptor instead.
|
||||||
|
func (*ServerBandwidthStat) Descriptor() ([]byte, []int) {
|
||||||
|
return file_models_model_server_bandwidth_stat_proto_rawDescGZIP(), []int{0}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ServerBandwidthStat) GetId() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.Id
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ServerBandwidthStat) GetUserId() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.UserId
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ServerBandwidthStat) GetServerId() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.ServerId
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ServerBandwidthStat) GetDay() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Day
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ServerBandwidthStat) GetTimeAt() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.TimeAt
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ServerBandwidthStat) GetBytes() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.Bytes
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
var File_models_model_server_bandwidth_stat_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
|
var file_models_model_server_bandwidth_stat_proto_rawDesc = []byte{
|
||||||
|
0x0a, 0x28, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x73,
|
||||||
|
0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x62, 0x61, 0x6e, 0x64, 0x77, 0x69, 0x64, 0x74, 0x68, 0x5f,
|
||||||
|
0x73, 0x74, 0x61, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, 0x99,
|
||||||
|
0x01, 0x0a, 0x13, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x42, 0x61, 0x6e, 0x64, 0x77, 0x69, 0x64,
|
||||||
|
0x74, 0x68, 0x53, 0x74, 0x61, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01,
|
||||||
|
0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64,
|
||||||
|
0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1a,
|
||||||
|
0x0a, 0x08, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03,
|
||||||
|
0x52, 0x08, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x49, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x64, 0x61,
|
||||||
|
0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x64, 0x61, 0x79, 0x12, 0x16, 0x0a, 0x06,
|
||||||
|
0x74, 0x69, 0x6d, 0x65, 0x41, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x74, 0x69,
|
||||||
|
0x6d, 0x65, 0x41, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x06, 0x20,
|
||||||
|
0x01, 0x28, 0x03, 0x52, 0x05, 0x62, 0x79, 0x74, 0x65, 0x73, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f,
|
||||||
|
0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
file_models_model_server_bandwidth_stat_proto_rawDescOnce sync.Once
|
||||||
|
file_models_model_server_bandwidth_stat_proto_rawDescData = file_models_model_server_bandwidth_stat_proto_rawDesc
|
||||||
|
)
|
||||||
|
|
||||||
|
func file_models_model_server_bandwidth_stat_proto_rawDescGZIP() []byte {
|
||||||
|
file_models_model_server_bandwidth_stat_proto_rawDescOnce.Do(func() {
|
||||||
|
file_models_model_server_bandwidth_stat_proto_rawDescData = protoimpl.X.CompressGZIP(file_models_model_server_bandwidth_stat_proto_rawDescData)
|
||||||
|
})
|
||||||
|
return file_models_model_server_bandwidth_stat_proto_rawDescData
|
||||||
|
}
|
||||||
|
|
||||||
|
var file_models_model_server_bandwidth_stat_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
|
||||||
|
var file_models_model_server_bandwidth_stat_proto_goTypes = []interface{}{
|
||||||
|
(*ServerBandwidthStat)(nil), // 0: pb.ServerBandwidthStat
|
||||||
|
}
|
||||||
|
var file_models_model_server_bandwidth_stat_proto_depIdxs = []int32{
|
||||||
|
0, // [0:0] is the sub-list for method output_type
|
||||||
|
0, // [0:0] is the sub-list for method input_type
|
||||||
|
0, // [0:0] is the sub-list for extension type_name
|
||||||
|
0, // [0:0] is the sub-list for extension extendee
|
||||||
|
0, // [0:0] is the sub-list for field type_name
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() { file_models_model_server_bandwidth_stat_proto_init() }
|
||||||
|
func file_models_model_server_bandwidth_stat_proto_init() {
|
||||||
|
if File_models_model_server_bandwidth_stat_proto != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if !protoimpl.UnsafeEnabled {
|
||||||
|
file_models_model_server_bandwidth_stat_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*ServerBandwidthStat); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
type x struct{}
|
||||||
|
out := protoimpl.TypeBuilder{
|
||||||
|
File: protoimpl.DescBuilder{
|
||||||
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
|
RawDescriptor: file_models_model_server_bandwidth_stat_proto_rawDesc,
|
||||||
|
NumEnums: 0,
|
||||||
|
NumMessages: 1,
|
||||||
|
NumExtensions: 0,
|
||||||
|
NumServices: 0,
|
||||||
|
},
|
||||||
|
GoTypes: file_models_model_server_bandwidth_stat_proto_goTypes,
|
||||||
|
DependencyIndexes: file_models_model_server_bandwidth_stat_proto_depIdxs,
|
||||||
|
MessageInfos: file_models_model_server_bandwidth_stat_proto_msgTypes,
|
||||||
|
}.Build()
|
||||||
|
File_models_model_server_bandwidth_stat_proto = out.File
|
||||||
|
file_models_model_server_bandwidth_stat_proto_rawDesc = nil
|
||||||
|
file_models_model_server_bandwidth_stat_proto_goTypes = nil
|
||||||
|
file_models_model_server_bandwidth_stat_proto_depIdxs = nil
|
||||||
|
}
|
||||||
@@ -31,17 +31,21 @@ type ServerDailyStat struct {
|
|||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
ServerId int64 `protobuf:"varint,1,opt,name=serverId,proto3" json:"serverId,omitempty"`
|
ServerId int64 `protobuf:"varint,1,opt,name=serverId,proto3" json:"serverId,omitempty"`
|
||||||
RegionId int64 `protobuf:"varint,2,opt,name=regionId,proto3" json:"regionId,omitempty"`
|
RegionId int64 `protobuf:"varint,2,opt,name=regionId,proto3" json:"regionId,omitempty"`
|
||||||
Bytes int64 `protobuf:"varint,3,opt,name=bytes,proto3" json:"bytes,omitempty"`
|
Bytes int64 `protobuf:"varint,3,opt,name=bytes,proto3" json:"bytes,omitempty"`
|
||||||
CachedBytes int64 `protobuf:"varint,5,opt,name=cachedBytes,proto3" json:"cachedBytes,omitempty"`
|
CachedBytes int64 `protobuf:"varint,5,opt,name=cachedBytes,proto3" json:"cachedBytes,omitempty"`
|
||||||
CountRequests int64 `protobuf:"varint,6,opt,name=countRequests,proto3" json:"countRequests,omitempty"`
|
CountRequests int64 `protobuf:"varint,6,opt,name=countRequests,proto3" json:"countRequests,omitempty"`
|
||||||
CountCachedRequests int64 `protobuf:"varint,7,opt,name=countCachedRequests,proto3" json:"countCachedRequests,omitempty"`
|
CountCachedRequests int64 `protobuf:"varint,7,opt,name=countCachedRequests,proto3" json:"countCachedRequests,omitempty"`
|
||||||
CreatedAt int64 `protobuf:"varint,4,opt,name=createdAt,proto3" json:"createdAt,omitempty"`
|
CreatedAt int64 `protobuf:"varint,4,opt,name=createdAt,proto3" json:"createdAt,omitempty"`
|
||||||
CountAttackRequests int64 `protobuf:"varint,8,opt,name=countAttackRequests,proto3" json:"countAttackRequests,omitempty"`
|
CountAttackRequests int64 `protobuf:"varint,8,opt,name=countAttackRequests,proto3" json:"countAttackRequests,omitempty"`
|
||||||
AttackBytes int64 `protobuf:"varint,9,opt,name=attackBytes,proto3" json:"attackBytes,omitempty"`
|
AttackBytes int64 `protobuf:"varint,9,opt,name=attackBytes,proto3" json:"attackBytes,omitempty"`
|
||||||
CheckTrafficLimiting bool `protobuf:"varint,10,opt,name=checkTrafficLimiting,proto3" json:"checkTrafficLimiting,omitempty"`
|
CheckTrafficLimiting bool `protobuf:"varint,10,opt,name=checkTrafficLimiting,proto3" json:"checkTrafficLimiting,omitempty"`
|
||||||
PlanId int64 `protobuf:"varint,11,opt,name=planId,proto3" json:"planId,omitempty"`
|
PlanId int64 `protobuf:"varint,11,opt,name=planId,proto3" json:"planId,omitempty"`
|
||||||
|
Day string `protobuf:"bytes,12,opt,name=day,proto3" json:"day,omitempty"`
|
||||||
|
Hour string `protobuf:"bytes,13,opt,name=hour,proto3" json:"hour,omitempty"`
|
||||||
|
TimeFrom string `protobuf:"bytes,14,opt,name=timeFrom,proto3" json:"timeFrom,omitempty"`
|
||||||
|
TimeTo string `protobuf:"bytes,15,opt,name=timeTo,proto3" json:"timeTo,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *ServerDailyStat) Reset() {
|
func (x *ServerDailyStat) Reset() {
|
||||||
@@ -153,12 +157,40 @@ func (x *ServerDailyStat) GetPlanId() int64 {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *ServerDailyStat) GetDay() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Day
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ServerDailyStat) GetHour() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Hour
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ServerDailyStat) GetTimeFrom() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.TimeFrom
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *ServerDailyStat) GetTimeTo() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.TimeTo
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
var File_models_model_server_daily_stat_proto protoreflect.FileDescriptor
|
var File_models_model_server_daily_stat_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
var file_models_model_server_daily_stat_proto_rawDesc = []byte{
|
var file_models_model_server_daily_stat_proto_rawDesc = []byte{
|
||||||
0x0a, 0x24, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x73,
|
0x0a, 0x24, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x73,
|
||||||
0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x64, 0x61, 0x69, 0x6c, 0x79, 0x5f, 0x73, 0x74, 0x61, 0x74,
|
0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x64, 0x61, 0x69, 0x6c, 0x79, 0x5f, 0x73, 0x74, 0x61, 0x74,
|
||||||
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, 0x97, 0x03, 0x0a, 0x0f, 0x53,
|
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, 0xf1, 0x03, 0x0a, 0x0f, 0x53,
|
||||||
0x65, 0x72, 0x76, 0x65, 0x72, 0x44, 0x61, 0x69, 0x6c, 0x79, 0x53, 0x74, 0x61, 0x74, 0x12, 0x1a,
|
0x65, 0x72, 0x76, 0x65, 0x72, 0x44, 0x61, 0x69, 0x6c, 0x79, 0x53, 0x74, 0x61, 0x74, 0x12, 0x1a,
|
||||||
0x0a, 0x08, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03,
|
0x0a, 0x08, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03,
|
||||||
0x52, 0x08, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65,
|
0x52, 0x08, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65,
|
||||||
@@ -184,8 +216,13 @@ var file_models_model_server_daily_stat_proto_rawDesc = []byte{
|
|||||||
0x18, 0x0a, 0x20, 0x01, 0x28, 0x08, 0x52, 0x14, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x54, 0x72, 0x61,
|
0x18, 0x0a, 0x20, 0x01, 0x28, 0x08, 0x52, 0x14, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x54, 0x72, 0x61,
|
||||||
0x66, 0x66, 0x69, 0x63, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x16, 0x0a, 0x06,
|
0x66, 0x66, 0x69, 0x63, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x16, 0x0a, 0x06,
|
||||||
0x70, 0x6c, 0x61, 0x6e, 0x49, 0x64, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x70, 0x6c,
|
0x70, 0x6c, 0x61, 0x6e, 0x49, 0x64, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x70, 0x6c,
|
||||||
0x61, 0x6e, 0x49, 0x64, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72,
|
0x61, 0x6e, 0x49, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x64, 0x61, 0x79, 0x18, 0x0c, 0x20, 0x01, 0x28,
|
||||||
0x6f, 0x74, 0x6f, 0x33,
|
0x09, 0x52, 0x03, 0x64, 0x61, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x6f, 0x75, 0x72, 0x18, 0x0d,
|
||||||
|
0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x6f, 0x75, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x74, 0x69,
|
||||||
|
0x6d, 0x65, 0x46, 0x72, 0x6f, 0x6d, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x69,
|
||||||
|
0x6d, 0x65, 0x46, 0x72, 0x6f, 0x6d, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x69, 0x6d, 0x65, 0x54, 0x6f,
|
||||||
|
0x18, 0x0f, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x74, 0x69, 0x6d, 0x65, 0x54, 0x6f, 0x42, 0x06,
|
||||||
|
0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|||||||
@@ -30,8 +30,9 @@ type ServerGroup struct {
|
|||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
|
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||||
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
|
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
|
||||||
|
UserId int64 `protobuf:"varint,3,opt,name=userId,proto3" json:"userId,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *ServerGroup) Reset() {
|
func (x *ServerGroup) Reset() {
|
||||||
@@ -80,16 +81,24 @@ func (x *ServerGroup) GetName() string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *ServerGroup) GetUserId() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.UserId
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
var File_models_model_server_group_proto protoreflect.FileDescriptor
|
var File_models_model_server_group_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
var file_models_model_server_group_proto_rawDesc = []byte{
|
var file_models_model_server_group_proto_rawDesc = []byte{
|
||||||
0x0a, 0x1f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x73,
|
0x0a, 0x1f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x73,
|
||||||
0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74,
|
0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74,
|
||||||
0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, 0x31, 0x0a, 0x0b, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x47,
|
0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, 0x49, 0x0a, 0x0b, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x47,
|
||||||
0x72, 0x6f, 0x75, 0x70, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03,
|
0x72, 0x6f, 0x75, 0x70, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03,
|
||||||
0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01,
|
0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01,
|
||||||
0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62,
|
0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73, 0x65, 0x72,
|
||||||
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64,
|
||||||
|
0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|||||||
219
pkg/rpc/pb/model_traffic_daily_stat.pb.go
Normal file
219
pkg/rpc/pb/model_traffic_daily_stat.pb.go
Normal file
@@ -0,0 +1,219 @@
|
|||||||
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
|
// versions:
|
||||||
|
// protoc-gen-go v1.25.0
|
||||||
|
// protoc v3.19.4
|
||||||
|
// source: models/model_traffic_daily_stat.proto
|
||||||
|
|
||||||
|
package pb
|
||||||
|
|
||||||
|
import (
|
||||||
|
proto "github.com/golang/protobuf/proto"
|
||||||
|
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||||
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
|
reflect "reflect"
|
||||||
|
sync "sync"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// Verify that this generated code is sufficiently up-to-date.
|
||||||
|
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||||
|
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||||
|
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||||
|
)
|
||||||
|
|
||||||
|
// This is a compile-time assertion that a sufficiently up-to-date version
|
||||||
|
// of the legacy proto package is being used.
|
||||||
|
const _ = proto.ProtoPackageIsVersion4
|
||||||
|
|
||||||
|
type TrafficDailyStat struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||||
|
Day string `protobuf:"bytes,2,opt,name=day,proto3" json:"day,omitempty"`
|
||||||
|
CachedBytes int64 `protobuf:"varint,3,opt,name=cachedBytes,proto3" json:"cachedBytes,omitempty"`
|
||||||
|
Bytes int64 `protobuf:"varint,4,opt,name=bytes,proto3" json:"bytes,omitempty"`
|
||||||
|
CountRequests int64 `protobuf:"varint,5,opt,name=countRequests,proto3" json:"countRequests,omitempty"`
|
||||||
|
CountCachedRequests int64 `protobuf:"varint,6,opt,name=countCachedRequests,proto3" json:"countCachedRequests,omitempty"`
|
||||||
|
CountAttackRequests int64 `protobuf:"varint,7,opt,name=countAttackRequests,proto3" json:"countAttackRequests,omitempty"`
|
||||||
|
AttackBytes int64 `protobuf:"varint,8,opt,name=attackBytes,proto3" json:"attackBytes,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *TrafficDailyStat) Reset() {
|
||||||
|
*x = TrafficDailyStat{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_models_model_traffic_daily_stat_proto_msgTypes[0]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *TrafficDailyStat) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*TrafficDailyStat) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *TrafficDailyStat) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_models_model_traffic_daily_stat_proto_msgTypes[0]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use TrafficDailyStat.ProtoReflect.Descriptor instead.
|
||||||
|
func (*TrafficDailyStat) Descriptor() ([]byte, []int) {
|
||||||
|
return file_models_model_traffic_daily_stat_proto_rawDescGZIP(), []int{0}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *TrafficDailyStat) GetId() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.Id
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *TrafficDailyStat) GetDay() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Day
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *TrafficDailyStat) GetCachedBytes() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.CachedBytes
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *TrafficDailyStat) GetBytes() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.Bytes
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *TrafficDailyStat) GetCountRequests() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.CountRequests
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *TrafficDailyStat) GetCountCachedRequests() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.CountCachedRequests
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *TrafficDailyStat) GetCountAttackRequests() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.CountAttackRequests
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *TrafficDailyStat) GetAttackBytes() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.AttackBytes
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
var File_models_model_traffic_daily_stat_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
|
var file_models_model_traffic_daily_stat_proto_rawDesc = []byte{
|
||||||
|
0x0a, 0x25, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x74,
|
||||||
|
0x72, 0x61, 0x66, 0x66, 0x69, 0x63, 0x5f, 0x64, 0x61, 0x69, 0x6c, 0x79, 0x5f, 0x73, 0x74, 0x61,
|
||||||
|
0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, 0x98, 0x02, 0x0a, 0x10,
|
||||||
|
0x54, 0x72, 0x61, 0x66, 0x66, 0x69, 0x63, 0x44, 0x61, 0x69, 0x6c, 0x79, 0x53, 0x74, 0x61, 0x74,
|
||||||
|
0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64,
|
||||||
|
0x12, 0x10, 0x0a, 0x03, 0x64, 0x61, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x64,
|
||||||
|
0x61, 0x79, 0x12, 0x20, 0x0a, 0x0b, 0x63, 0x61, 0x63, 0x68, 0x65, 0x64, 0x42, 0x79, 0x74, 0x65,
|
||||||
|
0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x63, 0x61, 0x63, 0x68, 0x65, 0x64, 0x42,
|
||||||
|
0x79, 0x74, 0x65, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x04, 0x20,
|
||||||
|
0x01, 0x28, 0x03, 0x52, 0x05, 0x62, 0x79, 0x74, 0x65, 0x73, 0x12, 0x24, 0x0a, 0x0d, 0x63, 0x6f,
|
||||||
|
0x75, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28,
|
||||||
|
0x03, 0x52, 0x0d, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x73,
|
||||||
|
0x12, 0x30, 0x0a, 0x13, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x43, 0x61, 0x63, 0x68, 0x65, 0x64, 0x52,
|
||||||
|
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x13, 0x63,
|
||||||
|
0x6f, 0x75, 0x6e, 0x74, 0x43, 0x61, 0x63, 0x68, 0x65, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
|
||||||
|
0x74, 0x73, 0x12, 0x30, 0x0a, 0x13, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x41, 0x74, 0x74, 0x61, 0x63,
|
||||||
|
0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52,
|
||||||
|
0x13, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x41, 0x74, 0x74, 0x61, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75,
|
||||||
|
0x65, 0x73, 0x74, 0x73, 0x12, 0x20, 0x0a, 0x0b, 0x61, 0x74, 0x74, 0x61, 0x63, 0x6b, 0x42, 0x79,
|
||||||
|
0x74, 0x65, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x61, 0x74, 0x74, 0x61, 0x63,
|
||||||
|
0x6b, 0x42, 0x79, 0x74, 0x65, 0x73, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06,
|
||||||
|
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
file_models_model_traffic_daily_stat_proto_rawDescOnce sync.Once
|
||||||
|
file_models_model_traffic_daily_stat_proto_rawDescData = file_models_model_traffic_daily_stat_proto_rawDesc
|
||||||
|
)
|
||||||
|
|
||||||
|
func file_models_model_traffic_daily_stat_proto_rawDescGZIP() []byte {
|
||||||
|
file_models_model_traffic_daily_stat_proto_rawDescOnce.Do(func() {
|
||||||
|
file_models_model_traffic_daily_stat_proto_rawDescData = protoimpl.X.CompressGZIP(file_models_model_traffic_daily_stat_proto_rawDescData)
|
||||||
|
})
|
||||||
|
return file_models_model_traffic_daily_stat_proto_rawDescData
|
||||||
|
}
|
||||||
|
|
||||||
|
var file_models_model_traffic_daily_stat_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
|
||||||
|
var file_models_model_traffic_daily_stat_proto_goTypes = []interface{}{
|
||||||
|
(*TrafficDailyStat)(nil), // 0: pb.TrafficDailyStat
|
||||||
|
}
|
||||||
|
var file_models_model_traffic_daily_stat_proto_depIdxs = []int32{
|
||||||
|
0, // [0:0] is the sub-list for method output_type
|
||||||
|
0, // [0:0] is the sub-list for method input_type
|
||||||
|
0, // [0:0] is the sub-list for extension type_name
|
||||||
|
0, // [0:0] is the sub-list for extension extendee
|
||||||
|
0, // [0:0] is the sub-list for field type_name
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() { file_models_model_traffic_daily_stat_proto_init() }
|
||||||
|
func file_models_model_traffic_daily_stat_proto_init() {
|
||||||
|
if File_models_model_traffic_daily_stat_proto != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if !protoimpl.UnsafeEnabled {
|
||||||
|
file_models_model_traffic_daily_stat_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*TrafficDailyStat); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
type x struct{}
|
||||||
|
out := protoimpl.TypeBuilder{
|
||||||
|
File: protoimpl.DescBuilder{
|
||||||
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
|
RawDescriptor: file_models_model_traffic_daily_stat_proto_rawDesc,
|
||||||
|
NumEnums: 0,
|
||||||
|
NumMessages: 1,
|
||||||
|
NumExtensions: 0,
|
||||||
|
NumServices: 0,
|
||||||
|
},
|
||||||
|
GoTypes: file_models_model_traffic_daily_stat_proto_goTypes,
|
||||||
|
DependencyIndexes: file_models_model_traffic_daily_stat_proto_depIdxs,
|
||||||
|
MessageInfos: file_models_model_traffic_daily_stat_proto_msgTypes,
|
||||||
|
}.Build()
|
||||||
|
File_models_model_traffic_daily_stat_proto = out.File
|
||||||
|
file_models_model_traffic_daily_stat_proto_rawDesc = nil
|
||||||
|
file_models_model_traffic_daily_stat_proto_goTypes = nil
|
||||||
|
file_models_model_traffic_daily_stat_proto_depIdxs = nil
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user