加入网络层
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1 +1,2 @@
|
|||||||
|
.idea
|
||||||
*/.idea
|
*/.idea
|
||||||
81
Public/Publish/docker-compose.yml
Normal file
81
Public/Publish/docker-compose.yml
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
version: '3.8'
|
||||||
|
services:
|
||||||
|
# ETCD 分布式键值存储
|
||||||
|
etcd:
|
||||||
|
image: quay.io/coreos/etcd:v3.5.4
|
||||||
|
container_name: etcd
|
||||||
|
ports:
|
||||||
|
- "2379:2379" # 客户端连接端口
|
||||||
|
- "2380:2380" # 节点通信端口
|
||||||
|
environment:
|
||||||
|
ETCD_LISTEN_CLIENT_URLS: "http://0.0.0.0:2379"
|
||||||
|
ETCD_ADVERTISE_CLIENT_URLS: "http://etcd:2379"
|
||||||
|
ETCD_LISTEN_PEER_URLS: "http://0.0.0.0:2380"
|
||||||
|
ETCD_INITIAL_ADVERTISE_PEER_URLS: "http://etcd:2380"
|
||||||
|
ETCD_NAME: "etcd-single"
|
||||||
|
ETCD_INITIAL_CLUSTER: "etcd-single=http://etcd:2380"
|
||||||
|
ETCD_INITIAL_CLUSTER_TOKEN: "etcd-cluster"
|
||||||
|
ETCD_INITIAL_CLUSTER_STATE: "new"
|
||||||
|
volumes:
|
||||||
|
- etcd-data:/etcd-data
|
||||||
|
networks:
|
||||||
|
- app-network
|
||||||
|
|
||||||
|
# Redis 缓存数据库
|
||||||
|
redis:
|
||||||
|
image: redis:7.0-alpine
|
||||||
|
container_name: redis
|
||||||
|
ports:
|
||||||
|
- "6379:6379"
|
||||||
|
volumes:
|
||||||
|
- redis-data:/data
|
||||||
|
networks:
|
||||||
|
- app-network
|
||||||
|
command: redis-server --save 60 1 --loglevel warning
|
||||||
|
|
||||||
|
# MySQL 数据库
|
||||||
|
mysql:
|
||||||
|
image: mysql:8.0
|
||||||
|
container_name: mysql
|
||||||
|
environment:
|
||||||
|
MYSQL_ROOT_PASSWORD: rootpassword # 请更改为强密码
|
||||||
|
MYSQL_DATABASE: app_db
|
||||||
|
MYSQL_USER: app_user
|
||||||
|
MYSQL_PASSWORD: userpassword # 请更改为强密码
|
||||||
|
ports:
|
||||||
|
- "3306:3306"
|
||||||
|
volumes:
|
||||||
|
- mysql-data:/var/lib/mysql
|
||||||
|
- ./mysql-init:/docker-entrypoint-initdb.d # 初始化SQL脚本目录
|
||||||
|
networks:
|
||||||
|
- app-network
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
|
||||||
|
interval: 5s
|
||||||
|
timeout: 10s
|
||||||
|
retries: 5
|
||||||
|
|
||||||
|
# ETCD 可视化界面 (Web UI)
|
||||||
|
etcd-viewer:
|
||||||
|
image: deltaprojects/etcdkeeper:latest
|
||||||
|
container_name: etcd-viewer
|
||||||
|
ports:
|
||||||
|
- "8080:8080"
|
||||||
|
environment:
|
||||||
|
ETCD_HOST: etcd
|
||||||
|
ETCD_PORT: 2379
|
||||||
|
networks:
|
||||||
|
- app-network
|
||||||
|
depends_on:
|
||||||
|
- etcd
|
||||||
|
|
||||||
|
# 数据卷声明
|
||||||
|
volumes:
|
||||||
|
etcd-data:
|
||||||
|
redis-data:
|
||||||
|
mysql-data:
|
||||||
|
|
||||||
|
# 网络配置
|
||||||
|
networks:
|
||||||
|
app-network:
|
||||||
|
driver: bridge
|
||||||
7
Public/Tools/gen_proto.bat
Normal file
7
Public/Tools/gen_proto.bat
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
@echo off
|
||||||
|
|
||||||
|
cd ../../Server/common
|
||||||
|
|
||||||
|
protoc --proto_path=. --go_out=.. ./proto/common.proto
|
||||||
|
protoc --proto_path=./proto --go_out=.. ./proto/grpc/*.proto
|
||||||
|
protoc --proto_path=./proto --go_out=.. --go-grpc_out=.. ./proto/grpc/*.proto
|
||||||
76
Server/Gateway/app/app.go
Normal file
76
Server/Gateway/app/app.go
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
package app
|
||||||
|
|
||||||
|
import (
|
||||||
|
"common/db/etcd"
|
||||||
|
"common/discover"
|
||||||
|
"common/log"
|
||||||
|
"common/net/grpc/service"
|
||||||
|
"common/net/socket/websocket"
|
||||||
|
"fmt"
|
||||||
|
"gateway/config"
|
||||||
|
"gateway/grpc_server"
|
||||||
|
"gateway/handler/ws_handler"
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
"github.com/judwhite/go-svc"
|
||||||
|
"runtime/debug"
|
||||||
|
"sync"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Program struct {
|
||||||
|
wg *sync.WaitGroup
|
||||||
|
server service.IService // grpc服务
|
||||||
|
webServer *gin.Engine // web服务
|
||||||
|
wsServer *websocket.WSServer // websocket服务
|
||||||
|
stop chan bool
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *Program) Init(_ svc.Environment) error {
|
||||||
|
if cfg, err := p.initBase(); err != nil {
|
||||||
|
return err
|
||||||
|
} else {
|
||||||
|
log.Infof(fmt.Sprintf("%v starting...", cfg.App.Name))
|
||||||
|
if err := p.initDB(cfg); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := p.initWebServer(cfg); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := p.initWsServer(cfg); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *Program) Start() error {
|
||||||
|
defer func() {
|
||||||
|
if err := recover(); err != nil {
|
||||||
|
fmt.Printf("Start err: %v", err)
|
||||||
|
debug.PrintStack()
|
||||||
|
_ = p.Stop()
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
|
discover.Listen()
|
||||||
|
p.server = grpc_server.NewServer(config.Get().Grpc.Registry.TTL)
|
||||||
|
p.server.Init(config.Get().Grpc.Registry.Address, config.Get().Grpc.Registry.Port)
|
||||||
|
|
||||||
|
ws_handler.NewClient(123, nil)
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *Program) Stop() error {
|
||||||
|
defer func() {
|
||||||
|
if err := recover(); err != nil {
|
||||||
|
fmt.Printf("Stop err: %v", err)
|
||||||
|
debug.PrintStack()
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
|
discover.Close()
|
||||||
|
p.server.Close()
|
||||||
|
_ = etcd.Close()
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
22
Server/Gateway/app/base.go
Normal file
22
Server/Gateway/app/base.go
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
package app
|
||||||
|
|
||||||
|
import (
|
||||||
|
"common/log"
|
||||||
|
"common/utils"
|
||||||
|
"gateway/config"
|
||||||
|
"math/rand"
|
||||||
|
)
|
||||||
|
|
||||||
|
func (p *Program) initBase() (*config.Config, error) {
|
||||||
|
// 配置
|
||||||
|
cfg, err := config.LoadConfig("./config")
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
// 日志
|
||||||
|
log.Init(cfg.Log.Debug, cfg.Log.MaxSize, cfg.Log.MaxBackups, cfg.Log.MaxAge, cfg.Log.Level)
|
||||||
|
// 雪花
|
||||||
|
utils.InitSnowflake(int64(rand.Intn(1000)))
|
||||||
|
|
||||||
|
return cfg, nil
|
||||||
|
}
|
||||||
20
Server/Gateway/app/db.go
Normal file
20
Server/Gateway/app/db.go
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
package app
|
||||||
|
|
||||||
|
import (
|
||||||
|
"common/db/etcd"
|
||||||
|
"gateway/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func (p *Program) initDB(cfg *config.Config) error {
|
||||||
|
// ETCD
|
||||||
|
if err := etcd.Init(cfg.DB.Etcd.Address); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *Program) stopDB() error {
|
||||||
|
_ = etcd.Close()
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
16
Server/Gateway/app/web.go
Normal file
16
Server/Gateway/app/web.go
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
package app
|
||||||
|
|
||||||
|
import (
|
||||||
|
"gateway/config"
|
||||||
|
"gateway/net/http_gateway"
|
||||||
|
)
|
||||||
|
|
||||||
|
func (p *Program) initWebServer(cfg *config.Config) error {
|
||||||
|
p.webServer = http_gateway.InitRouter(cfg)
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *Program) stopWebServer() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
39
Server/Gateway/app/websocket.go
Normal file
39
Server/Gateway/app/websocket.go
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
package app
|
||||||
|
|
||||||
|
import (
|
||||||
|
"common/log"
|
||||||
|
"common/net/socket/websocket"
|
||||||
|
"gateway/config"
|
||||||
|
"gateway/net/ws_gateway"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
func (p *Program) initWsServer(cfg *config.Config) error {
|
||||||
|
//p.wsServer = websocket.NewWSServer(
|
||||||
|
// &ws_gateway.GatewayWsServer{
|
||||||
|
// Decoder: &ws_gateway.Decoder{},
|
||||||
|
// },
|
||||||
|
// log.GetLogger(),
|
||||||
|
// fmt.Sprintf("tcp4://%v:%d", cfg.SocketServer.Host, cfg.SocketServer.Port),
|
||||||
|
// true,
|
||||||
|
// true,
|
||||||
|
// false,
|
||||||
|
// false,
|
||||||
|
// true,
|
||||||
|
// 8,
|
||||||
|
// 5*time.Second,
|
||||||
|
//)
|
||||||
|
p.wsServer = websocket.NewWSServer(
|
||||||
|
&ws_gateway.GatewayWsServer{},
|
||||||
|
log.GetLogger(),
|
||||||
|
5*time.Second,
|
||||||
|
)
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *Program) stopWsServer() error {
|
||||||
|
_ = p.wsServer.Stop()
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
19
Server/Gateway/config/config.dev.yaml
Normal file
19
Server/Gateway/config/config.dev.yaml
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
app:
|
||||||
|
name: "gateway-dev"
|
||||||
|
|
||||||
|
log:
|
||||||
|
debug: true
|
||||||
|
level: "debug"
|
||||||
|
max_size: 100
|
||||||
|
max_backups: 3
|
||||||
|
max_age: 7
|
||||||
|
|
||||||
|
grpc:
|
||||||
|
registry:
|
||||||
|
address: "10.0.40.199"
|
||||||
|
port: 8500
|
||||||
|
ttl: 20
|
||||||
|
|
||||||
|
db:
|
||||||
|
etcd:
|
||||||
|
address: [ "10.0.40.9:2379" ]
|
||||||
34
Server/Gateway/config/config.go
Normal file
34
Server/Gateway/config/config.go
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
package config
|
||||||
|
|
||||||
|
type Config struct {
|
||||||
|
App AppConfig `yaml:"app"`
|
||||||
|
Log LogConfig `yaml:"log"`
|
||||||
|
Grpc GrpcConfig `yaml:"grpc"`
|
||||||
|
DB DBConfig `yaml:"db"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type AppConfig struct {
|
||||||
|
Name string `yaml:"name"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type LogConfig struct {
|
||||||
|
Debug bool `yaml:"debug"`
|
||||||
|
MaxSize int `yaml:"max_size"`
|
||||||
|
MaxBackups int `yaml:"max_backups"`
|
||||||
|
MaxAge int `yaml:"max_age"`
|
||||||
|
Level string `yaml:"level"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type GrpcConfig struct {
|
||||||
|
Registry *struct {
|
||||||
|
Address string `yaml:"address"`
|
||||||
|
Port int `yaml:"port"`
|
||||||
|
TTL int64 `yaml:"ttl"`
|
||||||
|
} `yaml:"registry"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type DBConfig struct {
|
||||||
|
Etcd *struct {
|
||||||
|
Address []string `yaml:"address"`
|
||||||
|
} `yaml:"etcd"`
|
||||||
|
}
|
||||||
45
Server/Gateway/config/loader.go
Normal file
45
Server/Gateway/config/loader.go
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
package config
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"github.com/spf13/viper"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
defaultConfigName = "config.dev"
|
||||||
|
envConfigPrefix = "XH_G"
|
||||||
|
)
|
||||||
|
|
||||||
|
var cfg *Config
|
||||||
|
|
||||||
|
// LoadConfig 加载并返回应用配置
|
||||||
|
func LoadConfig(configDir string) (*Config, error) {
|
||||||
|
v := viper.New()
|
||||||
|
|
||||||
|
v.SetEnvPrefix(envConfigPrefix)
|
||||||
|
v.AutomaticEnv()
|
||||||
|
v.SetEnvKeyReplacer(strings.NewReplacer(".", "_"))
|
||||||
|
|
||||||
|
env := v.GetString("env")
|
||||||
|
if env == "" {
|
||||||
|
env = "dev"
|
||||||
|
}
|
||||||
|
|
||||||
|
v.SetConfigName(fmt.Sprintf("config.%s", strings.ToLower(env)))
|
||||||
|
v.AddConfigPath(configDir)
|
||||||
|
v.SetConfigType("yaml")
|
||||||
|
|
||||||
|
if err := v.ReadInConfig(); err != nil {
|
||||||
|
return nil, fmt.Errorf("读取配置失败: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := v.Unmarshal(&cfg); err != nil {
|
||||||
|
return nil, fmt.Errorf("解析配置失败: %w", err)
|
||||||
|
}
|
||||||
|
return cfg, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func Get() *Config {
|
||||||
|
return cfg
|
||||||
|
}
|
||||||
@@ -3,23 +3,75 @@ module gateway
|
|||||||
go 1.23.1
|
go 1.23.1
|
||||||
|
|
||||||
require (
|
require (
|
||||||
|
common v0.0.0-00010101000000-000000000000
|
||||||
|
github.com/gin-contrib/cors v1.7.6
|
||||||
|
github.com/gin-gonic/gin v1.10.1
|
||||||
|
github.com/gobwas/ws v1.4.0
|
||||||
|
github.com/golang/protobuf v1.5.4
|
||||||
|
github.com/judwhite/go-svc v1.2.1
|
||||||
github.com/spf13/viper v1.20.1
|
github.com/spf13/viper v1.20.1
|
||||||
go.uber.org/zap v1.27.0
|
go.mongodb.org/mongo-driver v1.17.4
|
||||||
golang.org/x/sync v0.15.0
|
golang.org/x/text v0.26.0
|
||||||
|
google.golang.org/grpc v1.71.1
|
||||||
|
google.golang.org/protobuf v1.36.6
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
|
github.com/bwmarrin/snowflake v0.3.0 // indirect
|
||||||
|
github.com/bytedance/sonic v1.13.3 // indirect
|
||||||
|
github.com/bytedance/sonic/loader v0.2.4 // indirect
|
||||||
|
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
||||||
|
github.com/cloudwego/base64x v0.1.5 // indirect
|
||||||
|
github.com/coreos/go-semver v0.3.1 // indirect
|
||||||
|
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
|
||||||
|
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
|
||||||
github.com/fsnotify/fsnotify v1.8.0 // indirect
|
github.com/fsnotify/fsnotify v1.8.0 // indirect
|
||||||
|
github.com/gabriel-vasile/mimetype v1.4.9 // indirect
|
||||||
|
github.com/getsentry/sentry-go v0.34.0 // indirect
|
||||||
|
github.com/gin-contrib/sse v1.1.0 // indirect
|
||||||
|
github.com/go-playground/locales v0.14.1 // indirect
|
||||||
|
github.com/go-playground/universal-translator v0.18.1 // indirect
|
||||||
|
github.com/go-playground/validator/v10 v10.26.0 // indirect
|
||||||
github.com/go-viper/mapstructure/v2 v2.2.1 // indirect
|
github.com/go-viper/mapstructure/v2 v2.2.1 // indirect
|
||||||
github.com/pelletier/go-toml/v2 v2.2.3 // indirect
|
github.com/gobwas/httphead v0.1.0 // indirect
|
||||||
|
github.com/gobwas/pool v0.2.1 // indirect
|
||||||
|
github.com/goccy/go-json v0.10.5 // indirect
|
||||||
|
github.com/gogo/protobuf v1.3.2 // indirect
|
||||||
|
github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3 // indirect
|
||||||
|
github.com/json-iterator/go v1.1.12 // indirect
|
||||||
|
github.com/klauspost/cpuid/v2 v2.2.10 // indirect
|
||||||
|
github.com/leodido/go-urn v1.4.0 // indirect
|
||||||
|
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||||
|
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||||
|
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||||
|
github.com/natefinch/lumberjack v2.0.0+incompatible // indirect
|
||||||
|
github.com/panjf2000/ants/v2 v2.11.3 // indirect
|
||||||
|
github.com/panjf2000/gnet/v2 v2.9.1 // indirect
|
||||||
|
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
|
||||||
|
github.com/redis/go-redis/v9 v9.10.0 // indirect
|
||||||
github.com/sagikazarmark/locafero v0.7.0 // indirect
|
github.com/sagikazarmark/locafero v0.7.0 // indirect
|
||||||
github.com/sourcegraph/conc v0.3.0 // indirect
|
github.com/sourcegraph/conc v0.3.0 // indirect
|
||||||
github.com/spf13/afero v1.12.0 // indirect
|
github.com/spf13/afero v1.12.0 // indirect
|
||||||
github.com/spf13/cast v1.7.1 // indirect
|
github.com/spf13/cast v1.7.1 // indirect
|
||||||
github.com/spf13/pflag v1.0.6 // indirect
|
github.com/spf13/pflag v1.0.6 // indirect
|
||||||
github.com/subosito/gotenv v1.6.0 // indirect
|
github.com/subosito/gotenv v1.6.0 // indirect
|
||||||
go.uber.org/multierr v1.10.0 // indirect
|
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
|
||||||
golang.org/x/sys v0.29.0 // indirect
|
github.com/ugorji/go/codec v1.3.0 // indirect
|
||||||
golang.org/x/text v0.21.0 // indirect
|
github.com/valyala/bytebufferpool v1.0.0 // indirect
|
||||||
|
go.etcd.io/etcd/api/v3 v3.6.1 // indirect
|
||||||
|
go.etcd.io/etcd/client/pkg/v3 v3.6.1 // indirect
|
||||||
|
go.etcd.io/etcd/client/v3 v3.6.1 // indirect
|
||||||
|
go.uber.org/multierr v1.11.0 // indirect
|
||||||
|
go.uber.org/zap v1.27.0 // indirect
|
||||||
|
golang.org/x/arch v0.18.0 // indirect
|
||||||
|
golang.org/x/crypto v0.39.0 // indirect
|
||||||
|
golang.org/x/net v0.41.0 // indirect
|
||||||
|
golang.org/x/sync v0.15.0 // indirect
|
||||||
|
golang.org/x/sys v0.33.0 // indirect
|
||||||
|
google.golang.org/genproto/googleapis/api v0.0.0-20250303144028-a0af3efb3deb // indirect
|
||||||
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20250303144028-a0af3efb3deb // indirect
|
||||||
|
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
|
||||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||||
)
|
)
|
||||||
|
|
||||||
|
replace common => ../common
|
||||||
|
|||||||
@@ -1,23 +1,121 @@
|
|||||||
|
github.com/BurntSushi/toml v1.2.0 h1:Rt8g24XnyGTyglgET/PRUNlrUeu9F5L+7FilkXfZgs0=
|
||||||
|
github.com/BurntSushi/toml v1.2.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
|
||||||
|
github.com/bsm/ginkgo/v2 v2.12.0 h1:Ny8MWAHyOepLGlLKYmXG4IEkioBysk6GpaRTLC8zwWs=
|
||||||
|
github.com/bsm/ginkgo/v2 v2.12.0/go.mod h1:SwYbGRRDovPVboqFv0tPTcG1sN61LM1Z4ARdbAV9g4c=
|
||||||
|
github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA=
|
||||||
|
github.com/bsm/gomega v1.27.10/go.mod h1:JyEr/xRbxbtgWNi8tIEVPUYZ5Dzef52k01W3YH0H+O0=
|
||||||
|
github.com/bwmarrin/snowflake v0.3.0 h1:xm67bEhkKh6ij1790JB83OujPR5CzNe8QuQqAgISZN0=
|
||||||
|
github.com/bwmarrin/snowflake v0.3.0/go.mod h1:NdZxfVWX+oR6y2K0o6qAYv6gIOP9rjG0/E9WsDpxqwE=
|
||||||
|
github.com/bytedance/sonic v1.13.3 h1:MS8gmaH16Gtirygw7jV91pDCN33NyMrPbN7qiYhEsF0=
|
||||||
|
github.com/bytedance/sonic v1.13.3/go.mod h1:o68xyaF9u2gvVBuGHPlUVCy+ZfmNNO5ETf1+KgkJhz4=
|
||||||
|
github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU=
|
||||||
|
github.com/bytedance/sonic/loader v0.2.4 h1:ZWCw4stuXUsn1/+zQDqeE7JKP+QO47tz7QCNan80NzY=
|
||||||
|
github.com/bytedance/sonic/loader v0.2.4/go.mod h1:N8A3vUdtUebEY2/VQC0MyhYeKUFosQU6FxH2JmUe6VI=
|
||||||
|
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
|
||||||
|
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||||
|
github.com/cloudwego/base64x v0.1.5 h1:XPciSp1xaq2VCSt6lF0phncD4koWyULpl5bUxbfCyP4=
|
||||||
|
github.com/cloudwego/base64x v0.1.5/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w=
|
||||||
|
github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY=
|
||||||
|
github.com/coreos/go-semver v0.3.1 h1:yi21YpKnrx1gt5R+la8n5WgS0kCrsPp33dmEyHReZr4=
|
||||||
|
github.com/coreos/go-semver v0.3.1/go.mod h1:irMmmIw/7yzSRPWryHsK7EYSg09caPQL03VsM8rvUec=
|
||||||
|
github.com/coreos/go-systemd/v22 v22.5.0 h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8iXXhfZs=
|
||||||
|
github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
|
||||||
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
|
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=
|
||||||
|
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
|
||||||
github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8=
|
github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8=
|
||||||
github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0=
|
github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0=
|
||||||
github.com/fsnotify/fsnotify v1.8.0 h1:dAwr6QBTBZIkG8roQaJjGof0pp0EeF+tNV7YBP3F/8M=
|
github.com/fsnotify/fsnotify v1.8.0 h1:dAwr6QBTBZIkG8roQaJjGof0pp0EeF+tNV7YBP3F/8M=
|
||||||
github.com/fsnotify/fsnotify v1.8.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0=
|
github.com/fsnotify/fsnotify v1.8.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0=
|
||||||
|
github.com/gabriel-vasile/mimetype v1.4.9 h1:5k+WDwEsD9eTLL8Tz3L0VnmVh9QxGjRmjBvAG7U/oYY=
|
||||||
|
github.com/gabriel-vasile/mimetype v1.4.9/go.mod h1:WnSQhFKJuBlRyLiKohA/2DtIlPFAbguNaG7QCHcyGok=
|
||||||
|
github.com/getsentry/sentry-go v0.34.0 h1:1FCHBVp8TfSc8L10zqSwXUZNiOSF+10qw4czjarTiY4=
|
||||||
|
github.com/getsentry/sentry-go v0.34.0/go.mod h1:C55omcY9ChRQIUcVcGcs+Zdy4ZpQGvNJ7JYHIoSWOtE=
|
||||||
|
github.com/gin-contrib/cors v1.7.6 h1:3gQ8GMzs1Ylpf70y8bMw4fVpycXIeX1ZemuSQIsnQQY=
|
||||||
|
github.com/gin-contrib/cors v1.7.6/go.mod h1:Ulcl+xN4jel9t1Ry8vqph23a60FwH9xVLd+3ykmTjOk=
|
||||||
|
github.com/gin-contrib/sse v1.1.0 h1:n0w2GMuUpWDVp7qSpvze6fAu9iRxJY4Hmj6AmBOU05w=
|
||||||
|
github.com/gin-contrib/sse v1.1.0/go.mod h1:hxRZ5gVpWMT7Z0B0gSNYqqsSCNIJMjzvm6fqCz9vjwM=
|
||||||
|
github.com/gin-gonic/gin v1.10.1 h1:T0ujvqyCSqRopADpgPgiTT63DUQVSfojyME59Ei63pQ=
|
||||||
|
github.com/gin-gonic/gin v1.10.1/go.mod h1:4PMNQiOhvDRa013RKVbsiNwoyezlm2rm0uX/T7kzp5Y=
|
||||||
|
github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA=
|
||||||
|
github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og=
|
||||||
|
github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY=
|
||||||
|
github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
|
||||||
|
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
|
||||||
|
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
|
||||||
|
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
|
||||||
|
github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
|
||||||
|
github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA=
|
||||||
|
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
|
||||||
|
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
|
||||||
|
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
|
||||||
|
github.com/go-playground/validator/v10 v10.26.0 h1:SP05Nqhjcvz81uJaRfEV0YBSSSGMc/iMaVtFbr3Sw2k=
|
||||||
|
github.com/go-playground/validator/v10 v10.26.0/go.mod h1:I5QpIEbmr8On7W0TktmJAumgzX4CA1XNl4ZmDuVHKKo=
|
||||||
github.com/go-viper/mapstructure/v2 v2.2.1 h1:ZAaOCxANMuZx5RCeg0mBdEZk7DZasvvZIxtHqx8aGss=
|
github.com/go-viper/mapstructure/v2 v2.2.1 h1:ZAaOCxANMuZx5RCeg0mBdEZk7DZasvvZIxtHqx8aGss=
|
||||||
github.com/go-viper/mapstructure/v2 v2.2.1/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM=
|
github.com/go-viper/mapstructure/v2 v2.2.1/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM=
|
||||||
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
github.com/gobwas/httphead v0.1.0 h1:exrUm0f4YX0L7EBwZHuCF4GDp8aJfVeBrlLQrs6NqWU=
|
||||||
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
github.com/gobwas/httphead v0.1.0/go.mod h1:O/RXo79gxV8G+RqlR/otEwx4Q36zl9rqC5u12GKvMCM=
|
||||||
|
github.com/gobwas/pool v0.2.1 h1:xfeeEhW7pwmX8nuLVlqbzVc7udMDrwetjEv+TZIz1og=
|
||||||
|
github.com/gobwas/pool v0.2.1/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw=
|
||||||
|
github.com/gobwas/ws v1.4.0 h1:CTaoG1tojrh4ucGPcoJFiAQUAsEWekEWvLy7GsVNqGs=
|
||||||
|
github.com/gobwas/ws v1.4.0/go.mod h1:G3gNqMNtPppf5XUz7O4shetPpcZ1VJ7zt18dlUeakrc=
|
||||||
|
github.com/goccy/go-json v0.10.5 h1:Fq85nIqj+gXn/S5ahsiTlK3TmC85qgirsdTP/+DeaC4=
|
||||||
|
github.com/goccy/go-json v0.10.5/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M=
|
||||||
|
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
|
||||||
|
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
|
||||||
|
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
|
||||||
|
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
|
||||||
|
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
|
||||||
|
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
|
||||||
|
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
|
||||||
|
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||||
|
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||||
|
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||||
|
github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3 h1:5ZPtiqj0JL5oKWmcsq4VMaAW5ukBEgSGXEN89zeH1Jo=
|
||||||
|
github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3/go.mod h1:ndYquD05frm2vACXE1nsccT4oJzjhw2arTS2cpUD1PI=
|
||||||
|
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
|
||||||
|
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
|
||||||
|
github.com/judwhite/go-svc v1.2.1 h1:a7fsJzYUa33sfDJRF2N/WXhA+LonCEEY8BJb1tuS5tA=
|
||||||
|
github.com/judwhite/go-svc v1.2.1/go.mod h1:mo/P2JNX8C07ywpP9YtO2gnBgnUiFTHqtsZekJrUuTk=
|
||||||
|
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
|
||||||
|
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
|
||||||
|
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
|
||||||
|
github.com/klauspost/cpuid/v2 v2.2.10 h1:tBs3QSyvjDyFTq3uoc/9xFpCuOsJQFNPiAhYdw2skhE=
|
||||||
|
github.com/klauspost/cpuid/v2 v2.2.10/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0=
|
||||||
|
github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M=
|
||||||
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
||||||
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
|
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
|
||||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||||
github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M=
|
github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ=
|
||||||
github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xlb6rzQu9GuUkc=
|
github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI=
|
||||||
|
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
||||||
|
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||||
|
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||||
|
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
|
||||||
|
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||||
|
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
|
||||||
|
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
|
||||||
|
github.com/natefinch/lumberjack v2.0.0+incompatible h1:4QJd3OLAMgj7ph+yZTuX13Ld4UpgHp07nNdFX7mqFfM=
|
||||||
|
github.com/natefinch/lumberjack v2.0.0+incompatible/go.mod h1:Wi9p2TTF5DG5oU+6YfsmYQpsTIOm0B1VNzQg9Mw6nPk=
|
||||||
|
github.com/panjf2000/ants/v2 v2.11.3 h1:AfI0ngBoXJmYOpDh9m516vjqoUu2sLrIVgppI9TZVpg=
|
||||||
|
github.com/panjf2000/ants/v2 v2.11.3/go.mod h1:8u92CYMUc6gyvTIw8Ru7Mt7+/ESnJahz5EVtqfrilek=
|
||||||
|
github.com/panjf2000/gnet/v2 v2.9.1 h1:bKewICy/0xnQ9PMzNaswpe/Ah14w1TrRk91LHTcbIlA=
|
||||||
|
github.com/panjf2000/gnet/v2 v2.9.1/go.mod h1:WQTxDWYuQ/hz3eccH0FN32IVuvZ19HewEWx0l62fx7E=
|
||||||
|
github.com/pelletier/go-toml/v2 v2.2.4 h1:mye9XuhQ6gvn5h28+VilKrrPoQVanw5PMw/TB0t5Ec4=
|
||||||
|
github.com/pelletier/go-toml/v2 v2.2.4/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8t9Stt+h56mCY=
|
||||||
|
github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4=
|
||||||
|
github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8=
|
||||||
|
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
||||||
|
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
|
github.com/redis/go-redis/v9 v9.10.0 h1:FxwK3eV8p/CQa0Ch276C7u2d0eNC9kCmAYQ7mCXCzVs=
|
||||||
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
|
github.com/redis/go-redis/v9 v9.10.0/go.mod h1:huWgSWd8mW6+m0VPhJjSSQ+d6Nh1VICQ6Q5lHuCH/Iw=
|
||||||
|
github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII=
|
||||||
|
github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o=
|
||||||
github.com/sagikazarmark/locafero v0.7.0 h1:5MqpDsTGNDhY8sGp0Aowyf0qKsPrhewaLSsFaodPcyo=
|
github.com/sagikazarmark/locafero v0.7.0 h1:5MqpDsTGNDhY8sGp0Aowyf0qKsPrhewaLSsFaodPcyo=
|
||||||
github.com/sagikazarmark/locafero v0.7.0/go.mod h1:2za3Cg5rMaTMoG/2Ulr9AwtFaIppKXTRYnozin4aB5k=
|
github.com/sagikazarmark/locafero v0.7.0/go.mod h1:2za3Cg5rMaTMoG/2Ulr9AwtFaIppKXTRYnozin4aB5k=
|
||||||
github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo=
|
github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo=
|
||||||
@@ -30,24 +128,107 @@ github.com/spf13/pflag v1.0.6 h1:jFzHGLGAlb3ruxLB8MhbI6A8+AQX/2eW4qeyNZXNp2o=
|
|||||||
github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||||
github.com/spf13/viper v1.20.1 h1:ZMi+z/lvLyPSCoNtFCpqjy0S4kPbirhpTMwl8BkW9X4=
|
github.com/spf13/viper v1.20.1 h1:ZMi+z/lvLyPSCoNtFCpqjy0S4kPbirhpTMwl8BkW9X4=
|
||||||
github.com/spf13/viper v1.20.1/go.mod h1:P9Mdzt1zoHIG8m2eZQinpiBjo6kCmZSKBClNNqjJvu4=
|
github.com/spf13/viper v1.20.1/go.mod h1:P9Mdzt1zoHIG8m2eZQinpiBjo6kCmZSKBClNNqjJvu4=
|
||||||
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
|
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
||||||
|
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
||||||
|
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||||
|
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||||
|
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||||
|
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||||
|
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||||
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
|
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
|
||||||
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||||
github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8=
|
github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8=
|
||||||
github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU=
|
github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU=
|
||||||
|
github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI=
|
||||||
|
github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08=
|
||||||
|
github.com/ugorji/go/codec v1.3.0 h1:Qd2W2sQawAfG8XSvzwhBeoGq71zXOC/Q1E9y/wUcsUA=
|
||||||
|
github.com/ugorji/go/codec v1.3.0/go.mod h1:pRBVtBSKl77K30Bv8R2P+cLSGaTtex6fsA2Wjqmfxj4=
|
||||||
|
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
|
||||||
|
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
|
||||||
|
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||||
|
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||||
|
go.etcd.io/etcd/api/v3 v3.6.1 h1:yJ9WlDih9HT457QPuHt/TH/XtsdN2tubyxyQHSHPsEo=
|
||||||
|
go.etcd.io/etcd/api/v3 v3.6.1/go.mod h1:lnfuqoGsXMlZdTJlact3IB56o3bWp1DIlXPIGKRArto=
|
||||||
|
go.etcd.io/etcd/client/pkg/v3 v3.6.1 h1:CxDVv8ggphmamrXM4Of8aCC8QHzDM4tGcVr9p2BSoGk=
|
||||||
|
go.etcd.io/etcd/client/pkg/v3 v3.6.1/go.mod h1:aTkCp+6ixcVTZmrJGa7/Mc5nMNs59PEgBbq+HCmWyMc=
|
||||||
|
go.etcd.io/etcd/client/v3 v3.6.1 h1:KelkcizJGsskUXlsxjVrSmINvMMga0VWwFF0tSPGEP0=
|
||||||
|
go.etcd.io/etcd/client/v3 v3.6.1/go.mod h1:fCbPUdjWNLfx1A6ATo9syUmFVxqHH9bCnPLBZmnLmMY=
|
||||||
|
go.mongodb.org/mongo-driver v1.17.4 h1:jUorfmVzljjr0FLzYQsGP8cgN/qzzxlY9Vh0C9KFXVw=
|
||||||
|
go.mongodb.org/mongo-driver v1.17.4/go.mod h1:Hy04i7O2kC4RS06ZrhPRqj/u4DTYkFDAAccj+rVKqgQ=
|
||||||
|
go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA=
|
||||||
|
go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A=
|
||||||
|
go.opentelemetry.io/otel v1.34.0 h1:zRLXxLCgL1WyKsPVrgbSdMN4c0FMkDAskSTQP+0hdUY=
|
||||||
|
go.opentelemetry.io/otel v1.34.0/go.mod h1:OWFPOQ+h4G8xpyjgqo4SxJYdDQ/qmRH+wivy7zzx9oI=
|
||||||
|
go.opentelemetry.io/otel/metric v1.34.0 h1:+eTR3U0MyfWjRDhmFMxe2SsW64QrZ84AOhvqS7Y+PoQ=
|
||||||
|
go.opentelemetry.io/otel/metric v1.34.0/go.mod h1:CEDrp0fy2D0MvkXE+dPV7cMi8tWZwX3dmaIhwPOaqHE=
|
||||||
|
go.opentelemetry.io/otel/sdk v1.34.0 h1:95zS4k/2GOy069d321O8jWgYsW3MzVV+KuSPKp7Wr1A=
|
||||||
|
go.opentelemetry.io/otel/sdk v1.34.0/go.mod h1:0e/pNiaMAqaykJGKbi+tSjWfNNHMTxoC9qANsCzbyxU=
|
||||||
|
go.opentelemetry.io/otel/sdk/metric v1.34.0 h1:5CeK9ujjbFVL5c1PhLuStg1wxA7vQv7ce1EK0Gyvahk=
|
||||||
|
go.opentelemetry.io/otel/sdk/metric v1.34.0/go.mod h1:jQ/r8Ze28zRKoNRdkjCZxfs6YvBTG1+YIqyFVFYec5w=
|
||||||
|
go.opentelemetry.io/otel/trace v1.34.0 h1:+ouXS2V8Rd4hp4580a8q23bg0azF2nI8cqLYnC8mh/k=
|
||||||
|
go.opentelemetry.io/otel/trace v1.34.0/go.mod h1:Svm7lSjQD7kG7KJ/MUHPVXSDGz2OX4h0M2jHBhmSfRE=
|
||||||
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
|
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
|
||||||
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
|
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
|
||||||
go.uber.org/multierr v1.10.0 h1:S0h4aNzvfcFsC3dRF1jLoaov7oRaKqRGC/pUEJ2yvPQ=
|
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
|
||||||
go.uber.org/multierr v1.10.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
|
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
|
||||||
go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8=
|
go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8=
|
||||||
go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
|
go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
|
||||||
|
golang.org/x/arch v0.18.0 h1:WN9poc33zL4AzGxqf8VtpKUnGvMi8O9lhNyBMF/85qc=
|
||||||
|
golang.org/x/arch v0.18.0/go.mod h1:bdwinDaKcfZUGpH09BB7ZmOfhalA8lQdzl62l8gGWsk=
|
||||||
|
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||||
|
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||||
|
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||||
|
golang.org/x/crypto v0.39.0 h1:SHs+kF4LP+f+p14esP5jAoDpHU8Gu/v9lFRK6IT5imM=
|
||||||
|
golang.org/x/crypto v0.39.0/go.mod h1:L+Xg3Wf6HoL4Bn4238Z6ft6KfEpN0tJGo53AAPC632U=
|
||||||
|
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||||
|
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||||
|
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||||
|
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
|
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
|
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||||
|
golang.org/x/net v0.41.0 h1:vBTly1HeNPEn3wtREYfy4GZ/NECgw2Cnl+nK6Nz3uvw=
|
||||||
|
golang.org/x/net v0.41.0/go.mod h1:B/K4NNqkfmg07DQYrbwvSluqCJOOXwUjeb/5lOisjbA=
|
||||||
|
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.15.0 h1:KWH3jNZsfyT6xfAfKiz6MRNmd46ByHDYaZ7KSkCtdW8=
|
golang.org/x/sync v0.15.0 h1:KWH3jNZsfyT6xfAfKiz6MRNmd46ByHDYaZ7KSkCtdW8=
|
||||||
golang.org/x/sync v0.15.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
|
golang.org/x/sync v0.15.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
|
||||||
golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU=
|
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo=
|
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
|
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw=
|
||||||
|
golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
|
||||||
|
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
|
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
|
golang.org/x/text v0.26.0 h1:P42AVeLghgTYr4+xUnTRKDMqpar+PtX7KWuNQL21L8M=
|
||||||
|
golang.org/x/text v0.26.0/go.mod h1:QK15LZJUUQVJxhz7wXgxSy/CJaTFjd0G+YLonydOVQA=
|
||||||
|
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
|
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||||
|
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
||||||
|
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||||
|
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
|
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
|
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
|
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
|
google.golang.org/genproto/googleapis/api v0.0.0-20250303144028-a0af3efb3deb h1:p31xT4yrYrSM/G4Sn2+TNUkVhFCbG9y8itM2S6Th950=
|
||||||
|
google.golang.org/genproto/googleapis/api v0.0.0-20250303144028-a0af3efb3deb/go.mod h1:jbe3Bkdp+Dh2IrslsFCklNhweNTBgSYanP1UXhJDhKg=
|
||||||
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20250303144028-a0af3efb3deb h1:TLPQVbx1GJ8VKZxz52VAxl1EBgKXXbTiU9Fc5fZeLn4=
|
||||||
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20250303144028-a0af3efb3deb/go.mod h1:LuRYeWDFV6WOn90g357N17oMCaxpgCnbi/44qJvDn2I=
|
||||||
|
google.golang.org/grpc v1.71.1 h1:ffsFWr7ygTUscGPI0KKK6TLrGz0476KUvvsbqWK0rPI=
|
||||||
|
google.golang.org/grpc v1.71.1/go.mod h1:H0GRtasmQOh9LkFoCPDu3ZrwUtD1YGE+b2vYBYd/8Ec=
|
||||||
|
google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY=
|
||||||
|
google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
|
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
||||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
||||||
|
gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc=
|
||||||
|
gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc=
|
||||||
|
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
|
||||||
|
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
||||||
|
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
|
nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50=
|
||||||
|
|||||||
12
Server/Gateway/grpc_server/server.go
Normal file
12
Server/Gateway/grpc_server/server.go
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
package grpc_server
|
||||||
|
|
||||||
|
import (
|
||||||
|
"common/log"
|
||||||
|
"common/proto/gen/common"
|
||||||
|
"context"
|
||||||
|
)
|
||||||
|
|
||||||
|
func (s *Server) SendMessage(ctx context.Context, req *common.Empty) (*common.Empty, error) {
|
||||||
|
log.Infof("未实现函数")
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
32
Server/Gateway/grpc_server/server_init.go
Normal file
32
Server/Gateway/grpc_server/server_init.go
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
package grpc_server
|
||||||
|
|
||||||
|
import (
|
||||||
|
"common/discover/common"
|
||||||
|
"common/net/grpc/service"
|
||||||
|
"common/proto/gen/grpc_pb"
|
||||||
|
"google.golang.org/grpc"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Server struct {
|
||||||
|
grpc_pb.UnimplementedGatewayServer
|
||||||
|
service.Base
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewServer(ttl int64) *Server {
|
||||||
|
s := &Server{
|
||||||
|
Base: service.Base{
|
||||||
|
Target: common.KeyDiscoverGateway,
|
||||||
|
EtcdTTL: ttl,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
s.Base.OnInit = s.OnInit
|
||||||
|
s.Base.OnClose = s.OnClose
|
||||||
|
return s
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Server) OnInit(serve *grpc.Server) {
|
||||||
|
grpc_pb.RegisterGatewayServer(serve, s)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Server) OnClose() {
|
||||||
|
}
|
||||||
89
Server/Gateway/handler/ws_handler/client.go
Normal file
89
Server/Gateway/handler/ws_handler/client.go
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
package ws_handler
|
||||||
|
|
||||||
|
import (
|
||||||
|
"common/log"
|
||||||
|
"common/net/socket"
|
||||||
|
"context"
|
||||||
|
"go.uber.org/zap"
|
||||||
|
"runtime/debug"
|
||||||
|
"sync"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Client struct {
|
||||||
|
sync.WaitGroup
|
||||||
|
conn socket.ISocketConn // Socket
|
||||||
|
mailChan chan Event // 邮箱队列
|
||||||
|
logger *zap.SugaredLogger
|
||||||
|
ctx context.Context
|
||||||
|
cancel context.CancelFunc
|
||||||
|
heartBeat time.Time
|
||||||
|
|
||||||
|
UID int32
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewClient(uid int32, conn socket.ISocketConn) *Client {
|
||||||
|
client := &Client{}
|
||||||
|
client.UID = uid
|
||||||
|
client.conn = conn
|
||||||
|
client.logger = log.GetLogger().Named("uid").With("uid", client.UID)
|
||||||
|
client.logger.Errorf("错误日志 %v", 1)
|
||||||
|
|
||||||
|
client.heartBeat = time.Now()
|
||||||
|
client.mailChan = make(chan Event, 1024)
|
||||||
|
client.ctx, client.cancel = context.WithCancel(context.Background())
|
||||||
|
go client.Loop()
|
||||||
|
return client
|
||||||
|
}
|
||||||
|
|
||||||
|
// CloseClient 关闭客户端
|
||||||
|
func (c *Client) CloseClient() {
|
||||||
|
if c.cancel != nil {
|
||||||
|
c.cancel()
|
||||||
|
c.Wait()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) onClose() {
|
||||||
|
if c.conn != nil {
|
||||||
|
_ = c.conn.Close()
|
||||||
|
c.conn = nil
|
||||||
|
}
|
||||||
|
if c.mailChan != nil {
|
||||||
|
close(c.mailChan)
|
||||||
|
c.mailChan = nil
|
||||||
|
}
|
||||||
|
UserMgr.Delete(c.UID)
|
||||||
|
c.Done()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) Loop() {
|
||||||
|
defer func() {
|
||||||
|
if err := recover(); err != nil {
|
||||||
|
c.logger.Errorf("Client Loop err: %v", err)
|
||||||
|
debug.PrintStack()
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
defer c.onClose()
|
||||||
|
c.Add(1)
|
||||||
|
//心跳检测
|
||||||
|
hearBeatTicker := time.NewTicker(3000 * time.Millisecond)
|
||||||
|
for {
|
||||||
|
select {
|
||||||
|
case <-c.ctx.Done():
|
||||||
|
return
|
||||||
|
case _, _ = <-c.mailChan:
|
||||||
|
|
||||||
|
case <-hearBeatTicker.C:
|
||||||
|
// 心跳超时直接关掉连接
|
||||||
|
if c.checkHeartBeatTimeout() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) checkHeartBeatTimeout() bool {
|
||||||
|
sub := time.Now().Sub(c.heartBeat)
|
||||||
|
return sub > 60*time.Second
|
||||||
|
}
|
||||||
18
Server/Gateway/handler/ws_handler/event.go
Normal file
18
Server/Gateway/handler/ws_handler/event.go
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
package ws_handler
|
||||||
|
|
||||||
|
import (
|
||||||
|
"google.golang.org/protobuf/proto"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Event interface {
|
||||||
|
}
|
||||||
|
|
||||||
|
// ClientEvent 客户端发过来的Event
|
||||||
|
type ClientEvent struct {
|
||||||
|
Event
|
||||||
|
Msg proto.Message
|
||||||
|
}
|
||||||
|
|
||||||
|
type RemoveConnectionEvent struct {
|
||||||
|
Event
|
||||||
|
}
|
||||||
42
Server/Gateway/handler/ws_handler/manager.go
Normal file
42
Server/Gateway/handler/ws_handler/manager.go
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
package ws_handler
|
||||||
|
|
||||||
|
import (
|
||||||
|
"sync"
|
||||||
|
)
|
||||||
|
|
||||||
|
var UserMgr *userManager
|
||||||
|
|
||||||
|
type userManager struct {
|
||||||
|
userMap map[int32]*Client
|
||||||
|
sync.RWMutex
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
UserMgr = &userManager{
|
||||||
|
userMap: make(map[int32]*Client),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *userManager) Add(cid int32, client *Client) {
|
||||||
|
m.Lock()
|
||||||
|
defer m.Unlock()
|
||||||
|
m.userMap[cid] = client
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *userManager) Delete(cid int32) {
|
||||||
|
m.Lock()
|
||||||
|
defer m.Unlock()
|
||||||
|
delete(m.userMap, cid)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *userManager) GetAll() map[int32]*Client {
|
||||||
|
m.RLock()
|
||||||
|
defer m.RUnlock()
|
||||||
|
return m.userMap
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *userManager) GetByUID(uid int32) *Client {
|
||||||
|
m.RLock()
|
||||||
|
defer m.RUnlock()
|
||||||
|
return m.userMap[uid]
|
||||||
|
}
|
||||||
@@ -1,64 +1,14 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"fmt"
|
||||||
"github.com/spf13/viper"
|
"gateway/app"
|
||||||
"go.uber.org/zap"
|
"github.com/judwhite/go-svc"
|
||||||
"golang.org/x/sync/errgroup"
|
|
||||||
"gorm.io/gorm/logger"
|
|
||||||
"os"
|
|
||||||
"os/signal"
|
|
||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
// 初始化配置与日志
|
if err := svc.Run(&app.Program{}, syscall.SIGINT, syscall.SIGTERM, syscall.SIGKILL); err != nil {
|
||||||
initConfig()
|
fmt.Println(err)
|
||||||
// 数据库初始化
|
|
||||||
initDB()
|
|
||||||
|
|
||||||
// HTTP 服务配置
|
|
||||||
server := initServer(viper.GetString("PORT"), logger)
|
|
||||||
|
|
||||||
// 生命周期管理
|
|
||||||
ctx, cancel := context.WithCancel(context.Background())
|
|
||||||
g, gCtx := errgroup.WithContext(ctx)
|
|
||||||
|
|
||||||
// 启动 HTTP 服务
|
|
||||||
g.Go(func() error {
|
|
||||||
return server.Start()
|
|
||||||
})
|
|
||||||
|
|
||||||
// 优雅关闭
|
|
||||||
g.Go(func() error {
|
|
||||||
<-gCtx.Done()
|
|
||||||
return server.Shutdown(30 * time.Second)
|
|
||||||
})
|
|
||||||
|
|
||||||
// 信号监听
|
|
||||||
signals := make(chan os.Signal, 1)
|
|
||||||
signal.Notify(signals, syscall.SIGINT, syscall.SIGTERM)
|
|
||||||
g.Go(func() error {
|
|
||||||
select {
|
|
||||||
case <-gCtx.Done():
|
|
||||||
return gCtx.Err()
|
|
||||||
case sig := <-signals:
|
|
||||||
logger.Info("Received signal", zap.String("signal", sig.String()))
|
|
||||||
cancel() // 触发关闭
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
})
|
|
||||||
|
|
||||||
if err := g.Wait(); err != nil {
|
|
||||||
logger.Fatal("Server exited with error", zap.Error(err))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func initConfig() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func initDB() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|||||||
44
Server/Gateway/net/http_gateway/router.go
Normal file
44
Server/Gateway/net/http_gateway/router.go
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
package http_gateway
|
||||||
|
|
||||||
|
import (
|
||||||
|
"gateway/config"
|
||||||
|
"github.com/gin-contrib/cors"
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
"net/http"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
func InitRouter(cfg *config.Config) *gin.Engine {
|
||||||
|
r := gin.Default()
|
||||||
|
r.Use(gin.Recovery())
|
||||||
|
r.Use(cors.New(getCorsConfig()))
|
||||||
|
|
||||||
|
r.MaxMultipartMemory = 8 << 20
|
||||||
|
r.HandleMethodNotAllowed = true
|
||||||
|
r.NoMethod(func(c *gin.Context) {
|
||||||
|
c.JSON(http.StatusMethodNotAllowed, gin.H{
|
||||||
|
"result": false,
|
||||||
|
"error": "Method Not Allowed",
|
||||||
|
})
|
||||||
|
return
|
||||||
|
})
|
||||||
|
r.NoRoute(func(c *gin.Context) {
|
||||||
|
c.JSON(http.StatusNotFound, gin.H{
|
||||||
|
"result": false,
|
||||||
|
"error": "Endpoint Not Found",
|
||||||
|
})
|
||||||
|
return
|
||||||
|
})
|
||||||
|
|
||||||
|
return r
|
||||||
|
}
|
||||||
|
|
||||||
|
func getCorsConfig() cors.Config {
|
||||||
|
return cors.Config{
|
||||||
|
AllowMethods: []string{"GET", "POST", "PUT", "PATCH", "DELETE", "HEAD"},
|
||||||
|
AllowHeaders: []string{"Origin", "Content-Length", "Content-Type", "Authorization", "X-Forwarded-For", "User-Agent", "Referer", "X-Token", "token", "Token", "company-id", "lang", "source"},
|
||||||
|
AllowCredentials: false,
|
||||||
|
AllowAllOrigins: true,
|
||||||
|
MaxAge: 12 * time.Hour,
|
||||||
|
}
|
||||||
|
}
|
||||||
29
Server/Gateway/net/ws_gateway/server.go
Normal file
29
Server/Gateway/net/ws_gateway/server.go
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
package ws_gateway
|
||||||
|
|
||||||
|
import (
|
||||||
|
"common/net/socket"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
type GatewayWsServer struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *GatewayWsServer) OnOpen(_ socket.ISocketConn) ([]byte, socket.Action) {
|
||||||
|
return nil, socket.None
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *GatewayWsServer) OnHandShake(conn socket.ISocketConn) {
|
||||||
|
//query := conn.GetParam("query")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *GatewayWsServer) OnMessage(conn socket.ISocketConn, bytes []byte) socket.Action {
|
||||||
|
return socket.None
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *GatewayWsServer) OnClose(conn socket.ISocketConn, _ error) socket.Action {
|
||||||
|
return socket.None
|
||||||
|
}
|
||||||
|
|
||||||
|
func (g *GatewayWsServer) OnTick() (time.Duration, socket.Action) {
|
||||||
|
return 5 * time.Second, socket.None
|
||||||
|
}
|
||||||
@@ -1,108 +0,0 @@
|
|||||||
{
|
|
||||||
"logger": {
|
|
||||||
"level": "debug",
|
|
||||||
"max_age": 7,
|
|
||||||
"max_back_up": 128,
|
|
||||||
"max_size": 128,
|
|
||||||
"debug": false
|
|
||||||
},
|
|
||||||
"redis": {
|
|
||||||
"host": "10.0.40.3",
|
|
||||||
"port": 6379,
|
|
||||||
"auth": "123456",
|
|
||||||
"max_idle": 20,
|
|
||||||
"max_active": 100,
|
|
||||||
"db": 0,
|
|
||||||
"tls": false,
|
|
||||||
"user_name": "default"
|
|
||||||
},
|
|
||||||
"etcd": {
|
|
||||||
"host": "http://10.0.40.3",
|
|
||||||
"port": 2379,
|
|
||||||
"ttl": 10,
|
|
||||||
"key_discover": "/discover"
|
|
||||||
},
|
|
||||||
"mysql": {
|
|
||||||
"driver": "mysql",
|
|
||||||
"host": "10.0.40.3",
|
|
||||||
"port": "3306",
|
|
||||||
"user": "root",
|
|
||||||
"password": "123456"
|
|
||||||
},
|
|
||||||
"mongo": {
|
|
||||||
"user": "root",
|
|
||||||
"password": "superhmm",
|
|
||||||
"ssl_ca_file": "",
|
|
||||||
"host": "10.0.40.3",
|
|
||||||
"port": 27017
|
|
||||||
},
|
|
||||||
"kafka": {
|
|
||||||
"chunkSize": 0,
|
|
||||||
"flushInterval": 1,
|
|
||||||
"brokers": [
|
|
||||||
"10.0.40.3:9092"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"jwt": {
|
|
||||||
"secret": "ZMpy1gIxRevtcIwoW1qA84YAcWj4cjrEhPUebOiB8hUXkiwOfobJxeklH4ZO1VE1",
|
|
||||||
"expires": 30
|
|
||||||
},
|
|
||||||
"tencent_video_call": {
|
|
||||||
"appID": 1600034485,
|
|
||||||
"secretKey": "9c2e7aab5c318194ee815ee0a5162ea9ab0b0bce981311d5ce08d26c5e9df9e0",
|
|
||||||
"callBackKey": "Pv3JD4RJXBCo",
|
|
||||||
"prefix": "branch_dev",
|
|
||||||
"tencent_asr_cloud_os": {
|
|
||||||
"bucket": "meeting-test-1306984848",
|
|
||||||
"region": "ap-guangzhou",
|
|
||||||
"bucketURL": "https://meeting-test-1306984848.cos.ap-guangzhou.myqcloud.com",
|
|
||||||
"CIURL": "https://meeting-test-1306984848.ci.ap-guangzhou.myqcloud.com",
|
|
||||||
"CIWorkflows": {
|
|
||||||
"asr_workflow": {
|
|
||||||
"name": "cover_asr",
|
|
||||||
"workflowId": "wc700505871f849908f56f30533cb54ce"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"tencent_cloud_os": {
|
|
||||||
"bucketURL": "https://ecosmos-test-1306984848.cos.ap-guangzhou.myqcloud.com",
|
|
||||||
"serviceURL": "https://cos.ap-guangzhou.myqcloud.com",
|
|
||||||
"batchURL": "https://AKID27MnCY2eFsWCnKlItThxt1EubMriDewC.cos-control.ap-guangzhou.myqcloud.com",
|
|
||||||
"CIURL": "https://ecosmos-test-1306984848.ci.ap-guangzhou.myqcloud.com"
|
|
||||||
},
|
|
||||||
"tencent_sdk_common": {
|
|
||||||
"secretId": "AKID27MnCY2eFsWCnKlItThxt1EubMriDewC",
|
|
||||||
"secretKey": "IWdfaTTN8Y6g8Q4qdRH3BUsQySCjOKiC"
|
|
||||||
},
|
|
||||||
"back_http": {
|
|
||||||
"scheme": "http",
|
|
||||||
"host": "10.0.40.9:7098",
|
|
||||||
"xkey": "lkAsgl2sShgfnDweJLJSNGLSNG1234sKE58dgd"
|
|
||||||
},
|
|
||||||
"us": {
|
|
||||||
"public_key": "4eZBdZBQvR7JdD3Q3WMHna67b0BPf7U6O",
|
|
||||||
"private_key": "FugwvTjts8rJ2eYiLTatH0FK2n3zjhhWP9EsXXbmDhvy",
|
|
||||||
"bucket_name": "ecosmos-test",
|
|
||||||
"file_host": "cn-wlcb.ufileos.com",
|
|
||||||
"bucket_host": "api.ucloud.cn",
|
|
||||||
"verfiy_upload_md5": true,
|
|
||||||
"us_host_path": "https"
|
|
||||||
},
|
|
||||||
"ai_server": {
|
|
||||||
"scheme": "http",
|
|
||||||
"host": "106.52.14.61:15002"
|
|
||||||
},
|
|
||||||
"elecnest": {
|
|
||||||
"scheme": "https",
|
|
||||||
"host": "id.elecnest.cn"
|
|
||||||
},
|
|
||||||
"open_log": true,
|
|
||||||
"wechat_mini": {
|
|
||||||
"scheme": "https",
|
|
||||||
"host": "api.weixin.qq.com",
|
|
||||||
"envVersion": "trial",
|
|
||||||
"getWxACodeUnLimitPath": "/wxa/getwxacodeunlimit",
|
|
||||||
"generateUrlLinkPath": "/wxa/generate_urllink"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,108 +0,0 @@
|
|||||||
{
|
|
||||||
"logger": {
|
|
||||||
"level": "debug",
|
|
||||||
"max_age": 7,
|
|
||||||
"max_back_up": 128,
|
|
||||||
"max_size": 128,
|
|
||||||
"debug": false
|
|
||||||
},
|
|
||||||
"redis": {
|
|
||||||
"host": "10.0.0.12",
|
|
||||||
"port": 6379,
|
|
||||||
"auth": "Q3GNWg!TEsmkURuSYe9",
|
|
||||||
"max_idle": 20,
|
|
||||||
"max_active": 100,
|
|
||||||
"db": 0,
|
|
||||||
"tls": false,
|
|
||||||
"user_name": "default"
|
|
||||||
},
|
|
||||||
"etcd": {
|
|
||||||
"host": "http://10.0.0.12",
|
|
||||||
"port": 2379,
|
|
||||||
"ttl": 10,
|
|
||||||
"key_discover": "/discover"
|
|
||||||
},
|
|
||||||
"mysql": {
|
|
||||||
"driver": "mysql",
|
|
||||||
"host": "10.0.0.12",
|
|
||||||
"port": "3306",
|
|
||||||
"user": "root",
|
|
||||||
"password": "MwrC5zcZ8HQ7BB=qb4K8"
|
|
||||||
},
|
|
||||||
"mongo": {
|
|
||||||
"user": "root",
|
|
||||||
"password": "eExeaWF=dQzJpkMtc9kb",
|
|
||||||
"ssl_ca_file": "",
|
|
||||||
"host": "10.0.0.12",
|
|
||||||
"port": 27017
|
|
||||||
},
|
|
||||||
"kafka": {
|
|
||||||
"chunkSize": 0,
|
|
||||||
"flushInterval": 1,
|
|
||||||
"brokers": [
|
|
||||||
"10.0.0.12:9092"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"jwt": {
|
|
||||||
"secret": "ZMpy1gIxRevtcIwoW1qA84YAcWj4cjrEhPUebOiB8hUXkiwOfobJxeklH4ZO1VE4",
|
|
||||||
"expires": 30
|
|
||||||
},
|
|
||||||
"tencent_video_call": {
|
|
||||||
"appID": 1600034485,
|
|
||||||
"secretKey": "9c2e7aab5c318194ee815ee0a5162ea9ab0b0bce981311d5ce08d26c5e9df9e0",
|
|
||||||
"callBackKey": "Pv3JD4RJXBCo",
|
|
||||||
"prefix": "branch_test",
|
|
||||||
"tencent_asr_cloud_os": {
|
|
||||||
"bucket": "meeting-test-1306984848",
|
|
||||||
"region": "ap-guangzhou",
|
|
||||||
"bucketURL": "https://meeting-test-1306984848.cos.ap-guangzhou.myqcloud.com",
|
|
||||||
"CIURL": "https://meeting-test-1306984848.ci.ap-guangzhou.myqcloud.com",
|
|
||||||
"CIWorkflows": {
|
|
||||||
"asr_workflow": {
|
|
||||||
"name": "cover_asr",
|
|
||||||
"workflowId": "wc700505871f849908f56f30533cb54ce"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"tencent_cloud_os": {
|
|
||||||
"bucketURL": "https://ecosmos-test-1306984848.cos.ap-guangzhou.myqcloud.com",
|
|
||||||
"serviceURL": "https://cos.ap-guangzhou.myqcloud.com",
|
|
||||||
"batchURL": "https://AKID27MnCY2eFsWCnKlItThxt1EubMriDewC.cos-control.ap-guangzhou.myqcloud.com",
|
|
||||||
"CIURL": "https://ecosmos-test-1306984848.ci.ap-guangzhou.myqcloud.com"
|
|
||||||
},
|
|
||||||
"tencent_sdk_common": {
|
|
||||||
"secretId": "AKID27MnCY2eFsWCnKlItThxt1EubMriDewC",
|
|
||||||
"secretKey": "IWdfaTTN8Y6g8Q4qdRH3BUsQySCjOKiC"
|
|
||||||
},
|
|
||||||
"back_http": {
|
|
||||||
"scheme": "http",
|
|
||||||
"host": "10.0.0.12:7098",
|
|
||||||
"xkey": "lkAsgl2sShgfnDweJLJSNGLSNG1234sKE58dgd"
|
|
||||||
},
|
|
||||||
"us": {
|
|
||||||
"public_key": "4eZBdZBQvR7JdD3Q3WMHna67b0BPf7U6O",
|
|
||||||
"private_key": "FugwvTjts8rJ2eYiLTatH0FK2n3zjhhWP9EsXXbmDhvy",
|
|
||||||
"bucket_name": "ecosmos-test",
|
|
||||||
"file_host": "cn-wlcb.ufileos.com",
|
|
||||||
"bucket_host": "api.ucloud.cn",
|
|
||||||
"verfiy_upload_md5": true,
|
|
||||||
"us_host_path": "https"
|
|
||||||
},
|
|
||||||
"ai_server": {
|
|
||||||
"scheme": "http",
|
|
||||||
"host": "106.52.14.61:15002"
|
|
||||||
},
|
|
||||||
"elecnest": {
|
|
||||||
"scheme": "https",
|
|
||||||
"host": "id.elecnest.cn"
|
|
||||||
},
|
|
||||||
"open_log": true,
|
|
||||||
"wechat_mini": {
|
|
||||||
"scheme": "https",
|
|
||||||
"host": "api.weixin.qq.com",
|
|
||||||
"envVersion": "trial",
|
|
||||||
"getWxACodeUnLimitPath": "/wxa/getwxacodeunlimit",
|
|
||||||
"generateUrlLinkPath": "/wxa/generate_urllink"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,108 +0,0 @@
|
|||||||
{
|
|
||||||
"logger": {
|
|
||||||
"level": "debug",
|
|
||||||
"max_age": 7,
|
|
||||||
"max_back_up": 128,
|
|
||||||
"max_size": 128,
|
|
||||||
"debug": false
|
|
||||||
},
|
|
||||||
"redis": {
|
|
||||||
"host": "10.0.10.9",
|
|
||||||
"port": 6379,
|
|
||||||
"auth": "ZzC2gCVuR52!z",
|
|
||||||
"max_idle": 20,
|
|
||||||
"max_active": 100,
|
|
||||||
"db": 1,
|
|
||||||
"tls": false,
|
|
||||||
"user_name": "default"
|
|
||||||
},
|
|
||||||
"etcd": {
|
|
||||||
"host": "http://10.0.0.7",
|
|
||||||
"port": 2379,
|
|
||||||
"ttl": 20,
|
|
||||||
"key_discover": "/discover"
|
|
||||||
},
|
|
||||||
"mysql": {
|
|
||||||
"driver": "mysql",
|
|
||||||
"host": "10.0.5.10",
|
|
||||||
"port": "3306",
|
|
||||||
"user": "root",
|
|
||||||
"password": "d3tnt4J2aWRg7fZ52M"
|
|
||||||
},
|
|
||||||
"mongo": {
|
|
||||||
"user": "mongouser",
|
|
||||||
"password": "xEti2JhEgI!m",
|
|
||||||
"ssl_ca_file": "",
|
|
||||||
"host": "10.0.2.9",
|
|
||||||
"port": 27017
|
|
||||||
},
|
|
||||||
"kafka": {
|
|
||||||
"chunkSize": 0,
|
|
||||||
"flushInterval": 1,
|
|
||||||
"brokers": [
|
|
||||||
"10.0.12.16:9092"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"jwt": {
|
|
||||||
"secret": "ZMpy1gIxRevtcIwoW1qA84YAcWj4cjrEhPUebOiB8hUXkiwOfobJxeklH4ZO1VE3",
|
|
||||||
"expires": 30
|
|
||||||
},
|
|
||||||
"tencent_video_call": {
|
|
||||||
"appID": 1600003528,
|
|
||||||
"secretKey": "8188013dbe9f35305c58a2f8964fbf330f9e1de4a60827966c91a47b9f2ae607",
|
|
||||||
"callBackKey": "MzPBm3csloMHkXmEcvl",
|
|
||||||
"prefix": "prod",
|
|
||||||
"tencent_asr_cloud_os": {
|
|
||||||
"bucket": "meeting-prod-1306984848",
|
|
||||||
"region": "ap-guangzhou",
|
|
||||||
"bucketURL": "https://meeting-prod-1306984848.cos.ap-guangzhou.myqcloud.com",
|
|
||||||
"CIURL": "https://meeting-prod-1306984848.ci.ap-guangzhou.myqcloud.com",
|
|
||||||
"CIWorkflows": {
|
|
||||||
"asr_workflow": {
|
|
||||||
"name": "prod_cover_asr",
|
|
||||||
"workflowId": "w2d30647561e341f19342d684c92e483a"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"tencent_cloud_os": {
|
|
||||||
"bucketURL": "https://ecosmos-prod-1306984848.cos.ap-guangzhou.myqcloud.com",
|
|
||||||
"serviceURL": "https://cos.ap-guangzhou.myqcloud.com",
|
|
||||||
"batchURL": "https://AKID27MnCY2eFsWCnKlItThxt1EubMriDewC.cos-control.ap-guangzhou.myqcloud.com",
|
|
||||||
"CIURL": "https://ecosmos-prod-1306984848.ci.ap-guangzhou.myqcloud.com"
|
|
||||||
},
|
|
||||||
"tencent_sdk_common": {
|
|
||||||
"secretId": "AKID27MnCY2eFsWCnKlItThxt1EubMriDewC",
|
|
||||||
"secretKey": "IWdfaTTN8Y6g8Q4qdRH3BUsQySCjOKiC"
|
|
||||||
},
|
|
||||||
"back_http": {
|
|
||||||
"scheme": "http",
|
|
||||||
"host": "10.0.0.7:7098",
|
|
||||||
"xkey": "lkAsgl2sShgfnDweJLJSNGLSNG1234sKE58dgd"
|
|
||||||
},
|
|
||||||
"us": {
|
|
||||||
"public_key": "4eZBdZBQvR7JdD3Q3WMHna67b0BPf7U6O",
|
|
||||||
"private_key": "FugwvTjts8rJ2eYiLTatH0FK2n3zjhhWP9EsXXbmDhvy",
|
|
||||||
"bucket_name": "ecosmos",
|
|
||||||
"file_host": "cn-wlcb.ufileos.com",
|
|
||||||
"bucket_host": "api.ucloud.cn",
|
|
||||||
"verfiy_upload_md5": true,
|
|
||||||
"us_host_path": "https"
|
|
||||||
},
|
|
||||||
"ai_server": {
|
|
||||||
"scheme": "http",
|
|
||||||
"host": "106.52.14.61:15002"
|
|
||||||
},
|
|
||||||
"elecnest": {
|
|
||||||
"scheme": "https",
|
|
||||||
"host": "identify.elecnest.com"
|
|
||||||
},
|
|
||||||
"open_log": true,
|
|
||||||
"wechat_mini": {
|
|
||||||
"scheme": "https",
|
|
||||||
"host": "api.weixin.qq.com",
|
|
||||||
"envVersion": "release",
|
|
||||||
"getWxACodeUnLimitPath": "/wxa/getwxacodeunlimit",
|
|
||||||
"generateUrlLinkPath": "/wxa/generate_urllink"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,108 +0,0 @@
|
|||||||
{
|
|
||||||
"logger": {
|
|
||||||
"level": "debug",
|
|
||||||
"max_age": 7,
|
|
||||||
"max_back_up": 128,
|
|
||||||
"max_size": 128,
|
|
||||||
"debug": false
|
|
||||||
},
|
|
||||||
"redis": {
|
|
||||||
"host": "10.0.40.9",
|
|
||||||
"port": 6379,
|
|
||||||
"auth": "superhmm",
|
|
||||||
"max_idle": 20,
|
|
||||||
"max_active": 100,
|
|
||||||
"db": 0,
|
|
||||||
"tls": false,
|
|
||||||
"user_name": "default"
|
|
||||||
},
|
|
||||||
"etcd": {
|
|
||||||
"host": "http://10.0.40.9",
|
|
||||||
"port": 2379,
|
|
||||||
"ttl": 10,
|
|
||||||
"key_discover": "/discover"
|
|
||||||
},
|
|
||||||
"mysql": {
|
|
||||||
"driver": "mysql",
|
|
||||||
"host": "10.0.40.9",
|
|
||||||
"port": "3306",
|
|
||||||
"user": "root",
|
|
||||||
"password": "123456"
|
|
||||||
},
|
|
||||||
"mongo": {
|
|
||||||
"user": "root",
|
|
||||||
"password": "superhmm",
|
|
||||||
"ssl_ca_file": "",
|
|
||||||
"host": "10.0.40.9",
|
|
||||||
"port": 27017
|
|
||||||
},
|
|
||||||
"kafka": {
|
|
||||||
"chunkSize": 0,
|
|
||||||
"flushInterval": 1,
|
|
||||||
"brokers": [
|
|
||||||
"10.0.40.9:9092"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"jwt": {
|
|
||||||
"secret": "ZMpy1gIxRevtcIwoW1qA84YAcWj4cjrEhPUebOiB8hUXkiwOfobJxeklH4ZO1VE1",
|
|
||||||
"expires": 30
|
|
||||||
},
|
|
||||||
"tencent_video_call": {
|
|
||||||
"appID": 1600034485,
|
|
||||||
"secretKey": "9c2e7aab5c318194ee815ee0a5162ea9ab0b0bce981311d5ce08d26c5e9df9e0",
|
|
||||||
"callBackKey": "RSHRgskxwUauX6JyTb7m",
|
|
||||||
"prefix": "dev",
|
|
||||||
"tencent_asr_cloud_os": {
|
|
||||||
"bucket": "meeting-dev-1306984848",
|
|
||||||
"region": "ap-guangzhou",
|
|
||||||
"bucketURL": "https://meeting-dev-1306984848.cos.ap-guangzhou.myqcloud.com",
|
|
||||||
"CIURL": "https://meeting-dev-1306984848.ci.ap-guangzhou.myqcloud.com",
|
|
||||||
"CIWorkflows": {
|
|
||||||
"asr_workflow": {
|
|
||||||
"name": "cover_asr",
|
|
||||||
"workflowId": "w8b3ece33cd2d4b28a373779dc3a93941"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"tencent_cloud_os": {
|
|
||||||
"bucketURL": "https://ecosmos-dev-1306984848.cos.ap-guangzhou.myqcloud.com",
|
|
||||||
"serviceURL": "https://cos.ap-guangzhou.myqcloud.com",
|
|
||||||
"batchURL": "https://AKID27MnCY2eFsWCnKlItThxt1EubMriDewC.cos-control.ap-guangzhou.myqcloud.com",
|
|
||||||
"CIURL": "https://ecosmos-dev-1306984848.ci.ap-guangzhou.myqcloud.com"
|
|
||||||
},
|
|
||||||
"tencent_sdk_common": {
|
|
||||||
"secretId": "AKID27MnCY2eFsWCnKlItThxt1EubMriDewC",
|
|
||||||
"secretKey": "IWdfaTTN8Y6g8Q4qdRH3BUsQySCjOKiC"
|
|
||||||
},
|
|
||||||
"back_http": {
|
|
||||||
"scheme": "http",
|
|
||||||
"host": "10.0.40.9:7098",
|
|
||||||
"xkey": "lkAsgl2sShgfnDweJLJSNGLSNG1234sKE58dgd"
|
|
||||||
},
|
|
||||||
"us": {
|
|
||||||
"public_key": "4eZBdZBQvR7JdD3Q3WMHna67b0BPf7U6O",
|
|
||||||
"private_key": "FugwvTjts8rJ2eYiLTatH0FK2n3zjhhWP9EsXXbmDhvy",
|
|
||||||
"bucket_name": "ecosmos-test",
|
|
||||||
"file_host": "cn-wlcb.ufileos.com",
|
|
||||||
"bucket_host": "api.ucloud.cn",
|
|
||||||
"verfiy_upload_md5": true,
|
|
||||||
"us_host_path": "https"
|
|
||||||
},
|
|
||||||
"ai_server": {
|
|
||||||
"scheme": "http",
|
|
||||||
"host": "106.52.14.61:15002"
|
|
||||||
},
|
|
||||||
"elecnest": {
|
|
||||||
"scheme": "https",
|
|
||||||
"host": "id.elecnest.cn"
|
|
||||||
},
|
|
||||||
"openLog": false,
|
|
||||||
"wechat_mini": {
|
|
||||||
"scheme": "https",
|
|
||||||
"host": "api.weixin.qq.com",
|
|
||||||
"envVersion": "develop",
|
|
||||||
"getWxACodeUnLimitPath": "/wxa/getwxacodeunlimit",
|
|
||||||
"generateUrlLinkPath": "/wxa/generate_urllink"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,108 +0,0 @@
|
|||||||
{
|
|
||||||
"logger": {
|
|
||||||
"level": "debug",
|
|
||||||
"max_age": 7,
|
|
||||||
"max_back_up": 128,
|
|
||||||
"max_size": 128,
|
|
||||||
"debug": false
|
|
||||||
},
|
|
||||||
"redis": {
|
|
||||||
"host": "10.0.0.15",
|
|
||||||
"port": 6379,
|
|
||||||
"auth": "Q3GNWg!TEsmkURuSYe9",
|
|
||||||
"max_idle": 20,
|
|
||||||
"max_active": 100,
|
|
||||||
"db": 0,
|
|
||||||
"tls": false,
|
|
||||||
"user_name": "default"
|
|
||||||
},
|
|
||||||
"etcd": {
|
|
||||||
"host": "http://10.0.0.15",
|
|
||||||
"port": 2379,
|
|
||||||
"ttl": 10,
|
|
||||||
"key_discover": "/discover"
|
|
||||||
},
|
|
||||||
"mysql": {
|
|
||||||
"driver": "mysql",
|
|
||||||
"host": "10.0.0.15",
|
|
||||||
"port": "3306",
|
|
||||||
"user": "root",
|
|
||||||
"password": "MwrC5zcZ8HQ7BB=qb4K8"
|
|
||||||
},
|
|
||||||
"mongo": {
|
|
||||||
"user": "root",
|
|
||||||
"password": "eExeaWF=dQzJpkMtc9kb",
|
|
||||||
"ssl_ca_file": "",
|
|
||||||
"host": "134.175.247.234",
|
|
||||||
"port": 27017
|
|
||||||
},
|
|
||||||
"kafka": {
|
|
||||||
"chunkSize": 0,
|
|
||||||
"flushInterval": 1,
|
|
||||||
"brokers": [
|
|
||||||
"10.0.0.15:9092"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"jwt": {
|
|
||||||
"secret": "ZMpy1gIxRevtcIwoW1qA84YAcWj4cjrEhPUebOiB8hUXkiwOfobJxeklH4ZO1VE2",
|
|
||||||
"expires": 30
|
|
||||||
},
|
|
||||||
"tencent_video_call": {
|
|
||||||
"appID": 1600034485,
|
|
||||||
"secretKey": "9c2e7aab5c318194ee815ee0a5162ea9ab0b0bce981311d5ce08d26c5e9df9e0",
|
|
||||||
"callBackKey": "Pv3JD4RJXBCo",
|
|
||||||
"prefix": "test",
|
|
||||||
"tencent_asr_cloud_os": {
|
|
||||||
"bucket": "meeting-test-1306984848",
|
|
||||||
"region": "ap-guangzhou",
|
|
||||||
"bucketURL": "https://meeting-test-1306984848.cos.ap-guangzhou.myqcloud.com",
|
|
||||||
"CIURL": "https://meeting-test-1306984848.ci.ap-guangzhou.myqcloud.com",
|
|
||||||
"CIWorkflows": {
|
|
||||||
"asr_workflow": {
|
|
||||||
"name": "cover_asr",
|
|
||||||
"workflowId": "wc700505871f849908f56f30533cb54ce"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"tencent_cloud_os": {
|
|
||||||
"bucketURL": "https://ecosmos-test-1306984848.cos.ap-guangzhou.myqcloud.com",
|
|
||||||
"serviceURL": "https://cos.ap-guangzhou.myqcloud.com",
|
|
||||||
"batchURL": "https://AKID27MnCY2eFsWCnKlItThxt1EubMriDewC.cos-control.ap-guangzhou.myqcloud.com",
|
|
||||||
"CIURL": "https://ecosmos-test-1306984848.ci.ap-guangzhou.myqcloud.com"
|
|
||||||
},
|
|
||||||
"tencent_sdk_common": {
|
|
||||||
"secretId": "AKID27MnCY2eFsWCnKlItThxt1EubMriDewC",
|
|
||||||
"secretKey": "IWdfaTTN8Y6g8Q4qdRH3BUsQySCjOKiC"
|
|
||||||
},
|
|
||||||
"back_http": {
|
|
||||||
"scheme": "http",
|
|
||||||
"host": "10.0.0.15:7098",
|
|
||||||
"xkey": "lkAsgl2sShgfnDweJLJSNGLSNG1234sKE58dgd"
|
|
||||||
},
|
|
||||||
"us": {
|
|
||||||
"public_key": "4eZBdZBQvR7JdD3Q3WMHna67b0BPf7U6O",
|
|
||||||
"private_key": "FugwvTjts8rJ2eYiLTatH0FK2n3zjhhWP9EsXXbmDhvy",
|
|
||||||
"bucket_name": "ecosmos-test",
|
|
||||||
"file_host": "cn-wlcb.ufileos.com",
|
|
||||||
"bucket_host": "api.ucloud.cn",
|
|
||||||
"verfiy_upload_md5": true,
|
|
||||||
"us_host_path": "https"
|
|
||||||
},
|
|
||||||
"ai_server": {
|
|
||||||
"scheme": "http",
|
|
||||||
"host": "106.52.14.61:15002"
|
|
||||||
},
|
|
||||||
"elecnest": {
|
|
||||||
"scheme": "https",
|
|
||||||
"host": "id.elecnest.cn"
|
|
||||||
},
|
|
||||||
"open_log": true,
|
|
||||||
"wechat_mini": {
|
|
||||||
"scheme": "https",
|
|
||||||
"host": "api.weixin.qq.com",
|
|
||||||
"envVersion": "trial",
|
|
||||||
"getWxACodeUnLimitPath": "/wxa/getwxacodeunlimit",
|
|
||||||
"generateUrlLinkPath": "/wxa/generate_urllink"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,166 +0,0 @@
|
|||||||
package config
|
|
||||||
|
|
||||||
type (
|
|
||||||
LoggerConfig struct {
|
|
||||||
Level string `json:"level"`
|
|
||||||
MaxAge int `json:"max_age"`
|
|
||||||
MaxBackUp int `json:"max_back_up"`
|
|
||||||
MaxSize int `json:"max_size"`
|
|
||||||
Debug bool `json:"debug"`
|
|
||||||
}
|
|
||||||
|
|
||||||
RedisConfig struct {
|
|
||||||
Host string `json:"host" env:"REDIS_HOST"`
|
|
||||||
Port int `json:"port" env:"REDIS_PORT"`
|
|
||||||
Auth string `json:"auth" env:"REDIS_AUTH"`
|
|
||||||
MaxIdle int `json:"max_idle" env:"REDIS_MAX_IDLE"`
|
|
||||||
MaxActive int `json:"max_active" env:"REDIS_MAX_ACTIVE"`
|
|
||||||
Db int `json:"db" env:"REDIS_DB"`
|
|
||||||
Tls bool `json:"tls"`
|
|
||||||
UserName string `json:"user_name"`
|
|
||||||
}
|
|
||||||
|
|
||||||
EtcdConfig struct {
|
|
||||||
Host string `json:"host"`
|
|
||||||
Port int `json:"port"`
|
|
||||||
TTL int64 `json:"ttl"`
|
|
||||||
}
|
|
||||||
|
|
||||||
JWTConfig struct {
|
|
||||||
Secret string `json:"secret"`
|
|
||||||
Expires int `json:"expires"`
|
|
||||||
}
|
|
||||||
|
|
||||||
TableConfig struct {
|
|
||||||
Path string `json:"path"`
|
|
||||||
}
|
|
||||||
|
|
||||||
ConnectionInfo struct {
|
|
||||||
WebSocket string `json:"web_socket"`
|
|
||||||
HttpAddr string `json:"http_addr"`
|
|
||||||
GameSocketHost string `json:"game_socket_host"`
|
|
||||||
GameSocketPort int `json:"game_socket_port"`
|
|
||||||
}
|
|
||||||
|
|
||||||
MysqlConfig struct {
|
|
||||||
Driver string `json:"driver"`
|
|
||||||
Host string `json:"host"`
|
|
||||||
Port string `json:"port"`
|
|
||||||
User string `json:"user"`
|
|
||||||
Password string `json:"password"`
|
|
||||||
DbName string `json:"db_name"`
|
|
||||||
}
|
|
||||||
|
|
||||||
MongoConfig struct {
|
|
||||||
User string `json:"user"`
|
|
||||||
Password string `json:"password"`
|
|
||||||
SSLCaFile string `json:"ssl_ca_file"`
|
|
||||||
Host string `json:"host"`
|
|
||||||
Port int `json:"port"`
|
|
||||||
}
|
|
||||||
|
|
||||||
GamesInfo struct {
|
|
||||||
ConnectInfo []ConnectionInfo `json:"connect_info"`
|
|
||||||
}
|
|
||||||
TencentVideo struct {
|
|
||||||
AppID int `json:"appID"`
|
|
||||||
Key string `json:"secretKey"`
|
|
||||||
CallBackKey string `json:"callBackKey"`
|
|
||||||
Prefix string `json:"prefix"`
|
|
||||||
TencentAsrCloudOS TencentAsrCloudOS `json:"tencent_asr_cloud_os"`
|
|
||||||
}
|
|
||||||
TencentAsr struct {
|
|
||||||
AppID string `json:"appID"`
|
|
||||||
Key string `json:"secretKey"`
|
|
||||||
CallBackKey string `json:"callBackKey"`
|
|
||||||
Prefix string `json:"prefix"`
|
|
||||||
}
|
|
||||||
TencentAsrCloudOS struct {
|
|
||||||
Bucket string `json:"bucket"`
|
|
||||||
|
|
||||||
Region string `json:"region"`
|
|
||||||
|
|
||||||
BucketURL string `json:"bucketURL"`
|
|
||||||
|
|
||||||
CIURL string `json:"CIURL"`
|
|
||||||
|
|
||||||
CIWorkflows map[string]TencentCIWorkflows `json:"CIWorkflows"`
|
|
||||||
}
|
|
||||||
TencentCIWorkflows struct {
|
|
||||||
Name string `json:"name"`
|
|
||||||
|
|
||||||
WorkflowId string `json:"workflowId"`
|
|
||||||
}
|
|
||||||
|
|
||||||
TencentCloudOS struct {
|
|
||||||
BucketURL string `json:"bucketURL"`
|
|
||||||
ServiceURL string `json:"serviceURL"`
|
|
||||||
BatchURL string `json:"batchURL"`
|
|
||||||
CIURL string `json:"CIURL"`
|
|
||||||
}
|
|
||||||
|
|
||||||
TencentSdkCommon struct {
|
|
||||||
SecretId string `json:"secretId"`
|
|
||||||
SecretKey string `json:"secretKey"`
|
|
||||||
}
|
|
||||||
BackHttp struct {
|
|
||||||
Scheme string `json:"scheme"`
|
|
||||||
Host string `json:"host"`
|
|
||||||
Xkey string `json:"xkey"`
|
|
||||||
}
|
|
||||||
Us struct {
|
|
||||||
PublicKey string `json:"public_key"`
|
|
||||||
PrivateKey string `json:"private_key"`
|
|
||||||
BucketHost string `json:"bucket_host"`
|
|
||||||
BucketName string `json:"bucket_name"`
|
|
||||||
FileHost string `json:"file_host"`
|
|
||||||
VerifyUploadMD5 bool `json:"verfiy_upload_md5"`
|
|
||||||
Endpoint string `json:"endpoint"`
|
|
||||||
UsHostPath string `json:"us_host_path"`
|
|
||||||
}
|
|
||||||
|
|
||||||
AIServer struct {
|
|
||||||
Scheme string `json:"scheme"`
|
|
||||||
Host string `json:"host"`
|
|
||||||
}
|
|
||||||
|
|
||||||
KafkaConfig struct {
|
|
||||||
Brokers []string `json:"brokers"`
|
|
||||||
ChunkSize int `json:"chunkSize"`
|
|
||||||
FlushInterval int `json:"flushInterval"`
|
|
||||||
}
|
|
||||||
|
|
||||||
Elecnest struct {
|
|
||||||
Scheme string `json:"scheme"`
|
|
||||||
Host string `json:"host"`
|
|
||||||
}
|
|
||||||
|
|
||||||
WechatMini struct {
|
|
||||||
Scheme string `json:"scheme"`
|
|
||||||
Host string `json:"host"`
|
|
||||||
EnvVersion string `json:"envVersion"`
|
|
||||||
GetWxACodeUnLimitPath string `json:"getWxACodeUnLimitPath"`
|
|
||||||
GenerateUrlLinkPath string `json:"generateUrlLinkPath"`
|
|
||||||
}
|
|
||||||
|
|
||||||
CommonConfig struct {
|
|
||||||
Logger LoggerConfig `json:"logger"`
|
|
||||||
Redis RedisConfig `json:"redis"`
|
|
||||||
Etcd EtcdConfig `json:"etcd"`
|
|
||||||
Tables TableConfig `json:"tables"`
|
|
||||||
JWT JWTConfig `json:"jwt"`
|
|
||||||
MysqlConfig MysqlConfig `json:"mysql"`
|
|
||||||
MongoConfig MongoConfig `json:"mongo"`
|
|
||||||
Kafka KafkaConfig `json:"kafka"`
|
|
||||||
TencentVideo TencentVideo `json:"tencent_video_call"`
|
|
||||||
TencentCloudOS TencentCloudOS `json:"tencent_cloud_os"`
|
|
||||||
TencentSdkCommon TencentSdkCommon `json:"tencent_sdk_common"`
|
|
||||||
GamesInfo GamesInfo `json:"games"`
|
|
||||||
Back BackHttp `json:"back_http"`
|
|
||||||
Us Us `json:"us"`
|
|
||||||
AIServer AIServer `json:"ai_server"`
|
|
||||||
Elecnest *Elecnest `json:"elecnest"`
|
|
||||||
OpenLog bool `json:"open_log"`
|
|
||||||
WechatMini *WechatMini `json:"wechat_mini"`
|
|
||||||
}
|
|
||||||
)
|
|
||||||
@@ -1,29 +1,28 @@
|
|||||||
package etcd
|
package etcd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
commonConfig "common/config"
|
"go.etcd.io/etcd/client/v3"
|
||||||
"fmt"
|
"time"
|
||||||
clientv3 "go.etcd.io/etcd/client/v3"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var etcdClient *clientv3.Client
|
var cli *clientv3.Client
|
||||||
|
|
||||||
func Init(cfg *commonConfig.EtcdConfig) error {
|
func Init(endpoints []string) error {
|
||||||
client, err := clientv3.New(clientv3.Config{
|
client, err := clientv3.New(clientv3.Config{
|
||||||
Endpoints: []string{fmt.Sprintf("%v:%v", cfg.Host, cfg.Port)},
|
Endpoints: endpoints,
|
||||||
DialTimeout: 0,
|
DialTimeout: 5 * time.Second,
|
||||||
})
|
})
|
||||||
etcdClient = client
|
cli = client
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func Client() *clientv3.Client {
|
||||||
|
return cli
|
||||||
|
}
|
||||||
|
|
||||||
func Close() error {
|
func Close() error {
|
||||||
if etcdClient != nil {
|
if cli != nil {
|
||||||
return etcdClient.Close()
|
return cli.Close()
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func Client() *clientv3.Client {
|
|
||||||
return etcdClient
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,77 +0,0 @@
|
|||||||
package mongo
|
|
||||||
|
|
||||||
import (
|
|
||||||
commonConfig "common/config"
|
|
||||||
"common/log"
|
|
||||||
"context"
|
|
||||||
"crypto/tls"
|
|
||||||
"crypto/x509"
|
|
||||||
"fmt"
|
|
||||||
"go.mongodb.org/mongo-driver/event"
|
|
||||||
"go.mongodb.org/mongo-driver/mongo"
|
|
||||||
"go.mongodb.org/mongo-driver/mongo/options"
|
|
||||||
"io/ioutil"
|
|
||||||
)
|
|
||||||
|
|
||||||
var (
|
|
||||||
MDB *mongo.Client
|
|
||||||
DefaultDB *mongo.Database
|
|
||||||
ChatDB *mongo.Database
|
|
||||||
ErrNoDocuments = mongo.ErrNoDocuments
|
|
||||||
)
|
|
||||||
|
|
||||||
func Init(cfg *commonConfig.MongoConfig) error {
|
|
||||||
dialect := ""
|
|
||||||
if len(cfg.User) > 0 && len(cfg.Password) > 0 {
|
|
||||||
dialect = fmt.Sprintf("mongodb://%s:%s@%s:%d/admin?appname=MongoDB", cfg.User, cfg.Password, cfg.Host, cfg.Port)
|
|
||||||
} else {
|
|
||||||
dialect = fmt.Sprintf("mongodb://%s:%d/admin?readPreference=primary&appname=MongoDB&ssl=false", cfg.Host, cfg.Port)
|
|
||||||
}
|
|
||||||
var clientOptions *options.ClientOptions
|
|
||||||
if len(cfg.SSLCaFile) > 0 {
|
|
||||||
data, err := ioutil.ReadFile(cfg.SSLCaFile)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
dialect += "&ssl=true"
|
|
||||||
roots := x509.NewCertPool()
|
|
||||||
roots.AppendCertsFromPEM(data)
|
|
||||||
clientOptions = options.Client().ApplyURI(dialect).SetTLSConfig(&tls.Config{
|
|
||||||
RootCAs: roots,
|
|
||||||
//InsecureSkipVerify: true,
|
|
||||||
}).SetRetryWrites(false)
|
|
||||||
} else {
|
|
||||||
dialect += "&ssl=false"
|
|
||||||
clientOptions = options.Client().ApplyURI(dialect).SetRetryWrites(false)
|
|
||||||
}
|
|
||||||
monitor := &event.CommandMonitor{
|
|
||||||
Started: func(ctx context.Context, startedEvent *event.CommandStartedEvent) {
|
|
||||||
log.Infof("mongoDB Command started %v %v", startedEvent.CommandName, startedEvent.Command.String())
|
|
||||||
},
|
|
||||||
Failed: func(ctx context.Context, failedEvent *event.CommandFailedEvent) {
|
|
||||||
log.Errorf("mongoDB Command error %v %v", failedEvent.CommandName, failedEvent.Failure)
|
|
||||||
},
|
|
||||||
}
|
|
||||||
clientOptions.SetMonitor(monitor)
|
|
||||||
client, err := mongo.Connect(context.Background(), clientOptions)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
err = client.Ping(context.Background(), nil)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
MDB = client
|
|
||||||
DefaultDB = MDB.Database("ecosmos")
|
|
||||||
ChatDB = MDB.Database("ecosmos_chat")
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func Close() error {
|
|
||||||
if MDB != nil {
|
|
||||||
return MDB.Disconnect(context.Background())
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
@@ -1,90 +0,0 @@
|
|||||||
package mysql
|
|
||||||
|
|
||||||
import (
|
|
||||||
commonConfig "common/config"
|
|
||||||
"common/log"
|
|
||||||
"common/query"
|
|
||||||
|
|
||||||
"fmt"
|
|
||||||
"gorm.io/driver/mysql"
|
|
||||||
"gorm.io/gorm"
|
|
||||||
"time"
|
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
|
||||||
DBNameEcosmos = "ecosmos"
|
|
||||||
DBNameEcosmosShop = "ecosmos_shop"
|
|
||||||
)
|
|
||||||
|
|
||||||
var dbs = make(map[string]*gorm.DB)
|
|
||||||
var queryS = make(map[string]*query.Query)
|
|
||||||
|
|
||||||
func Init(cfg *commonConfig.MysqlConfig) error {
|
|
||||||
db, err := initOneDB(cfg, DBNameEcosmosShop)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
queryS[DBNameEcosmosShop] = query.Use(db)
|
|
||||||
|
|
||||||
db, err = initOneDB(cfg, DBNameEcosmos)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
query.SetDefault(db)
|
|
||||||
queryS[DBNameEcosmos] = query.Q
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func initOneDB(cfg *commonConfig.MysqlConfig, dbName string) (*gorm.DB, error) {
|
|
||||||
dialect := fmt.Sprintf("%s:%s@tcp(%s:%s)/%s?charset=utf8mb4&parseTime=True&loc=Local", cfg.User, cfg.Password, cfg.Host, cfg.Port, dbName)
|
|
||||||
db, err := gorm.Open(
|
|
||||||
mysql.New(
|
|
||||||
mysql.Config{
|
|
||||||
DSN: dialect,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
&gorm.Config{
|
|
||||||
TranslateError: true,
|
|
||||||
},
|
|
||||||
)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
sqlDb, err := db.DB()
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
sqlDb.SetMaxOpenConns(50)
|
|
||||||
sqlDb.SetMaxIdleConns(5)
|
|
||||||
sqlDb.SetConnMaxLifetime(time.Second * 10)
|
|
||||||
if err = sqlDb.Ping(); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
dbs[dbName] = db
|
|
||||||
return db.Debug(), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func DBQuery(dbName string) *query.Query {
|
|
||||||
if q, ok := queryS[dbName]; ok {
|
|
||||||
return q
|
|
||||||
}
|
|
||||||
|
|
||||||
log.Errorf("mysql db not init: %v", dbName)
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func Close() error {
|
|
||||||
fmt.Println("close mysql connect")
|
|
||||||
for _, db := range dbs {
|
|
||||||
sqlDb, err := db.DB()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
err = sqlDb.Close()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
package sql_code
|
|
||||||
|
|
||||||
const (
|
|
||||||
Unread_HasRead = 1
|
|
||||||
Unread_NotRead = 0
|
|
||||||
IsAgree_Agree = 1
|
|
||||||
IsAgree_Refuse = -1
|
|
||||||
IsAgree_NoDeal = 0
|
|
||||||
Online = 1
|
|
||||||
Offline = 0
|
|
||||||
Mail_UN_READ = 0
|
|
||||||
|
|
||||||
MAIL_UN_READ = 0
|
|
||||||
|
|
||||||
MAIL_READ_NOT_GET = 1
|
|
||||||
|
|
||||||
MAIL_READ_HAS_GET = 2
|
|
||||||
|
|
||||||
MAIL_HAS_DELETE = 3
|
|
||||||
|
|
||||||
MAIL_NO_EXTRAL = 0
|
|
||||||
|
|
||||||
MAIL_HAS_EXTRAL = 1
|
|
||||||
)
|
|
||||||
34
Server/common/db/redis/client.go
Normal file
34
Server/common/db/redis/client.go
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
package redis
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"fmt"
|
||||||
|
"github.com/redis/go-redis/v9"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
cli *redis.Client
|
||||||
|
Nil = redis.Nil
|
||||||
|
)
|
||||||
|
|
||||||
|
func Init(host string, port int, password string, db int) error {
|
||||||
|
cli = redis.NewClient(&redis.Options{
|
||||||
|
Addr: fmt.Sprintf("%s:%d", host, port),
|
||||||
|
Password: password,
|
||||||
|
DB: db,
|
||||||
|
})
|
||||||
|
|
||||||
|
_, err := cli.Ping(context.Background()).Result()
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
func Client() *redis.Client {
|
||||||
|
return cli
|
||||||
|
}
|
||||||
|
|
||||||
|
func Close() error {
|
||||||
|
if cli != nil {
|
||||||
|
return cli.Close()
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
@@ -1,57 +0,0 @@
|
|||||||
package redis
|
|
||||||
|
|
||||||
import (
|
|
||||||
commonConfig "common/config"
|
|
||||||
"context"
|
|
||||||
"crypto/tls"
|
|
||||||
"errors"
|
|
||||||
"fmt"
|
|
||||||
"github.com/redis/go-redis/v9"
|
|
||||||
"time"
|
|
||||||
)
|
|
||||||
|
|
||||||
var (
|
|
||||||
redisClient *redis.Client
|
|
||||||
redisNotInitErr = errors.New("redis is not initialized.")
|
|
||||||
keyNotExist = errors.New("key does not exist")
|
|
||||||
Nil = redis.Nil
|
|
||||||
)
|
|
||||||
|
|
||||||
func Init(cfg *commonConfig.RedisConfig) error {
|
|
||||||
url := fmt.Sprintf("%s:%d", cfg.Host, cfg.Port)
|
|
||||||
if cfg.Tls {
|
|
||||||
redisClient = redis.NewClient(&redis.Options{
|
|
||||||
Addr: url,
|
|
||||||
Password: cfg.Auth,
|
|
||||||
DB: cfg.Db,
|
|
||||||
DialTimeout: 20 * time.Second,
|
|
||||||
Username: cfg.UserName,
|
|
||||||
TLSConfig: &tls.Config{},
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
redisClient = redis.NewClient(&redis.Options{
|
|
||||||
Addr: url,
|
|
||||||
Password: cfg.Auth,
|
|
||||||
DB: cfg.Db,
|
|
||||||
DialTimeout: 20 * time.Second,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
ret := redisClient.Ping(context.Background())
|
|
||||||
//p := redisClient.Pipeline()
|
|
||||||
//l := p.HGetAll(xxx, xxx)
|
|
||||||
//s := p.Get(xxx, xx)
|
|
||||||
//p.Exec(xxx)
|
|
||||||
return ret.Err()
|
|
||||||
}
|
|
||||||
|
|
||||||
func Close() error {
|
|
||||||
if redisClient != nil {
|
|
||||||
return redisClient.Close()
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func GetRedisClient() *redis.Client {
|
|
||||||
return redisClient
|
|
||||||
}
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
package redis
|
|
||||||
|
|
||||||
import (
|
|
||||||
"common/log"
|
|
||||||
"context"
|
|
||||||
"errors"
|
|
||||||
"time"
|
|
||||||
)
|
|
||||||
|
|
||||||
var ReleaseLockExpire = errors.New("release redis lock expire key")
|
|
||||||
|
|
||||||
func Acquire(ctx context.Context, key string, tag string, expiration time.Duration) (bool, error) {
|
|
||||||
success, err := redisClient.SetNX(ctx, key, tag, expiration).Result()
|
|
||||||
return success, err
|
|
||||||
}
|
|
||||||
|
|
||||||
func Release(ctx context.Context, key string, tag string) error {
|
|
||||||
script := `
|
|
||||||
if redis.call("GET", KEYS[1]) == ARGV[1] then
|
|
||||||
return redis.call("DEL", KEYS[1])
|
|
||||||
else
|
|
||||||
return 0
|
|
||||||
end`
|
|
||||||
|
|
||||||
// 执行 Lua 脚本
|
|
||||||
result, err := redisClient.Eval(ctx, script, []string{key}, tag).Result()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
// 检查返回值
|
|
||||||
if result == int64(0) {
|
|
||||||
log.Errorf("release redis lock expire key :%v", key)
|
|
||||||
return ReleaseLockExpire
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
package db
|
|
||||||
|
|
||||||
import (
|
|
||||||
"common/config"
|
|
||||||
"common/db/mongo"
|
|
||||||
"common/db/mysql"
|
|
||||||
"common/log"
|
|
||||||
"common/utils"
|
|
||||||
"fmt"
|
|
||||||
"github.com/jinzhu/configor"
|
|
||||||
"math/rand"
|
|
||||||
"os"
|
|
||||||
)
|
|
||||||
|
|
||||||
// 用于单元测试初始化数据库
|
|
||||||
|
|
||||||
func InitTestDB(env string) {
|
|
||||||
wd, err := os.Getwd()
|
|
||||||
if err != nil {
|
|
||||||
fmt.Println("无法获取工作目录:", err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
var commonCfg config.CommonConfig
|
|
||||||
err = configor.Load(&commonCfg, fmt.Sprintf(wd+"/config/common-config-%v.json", env))
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
log.Init(&commonCfg.Logger)
|
|
||||||
utils.InitSnowflake(int64(rand.Intn(1000)))
|
|
||||||
//// Redis
|
|
||||||
//if err := redis.Init(&commonCfg.Redis); err != nil {
|
|
||||||
// panic(err)
|
|
||||||
//}
|
|
||||||
// MySQL
|
|
||||||
if err := mysql.Init(&commonCfg.MysqlConfig); err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
// Mongo
|
|
||||||
if err := mongo.Init(&commonCfg.MongoConfig); err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
//// Etcd
|
|
||||||
//if err := etcd.Init(&commonCfg.Etcd); err != nil {
|
|
||||||
// panic(err)
|
|
||||||
//}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -8,7 +8,7 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
KeyDiscover = "discover"
|
KeyDiscover = "xh-discover"
|
||||||
KeyDiscoverService = KeyDiscover + "/service"
|
KeyDiscoverService = KeyDiscover + "/service"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ func Listen() {
|
|||||||
// 服务发生变化
|
// 服务发生变化
|
||||||
func onServerChange(t mvccpb.Event_EventType, key, value string) {
|
func onServerChange(t mvccpb.Event_EventType, key, value string) {
|
||||||
split := strings.Split(key, "/")
|
split := strings.Split(key, "/")
|
||||||
if len(split) != 5 {
|
if len(split) != 4 {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
switch t {
|
switch t {
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ package discover
|
|||||||
import (
|
import (
|
||||||
"common/db/etcd"
|
"common/db/etcd"
|
||||||
"common/discover/common"
|
"common/discover/common"
|
||||||
"common/discover/grpc_client"
|
|
||||||
"common/log"
|
"common/log"
|
||||||
|
"common/net/grpc/grpc_conn"
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
clientv3 "go.etcd.io/etcd/client/v3"
|
clientv3 "go.etcd.io/etcd/client/v3"
|
||||||
@@ -15,7 +15,7 @@ import (
|
|||||||
// 大量读少量写的情况下,读写锁比同步Map更高效
|
// 大量读少量写的情况下,读写锁比同步Map更高效
|
||||||
var (
|
var (
|
||||||
serverMU = sync.RWMutex{}
|
serverMU = sync.RWMutex{}
|
||||||
conn = make(map[string]*grpc_client.GrpcConnectionMgr)
|
conn = make(map[string]*grpc_conn.GrpcConnectionMgr)
|
||||||
serverLeaseM = make(map[string]clientv3.LeaseID)
|
serverLeaseM = make(map[string]clientv3.LeaseID)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -80,7 +80,7 @@ func onServerStart(data any) {
|
|||||||
if v, ok := conn[provider.Target]; ok {
|
if v, ok := conn[provider.Target]; ok {
|
||||||
v.Store(provider.SID, provider.Addr)
|
v.Store(provider.SID, provider.Addr)
|
||||||
} else {
|
} else {
|
||||||
mgr := grpc_client.NewGrpcConnectionMgr()
|
mgr := grpc_conn.NewGrpcConnectionMgr()
|
||||||
mgr.Store(provider.SID, provider.Addr)
|
mgr.Store(provider.SID, provider.Addr)
|
||||||
conn[provider.Target] = mgr
|
conn[provider.Target] = mgr
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,24 +0,0 @@
|
|||||||
package service
|
|
||||||
|
|
||||||
import (
|
|
||||||
"common/discover"
|
|
||||||
"common/discover/common"
|
|
||||||
"common/discover/service/game/game_pb"
|
|
||||||
)
|
|
||||||
|
|
||||||
func GatewayNewClient(sid ...string) (game_pb.GameClient, error) {
|
|
||||||
c, err := discover.FindServer(common.KeyDiscoverGateway, sid...)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return game_pb.NewGameClient(c), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func GatewayNewBroadcastClient() map[string]game_pb.GameClient {
|
|
||||||
clientM := make(map[string]game_pb.GameClient)
|
|
||||||
connM := discover.FindServerAll(common.KeyDiscoverGateway)
|
|
||||||
for sid, conn := range connM {
|
|
||||||
clientM[sid] = game_pb.NewGameClient(conn)
|
|
||||||
}
|
|
||||||
return clientM
|
|
||||||
}
|
|
||||||
@@ -3,43 +3,34 @@ module common
|
|||||||
go 1.23.1
|
go 1.23.1
|
||||||
|
|
||||||
require (
|
require (
|
||||||
|
github.com/bwmarrin/snowflake v0.3.0
|
||||||
github.com/getsentry/sentry-go v0.34.0
|
github.com/getsentry/sentry-go v0.34.0
|
||||||
github.com/jinzhu/configor v1.2.2
|
github.com/gobwas/ws v1.4.0
|
||||||
github.com/natefinch/lumberjack v2.0.0+incompatible
|
github.com/natefinch/lumberjack v2.0.0+incompatible
|
||||||
|
github.com/panjf2000/gnet/v2 v2.9.1
|
||||||
github.com/redis/go-redis/v9 v9.10.0
|
github.com/redis/go-redis/v9 v9.10.0
|
||||||
go.etcd.io/etcd/api/v3 v3.6.1
|
go.etcd.io/etcd/api/v3 v3.6.1
|
||||||
go.etcd.io/etcd/client/v3 v3.6.1
|
go.etcd.io/etcd/client/v3 v3.6.1
|
||||||
go.mongodb.org/mongo-driver v1.17.4
|
|
||||||
go.uber.org/zap v1.27.0
|
go.uber.org/zap v1.27.0
|
||||||
google.golang.org/grpc v1.71.1
|
google.golang.org/grpc v1.71.1
|
||||||
google.golang.org/protobuf v1.36.5
|
google.golang.org/protobuf v1.36.5
|
||||||
gorm.io/driver/mysql v1.6.0
|
|
||||||
gorm.io/gorm v1.30.0
|
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
filippo.io/edwards25519 v1.1.0 // indirect
|
|
||||||
github.com/BurntSushi/toml v1.2.0 // indirect
|
github.com/BurntSushi/toml v1.2.0 // indirect
|
||||||
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
||||||
github.com/coreos/go-semver v0.3.1 // indirect
|
github.com/coreos/go-semver v0.3.1 // indirect
|
||||||
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
|
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
|
||||||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
|
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
|
||||||
github.com/go-sql-driver/mysql v1.8.1 // indirect
|
github.com/gobwas/httphead v0.1.0 // indirect
|
||||||
|
github.com/gobwas/pool v0.2.1 // indirect
|
||||||
github.com/gogo/protobuf v1.3.2 // indirect
|
github.com/gogo/protobuf v1.3.2 // indirect
|
||||||
github.com/golang/protobuf v1.5.4 // indirect
|
github.com/golang/protobuf v1.5.4 // indirect
|
||||||
github.com/golang/snappy v0.0.4 // indirect
|
|
||||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3 // indirect
|
github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3 // indirect
|
||||||
github.com/jinzhu/inflection v1.0.0 // indirect
|
github.com/panjf2000/ants/v2 v2.11.3 // indirect
|
||||||
github.com/jinzhu/now v1.1.5 // indirect
|
github.com/valyala/bytebufferpool v1.0.0 // indirect
|
||||||
github.com/klauspost/compress v1.17.9 // indirect
|
|
||||||
github.com/montanaflynn/stats v0.7.1 // indirect
|
|
||||||
github.com/xdg-go/pbkdf2 v1.0.0 // indirect
|
|
||||||
github.com/xdg-go/scram v1.1.2 // indirect
|
|
||||||
github.com/xdg-go/stringprep v1.0.4 // indirect
|
|
||||||
github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78 // indirect
|
|
||||||
go.etcd.io/etcd/client/pkg/v3 v3.6.1 // indirect
|
go.etcd.io/etcd/client/pkg/v3 v3.6.1 // indirect
|
||||||
go.uber.org/multierr v1.11.0 // indirect
|
go.uber.org/multierr v1.11.0 // indirect
|
||||||
golang.org/x/crypto v0.36.0 // indirect
|
|
||||||
golang.org/x/net v0.38.0 // indirect
|
golang.org/x/net v0.38.0 // indirect
|
||||||
golang.org/x/sync v0.15.0 // indirect
|
golang.org/x/sync v0.15.0 // indirect
|
||||||
golang.org/x/sys v0.31.0 // indirect
|
golang.org/x/sys v0.31.0 // indirect
|
||||||
@@ -48,5 +39,4 @@ require (
|
|||||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20250303144028-a0af3efb3deb // indirect
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20250303144028-a0af3efb3deb // indirect
|
||||||
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
|
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
|
||||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
|
|
||||||
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
|
|
||||||
github.com/BurntSushi/toml v1.2.0 h1:Rt8g24XnyGTyglgET/PRUNlrUeu9F5L+7FilkXfZgs0=
|
github.com/BurntSushi/toml v1.2.0 h1:Rt8g24XnyGTyglgET/PRUNlrUeu9F5L+7FilkXfZgs0=
|
||||||
github.com/BurntSushi/toml v1.2.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
|
github.com/BurntSushi/toml v1.2.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
|
||||||
github.com/bsm/ginkgo/v2 v2.12.0 h1:Ny8MWAHyOepLGlLKYmXG4IEkioBysk6GpaRTLC8zwWs=
|
github.com/bsm/ginkgo/v2 v2.12.0 h1:Ny8MWAHyOepLGlLKYmXG4IEkioBysk6GpaRTLC8zwWs=
|
||||||
github.com/bsm/ginkgo/v2 v2.12.0/go.mod h1:SwYbGRRDovPVboqFv0tPTcG1sN61LM1Z4ARdbAV9g4c=
|
github.com/bsm/ginkgo/v2 v2.12.0/go.mod h1:SwYbGRRDovPVboqFv0tPTcG1sN61LM1Z4ARdbAV9g4c=
|
||||||
github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA=
|
github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA=
|
||||||
github.com/bsm/gomega v1.27.10/go.mod h1:JyEr/xRbxbtgWNi8tIEVPUYZ5Dzef52k01W3YH0H+O0=
|
github.com/bsm/gomega v1.27.10/go.mod h1:JyEr/xRbxbtgWNi8tIEVPUYZ5Dzef52k01W3YH0H+O0=
|
||||||
|
github.com/bwmarrin/snowflake v0.3.0 h1:xm67bEhkKh6ij1790JB83OujPR5CzNe8QuQqAgISZN0=
|
||||||
|
github.com/bwmarrin/snowflake v0.3.0/go.mod h1:NdZxfVWX+oR6y2K0o6qAYv6gIOP9rjG0/E9WsDpxqwE=
|
||||||
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
|
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
|
||||||
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||||
github.com/coreos/go-semver v0.3.1 h1:yi21YpKnrx1gt5R+la8n5WgS0kCrsPp33dmEyHReZr4=
|
github.com/coreos/go-semver v0.3.1 h1:yi21YpKnrx1gt5R+la8n5WgS0kCrsPp33dmEyHReZr4=
|
||||||
@@ -24,39 +24,31 @@ github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY=
|
|||||||
github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
|
github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
|
||||||
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
|
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
|
||||||
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
|
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
|
||||||
github.com/go-sql-driver/mysql v1.8.1 h1:LedoTUt/eveggdHS9qUFC1EFSa8bU2+1pZjSRpvNJ1Y=
|
github.com/gobwas/httphead v0.1.0 h1:exrUm0f4YX0L7EBwZHuCF4GDp8aJfVeBrlLQrs6NqWU=
|
||||||
github.com/go-sql-driver/mysql v1.8.1/go.mod h1:wEBSXgmK//2ZFJyE+qWnIsVGmvmEKlqwuVSjsCm7DZg=
|
github.com/gobwas/httphead v0.1.0/go.mod h1:O/RXo79gxV8G+RqlR/otEwx4Q36zl9rqC5u12GKvMCM=
|
||||||
|
github.com/gobwas/pool v0.2.1 h1:xfeeEhW7pwmX8nuLVlqbzVc7udMDrwetjEv+TZIz1og=
|
||||||
|
github.com/gobwas/pool v0.2.1/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw=
|
||||||
|
github.com/gobwas/ws v1.4.0 h1:CTaoG1tojrh4ucGPcoJFiAQUAsEWekEWvLy7GsVNqGs=
|
||||||
|
github.com/gobwas/ws v1.4.0/go.mod h1:G3gNqMNtPppf5XUz7O4shetPpcZ1VJ7zt18dlUeakrc=
|
||||||
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
|
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
|
||||||
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
|
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
|
||||||
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
|
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
|
||||||
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
|
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
|
||||||
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
|
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
|
||||||
github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM=
|
|
||||||
github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
|
||||||
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
|
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
|
||||||
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
|
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
|
||||||
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3 h1:5ZPtiqj0JL5oKWmcsq4VMaAW5ukBEgSGXEN89zeH1Jo=
|
github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3 h1:5ZPtiqj0JL5oKWmcsq4VMaAW5ukBEgSGXEN89zeH1Jo=
|
||||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3/go.mod h1:ndYquD05frm2vACXE1nsccT4oJzjhw2arTS2cpUD1PI=
|
github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3/go.mod h1:ndYquD05frm2vACXE1nsccT4oJzjhw2arTS2cpUD1PI=
|
||||||
github.com/jinzhu/configor v1.2.2 h1:sLgh6KMzpCmaQB4e+9Fu/29VErtBUqsS2t8C9BNIVsA=
|
|
||||||
github.com/jinzhu/configor v1.2.2/go.mod h1:iFFSfOBKP3kC2Dku0ZGB3t3aulfQgTGJknodhFavsU8=
|
|
||||||
github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E=
|
|
||||||
github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
|
|
||||||
github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ=
|
|
||||||
github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
|
|
||||||
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
|
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
|
||||||
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
|
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
|
||||||
github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA=
|
|
||||||
github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw=
|
|
||||||
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
|
||||||
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
|
|
||||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
|
||||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
|
||||||
github.com/montanaflynn/stats v0.7.1 h1:etflOAAHORrCC44V+aR6Ftzort912ZU+YLiSTuV8eaE=
|
|
||||||
github.com/montanaflynn/stats v0.7.1/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow=
|
|
||||||
github.com/natefinch/lumberjack v2.0.0+incompatible h1:4QJd3OLAMgj7ph+yZTuX13Ld4UpgHp07nNdFX7mqFfM=
|
github.com/natefinch/lumberjack v2.0.0+incompatible h1:4QJd3OLAMgj7ph+yZTuX13Ld4UpgHp07nNdFX7mqFfM=
|
||||||
github.com/natefinch/lumberjack v2.0.0+incompatible/go.mod h1:Wi9p2TTF5DG5oU+6YfsmYQpsTIOm0B1VNzQg9Mw6nPk=
|
github.com/natefinch/lumberjack v2.0.0+incompatible/go.mod h1:Wi9p2TTF5DG5oU+6YfsmYQpsTIOm0B1VNzQg9Mw6nPk=
|
||||||
|
github.com/panjf2000/ants/v2 v2.11.3 h1:AfI0ngBoXJmYOpDh9m516vjqoUu2sLrIVgppI9TZVpg=
|
||||||
|
github.com/panjf2000/ants/v2 v2.11.3/go.mod h1:8u92CYMUc6gyvTIw8Ru7Mt7+/ESnJahz5EVtqfrilek=
|
||||||
|
github.com/panjf2000/gnet/v2 v2.9.1 h1:bKewICy/0xnQ9PMzNaswpe/Ah14w1TrRk91LHTcbIlA=
|
||||||
|
github.com/panjf2000/gnet/v2 v2.9.1/go.mod h1:WQTxDWYuQ/hz3eccH0FN32IVuvZ19HewEWx0l62fx7E=
|
||||||
github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4=
|
github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4=
|
||||||
github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8=
|
github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8=
|
||||||
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
||||||
@@ -65,29 +57,18 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
|
|||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
github.com/redis/go-redis/v9 v9.10.0 h1:FxwK3eV8p/CQa0Ch276C7u2d0eNC9kCmAYQ7mCXCzVs=
|
github.com/redis/go-redis/v9 v9.10.0 h1:FxwK3eV8p/CQa0Ch276C7u2d0eNC9kCmAYQ7mCXCzVs=
|
||||||
github.com/redis/go-redis/v9 v9.10.0/go.mod h1:huWgSWd8mW6+m0VPhJjSSQ+d6Nh1VICQ6Q5lHuCH/Iw=
|
github.com/redis/go-redis/v9 v9.10.0/go.mod h1:huWgSWd8mW6+m0VPhJjSSQ+d6Nh1VICQ6Q5lHuCH/Iw=
|
||||||
github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII=
|
|
||||||
github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o=
|
|
||||||
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
|
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
|
||||||
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||||
github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c=
|
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
|
||||||
github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI=
|
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
|
||||||
github.com/xdg-go/scram v1.1.2 h1:FHX5I5B4i4hKRVRBCFRxq1iQRej7WO3hhBuJf+UUySY=
|
|
||||||
github.com/xdg-go/scram v1.1.2/go.mod h1:RT/sEzTbU5y00aCK8UOx6R7YryM0iF1N2MOmC3kKLN4=
|
|
||||||
github.com/xdg-go/stringprep v1.0.4 h1:XLI/Ng3O1Atzq0oBs3TWm+5ZVgkq2aqdlvP9JtoZ6c8=
|
|
||||||
github.com/xdg-go/stringprep v1.0.4/go.mod h1:mPGuuIYwz7CmR2bT9j4GbQqutWS1zV24gijq1dTyGkM=
|
|
||||||
github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78 h1:ilQV1hzziu+LLM3zUTJ0trRztfwgjqKnBWNtSRkbmwM=
|
|
||||||
github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78/go.mod h1:aL8wCCfTfSfmXjznFBSZNN13rSJjlIOI1fUNAtF7rmI=
|
|
||||||
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||||
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||||
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
|
||||||
go.etcd.io/etcd/api/v3 v3.6.1 h1:yJ9WlDih9HT457QPuHt/TH/XtsdN2tubyxyQHSHPsEo=
|
go.etcd.io/etcd/api/v3 v3.6.1 h1:yJ9WlDih9HT457QPuHt/TH/XtsdN2tubyxyQHSHPsEo=
|
||||||
go.etcd.io/etcd/api/v3 v3.6.1/go.mod h1:lnfuqoGsXMlZdTJlact3IB56o3bWp1DIlXPIGKRArto=
|
go.etcd.io/etcd/api/v3 v3.6.1/go.mod h1:lnfuqoGsXMlZdTJlact3IB56o3bWp1DIlXPIGKRArto=
|
||||||
go.etcd.io/etcd/client/pkg/v3 v3.6.1 h1:CxDVv8ggphmamrXM4Of8aCC8QHzDM4tGcVr9p2BSoGk=
|
go.etcd.io/etcd/client/pkg/v3 v3.6.1 h1:CxDVv8ggphmamrXM4Of8aCC8QHzDM4tGcVr9p2BSoGk=
|
||||||
go.etcd.io/etcd/client/pkg/v3 v3.6.1/go.mod h1:aTkCp+6ixcVTZmrJGa7/Mc5nMNs59PEgBbq+HCmWyMc=
|
go.etcd.io/etcd/client/pkg/v3 v3.6.1/go.mod h1:aTkCp+6ixcVTZmrJGa7/Mc5nMNs59PEgBbq+HCmWyMc=
|
||||||
go.etcd.io/etcd/client/v3 v3.6.1 h1:KelkcizJGsskUXlsxjVrSmINvMMga0VWwFF0tSPGEP0=
|
go.etcd.io/etcd/client/v3 v3.6.1 h1:KelkcizJGsskUXlsxjVrSmINvMMga0VWwFF0tSPGEP0=
|
||||||
go.etcd.io/etcd/client/v3 v3.6.1/go.mod h1:fCbPUdjWNLfx1A6ATo9syUmFVxqHH9bCnPLBZmnLmMY=
|
go.etcd.io/etcd/client/v3 v3.6.1/go.mod h1:fCbPUdjWNLfx1A6ATo9syUmFVxqHH9bCnPLBZmnLmMY=
|
||||||
go.mongodb.org/mongo-driver v1.17.4 h1:jUorfmVzljjr0FLzYQsGP8cgN/qzzxlY9Vh0C9KFXVw=
|
|
||||||
go.mongodb.org/mongo-driver v1.17.4/go.mod h1:Hy04i7O2kC4RS06ZrhPRqj/u4DTYkFDAAccj+rVKqgQ=
|
|
||||||
go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA=
|
go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA=
|
||||||
go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A=
|
go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A=
|
||||||
go.opentelemetry.io/otel v1.34.0 h1:zRLXxLCgL1WyKsPVrgbSdMN4c0FMkDAskSTQP+0hdUY=
|
go.opentelemetry.io/otel v1.34.0 h1:zRLXxLCgL1WyKsPVrgbSdMN4c0FMkDAskSTQP+0hdUY=
|
||||||
@@ -109,48 +90,33 @@ go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
|
|||||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
|
||||||
golang.org/x/crypto v0.36.0 h1:AnAEvhDddvBdpY+uR+MyHmuZzzNqXSe/GvuDeob5L34=
|
|
||||||
golang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc=
|
|
||||||
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||||
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
|
||||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
|
||||||
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
|
||||||
golang.org/x/net v0.38.0 h1:vRMAPTMaeGqVhG5QyLJHqNDwecKTomGeqbnfZyKlBI8=
|
golang.org/x/net v0.38.0 h1:vRMAPTMaeGqVhG5QyLJHqNDwecKTomGeqbnfZyKlBI8=
|
||||||
golang.org/x/net v0.38.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8=
|
golang.org/x/net v0.38.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8=
|
||||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|
||||||
golang.org/x/sync v0.15.0 h1:KWH3jNZsfyT6xfAfKiz6MRNmd46ByHDYaZ7KSkCtdW8=
|
golang.org/x/sync v0.15.0 h1:KWH3jNZsfyT6xfAfKiz6MRNmd46ByHDYaZ7KSkCtdW8=
|
||||||
golang.org/x/sync v0.15.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
|
golang.org/x/sync v0.15.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
|
||||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.6.0/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-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|
||||||
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|
||||||
golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik=
|
golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik=
|
||||||
golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
|
golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
|
||||||
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.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
|
||||||
golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=
|
|
||||||
golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY=
|
golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY=
|
||||||
golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4=
|
golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4=
|
||||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||||
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
||||||
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||||
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
|
||||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
@@ -164,15 +130,9 @@ google.golang.org/grpc v1.71.1/go.mod h1:H0GRtasmQOh9LkFoCPDu3ZrwUtD1YGE+b2vYBYd
|
|||||||
google.golang.org/protobuf v1.36.5 h1:tPhr+woSbjfYvY6/GPufUoYizxw1cF/yFoxJ2fmpwlM=
|
google.golang.org/protobuf v1.36.5 h1:tPhr+woSbjfYvY6/GPufUoYizxw1cF/yFoxJ2fmpwlM=
|
||||||
google.golang.org/protobuf v1.36.5/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
|
google.golang.org/protobuf v1.36.5/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
|
||||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
|
||||||
gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc=
|
gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc=
|
||||||
gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc=
|
gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc=
|
||||||
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
|
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
|
||||||
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
||||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
gorm.io/driver/mysql v1.6.0 h1:eNbLmNTpPpTOVZi8MMxCi2aaIm0ZpInbORNXDwyLGvg=
|
|
||||||
gorm.io/driver/mysql v1.6.0/go.mod h1:D/oCC2GWK3M/dqoLxnOlaNKmXz8WNTfcS9y5ovaSqKo=
|
|
||||||
gorm.io/gorm v1.30.0 h1:qbT5aPv1UH8gI99OsRlvDToLxW5zR7FzS9acZDOZcgs=
|
|
||||||
gorm.io/gorm v1.30.0/go.mod h1:8Z33v652h4//uMA76KjeDH8mJXPm1QNCYrMeatR0DOE=
|
|
||||||
|
|||||||
@@ -1,14 +1,13 @@
|
|||||||
package log
|
package log
|
||||||
|
|
||||||
import (
|
import (
|
||||||
commonConfig "common/config"
|
|
||||||
"github.com/natefinch/lumberjack"
|
"github.com/natefinch/lumberjack"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
"go.uber.org/zap/zapcore"
|
"go.uber.org/zap/zapcore"
|
||||||
"os"
|
"os"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Init(cfg *commonConfig.LoggerConfig) {
|
func Init(debug bool, maxSize, maxBackups, maxAge int, level string) {
|
||||||
// 格式配置
|
// 格式配置
|
||||||
jsonConfig := zapcore.EncoderConfig{
|
jsonConfig := zapcore.EncoderConfig{
|
||||||
MessageKey: "M",
|
MessageKey: "M",
|
||||||
@@ -23,25 +22,27 @@ func Init(cfg *commonConfig.LoggerConfig) {
|
|||||||
EncodeTime: zapcore.TimeEncoderOfLayout("01-02 15:04:05.000"),
|
EncodeTime: zapcore.TimeEncoderOfLayout("01-02 15:04:05.000"),
|
||||||
EncodeDuration: zapcore.SecondsDurationEncoder,
|
EncodeDuration: zapcore.SecondsDurationEncoder,
|
||||||
EncodeCaller: zapcore.ShortCallerEncoder,
|
EncodeCaller: zapcore.ShortCallerEncoder,
|
||||||
EncodeName: nil,
|
EncodeName: func(loggerName string, enc zapcore.PrimitiveArrayEncoder) {
|
||||||
|
enc.AppendString("[" + loggerName + "]")
|
||||||
|
},
|
||||||
ConsoleSeparator: " ",
|
ConsoleSeparator: " ",
|
||||||
}
|
}
|
||||||
|
|
||||||
// 日志输出到控制台和文件
|
// 日志输出到控制台和文件
|
||||||
writeSyncer := []zapcore.WriteSyncer{zapcore.AddSync(os.Stdout)}
|
writeSyncer := []zapcore.WriteSyncer{zapcore.AddSync(os.Stdout)}
|
||||||
if !cfg.Debug {
|
if !debug {
|
||||||
writeSyncer = append(writeSyncer, zapcore.AddSync(&lumberjack.Logger{
|
writeSyncer = append(writeSyncer, zapcore.AddSync(&lumberjack.Logger{
|
||||||
Filename: "./logs/log.log", // 日志文件位置
|
Filename: "./logs/log.log", // 日志文件位置
|
||||||
MaxSize: cfg.MaxSize, // 最大文件大小(MB)
|
MaxSize: maxSize, // 最大文件大小(MB)
|
||||||
MaxBackups: cfg.MaxBackUp, // 保留旧文件的最大个数
|
MaxBackups: maxBackups, // 保留旧文件的最大个数
|
||||||
MaxAge: cfg.MaxAge, // 保留旧文件的最大天数
|
MaxAge: maxAge, // 保留旧文件的最大天数
|
||||||
Compress: false, // 是否压缩/归档旧文件
|
Compress: false, // 是否压缩/归档旧文件
|
||||||
LocalTime: true,
|
LocalTime: true,
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
var encoder zapcore.Encoder
|
var encoder zapcore.Encoder
|
||||||
if cfg.Debug {
|
if debug {
|
||||||
encoder = zapcore.NewConsoleEncoder(jsonConfig)
|
encoder = zapcore.NewConsoleEncoder(jsonConfig)
|
||||||
} else {
|
} else {
|
||||||
encoder = zapcore.NewJSONEncoder(jsonConfig)
|
encoder = zapcore.NewJSONEncoder(jsonConfig)
|
||||||
@@ -49,9 +50,9 @@ func Init(cfg *commonConfig.LoggerConfig) {
|
|||||||
logger := zap.New(zapcore.NewCore(
|
logger := zap.New(zapcore.NewCore(
|
||||||
encoder,
|
encoder,
|
||||||
zapcore.NewMultiWriteSyncer(writeSyncer...),
|
zapcore.NewMultiWriteSyncer(writeSyncer...),
|
||||||
zap.NewAtomicLevelAt(GetLogLevel(cfg.Level)),
|
zap.NewAtomicLevelAt(GetLogLevel(level)),
|
||||||
))
|
))
|
||||||
if cfg.Debug {
|
if debug {
|
||||||
logger = logger.WithOptions(
|
logger = logger.WithOptions(
|
||||||
zap.AddCaller(),
|
zap.AddCaller(),
|
||||||
zap.AddCallerSkip(1),
|
zap.AddCallerSkip(1),
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package grpc_client
|
package grpc_conn
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"common/log"
|
"common/log"
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package grpc_client
|
package grpc_conn
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"common/log"
|
"common/log"
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package grpc_client
|
package grpc_conn
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
24
Server/common/net/grpc/service/client_gateway.go
Normal file
24
Server/common/net/grpc/service/client_gateway.go
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
package service
|
||||||
|
|
||||||
|
import (
|
||||||
|
"common/discover"
|
||||||
|
"common/discover/common"
|
||||||
|
"common/proto/gen/grpc_pb"
|
||||||
|
)
|
||||||
|
|
||||||
|
func GatewayNewClient(sid ...string) (grpc_pb.GatewayClient, error) {
|
||||||
|
c, err := discover.FindServer(common.KeyDiscoverGateway, sid...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return grpc_pb.NewGatewayClient(c), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func GatewayNewBroadcastClient() map[string]grpc_pb.GatewayClient {
|
||||||
|
clientM := make(map[string]grpc_pb.GatewayClient)
|
||||||
|
connM := discover.FindServerAll(common.KeyDiscoverGateway)
|
||||||
|
for sid, conn := range connM {
|
||||||
|
clientM[sid] = grpc_pb.NewGatewayClient(conn)
|
||||||
|
}
|
||||||
|
return clientM
|
||||||
|
}
|
||||||
@@ -2,25 +2,23 @@ package service
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"common/discover"
|
"common/discover"
|
||||||
"common/discover/common"
|
|
||||||
"common/log"
|
"common/log"
|
||||||
"common/utils"
|
"common/utils"
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
"google.golang.org/grpc/keepalive"
|
"google.golang.org/grpc/keepalive"
|
||||||
"os"
|
"net"
|
||||||
"strconv"
|
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
type IService interface {
|
type IService interface {
|
||||||
Init(addr string)
|
Init(addr string, port int)
|
||||||
Close()
|
Close()
|
||||||
}
|
}
|
||||||
|
|
||||||
type ServiceBase struct {
|
type Base struct {
|
||||||
Target string
|
Target string
|
||||||
SID string
|
SID string
|
||||||
Serve *grpc.Server
|
Serve *grpc.Server
|
||||||
@@ -31,7 +29,7 @@ type ServiceBase struct {
|
|||||||
wg *sync.WaitGroup
|
wg *sync.WaitGroup
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *ServiceBase) Init(addr string) {
|
func (s *Base) Init(addr string, port int) {
|
||||||
s.wg = &sync.WaitGroup{}
|
s.wg = &sync.WaitGroup{}
|
||||||
s.wg.Add(1)
|
s.wg.Add(1)
|
||||||
s.SID = utils.SnowflakeInstance().Generate().String()
|
s.SID = utils.SnowflakeInstance().Generate().String()
|
||||||
@@ -40,17 +38,10 @@ func (s *ServiceBase) Init(addr string) {
|
|||||||
defer s.OnClose()
|
defer s.OnClose()
|
||||||
defer discover.UnRegisterGrpcServer(s.SID)
|
defer discover.UnRegisterGrpcServer(s.SID)
|
||||||
|
|
||||||
pMin, _ := strconv.ParseInt(os.Getenv("P_MIN"), 10, 64)
|
// 监听端口
|
||||||
pMax, _ := strconv.ParseInt(os.Getenv("P_MAX"), 10, 64)
|
lis, err := net.Listen("tcp", fmt.Sprintf(":%d", port))
|
||||||
if pMin == 0 || pMax == 0 || pMin > pMax {
|
if err != nil {
|
||||||
log.Errorf(" %v init err: pMin or pMax is 0 or pMin > pMax", s.Target)
|
log.Errorf("%v ListenPort err: %v", s.Target, err)
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// 服务注册
|
|
||||||
lis, port, err := common.ListenRandomPort(pMin, pMax)
|
|
||||||
if lis == nil {
|
|
||||||
log.Errorf(" %v ListenRandomPort err: %v", s.Target, err)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,7 +77,7 @@ func (s *ServiceBase) Init(addr string) {
|
|||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *ServiceBase) Close() {
|
func (s *Base) Close() {
|
||||||
if s.Serve != nil {
|
if s.Serve != nil {
|
||||||
s.Serve.Stop()
|
s.Serve.Stop()
|
||||||
s.wg.Wait()
|
s.wg.Wait()
|
||||||
33
Server/common/net/socket/server.go
Normal file
33
Server/common/net/socket/server.go
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
package socket
|
||||||
|
|
||||||
|
import (
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Action int
|
||||||
|
|
||||||
|
const (
|
||||||
|
// None indicates that no action should occur following an event.
|
||||||
|
None Action = iota
|
||||||
|
// Close closes the connection.
|
||||||
|
Close
|
||||||
|
// Shutdown shutdowns the engine.
|
||||||
|
Shutdown
|
||||||
|
)
|
||||||
|
|
||||||
|
// ISocketServer 由应用层实现
|
||||||
|
type ISocketServer interface {
|
||||||
|
OnOpen(ISocketConn) ([]byte, Action) // 开启连接
|
||||||
|
OnHandShake(ISocketConn) // 开始握手
|
||||||
|
OnMessage(ISocketConn, []byte) Action // 收到消息
|
||||||
|
OnClose(ISocketConn, error) Action // 关闭连接
|
||||||
|
OnTick() (time.Duration, Action)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ISocketConn 由网络层实现
|
||||||
|
type ISocketConn interface {
|
||||||
|
GetParam(key string) interface{}
|
||||||
|
SetParam(key string, values interface{})
|
||||||
|
Write(data []byte) error
|
||||||
|
Close() error
|
||||||
|
}
|
||||||
196
Server/common/net/socket/websocket/websocket.go
Normal file
196
Server/common/net/socket/websocket/websocket.go
Normal file
@@ -0,0 +1,196 @@
|
|||||||
|
package websocket
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"common/net/socket"
|
||||||
|
"context"
|
||||||
|
"github.com/panjf2000/gnet/v2"
|
||||||
|
"github.com/panjf2000/gnet/v2/pkg/logging"
|
||||||
|
"sync"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
// WSServer 实现GNet库接口
|
||||||
|
type WSServer struct {
|
||||||
|
gnet.BuiltinEventEngine
|
||||||
|
eng gnet.Engine
|
||||||
|
i socket.ISocketServer
|
||||||
|
logger logging.Logger // 日志
|
||||||
|
upgradeTimeout time.Duration // 升级超时时间
|
||||||
|
unUpgradeConn sync.Map
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewWSServer(i socket.ISocketServer, logger logging.Logger, timeout time.Duration) *WSServer {
|
||||||
|
if i == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return &WSServer{
|
||||||
|
i: i,
|
||||||
|
logger: logger,
|
||||||
|
upgradeTimeout: timeout,
|
||||||
|
unUpgradeConn: sync.Map{},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *WSServer) Run(logger logging.Logger, addr string, multiCore, reusePort, tick, lockOSThread, reuseAddr bool, processNum int) error {
|
||||||
|
return gnet.Run(
|
||||||
|
s,
|
||||||
|
addr,
|
||||||
|
gnet.WithMulticore(multiCore),
|
||||||
|
gnet.WithNumEventLoop(processNum),
|
||||||
|
gnet.WithReusePort(reusePort),
|
||||||
|
gnet.WithTicker(tick),
|
||||||
|
gnet.WithLogger(logger),
|
||||||
|
gnet.WithLockOSThread(lockOSThread),
|
||||||
|
gnet.WithReuseAddr(reuseAddr),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *WSServer) Stop() error {
|
||||||
|
return s.eng.Stop(context.Background())
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *WSServer) OnBoot(eng gnet.Engine) gnet.Action {
|
||||||
|
s.eng = eng
|
||||||
|
return gnet.None
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *WSServer) OnOpen(c gnet.Conn) ([]byte, gnet.Action) {
|
||||||
|
ws := &WSConn{
|
||||||
|
Conn: c,
|
||||||
|
isUpgrade: false,
|
||||||
|
openTime: time.Now().Unix(),
|
||||||
|
buf: bytes.Buffer{},
|
||||||
|
logger: s.logger,
|
||||||
|
wsMessageBuf: wsMessageBuf{
|
||||||
|
curHeader: nil,
|
||||||
|
cachedBuf: bytes.Buffer{},
|
||||||
|
},
|
||||||
|
param: make(map[string]interface{}),
|
||||||
|
}
|
||||||
|
c.SetContext(ws)
|
||||||
|
s.unUpgradeConn.Store(c.RemoteAddr().String(), ws)
|
||||||
|
d, a := s.i.OnOpen(ws)
|
||||||
|
return d, (gnet.Action)(a)
|
||||||
|
}
|
||||||
|
|
||||||
|
// OnClose fires when a connection has been closed.
|
||||||
|
// The parameter err is the last known connection error.
|
||||||
|
func (s *WSServer) OnClose(c gnet.Conn, err error) (action gnet.Action) {
|
||||||
|
s.unUpgradeConn.Delete(c.RemoteAddr().String())
|
||||||
|
tmp := c.Context()
|
||||||
|
ws, ok := tmp.(*WSConn)
|
||||||
|
if ok {
|
||||||
|
s.logger.Warnf("connection close")
|
||||||
|
return gnet.Action(s.i.OnClose(ws, err))
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// OnTraffic fires when a local socket receives data from the peer.
|
||||||
|
func (s *WSServer) OnTraffic(c gnet.Conn) (action gnet.Action) {
|
||||||
|
tmp := c.Context()
|
||||||
|
if tmp == nil {
|
||||||
|
if s.logger != nil {
|
||||||
|
s.logger.Errorf("OnTraffic context nil: %v", c)
|
||||||
|
}
|
||||||
|
action = gnet.Close
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
ws, ok := tmp.(*WSConn)
|
||||||
|
if !ok {
|
||||||
|
if s.logger != nil {
|
||||||
|
s.logger.Errorf("OnTraffic convert ws error: %v", tmp)
|
||||||
|
}
|
||||||
|
action = gnet.Close
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
action = ws.readBytesBuf(c)
|
||||||
|
if action != gnet.None {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if !ws.isUpgrade {
|
||||||
|
var data []byte
|
||||||
|
data, ok, action = ws.upgrade()
|
||||||
|
if ok {
|
||||||
|
s.unUpgradeConn.Delete(c.RemoteAddr().String())
|
||||||
|
s.i.OnHandShake(ws)
|
||||||
|
if data != nil {
|
||||||
|
err := ws.Conn.AsyncWrite(data, nil)
|
||||||
|
if err != nil {
|
||||||
|
if ws.logger != nil {
|
||||||
|
ws.logger.Errorf("update ws write upgrade protocol error", err)
|
||||||
|
}
|
||||||
|
action = gnet.Close
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
msg, err := ws.readWsMessages()
|
||||||
|
if err != nil {
|
||||||
|
if ws.logger != nil {
|
||||||
|
ws.logger.Errorf("read ws messages errors", err)
|
||||||
|
}
|
||||||
|
return gnet.Close
|
||||||
|
}
|
||||||
|
|
||||||
|
if msg != nil {
|
||||||
|
for _, m := range msg {
|
||||||
|
a := s.i.OnMessage(ws, m.Payload)
|
||||||
|
if gnet.Action(a) != gnet.None {
|
||||||
|
action = gnet.Action(a)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// OnTick fires immediately after the engine starts and will fire again
|
||||||
|
// following the duration specified by the delay return value.
|
||||||
|
func (s *WSServer) OnTick() (delay time.Duration, action gnet.Action) {
|
||||||
|
now := time.Now().Unix()
|
||||||
|
|
||||||
|
delConn := make([]string, 0)
|
||||||
|
s.unUpgradeConn.Range(func(key, value interface{}) bool {
|
||||||
|
k, ok := key.(string)
|
||||||
|
if !ok {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
v, ok := value.(*WSConn)
|
||||||
|
if !ok {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
if now-v.openTime >= int64(s.upgradeTimeout.Seconds()) {
|
||||||
|
delConn = append(delConn, k)
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
})
|
||||||
|
|
||||||
|
for _, k := range delConn {
|
||||||
|
wsConn, _ := s.unUpgradeConn.LoadAndDelete(k)
|
||||||
|
if wsConn == nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
v, ok := wsConn.(*WSConn)
|
||||||
|
if !ok {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if err := v.Close(); err != nil {
|
||||||
|
if s.logger != nil {
|
||||||
|
s.logger.Errorf("upgrade ws time out close socket error: %v", err)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
d, a := s.i.OnTick()
|
||||||
|
delay = d
|
||||||
|
action = gnet.Action(a)
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
263
Server/common/net/socket/websocket/wsconn.go
Normal file
263
Server/common/net/socket/websocket/wsconn.go
Normal file
@@ -0,0 +1,263 @@
|
|||||||
|
package websocket
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bufio"
|
||||||
|
"bytes"
|
||||||
|
"errors"
|
||||||
|
"github.com/gobwas/ws"
|
||||||
|
"github.com/gobwas/ws/wsutil"
|
||||||
|
"github.com/panjf2000/gnet/v2"
|
||||||
|
"github.com/panjf2000/gnet/v2/pkg/logging"
|
||||||
|
"io"
|
||||||
|
"net/url"
|
||||||
|
)
|
||||||
|
|
||||||
|
// WSConn 实现ISocketConn接口
|
||||||
|
type WSConn struct {
|
||||||
|
gnet.Conn
|
||||||
|
buf bytes.Buffer
|
||||||
|
logger logging.Logger
|
||||||
|
isUpgrade bool
|
||||||
|
isClose bool
|
||||||
|
param map[string]interface{}
|
||||||
|
openTime int64
|
||||||
|
wsMessageBuf
|
||||||
|
}
|
||||||
|
|
||||||
|
type wsMessageBuf struct {
|
||||||
|
curHeader *ws.Header
|
||||||
|
cachedBuf bytes.Buffer
|
||||||
|
}
|
||||||
|
|
||||||
|
type readWrite struct {
|
||||||
|
io.Reader
|
||||||
|
io.Writer
|
||||||
|
}
|
||||||
|
|
||||||
|
func (w *WSConn) readBytesBuf(c gnet.Conn) gnet.Action {
|
||||||
|
size := c.InboundBuffered()
|
||||||
|
if size <= 0 {
|
||||||
|
return gnet.None
|
||||||
|
}
|
||||||
|
buf := make([]byte, size)
|
||||||
|
|
||||||
|
read, err := c.Read(buf)
|
||||||
|
if err != nil {
|
||||||
|
if w.logger != nil {
|
||||||
|
w.logger.Errorf("ws read bytes buf error", err)
|
||||||
|
}
|
||||||
|
return gnet.Close
|
||||||
|
}
|
||||||
|
|
||||||
|
if read < size {
|
||||||
|
if w.logger != nil {
|
||||||
|
w.logger.Errorf("read bytes len err! size: %d read: %d", size, read)
|
||||||
|
}
|
||||||
|
return gnet.Close
|
||||||
|
}
|
||||||
|
w.buf.Write(buf)
|
||||||
|
return gnet.None
|
||||||
|
}
|
||||||
|
|
||||||
|
func (w *WSConn) upgrade() (data []byte, ok bool, action gnet.Action) {
|
||||||
|
if w.isUpgrade {
|
||||||
|
ok = true
|
||||||
|
return
|
||||||
|
}
|
||||||
|
buf := &w.buf
|
||||||
|
tmpReader := bytes.NewReader(buf.Bytes())
|
||||||
|
oldLen := tmpReader.Len()
|
||||||
|
result := &bytes.Buffer{}
|
||||||
|
tempWriter := bufio.NewWriter(result)
|
||||||
|
|
||||||
|
var err error = nil
|
||||||
|
up := ws.Upgrader{
|
||||||
|
OnRequest: w.OnRequest,
|
||||||
|
}
|
||||||
|
_, err = up.Upgrade(readWrite{tmpReader, tempWriter})
|
||||||
|
skipN := oldLen - tmpReader.Len()
|
||||||
|
if err != nil {
|
||||||
|
if errors.Is(err, io.EOF) || errors.Is(err, io.ErrUnexpectedEOF) { //数据不完整
|
||||||
|
return
|
||||||
|
}
|
||||||
|
buf.Next(skipN)
|
||||||
|
if w.logger != nil {
|
||||||
|
w.logger.Errorf("ws upgrade error", err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
action = gnet.Close
|
||||||
|
return
|
||||||
|
}
|
||||||
|
buf.Next(skipN)
|
||||||
|
if w.logger != nil {
|
||||||
|
w.logger.Infof("ws upgrade success conn upgrade websocket protocol!")
|
||||||
|
}
|
||||||
|
_ = tempWriter.Flush()
|
||||||
|
data = result.Bytes()
|
||||||
|
ok = true
|
||||||
|
w.isUpgrade = true
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func (w *WSConn) readWsMessages() (messages []wsutil.Message, err error) {
|
||||||
|
in := &w.buf
|
||||||
|
//messages, err = wsutil.ReadClientMessage(in, messages)
|
||||||
|
//return
|
||||||
|
for {
|
||||||
|
if w.curHeader == nil {
|
||||||
|
if in.Len() < ws.MinHeaderSize { //头长度至少是2
|
||||||
|
return
|
||||||
|
}
|
||||||
|
var head ws.Header
|
||||||
|
//有可能不完整,构建新的 reader 读取 head 读取成功才实际对 in 进行读操作
|
||||||
|
tmpReader := bytes.NewReader(in.Bytes())
|
||||||
|
oldLen := tmpReader.Len()
|
||||||
|
head, err = ws.ReadHeader(tmpReader)
|
||||||
|
skipN := oldLen - tmpReader.Len()
|
||||||
|
if err != nil {
|
||||||
|
if errors.Is(err, io.EOF) || errors.Is(err, io.ErrUnexpectedEOF) { //数据不完整
|
||||||
|
return messages, nil
|
||||||
|
}
|
||||||
|
in.Next(skipN)
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
_, err = io.CopyN(&w.cachedBuf, in, int64(skipN))
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
//in.Next(skipN)
|
||||||
|
|
||||||
|
w.curHeader = &head
|
||||||
|
//err = ws.WriteHeader(&msgBuf.cachedBuf, head)
|
||||||
|
//if err != nil {
|
||||||
|
// return nil, err
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
dataLen := (int)(w.curHeader.Length)
|
||||||
|
if dataLen > 0 {
|
||||||
|
if in.Len() >= dataLen {
|
||||||
|
_, err = io.CopyN(&w.cachedBuf, in, int64(dataLen))
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
} else { //数据不完整
|
||||||
|
if w.logger != nil {
|
||||||
|
w.logger.Debugf("ws read ws message incomplete data", in.Len(), dataLen)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if w.curHeader.Fin { //当前 header 已经是一个完整消息
|
||||||
|
messages, err = wsutil.ReadClientMessage(&w.cachedBuf, messages)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
w.cachedBuf.Reset()
|
||||||
|
}
|
||||||
|
w.curHeader = nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (w *WSConn) OnRequest(u []byte) error {
|
||||||
|
parsedURL, err := url.Parse(string(u))
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
w.SetParam("query", parsedURL.Query())
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (w *WSConn) GetParam(key string) interface{} {
|
||||||
|
return w.param[key]
|
||||||
|
}
|
||||||
|
|
||||||
|
func (w *WSConn) SetParam(key string, values interface{}) {
|
||||||
|
w.param[key] = values
|
||||||
|
}
|
||||||
|
|
||||||
|
func (w *WSConn) Write(data []byte) error {
|
||||||
|
if w.isClose {
|
||||||
|
return errors.New("connection has close")
|
||||||
|
}
|
||||||
|
return w.write(data, ws.OpBinary)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (w *WSConn) Close() (err error) {
|
||||||
|
defer func(Conn gnet.Conn) {
|
||||||
|
err = Conn.Close()
|
||||||
|
}(w.Conn)
|
||||||
|
return w.write(make([]byte, 0), ws.OpClose)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (w *WSConn) write(data []byte, opCode ws.OpCode) error {
|
||||||
|
buf := bytes.Buffer{}
|
||||||
|
err := wsutil.WriteServerMessage(&buf, opCode, data)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return w.Conn.AsyncWrite(buf.Bytes(), nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
//func (w *WSConn) Pong(data []byte) (err error) {
|
||||||
|
// buf := bytes.Buffer{}
|
||||||
|
// if data == nil {
|
||||||
|
// err = wsutil.WriteServerMessage(&buf, ws.OpPong, emptyPayload)
|
||||||
|
// } else {
|
||||||
|
// err = wsutil.WriteServerMessage(&buf, ws.OpPong, data)
|
||||||
|
// }
|
||||||
|
// if w.isClose {
|
||||||
|
// return errors.New("connection has close")
|
||||||
|
// }
|
||||||
|
// if err != nil {
|
||||||
|
// return
|
||||||
|
// }
|
||||||
|
// return w.Conn.AsyncWrite(buf.Bytes(), nil)
|
||||||
|
//}
|
||||||
|
|
||||||
|
//func (w *WSConn) Ping(data []byte) (err error) {
|
||||||
|
// buf := bytes.Buffer{}
|
||||||
|
// if data == nil {
|
||||||
|
// err = wsutil.WriteServerMessage(&buf, ws.OpPing, emptyPayload)
|
||||||
|
// } else {
|
||||||
|
// err = wsutil.WriteServerMessage(&buf, ws.OpPing, data)
|
||||||
|
// }
|
||||||
|
// if w.isClose {
|
||||||
|
// return errors.New("connection has close")
|
||||||
|
// }
|
||||||
|
// if err != nil {
|
||||||
|
// return err
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// return w.Conn.AsyncWrite(buf.Bytes(), nil)
|
||||||
|
//}
|
||||||
|
|
||||||
|
//func (w *WSConn) GetProperty(key string) (interface{}, error) {
|
||||||
|
// if w.context[key] == nil {
|
||||||
|
// return nil, errors.New("not found this key")
|
||||||
|
// }
|
||||||
|
// return w.context[key], nil
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
//func (w *WSConn) SetProperty(key string, ctx interface{}) {
|
||||||
|
// w.context[key] = ctx
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
//func (w *WSConn) RemoveProperty(key string) {
|
||||||
|
// delete(w.context, key)
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
//func (w *WSConn) GetConnID() uint64 {
|
||||||
|
// return w.connID
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
//func (w *WSConn) Clear() {
|
||||||
|
// w.context = make(map[string]interface{})
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
//func (w *WSConn) GetUrlParam() map[string][]string {
|
||||||
|
// return w.urlParma
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
//func (w *WSConn) SetUrlParam(key string, values []string) {
|
||||||
|
// w.urlParma[key] = values
|
||||||
|
//}
|
||||||
7
Server/common/proto/common.proto
Normal file
7
Server/common/proto/common.proto
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
option go_package = "common/proto/gen/common";
|
||||||
|
|
||||||
|
// 空
|
||||||
|
message Empty {
|
||||||
|
}
|
||||||
132
Server/common/proto/gen/common/common.pb.go
Normal file
132
Server/common/proto/gen/common/common.pb.go
Normal file
@@ -0,0 +1,132 @@
|
|||||||
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
|
// versions:
|
||||||
|
// protoc-gen-go v1.32.0
|
||||||
|
// protoc v4.25.1
|
||||||
|
// source: proto/common.proto
|
||||||
|
|
||||||
|
package common
|
||||||
|
|
||||||
|
import (
|
||||||
|
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)
|
||||||
|
)
|
||||||
|
|
||||||
|
// 空
|
||||||
|
type Empty struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Empty) Reset() {
|
||||||
|
*x = Empty{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_proto_common_proto_msgTypes[0]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Empty) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*Empty) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *Empty) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_proto_common_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 Empty.ProtoReflect.Descriptor instead.
|
||||||
|
func (*Empty) Descriptor() ([]byte, []int) {
|
||||||
|
return file_proto_common_proto_rawDescGZIP(), []int{0}
|
||||||
|
}
|
||||||
|
|
||||||
|
var File_proto_common_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
|
var file_proto_common_proto_rawDesc = []byte{
|
||||||
|
0x0a, 0x12, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70,
|
||||||
|
0x72, 0x6f, 0x74, 0x6f, 0x22, 0x07, 0x0a, 0x05, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x42, 0x19, 0x5a,
|
||||||
|
0x17, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65,
|
||||||
|
0x6e, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
file_proto_common_proto_rawDescOnce sync.Once
|
||||||
|
file_proto_common_proto_rawDescData = file_proto_common_proto_rawDesc
|
||||||
|
)
|
||||||
|
|
||||||
|
func file_proto_common_proto_rawDescGZIP() []byte {
|
||||||
|
file_proto_common_proto_rawDescOnce.Do(func() {
|
||||||
|
file_proto_common_proto_rawDescData = protoimpl.X.CompressGZIP(file_proto_common_proto_rawDescData)
|
||||||
|
})
|
||||||
|
return file_proto_common_proto_rawDescData
|
||||||
|
}
|
||||||
|
|
||||||
|
var file_proto_common_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
|
||||||
|
var file_proto_common_proto_goTypes = []interface{}{
|
||||||
|
(*Empty)(nil), // 0: Empty
|
||||||
|
}
|
||||||
|
var file_proto_common_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_proto_common_proto_init() }
|
||||||
|
func file_proto_common_proto_init() {
|
||||||
|
if File_proto_common_proto != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if !protoimpl.UnsafeEnabled {
|
||||||
|
file_proto_common_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*Empty); 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_proto_common_proto_rawDesc,
|
||||||
|
NumEnums: 0,
|
||||||
|
NumMessages: 1,
|
||||||
|
NumExtensions: 0,
|
||||||
|
NumServices: 0,
|
||||||
|
},
|
||||||
|
GoTypes: file_proto_common_proto_goTypes,
|
||||||
|
DependencyIndexes: file_proto_common_proto_depIdxs,
|
||||||
|
MessageInfos: file_proto_common_proto_msgTypes,
|
||||||
|
}.Build()
|
||||||
|
File_proto_common_proto = out.File
|
||||||
|
file_proto_common_proto_rawDesc = nil
|
||||||
|
file_proto_common_proto_goTypes = nil
|
||||||
|
file_proto_common_proto_depIdxs = nil
|
||||||
|
}
|
||||||
71
Server/common/proto/gen/grpc_pb/gateway.pb.go
Normal file
71
Server/common/proto/gen/grpc_pb/gateway.pb.go
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
|
// versions:
|
||||||
|
// protoc-gen-go v1.32.0
|
||||||
|
// protoc v4.25.1
|
||||||
|
// source: grpc/gateway.proto
|
||||||
|
|
||||||
|
package grpc_pb
|
||||||
|
|
||||||
|
import (
|
||||||
|
common "common/proto/gen/common"
|
||||||
|
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||||
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
|
reflect "reflect"
|
||||||
|
)
|
||||||
|
|
||||||
|
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)
|
||||||
|
)
|
||||||
|
|
||||||
|
var File_grpc_gateway_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
|
var file_grpc_gateway_proto_rawDesc = []byte{
|
||||||
|
0x0a, 0x12, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x67, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x2e, 0x70,
|
||||||
|
0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0c, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f,
|
||||||
|
0x74, 0x6f, 0x32, 0x2a, 0x0a, 0x07, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x12, 0x1f, 0x0a,
|
||||||
|
0x0b, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x06, 0x2e, 0x45,
|
||||||
|
0x6d, 0x70, 0x74, 0x79, 0x1a, 0x06, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x42, 0x1a,
|
||||||
|
0x5a, 0x18, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67,
|
||||||
|
0x65, 0x6e, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x5f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
|
||||||
|
0x6f, 0x33,
|
||||||
|
}
|
||||||
|
|
||||||
|
var file_grpc_gateway_proto_goTypes = []interface{}{
|
||||||
|
(*common.Empty)(nil), // 0: Empty
|
||||||
|
}
|
||||||
|
var file_grpc_gateway_proto_depIdxs = []int32{
|
||||||
|
0, // 0: Gateway.SendMessage:input_type -> Empty
|
||||||
|
0, // 1: Gateway.SendMessage:output_type -> Empty
|
||||||
|
1, // [1:2] is the sub-list for method output_type
|
||||||
|
0, // [0:1] 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_grpc_gateway_proto_init() }
|
||||||
|
func file_grpc_gateway_proto_init() {
|
||||||
|
if File_grpc_gateway_proto != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
type x struct{}
|
||||||
|
out := protoimpl.TypeBuilder{
|
||||||
|
File: protoimpl.DescBuilder{
|
||||||
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
|
RawDescriptor: file_grpc_gateway_proto_rawDesc,
|
||||||
|
NumEnums: 0,
|
||||||
|
NumMessages: 0,
|
||||||
|
NumExtensions: 0,
|
||||||
|
NumServices: 1,
|
||||||
|
},
|
||||||
|
GoTypes: file_grpc_gateway_proto_goTypes,
|
||||||
|
DependencyIndexes: file_grpc_gateway_proto_depIdxs,
|
||||||
|
}.Build()
|
||||||
|
File_grpc_gateway_proto = out.File
|
||||||
|
file_grpc_gateway_proto_rawDesc = nil
|
||||||
|
file_grpc_gateway_proto_goTypes = nil
|
||||||
|
file_grpc_gateway_proto_depIdxs = nil
|
||||||
|
}
|
||||||
106
Server/common/proto/gen/grpc_pb/gateway_grpc.pb.go
Normal file
106
Server/common/proto/gen/grpc_pb/gateway_grpc.pb.go
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||||
|
// versions:
|
||||||
|
// - protoc-gen-go-grpc v1.2.0
|
||||||
|
// - protoc v4.25.1
|
||||||
|
// source: grpc/gateway.proto
|
||||||
|
|
||||||
|
package grpc_pb
|
||||||
|
|
||||||
|
import (
|
||||||
|
common "common/proto/gen/common"
|
||||||
|
context "context"
|
||||||
|
grpc "google.golang.org/grpc"
|
||||||
|
codes "google.golang.org/grpc/codes"
|
||||||
|
status "google.golang.org/grpc/status"
|
||||||
|
)
|
||||||
|
|
||||||
|
// This is a compile-time assertion to ensure that this generated file
|
||||||
|
// is compatible with the grpc package it is being compiled against.
|
||||||
|
// Requires gRPC-Go v1.32.0 or later.
|
||||||
|
const _ = grpc.SupportPackageIsVersion7
|
||||||
|
|
||||||
|
// GatewayClient is the client API for Gateway service.
|
||||||
|
//
|
||||||
|
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
||||||
|
type GatewayClient interface {
|
||||||
|
SendMessage(ctx context.Context, in *common.Empty, opts ...grpc.CallOption) (*common.Empty, error)
|
||||||
|
}
|
||||||
|
|
||||||
|
type gatewayClient struct {
|
||||||
|
cc grpc.ClientConnInterface
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewGatewayClient(cc grpc.ClientConnInterface) GatewayClient {
|
||||||
|
return &gatewayClient{cc}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *gatewayClient) SendMessage(ctx context.Context, in *common.Empty, opts ...grpc.CallOption) (*common.Empty, error) {
|
||||||
|
out := new(common.Empty)
|
||||||
|
err := c.cc.Invoke(ctx, "/Gateway/SendMessage", in, out, opts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// GatewayServer is the server API for Gateway service.
|
||||||
|
// All implementations must embed UnimplementedGatewayServer
|
||||||
|
// for forward compatibility
|
||||||
|
type GatewayServer interface {
|
||||||
|
SendMessage(context.Context, *common.Empty) (*common.Empty, error)
|
||||||
|
mustEmbedUnimplementedGatewayServer()
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnimplementedGatewayServer must be embedded to have forward compatible implementations.
|
||||||
|
type UnimplementedGatewayServer struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (UnimplementedGatewayServer) SendMessage(context.Context, *common.Empty) (*common.Empty, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method SendMessage not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedGatewayServer) mustEmbedUnimplementedGatewayServer() {}
|
||||||
|
|
||||||
|
// UnsafeGatewayServer may be embedded to opt out of forward compatibility for this service.
|
||||||
|
// Use of this interface is not recommended, as added methods to GatewayServer will
|
||||||
|
// result in compilation errors.
|
||||||
|
type UnsafeGatewayServer interface {
|
||||||
|
mustEmbedUnimplementedGatewayServer()
|
||||||
|
}
|
||||||
|
|
||||||
|
func RegisterGatewayServer(s grpc.ServiceRegistrar, srv GatewayServer) {
|
||||||
|
s.RegisterService(&Gateway_ServiceDesc, srv)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _Gateway_SendMessage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(common.Empty)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(GatewayServer).SendMessage(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: "/Gateway/SendMessage",
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(GatewayServer).SendMessage(ctx, req.(*common.Empty))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Gateway_ServiceDesc is the grpc.ServiceDesc for Gateway service.
|
||||||
|
// It's only intended for direct use with grpc.RegisterService,
|
||||||
|
// and not to be introspected or modified (even as a copy)
|
||||||
|
var Gateway_ServiceDesc = grpc.ServiceDesc{
|
||||||
|
ServiceName: "Gateway",
|
||||||
|
HandlerType: (*GatewayServer)(nil),
|
||||||
|
Methods: []grpc.MethodDesc{
|
||||||
|
{
|
||||||
|
MethodName: "SendMessage",
|
||||||
|
Handler: _Gateway_SendMessage_Handler,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Streams: []grpc.StreamDesc{},
|
||||||
|
Metadata: "grpc/gateway.proto",
|
||||||
|
}
|
||||||
9
Server/common/proto/grpc/gateway.proto
Normal file
9
Server/common/proto/grpc/gateway.proto
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
option go_package = "common/proto/gen/grpc_pb";
|
||||||
|
import "common.proto";
|
||||||
|
|
||||||
|
service Gateway {
|
||||||
|
rpc SendMessage(Empty) returns (Empty) {}
|
||||||
|
}
|
||||||
|
|
||||||
24
Server/common/utils/snowflake.go
Normal file
24
Server/common/utils/snowflake.go
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
package utils
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/bwmarrin/snowflake"
|
||||||
|
"log"
|
||||||
|
)
|
||||||
|
|
||||||
|
var instance *snowflake.Node
|
||||||
|
|
||||||
|
func InitSnowflake(node int64) *snowflake.Node {
|
||||||
|
n, err := snowflake.NewNode(node)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatalf("create snowflake's node failed: %v", err)
|
||||||
|
}
|
||||||
|
instance = n
|
||||||
|
return instance
|
||||||
|
}
|
||||||
|
|
||||||
|
func SnowflakeInstance() *snowflake.Node {
|
||||||
|
if instance == nil {
|
||||||
|
log.Fatal("snowflake's not init")
|
||||||
|
}
|
||||||
|
return instance
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user