Skip to content
This repository has been archived by the owner on Jan 22, 2024. It is now read-only.

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
chatless committed Jun 10, 2023
1 parent affc735 commit a2e4d68
Show file tree
Hide file tree
Showing 34 changed files with 51 additions and 53 deletions.
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ linters-settings:
sections:
- standard # Standard section: captures all standard packages.
- default # Default section: contains all imports that could not be matched to another section type.
- prefix(github.com/pole-group/polaris-apiserver-nacos) # Custom section: groups all imports with the specified Prefix.
- prefix(github.com/polaris-contrib/apiserver-nacos) # Custom section: groups all imports with the specified Prefix.
#- blank # Blank section: contains all blank imports. This section is not present unless explicitly enabled.
#- dot # Dot section: contains all dot imports. This section is not present unless explicitly enabled.
# Skip generated files.
Expand Down
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
# nacosserver
# apiserver-nacos

## 如何使用

#### 构建

执行构建脚本 `build.sh` 即可

```bash
# ${nacos_server_plugin_version}: nacosserver 插件版本,默认为 main 的最新 commit
# ${polaris_server_tag}: 北极星服务端版本信息,默认为 main 分支
bash build.sh ${nacos_server_plugin_version} ${polaris_server_tag}
make build ${nacos_server_plugin_version} ${polaris_server_tag}
```

#### 配置文件调整
Expand Down
4 changes: 2 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ if [ "${polaris_server_tag}" != "" ]; then
git checkout ${polaris_server_tag}
fi

cat ../plugin.go.temp >nacos_server_plugin.go
cat ../plugin_apiserver_nacos.go.temp >plugin_apiserver_nacos.go

go clean --modcache
go get -u github.com/pole-group/polaris-apiserver-nacos@${nacos_server_plugin_version}
go get -u github.com/polaris-contrib/apiserver-nacos@${nacos_server_plugin_version}
go mod tidy

make build VERSION=${polaris_server_tag}
Expand Down
2 changes: 1 addition & 1 deletion core/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

package core

import "github.com/pole-group/polaris-apiserver-nacos/logger"
import "github.com/polaris-contrib/apiserver-nacos/logger"

