可运行
This commit is contained in:
parent
7f9822e81f
commit
ed1125c6dd
@ -12,19 +12,15 @@ import (
|
|||||||
_ "dubbo.apache.org/dubbo-go/v3/imports"
|
_ "dubbo.apache.org/dubbo-go/v3/imports"
|
||||||
bccrClient "github.com/antchain-openapi-sdk-go/bccr/client"
|
bccrClient "github.com/antchain-openapi-sdk-go/bccr/client"
|
||||||
"github.com/bwmarrin/snowflake"
|
"github.com/bwmarrin/snowflake"
|
||||||
antCloud "github.com/huyi-cn/antcloud-golang-sdk"
|
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
)
|
)
|
||||||
|
|
||||||
func NewApp(Lg *zap.Logger, JaegerTracer *tracing.JaegerProvider, AntClient *antCloud.Client, BccrClient *bccrClient.Client, SfNode *snowflake.Node) *app.App {
|
func NewApp(Lg *zap.Logger, JaegerTracer *tracing.JaegerProvider, BccrClient *bccrClient.Client, SfNode *snowflake.Node) *app.App {
|
||||||
return &app.App{
|
return &app.App{
|
||||||
Lg: Lg,
|
Lg: Lg,
|
||||||
//RedisClient: RedisClient,
|
|
||||||
JaegerTracer: JaegerTracer,
|
JaegerTracer: JaegerTracer,
|
||||||
AntClient: AntClient,
|
|
||||||
BccrClient: BccrClient,
|
BccrClient: BccrClient,
|
||||||
SfNode: SfNode,
|
SfNode: SfNode,
|
||||||
//RtcClient: RtcClient,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"chain-dci/pkg/ant"
|
|
||||||
"chain-dci/pkg/app"
|
"chain-dci/pkg/app"
|
||||||
"chain-dci/pkg/bccr"
|
"chain-dci/pkg/bccr"
|
||||||
"chain-dci/pkg/logger"
|
"chain-dci/pkg/logger"
|
||||||
@ -15,6 +14,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func InitApp() (*app.App, error) {
|
func InitApp() (*app.App, error) {
|
||||||
wire.Build(logger.Provider, tracing.Provider, ant.Provider, bccr.Provider, snowf.Provider, NewApp)
|
wire.Build(logger.Provider, tracing.Provider, bccr.Provider, snowf.Provider, NewApp)
|
||||||
return &app.App{}, nil
|
return &app.App{}, nil
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"chain-dci/pkg/ant"
|
|
||||||
"chain-dci/pkg/app"
|
"chain-dci/pkg/app"
|
||||||
"chain-dci/pkg/bccr"
|
"chain-dci/pkg/bccr"
|
||||||
"chain-dci/pkg/logger"
|
"chain-dci/pkg/logger"
|
||||||
@ -16,6 +15,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
_ "chain-dci/internal/handler"
|
||||||
_ "dubbo.apache.org/dubbo-go/v3/filter/tps/strategy"
|
_ "dubbo.apache.org/dubbo-go/v3/filter/tps/strategy"
|
||||||
_ "dubbo.apache.org/dubbo-go/v3/imports"
|
_ "dubbo.apache.org/dubbo-go/v3/imports"
|
||||||
)
|
)
|
||||||
@ -25,9 +25,8 @@ import (
|
|||||||
func InitApp() (*app.App, error) {
|
func InitApp() (*app.App, error) {
|
||||||
zapLogger := logger.ZapInit()
|
zapLogger := logger.ZapInit()
|
||||||
jaegerProvider := tracing.NewTracing()
|
jaegerProvider := tracing.NewTracing()
|
||||||
client := ant.NewAntClient()
|
client := bccr.NewBccrClient()
|
||||||
clientClient := bccr.NewBccrClient()
|
|
||||||
node := snowf.NewSf()
|
node := snowf.NewSf()
|
||||||
appApp := NewApp(zapLogger, jaegerProvider, client, clientClient, node)
|
appApp := NewApp(zapLogger, jaegerProvider, client, node)
|
||||||
return appApp, nil
|
return appApp, nil
|
||||||
}
|
}
|
||||||
|
22
go.mod
22
go.mod
@ -3,18 +3,19 @@ module chain-dci
|
|||||||
go 1.20
|
go 1.20
|
||||||
|
|
||||||
require (
|
require (
|
||||||
dubbo.apache.org/dubbo-go/v3 v3.0.2
|
dubbo.apache.org/dubbo-go/v3 v3.1.0
|
||||||
github.com/alibabacloud-go/tea v1.2.1
|
github.com/alibabacloud-go/tea v1.2.1
|
||||||
github.com/antchain-openapi-sdk-go/bccr v1.17.65
|
github.com/antchain-openapi-sdk-go/bccr v1.17.65
|
||||||
github.com/bwmarrin/snowflake v0.3.0
|
github.com/bwmarrin/snowflake v0.3.0
|
||||||
github.com/dubbogo/gost v1.13.2
|
github.com/dubbogo/gost v1.14.0
|
||||||
github.com/dubbogo/grpc-go v1.42.10
|
github.com/dubbogo/grpc-go v1.42.10
|
||||||
github.com/dubbogo/triple v1.2.2-rc3
|
github.com/dubbogo/triple v1.2.2-rc3
|
||||||
github.com/gin-gonic/gin v1.9.1
|
github.com/gin-gonic/gin v1.9.1
|
||||||
github.com/go-redis/redis v6.15.9+incompatible
|
github.com/go-redis/redis v6.15.9+incompatible
|
||||||
github.com/golang/protobuf v1.5.3
|
github.com/golang/protobuf v1.5.3
|
||||||
github.com/google/wire v0.5.0
|
github.com/google/wire v0.5.0
|
||||||
github.com/huyi-cn/antcloud-golang-sdk v1.0.2
|
github.com/jinzhu/copier v0.3.5
|
||||||
|
github.com/mwitkow/go-proto-validators v0.3.2
|
||||||
github.com/natefinch/lumberjack v2.0.0+incompatible
|
github.com/natefinch/lumberjack v2.0.0+incompatible
|
||||||
github.com/opentracing/opentracing-go v1.2.0
|
github.com/opentracing/opentracing-go v1.2.0
|
||||||
github.com/spf13/viper v1.17.0
|
github.com/spf13/viper v1.17.0
|
||||||
@ -29,7 +30,6 @@ require (
|
|||||||
require (
|
require (
|
||||||
cloud.google.com/go/compute v1.23.0 // indirect
|
cloud.google.com/go/compute v1.23.0 // indirect
|
||||||
cloud.google.com/go/compute/metadata v0.2.3 // indirect
|
cloud.google.com/go/compute/metadata v0.2.3 // indirect
|
||||||
contrib.go.opencensus.io/exporter/prometheus v0.4.1 // indirect
|
|
||||||
github.com/RoaringBitmap/roaring v1.2.3 // indirect
|
github.com/RoaringBitmap/roaring v1.2.3 // indirect
|
||||||
github.com/Workiva/go-datastructures v1.0.52 // indirect
|
github.com/Workiva/go-datastructures v1.0.52 // indirect
|
||||||
github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5 // indirect
|
github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5 // indirect
|
||||||
@ -66,9 +66,6 @@ require (
|
|||||||
github.com/gabriel-vasile/mimetype v1.4.2 // indirect
|
github.com/gabriel-vasile/mimetype v1.4.2 // indirect
|
||||||
github.com/gin-contrib/sse v0.1.0 // indirect
|
github.com/gin-contrib/sse v0.1.0 // indirect
|
||||||
github.com/go-co-op/gocron v1.9.0 // indirect
|
github.com/go-co-op/gocron v1.9.0 // indirect
|
||||||
github.com/go-errors/errors v1.0.1 // indirect
|
|
||||||
github.com/go-kit/log v0.2.0 // indirect
|
|
||||||
github.com/go-logfmt/logfmt v0.5.1 // indirect
|
|
||||||
github.com/go-logr/logr v1.2.3 // indirect
|
github.com/go-logr/logr v1.2.3 // indirect
|
||||||
github.com/go-logr/stdr v1.2.2 // indirect
|
github.com/go-logr/stdr v1.2.2 // indirect
|
||||||
github.com/go-ole/go-ole v1.2.6 // indirect
|
github.com/go-ole/go-ole v1.2.6 // indirect
|
||||||
@ -79,7 +76,6 @@ require (
|
|||||||
github.com/go-sql-driver/mysql v1.7.0 // indirect
|
github.com/go-sql-driver/mysql v1.7.0 // indirect
|
||||||
github.com/goccy/go-json v0.10.2 // indirect
|
github.com/goccy/go-json v0.10.2 // indirect
|
||||||
github.com/gogo/protobuf v1.3.2 // indirect
|
github.com/gogo/protobuf v1.3.2 // indirect
|
||||||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
|
|
||||||
github.com/golang/mock v1.6.0 // indirect
|
github.com/golang/mock v1.6.0 // indirect
|
||||||
github.com/golang/snappy v0.0.4 // indirect
|
github.com/golang/snappy v0.0.4 // indirect
|
||||||
github.com/google/uuid v1.3.0 // indirect
|
github.com/google/uuid v1.3.0 // indirect
|
||||||
@ -89,7 +85,7 @@ require (
|
|||||||
github.com/hashicorp/go-multierror v1.1.1 // indirect
|
github.com/hashicorp/go-multierror v1.1.1 // indirect
|
||||||
github.com/hashicorp/hcl v1.0.0 // indirect
|
github.com/hashicorp/hcl v1.0.0 // indirect
|
||||||
github.com/hashicorp/vault/sdk v0.7.0 // indirect
|
github.com/hashicorp/vault/sdk v0.7.0 // indirect
|
||||||
github.com/jinzhu/copier v0.3.5 // indirect
|
github.com/influxdata/tdigest v0.0.1 // indirect
|
||||||
github.com/jinzhu/inflection v1.0.0 // indirect
|
github.com/jinzhu/inflection v1.0.0 // indirect
|
||||||
github.com/jinzhu/now v1.1.5 // indirect
|
github.com/jinzhu/now v1.1.5 // indirect
|
||||||
github.com/jmespath/go-jmespath v0.4.0 // indirect
|
github.com/jmespath/go-jmespath v0.4.0 // indirect
|
||||||
@ -110,7 +106,8 @@ require (
|
|||||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||||
github.com/mschoch/smat v0.2.0 // indirect
|
github.com/mschoch/smat v0.2.0 // indirect
|
||||||
github.com/nacos-group/nacos-sdk-go v1.1.4 // indirect
|
github.com/nacos-group/nacos-sdk-go/v2 v2.2.2 // indirect
|
||||||
|
github.com/oliveagle/jsonpath v0.0.0-20180606110733-2e52cf6e6852 // indirect
|
||||||
github.com/pelletier/go-toml v1.9.3 // indirect
|
github.com/pelletier/go-toml v1.9.3 // indirect
|
||||||
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
|
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
|
||||||
github.com/pierrec/lz4 v2.5.2+incompatible // indirect
|
github.com/pierrec/lz4 v2.5.2+incompatible // indirect
|
||||||
@ -121,11 +118,10 @@ require (
|
|||||||
github.com/prometheus/client_model v0.4.0 // indirect
|
github.com/prometheus/client_model v0.4.0 // indirect
|
||||||
github.com/prometheus/common v0.37.0 // indirect
|
github.com/prometheus/common v0.37.0 // indirect
|
||||||
github.com/prometheus/procfs v0.8.0 // indirect
|
github.com/prometheus/procfs v0.8.0 // indirect
|
||||||
github.com/prometheus/statsd_exporter v0.21.0 // indirect
|
|
||||||
github.com/robfig/cron/v3 v3.0.1 // indirect
|
github.com/robfig/cron/v3 v3.0.1 // indirect
|
||||||
github.com/sagikazarmark/locafero v0.3.0 // indirect
|
github.com/sagikazarmark/locafero v0.3.0 // indirect
|
||||||
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
|
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
|
||||||
github.com/satori/go.uuid v1.2.1-0.20181028125025-b2ce2384e17b // indirect
|
github.com/satori/go.uuid v1.2.0 // indirect
|
||||||
github.com/shirou/gopsutil/v3 v3.22.2 // indirect
|
github.com/shirou/gopsutil/v3 v3.22.2 // indirect
|
||||||
github.com/sourcegraph/conc v0.3.0 // indirect
|
github.com/sourcegraph/conc v0.3.0 // indirect
|
||||||
github.com/spaolacci/murmur3 v1.1.0 // indirect
|
github.com/spaolacci/murmur3 v1.1.0 // indirect
|
||||||
@ -139,11 +135,9 @@ require (
|
|||||||
github.com/uber/jaeger-lib v2.4.1+incompatible // indirect
|
github.com/uber/jaeger-lib v2.4.1+incompatible // indirect
|
||||||
github.com/ugorji/go/codec v1.2.11 // indirect
|
github.com/ugorji/go/codec v1.2.11 // indirect
|
||||||
github.com/yusufpapurcu/wmi v1.2.2 // indirect
|
github.com/yusufpapurcu/wmi v1.2.2 // indirect
|
||||||
github.com/zouyx/agollo/v3 v3.4.5 // indirect
|
|
||||||
go.etcd.io/etcd/api/v3 v3.5.9 // indirect
|
go.etcd.io/etcd/api/v3 v3.5.9 // indirect
|
||||||
go.etcd.io/etcd/client/pkg/v3 v3.5.9 // indirect
|
go.etcd.io/etcd/client/pkg/v3 v3.5.9 // indirect
|
||||||
go.etcd.io/etcd/client/v3 v3.5.9 // indirect
|
go.etcd.io/etcd/client/v3 v3.5.9 // indirect
|
||||||
go.opencensus.io v0.24.0 // indirect
|
|
||||||
go.opentelemetry.io/otel v1.11.0 // indirect
|
go.opentelemetry.io/otel v1.11.0 // indirect
|
||||||
go.opentelemetry.io/otel/trace v1.11.0 // indirect
|
go.opentelemetry.io/otel/trace v1.11.0 // indirect
|
||||||
go.uber.org/atomic v1.10.0 // indirect
|
go.uber.org/atomic v1.10.0 // indirect
|
||||||
|
@ -7,8 +7,8 @@ import (
|
|||||||
fmt "fmt"
|
fmt "fmt"
|
||||||
math "math"
|
math "math"
|
||||||
proto "github.com/golang/protobuf/proto"
|
proto "github.com/golang/protobuf/proto"
|
||||||
_ "google.golang.org/protobuf/types/descriptorpb"
|
|
||||||
_ "github.com/mwitkow/go-proto-validators"
|
_ "github.com/mwitkow/go-proto-validators"
|
||||||
|
_ "google.golang.org/protobuf/types/descriptorpb"
|
||||||
github_com_mwitkow_go_proto_validators "github.com/mwitkow/go-proto-validators"
|
github_com_mwitkow_go_proto_validators "github.com/mwitkow/go-proto-validators"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1,20 +0,0 @@
|
|||||||
package ant
|
|
||||||
|
|
||||||
import (
|
|
||||||
dciConfig "chain-dci/config"
|
|
||||||
"github.com/google/wire"
|
|
||||||
antCloud "github.com/huyi-cn/antcloud-golang-sdk"
|
|
||||||
)
|
|
||||||
|
|
||||||
var Provider = wire.NewSet(NewAntClient)
|
|
||||||
|
|
||||||
func NewAntClient() *antCloud.Client {
|
|
||||||
// Endpoint 请参考 https://api.aliyun.com/product/rtc
|
|
||||||
//bccrConfig := new(bccrClient.Config)
|
|
||||||
//bccrConfig.SetEndpoint(dciConfig.Data.Dci.EndPoint)
|
|
||||||
//bccrConfig.SetAccessKeyId(dciConfig.Data.Dci.AccessKey)
|
|
||||||
//bccrConfig.SetAccessKeySecret(dciConfig.Data.Dci.AccessKeySecret)
|
|
||||||
|
|
||||||
client := antCloud.NewClient(dciConfig.Data.AntCloud.EndPoint, dciConfig.Data.AntCloud.AccessKey, dciConfig.Data.AntCloud.AccessKeySecret, nil)
|
|
||||||
return client
|
|
||||||
}
|
|
@ -4,7 +4,6 @@ import (
|
|||||||
"chain-dci/pkg/tracing"
|
"chain-dci/pkg/tracing"
|
||||||
bccrClient "github.com/antchain-openapi-sdk-go/bccr/client"
|
bccrClient "github.com/antchain-openapi-sdk-go/bccr/client"
|
||||||
"github.com/bwmarrin/snowflake"
|
"github.com/bwmarrin/snowflake"
|
||||||
antCloud "github.com/huyi-cn/antcloud-golang-sdk"
|
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -16,6 +15,5 @@ type App struct {
|
|||||||
JaegerTracer *tracing.JaegerProvider
|
JaegerTracer *tracing.JaegerProvider
|
||||||
//DbMeeting *gorm.DB
|
//DbMeeting *gorm.DB
|
||||||
SfNode *snowflake.Node
|
SfNode *snowflake.Node
|
||||||
AntClient *antCloud.Client
|
|
||||||
BccrClient *bccrClient.Client
|
BccrClient *bccrClient.Client
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user