feat: registry.

This commit is contained in:
Bobo
2025-06-02 10:33:44 +08:00
parent 45a51d01a7
commit b0e91998e1
24 changed files with 1144 additions and 112 deletions

View File

@@ -1,18 +1,17 @@
package nacos
import (
nacosKratos "github.com/go-kratos/kratos/contrib/registry/nacos/v2"
"github.com/go-kratos/kratos/v2/log"
nacosClients "github.com/nacos-group/nacos-sdk-go/clients"
nacosConstant "github.com/nacos-group/nacos-sdk-go/common/constant"
nacosVo "github.com/nacos-group/nacos-sdk-go/vo"
nacosClients "github.com/nacos-group/nacos-sdk-go/v2/clients"
nacosConstant "github.com/nacos-group/nacos-sdk-go/v2/common/constant"
nacosVo "github.com/nacos-group/nacos-sdk-go/v2/vo"
conf "github.com/tx7do/kratos-bootstrap/api/gen/go/conf/v1"
)
// NewRegistry 创建一个注册发现客户端 - Nacos
func NewRegistry(c *conf.Registry) *nacosKratos.Registry {
func NewRegistry(c *conf.Registry) *Registry {
if c == nil || c.Nacos == nil {
return nil
}
@@ -43,7 +42,7 @@ func NewRegistry(c *conf.Registry) *nacosKratos.Registry {
log.Fatal(err)
}
reg := nacosKratos.New(cli)
reg := New(cli)
return reg
}