var (
nacoslog = logger.GetNacosLog()
Expand Down
2 changes: 1 addition & 1 deletion core/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import (
"github.com/polarismesh/polaris/common/utils"
"go.uber.org/zap"

nacosmodel "github.com/pole-group/polaris-apiserver-nacos/model"
nacosmodel "github.com/polaris-contrib/apiserver-nacos/model"
)

type PushType string
Expand Down
2 changes: 1 addition & 1 deletion core/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import (
"go.uber.org/zap"
"golang.org/x/sync/singleflight"

nacosmodel "github.com/pole-group/polaris-apiserver-nacos/model"
nacosmodel "github.com/polaris-contrib/apiserver-nacos/model"
)

type (
Expand Down
2 changes: 1 addition & 1 deletion default.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ package nacosserver
import (
"github.com/polarismesh/polaris/apiserver"

_ "github.com/pole-group/polaris-apiserver-nacos/v2"
_ "github.com/polaris-contrib/apiserver-nacos/v2"
)

// init 自注册到API服务器插槽
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/pole-group/polaris-apiserver-nacos
module github.com/polaris-contrib/apiserver-nacos

go 1.19

Expand Down
2 changes: 1 addition & 1 deletion import-format.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@ cd ../
go fmt ./...

find . -name "*.go" -type f | grep -v .pb.go|grep -v test/tools/tools.go | grep -v ./plugin.go |\
xargs -I {} ./goimports-reviser -rm-unused -format {} -local github.com/polarismesh/specification -project-name github.com/pole-group/polaris-apiserver-nacos
xargs -I {} ./goimports-reviser -rm-unused -format {} -local github.com/polarismesh/specification -project-name github.com/polaris-contrib/apiserver-nacos

2 changes: 1 addition & 1 deletion plugin.go.temp → plugin_apiserver_nacos.go.temp
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@
package main

import (
_ "github.com/pole-group/polaris-apiserver-nacos"
_ "github.com/polaris-contrib/apiserver-nacos"
)
6 changes: 3 additions & 3 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ import (
"github.com/polarismesh/polaris/service"
"github.com/polarismesh/polaris/service/healthcheck"

"github.com/pole-group/polaris-apiserver-nacos/core"
nacosv1 "github.com/pole-group/polaris-apiserver-nacos/v1"
nacosv2 "github.com/pole-group/polaris-apiserver-nacos/v2"
"github.com/polaris-contrib/apiserver-nacos/core"
nacosv1 "github.com/polaris-contrib/apiserver-nacos/v1"
nacosv2 "github.com/polaris-contrib/apiserver-nacos/v2"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ package nacosserver_test
import (
"testing"

_ "github.com/pole-group/polaris-apiserver-nacos"
_ "github.com/polaris-contrib/apiserver-nacos"
)

func TestMain(m *testing.M) {
Expand Down
4 changes: 2 additions & 2 deletions v1/access.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import (

"github.com/emicklei/go-restful/v3"

"github.com/pole-group/polaris-apiserver-nacos/core"
"github.com/pole-group/polaris-apiserver-nacos/model"
"github.com/polaris-contrib/apiserver-nacos/core"
"github.com/polaris-contrib/apiserver-nacos/model"
)

func (n *NacosV1Server) GetClientServer() (*restful.WebService, error) {
Expand Down
2 changes: 1 addition & 1 deletion v1/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (

"github.com/emicklei/go-restful/v3"

"github.com/pole-group/polaris-apiserver-nacos/model"
"github.com/polaris-contrib/apiserver-nacos/model"
)

func BuildInstance(namespace string, req *restful.Request) (*model.Instance, error) {
Expand Down
2 changes: 1 addition & 1 deletion v1/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (

"github.com/emicklei/go-restful/v3"

"github.com/pole-group/polaris-apiserver-nacos/model"
"github.com/polaris-contrib/apiserver-nacos/model"
)

var (
Expand Down
4 changes: 2 additions & 2 deletions v1/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ import (
apimodel "github.com/polarismesh/specification/source/go/api/v1/model"
apiservice "github.com/polarismesh/specification/source/go/api/v1/service_manage"

"github.com/pole-group/polaris-apiserver-nacos/core"
"github.com/pole-group/polaris-apiserver-nacos/model"
"github.com/polaris-contrib/apiserver-nacos/core"
"github.com/polaris-contrib/apiserver-nacos/model"
)

func (n *NacosV1Server) handleRegister(ctx context.Context, namespace, serviceName string, ins *model.Instance) error {
Expand Down
2 changes: 1 addition & 1 deletion v1/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

package v1

import "github.com/pole-group/polaris-apiserver-nacos/logger"
import "github.com/polaris-contrib/apiserver-nacos/logger"

var (
nacoslog = logger.GetNacosLog()
Expand Down
4 changes: 2 additions & 2 deletions v1/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ import (
apimodel "github.com/polarismesh/specification/source/go/api/v1/model"
"go.uber.org/zap"

"github.com/pole-group/polaris-apiserver-nacos/core"
"github.com/pole-group/polaris-apiserver-nacos/model"
"github.com/polaris-contrib/apiserver-nacos/core"
"github.com/polaris-contrib/apiserver-nacos/model"
)

func NewNacosV1Server(store *core.NacosDataStorage, options ...option) *NacosV1Server {
Expand Down
2 changes: 1 addition & 1 deletion v1/upd_push.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
commontime "github.com/polarismesh/polaris/common/time"
"go.uber.org/zap"

"github.com/pole-group/polaris-apiserver-nacos/core"
"github.com/polaris-contrib/apiserver-nacos/core"
)

func NewUDPPushCenter(store *core.NacosDataStorage) (core.PushCenter, error) {
Expand Down
4 changes: 2 additions & 2 deletions v2/access.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ import (
"go.uber.org/zap"
"google.golang.org/protobuf/types/known/anypb"

nacosmodel "github.com/pole-group/polaris-apiserver-nacos/model"
nacospb "github.com/pole-group/polaris-apiserver-nacos/v2/pb"
nacosmodel "github.com/polaris-contrib/apiserver-nacos/model"
nacospb "github.com/polaris-contrib/apiserver-nacos/v2/pb"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion v2/checker.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import (
"github.com/polarismesh/specification/source/go/api/v1/service_manage"
"go.uber.org/zap"

nacosmodel "github.com/pole-group/polaris-apiserver-nacos/model"
nacosmodel "github.com/polaris-contrib/apiserver-nacos/model"
)

type Checker struct {
Expand Down
2 changes: 1 addition & 1 deletion v2/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ package v2
import (
"context"

nacospb "github.com/pole-group/polaris-apiserver-nacos/v2/pb"
nacospb "github.com/polaris-contrib/apiserver-nacos/v2/pb"
)

// handleServerCheckRequest 客户端首次发起请求,用于向 server 获取当前长连接的 ID 信息
Expand Down
2 changes: 1 addition & 1 deletion v2/client_conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import (
"google.golang.org/grpc"
"google.golang.org/grpc/stats"

nacospb "github.com/pole-group/polaris-apiserver-nacos/v2/pb"
nacospb "github.com/polaris-contrib/apiserver-nacos/v2/pb"
)

type (
Expand Down
4 changes: 2 additions & 2 deletions v2/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import (

"github.com/emicklei/go-restful/v3"

"github.com/pole-group/polaris-apiserver-nacos/core"
v1 "github.com/pole-group/polaris-apiserver-nacos/v1"
"github.com/polaris-contrib/apiserver-nacos/core"
v1 "github.com/polaris-contrib/apiserver-nacos/v1"
)

func (n *NacosV2Server) RegistryDebugRoute() {
Expand Down
2 changes: 1 addition & 1 deletion v2/grpc_push.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
commontime "github.com/polarismesh/polaris/common/time"
"go.uber.org/zap"

"github.com/pole-group/polaris-apiserver-nacos/core"
"github.com/polaris-contrib/apiserver-nacos/core"
)

type Sender func(sub core.Subscriber, data *core.PushData) error
Expand Down
2 changes: 1 addition & 1 deletion v2/healthcheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ package v2
import (
"context"

nacospb "github.com/pole-group/polaris-apiserver-nacos/v2/pb"
nacospb "github.com/polaris-contrib/apiserver-nacos/v2/pb"
)

// handleHealthCheckRequest 主要用于客户端检查自己和 server 长连接的健康状态
Expand Down
4 changes: 2 additions & 2 deletions v2/inflights.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ package v2
import (
"sync"

nacosmodel "github.com/pole-group/polaris-apiserver-nacos/model"
nacospb "github.com/pole-group/polaris-apiserver-nacos/v2/pb"
nacosmodel "github.com/polaris-contrib/apiserver-nacos/model"
nacospb "github.com/polaris-contrib/apiserver-nacos/v2/pb"
)

type (
Expand Down
4 changes: 2 additions & 2 deletions v2/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ import (
"go.uber.org/zap"
"google.golang.org/protobuf/types/known/wrapperspb"

nacosmodel "github.com/pole-group/polaris-apiserver-nacos/model"
nacospb "github.com/pole-group/polaris-apiserver-nacos/v2/pb"
nacosmodel "github.com/polaris-contrib/apiserver-nacos/model"
nacospb "github.com/polaris-contrib/apiserver-nacos/v2/pb"
)

func (h *NacosV2Server) handleInstanceRequest(ctx context.Context, req nacospb.BaseRequest,
Expand Down
2 changes: 1 addition & 1 deletion v2/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

package v2

import "github.com/pole-group/polaris-apiserver-nacos/logger"
import "github.com/polaris-contrib/apiserver-nacos/logger"

var (
nacoslog = logger.GetNacosLog()
Expand Down
2 changes: 1 addition & 1 deletion v2/pb/naming_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"strconv"
"time"

"github.com/pole-group/polaris-apiserver-nacos/model"
"github.com/polaris-contrib/apiserver-nacos/model"
)

// NamingRequest
Expand Down
2 changes: 1 addition & 1 deletion v2/pb/response.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ package nacos_grpc_service
import (
"encoding/json"

"github.com/pole-group/polaris-apiserver-nacos/model"
"github.com/polaris-contrib/apiserver-nacos/model"
)

// BaseResponse
Expand Down
6 changes: 3 additions & 3 deletions v2/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ import (
"google.golang.org/grpc/peer"
"google.golang.org/grpc/status"

"github.com/pole-group/polaris-apiserver-nacos/core"
v1 "github.com/pole-group/polaris-apiserver-nacos/v1"
nacospb "github.com/pole-group/polaris-apiserver-nacos/v2/pb"
"github.com/polaris-contrib/apiserver-nacos/core"
v1 "github.com/polaris-contrib/apiserver-nacos/v1"
nacospb "github.com/polaris-contrib/apiserver-nacos/v2/pb"
)

func NewNacosV2Server(v1Svr *v1.NacosV1Server, store *core.NacosDataStorage, options ...option) *NacosV2Server {
Expand Down
6 changes: 3 additions & 3 deletions v2/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ import (
"context"
"strings"

"github.com/pole-group/polaris-apiserver-nacos/model"
nacosmodel "github.com/pole-group/polaris-apiserver-nacos/model"
nacospb "github.com/pole-group/polaris-apiserver-nacos/v2/pb"
"github.com/polaris-contrib/apiserver-nacos/model"
nacosmodel "github.com/polaris-contrib/apiserver-nacos/model"
nacospb "github.com/polaris-contrib/apiserver-nacos/v2/pb"
)

func (h *NacosV2Server) handleServiceListRequest(ctx context.Context, req nacospb.BaseRequest,
Expand Down
6 changes: 3 additions & 3 deletions v2/subscribe.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ import (
"github.com/polarismesh/polaris/common/utils"
"go.uber.org/zap"

"github.com/pole-group/polaris-apiserver-nacos/core"
nacosmodel "github.com/pole-group/polaris-apiserver-nacos/model"
nacospb "github.com/pole-group/polaris-apiserver-nacos/v2/pb"
"github.com/polaris-contrib/apiserver-nacos/core"
nacosmodel "github.com/polaris-contrib/apiserver-nacos/model"
nacospb "github.com/polaris-contrib/apiserver-nacos/v2/pb"
)

func (h *NacosV2Server) handleSubscribeServiceReques(ctx context.Context, req nacospb.BaseRequest,
Expand Down

0 comments on commit a2e4d68

Please sign in to comment.