Initial commit (code only without large binaries)
This commit is contained in:
31
EdgeCommon/build/README.md
Normal file
31
EdgeCommon/build/README.md
Normal file
@@ -0,0 +1,31 @@
|
||||
# 脚本使用指南
|
||||
|
||||
## 编译多语言相关源文件
|
||||
~~~bash
|
||||
./build-messages.sh
|
||||
~~~
|
||||
|
||||
## 编译API相关源文件
|
||||
在使用 `build.sh` 编译 `.proto` 文件之前,你需要确保已经为 `protoc` 安装了对应的插件:
|
||||
~~~bash
|
||||
# install protoc-gen-go plugin
|
||||
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
|
||||
|
||||
# install protoc-gen-go-grpc plugin
|
||||
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
|
||||
~~~
|
||||
|
||||
之后每次 `.proto` 文件有更新的时候,请运行 `build.sh` 重新生成相应的Go源代码和`rpc.json`文件:
|
||||
~~~bash
|
||||
./build.sh
|
||||
~~~
|
||||
|
||||
如果文件名有更改,请清空 `pkg/rpc/pb/*.go` 文件,然后再次运行 `build.sh`。
|
||||
|
||||
|
||||
## 生成RPC列表文件
|
||||
运行:
|
||||
~~~bash
|
||||
./proto-json.sh
|
||||
~~~
|
||||
可以重新生成 `rpc.json` 文件。
|
||||
4
EdgeCommon/build/build-messages.sh
Normal file
4
EdgeCommon/build/build-messages.sh
Normal file
@@ -0,0 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
ROOT=$(dirname "$0")
|
||||
/usr/local/bin/go run "${ROOT}"/../cmd/langs/main.go generate
|
||||
28
EdgeCommon/build/build.sh
Normal file
28
EdgeCommon/build/build.sh
Normal file
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
echo "starting ..."
|
||||
|
||||
function assert() {
|
||||
RESULT=$?
|
||||
if [ "${RESULT}" != "0" ]; then
|
||||
exit
|
||||
fi
|
||||
}
|
||||
|
||||
#rm -f ../pkg/rpc/pb/*.pb.go
|
||||
protoc --go_out=../pkg/rpc --proto_path=../pkg/rpc/protos ../pkg/rpc/protos/*.proto
|
||||
assert
|
||||
|
||||
protoc --go-grpc_out=../pkg/rpc --go-grpc_opt=require_unimplemented_servers=false --proto_path=../pkg/rpc/protos ../pkg/rpc/protos/*.proto
|
||||
assert
|
||||
|
||||
protoc --go_out=../pkg/rpc --proto_path=../pkg/rpc/protos ../pkg/rpc/protos/models/*.proto
|
||||
RESULT=$?
|
||||
assert
|
||||
|
||||
|
||||
# generate rpc.json
|
||||
./proto-json.sh --quiet
|
||||
assert
|
||||
|
||||
echo "ok"
|
||||
17
EdgeCommon/build/configs/brand.yaml
Normal file
17
EdgeCommon/build/configs/brand.yaml
Normal file
@@ -0,0 +1,17 @@
|
||||
# 品牌配置
|
||||
brand:
|
||||
# 官方站点域名
|
||||
officialSite: "https://goedge.cn"
|
||||
|
||||
# 文档站点域名(可以与官方站点不同)
|
||||
docsSite: "https://goedge.cn"
|
||||
|
||||
# 文档路径前缀
|
||||
docsPathPrefix: "/docs"
|
||||
|
||||
# 默认部署路径
|
||||
defaultInstallPath: "/usr/local/goedge"
|
||||
|
||||
# 产品名称
|
||||
productName: "GoEdge"
|
||||
|
||||
31
EdgeCommon/build/configs/ip_library.yaml
Normal file
31
EdgeCommon/build/configs/ip_library.yaml
Normal file
@@ -0,0 +1,31 @@
|
||||
# IP 库配置
|
||||
ipLibrary:
|
||||
# 类型:default(原有实现)或 maxmind
|
||||
type: default
|
||||
|
||||
# MaxMind 配置(当 type 为 maxmind 时使用)
|
||||
maxmind:
|
||||
# City 数据库路径(包含 Country 和 City 信息)
|
||||
# 示例:/usr/local/share/GeoIP2/GeoLite2-City.mmdb
|
||||
cityDBPath: ""
|
||||
|
||||
# ASN 数据库路径(可选,用于获取 ISP 信息)
|
||||
# 示例:/usr/local/share/GeoIP2/GeoLite2-ASN.mmdb
|
||||
asnDBPath: ""
|
||||
|
||||
# 自动更新配置
|
||||
autoUpdate:
|
||||
# 是否启用自动更新
|
||||
enabled: false
|
||||
|
||||
# MaxMind 许可证密钥(必需)
|
||||
# 获取方式:https://www.maxmind.com/en/accounts/current/license-key
|
||||
licenseKey: ""
|
||||
|
||||
# 更新 URL(可选,默认使用 MaxMind 官方)
|
||||
updateURL: "https://download.maxmind.com/app/geoip_download"
|
||||
|
||||
# 更新间隔(如 "7d", "24h", "1h30m")
|
||||
# 默认:7d(7天)
|
||||
updateInterval: "7d"
|
||||
|
||||
3
EdgeCommon/build/proto-json.sh
Normal file
3
EdgeCommon/build/proto-json.sh
Normal file
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
go run ../cmd/proto-json/main.go $1
|
||||
24116
EdgeCommon/build/rpc.json
Normal file
24116
EdgeCommon/build/rpc.json
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user