mirror of
				https://github.com/TeaOSLab/EdgeAPI.git
				synced 2025-11-04 16:00:24 +08:00 
			
		
		
		
	阶段性提交
This commit is contained in:
		@@ -1,14 +1,11 @@
 | 
			
		||||
#!/usr/bin/env bash
 | 
			
		||||
 | 
			
		||||
function proto_compile() {
 | 
			
		||||
	protoc --go_out=plugins=grpc:../internal/rpc --proto_path=../internal/rpc ../internal/rpc/${1}/*.proto
 | 
			
		||||
}
 | 
			
		||||
ADMIN_PROJECT="../../EdgeAdmin"
 | 
			
		||||
 | 
			
		||||
protoc --go_out=plugins=grpc:../internal/rpc --proto_path=../internal/rpc/protos ../internal/rpc/protos/*.proto
 | 
			
		||||
 | 
			
		||||
#admin
 | 
			
		||||
cp ../internal/rpc/protos/service_admin.proto ${ADMIN_PROJECT}/internal/rpc/protos/
 | 
			
		||||
cp ../internal/rpc/pb/service_admin.pb.go ${ADMIN_PROJECT}/internal/rpc/pb/
 | 
			
		||||
cp ../internal/rpc/pb/model_*.go ${ADMIN_PROJECT}/internal/rpc/pb/
 | 
			
		||||
 | 
			
		||||
proto_compile "admin"
 | 
			
		||||
proto_compile "dns"
 | 
			
		||||
proto_compile "log"
 | 
			
		||||
proto_compile "provider"
 | 
			
		||||
proto_compile "stat"
 | 
			
		||||
proto_compile "user"
 | 
			
		||||
proto_compile "monitor"
 | 
			
		||||
proto_compile "node"
 | 
			
		||||
@@ -3,14 +3,8 @@ package apis
 | 
			
		||||
import (
 | 
			
		||||
	"errors"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeAPI/internal/configs"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeAPI/internal/rpc/admin"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeAPI/internal/rpc/dns"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeAPI/internal/rpc/log"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeAPI/internal/rpc/monitor"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeAPI/internal/rpc/node"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeAPI/internal/rpc/provider"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeAPI/internal/rpc/stat"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeAPI/internal/rpc/user"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeAPI/internal/rpc/pb"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeAPI/internal/rpc/services"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeAPI/internal/utils"
 | 
			
		||||
	"github.com/iwind/TeaGo/logs"
 | 
			
		||||
	"google.golang.org/grpc"
 | 
			
		||||
@@ -57,14 +51,14 @@ func (this *APINode) listenRPC() error {
 | 
			
		||||
		return errors.New("[API]listen rpc failed: " + err.Error())
 | 
			
		||||
	}
 | 
			
		||||
	rpcServer := grpc.NewServer()
 | 
			
		||||
	dns.RegisterServiceServer(rpcServer, &dns.Service{})
 | 
			
		||||
	log.RegisterServiceServer(rpcServer, &log.Service{})
 | 
			
		||||
	monitor.RegisterServiceServer(rpcServer, &monitor.Service{})
 | 
			
		||||
	node.RegisterServiceServer(rpcServer, &node.Service{})
 | 
			
		||||
	provider.RegisterServiceServer(rpcServer, &provider.Service{})
 | 
			
		||||
	stat.RegisterServiceServer(rpcServer, &stat.Service{})
 | 
			
		||||
	user.RegisterServiceServer(rpcServer, &user.Service{})
 | 
			
		||||
	admin.RegisterServiceServer(rpcServer, &admin.Service{})
 | 
			
		||||
	pb.RegisterDnsServiceServer(rpcServer, &services.DNSService{})
 | 
			
		||||
	pb.RegisterLogServiceServer(rpcServer, &services.LogService{})
 | 
			
		||||
	pb.RegisterMonitorServiceServer(rpcServer, &services.MonitorService{})
 | 
			
		||||
	pb.RegisterNodeServiceServer(rpcServer, &services.NodeService{})
 | 
			
		||||
	pb.RegisterProviderServiceServer(rpcServer, &services.ProviderService{})
 | 
			
		||||
	pb.RegisterStatServiceServer(rpcServer, &services.StatService{})
 | 
			
		||||
	pb.RegisterUserServiceServer(rpcServer, &services.UserService{})
 | 
			
		||||
	pb.RegisterAdminServiceServer(rpcServer, &services.AdminService{})
 | 
			
		||||
	err = rpcServer.Serve(listener)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return errors.New("[API]start rpc failed: " + err.Error())
 | 
			
		||||
 
 | 
			
		||||
@@ -55,7 +55,7 @@ func (this *NodeClusterDAO) FindEnabledNodeCluster(id uint32) (*NodeCluster, err
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 根据主键查找名称
 | 
			
		||||
func (this *NodeClusterDAO) FindNodeClusterName(id uint32) (string, error) {
 | 
			
		||||
func (this *NodeClusterDAO) FindNodeClusterName(id int64) (string, error) {
 | 
			
		||||
	return this.Query().
 | 
			
		||||
		Pk(id).
 | 
			
		||||
		Result("name").
 | 
			
		||||
 
 | 
			
		||||
@@ -4,6 +4,8 @@ import (
 | 
			
		||||
	_ "github.com/go-sql-driver/mysql"
 | 
			
		||||
	"github.com/iwind/TeaGo/Tea"
 | 
			
		||||
	"github.com/iwind/TeaGo/dbs"
 | 
			
		||||
	"github.com/iwind/TeaGo/rands"
 | 
			
		||||
	"github.com/iwind/TeaGo/types"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
const (
 | 
			
		||||
@@ -62,3 +64,48 @@ func (this *NodeDAO) FindNodeName(id uint32) (string, error) {
 | 
			
		||||
		FindCol("")
 | 
			
		||||
	return name.(string), err
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 创建节点
 | 
			
		||||
func (this *NodeDAO) CreateNode(name string, clusterId int) (nodeId int, err error) {
 | 
			
		||||
	op := NewNodeOperator()
 | 
			
		||||
	op.Name = name
 | 
			
		||||
	op.NodeId = rands.HexString(32)
 | 
			
		||||
	op.Secret = rands.String(32)
 | 
			
		||||
	op.ClusterId = clusterId
 | 
			
		||||
	op.State = NodeStateEnabled
 | 
			
		||||
	_, err = this.Save(op)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return 0, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return types.Int(op.Id), nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 修改节点
 | 
			
		||||
func (this *NodeDAO) UpdateNode(nodeId int, name string, clusterId int) error {
 | 
			
		||||
	op := NewNodeOperator()
 | 
			
		||||
	op.Id = nodeId
 | 
			
		||||
	op.Name = name
 | 
			
		||||
	op.ClusterId = clusterId
 | 
			
		||||
	_, err := this.Save(op)
 | 
			
		||||
	return err
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 计算所有节点数量
 | 
			
		||||
func (this *NodeDAO) CountAllEnabledNodes() (int64, error) {
 | 
			
		||||
	return this.Query().
 | 
			
		||||
		State(NodeStateEnabled).
 | 
			
		||||
		Count()
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 列出单页节点
 | 
			
		||||
func (this *NodeDAO) ListEnabledNodes(offset int64, size int64) (result []*Node, err error) {
 | 
			
		||||
	_, err = this.Query().
 | 
			
		||||
		State(NodeStateEnabled).
 | 
			
		||||
		Offset(int(offset)).
 | 
			
		||||
		Limit(int(size)).
 | 
			
		||||
		DescPk().
 | 
			
		||||
		Slice(&result).
 | 
			
		||||
		FindAll()
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,181 +0,0 @@
 | 
			
		||||
package admin
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"context"
 | 
			
		||||
	"encoding/base64"
 | 
			
		||||
	"encoding/json"
 | 
			
		||||
	"errors"
 | 
			
		||||
	teaconst "github.com/TeaOSLab/EdgeAPI/internal/const"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeAPI/internal/db/models"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeAPI/internal/encrypt"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeAPI/internal/utils"
 | 
			
		||||
	"github.com/iwind/TeaGo/maps"
 | 
			
		||||
	"google.golang.org/grpc/metadata"
 | 
			
		||||
	"time"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type Service struct {
 | 
			
		||||
	debug bool
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (this *Service) Login(ctx context.Context, req *LoginRequest) (*LoginResponse, error) {
 | 
			
		||||
	_, err := this.validateRequest(ctx)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if len(req.Username) == 0 || len(req.Password) == 0 {
 | 
			
		||||
		return &LoginResponse{
 | 
			
		||||
			AdminId: 0,
 | 
			
		||||
			IsOk:    false,
 | 
			
		||||
			Message: "请输入正确的用户名密码",
 | 
			
		||||
		}, nil
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	adminId, err := models.SharedAdminDAO.CheckAdminPassword(req.Username, req.Password)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		utils.PrintError(err)
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if adminId <= 0 {
 | 
			
		||||
		return &LoginResponse{
 | 
			
		||||
			AdminId: 0,
 | 
			
		||||
			IsOk:    false,
 | 
			
		||||
			Message: "请输入正确的用户名密码",
 | 
			
		||||
		}, nil
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return &LoginResponse{
 | 
			
		||||
		AdminId: int64(adminId),
 | 
			
		||||
		IsOk:    true,
 | 
			
		||||
	}, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (this *Service) CreateLog(ctx context.Context, req *CreateLogRequest) (*CreateLogResponse, error) {
 | 
			
		||||
	adminId, err := this.validateAdminRequest(ctx)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
	err = models.SharedLogDAO.CreateAdminLog(adminId, req.Level, req.Description, req.Action, req.Ip)
 | 
			
		||||
	return &CreateLogResponse{
 | 
			
		||||
		IsOk: err != nil,
 | 
			
		||||
	}, err
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (this *Service) CheckAdminExists(ctx context.Context, req *CheckAdminExistsRequest) (*CheckAdminExistsResponse, error) {
 | 
			
		||||
	_, err := this.validateRequest(ctx)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if req.AdminId <= 0 {
 | 
			
		||||
		return &CheckAdminExistsResponse{
 | 
			
		||||
			IsOk: false,
 | 
			
		||||
		}, nil
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	ok, err := models.SharedAdminDAO.ExistEnabledAdmin(int(req.AdminId))
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return &CheckAdminExistsResponse{
 | 
			
		||||
		IsOk: ok,
 | 
			
		||||
	}, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (this *Service) FindAdminFullname(ctx context.Context, req *FindAdminNameRequest) (*FindAdminNameResponse, error) {
 | 
			
		||||
	_, err := this.validateRequest(ctx)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	fullname, err := models.SharedAdminDAO.FindAdminFullname(int(req.AdminId))
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		utils.PrintError(err)
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return &FindAdminNameResponse{
 | 
			
		||||
		Fullname: fullname,
 | 
			
		||||
	}, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (this *Service) validateRequest(ctx context.Context) (adminId int, err error) {
 | 
			
		||||
	var md metadata.MD
 | 
			
		||||
	var ok bool
 | 
			
		||||
	if this.debug {
 | 
			
		||||
		md, ok = metadata.FromOutgoingContext(ctx)
 | 
			
		||||
	} else {
 | 
			
		||||
		md, ok = metadata.FromIncomingContext(ctx)
 | 
			
		||||
	}
 | 
			
		||||
	if !ok {
 | 
			
		||||
		return 0, errors.New("context: need 'nodeId'")
 | 
			
		||||
	}
 | 
			
		||||
	nodeIds := md.Get("nodeid")
 | 
			
		||||
	if len(nodeIds) == 0 || len(nodeIds[0]) == 0 {
 | 
			
		||||
		return 0, errors.New("context: need 'nodeId'")
 | 
			
		||||
	}
 | 
			
		||||
	nodeId := nodeIds[0]
 | 
			
		||||
 | 
			
		||||
	// 获取Node信息
 | 
			
		||||
	apiToken, err := models.SharedApiTokenDAO.FindEnabledTokenWithNode(nodeId)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		utils.PrintError(err)
 | 
			
		||||
		return 0, err
 | 
			
		||||
	}
 | 
			
		||||
	if apiToken == nil {
 | 
			
		||||
		return 0, errors.New("can not find token from node id: " + err.Error())
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	tokens := md.Get("token")
 | 
			
		||||
	if len(tokens) == 0 || len(tokens[0]) == 0 {
 | 
			
		||||
		return 0, errors.New("context: need 'token'")
 | 
			
		||||
	}
 | 
			
		||||
	token := tokens[0]
 | 
			
		||||
 | 
			
		||||
	data, err := base64.StdEncoding.DecodeString(token)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return 0, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	method, err := encrypt.NewMethodInstance(teaconst.EncryptMethod, apiToken.Secret, nodeId)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		utils.PrintError(err)
 | 
			
		||||
		return 0, err
 | 
			
		||||
	}
 | 
			
		||||
	data, err = method.Decrypt(data)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return 0, err
 | 
			
		||||
	}
 | 
			
		||||
	if len(data) == 0 {
 | 
			
		||||
		return 0, errors.New("invalid token")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	m := maps.Map{}
 | 
			
		||||
	err = json.Unmarshal(data, &m)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return 0, errors.New("decode token error: " + err.Error())
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	timestamp := m.GetInt64("timestamp")
 | 
			
		||||
	if time.Now().Unix()-timestamp > 600 {
 | 
			
		||||
		// 请求超过10分钟认为超时
 | 
			
		||||
		return 0, errors.New("authenticate timeout")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	adminId = m.GetInt("adminId")
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (this *Service) validateAdminRequest(ctx context.Context) (adminId int, err error) {
 | 
			
		||||
	adminId, err = this.validateRequest(ctx)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return 0, err
 | 
			
		||||
	}
 | 
			
		||||
	if adminId <= 0 {
 | 
			
		||||
		return 0, errors.New("invalid admin id")
 | 
			
		||||
	}
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
@@ -1,881 +0,0 @@
 | 
			
		||||
// Code generated by protoc-gen-go. DO NOT EDIT.
 | 
			
		||||
// versions:
 | 
			
		||||
// 	protoc-gen-go v1.25.0
 | 
			
		||||
// 	protoc        v3.12.3
 | 
			
		||||
// source: admin/service.proto
 | 
			
		||||
 | 
			
		||||
package admin
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	context "context"
 | 
			
		||||
	proto "github.com/golang/protobuf/proto"
 | 
			
		||||
	grpc "google.golang.org/grpc"
 | 
			
		||||
	codes "google.golang.org/grpc/codes"
 | 
			
		||||
	status "google.golang.org/grpc/status"
 | 
			
		||||
	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)
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// This is a compile-time assertion that a sufficiently up-to-date version
 | 
			
		||||
// of the legacy proto package is being used.
 | 
			
		||||
const _ = proto.ProtoPackageIsVersion4
 | 
			
		||||
 | 
			
		||||
type LoginRequest struct {
 | 
			
		||||
	state         protoimpl.MessageState
 | 
			
		||||
	sizeCache     protoimpl.SizeCache
 | 
			
		||||
	unknownFields protoimpl.UnknownFields
 | 
			
		||||
 | 
			
		||||
	Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"`
 | 
			
		||||
	Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (x *LoginRequest) Reset() {
 | 
			
		||||
	*x = LoginRequest{}
 | 
			
		||||
	if protoimpl.UnsafeEnabled {
 | 
			
		||||
		mi := &file_admin_service_proto_msgTypes[0]
 | 
			
		||||
		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
 | 
			
		||||
		ms.StoreMessageInfo(mi)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (x *LoginRequest) String() string {
 | 
			
		||||
	return protoimpl.X.MessageStringOf(x)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (*LoginRequest) ProtoMessage() {}
 | 
			
		||||
 | 
			
		||||
func (x *LoginRequest) ProtoReflect() protoreflect.Message {
 | 
			
		||||
	mi := &file_admin_service_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 LoginRequest.ProtoReflect.Descriptor instead.
 | 
			
		||||
func (*LoginRequest) Descriptor() ([]byte, []int) {
 | 
			
		||||
	return file_admin_service_proto_rawDescGZIP(), []int{0}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (x *LoginRequest) GetUsername() string {
 | 
			
		||||
	if x != nil {
 | 
			
		||||
		return x.Username
 | 
			
		||||
	}
 | 
			
		||||
	return ""
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (x *LoginRequest) GetPassword() string {
 | 
			
		||||
	if x != nil {
 | 
			
		||||
		return x.Password
 | 
			
		||||
	}
 | 
			
		||||
	return ""
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type LoginResponse struct {
 | 
			
		||||
	state         protoimpl.MessageState
 | 
			
		||||
	sizeCache     protoimpl.SizeCache
 | 
			
		||||
	unknownFields protoimpl.UnknownFields
 | 
			
		||||
 | 
			
		||||
	AdminId int64  `protobuf:"varint,1,opt,name=adminId,proto3" json:"adminId,omitempty"`
 | 
			
		||||
	IsOk    bool   `protobuf:"varint,2,opt,name=isOk,proto3" json:"isOk,omitempty"`
 | 
			
		||||
	Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (x *LoginResponse) Reset() {
 | 
			
		||||
	*x = LoginResponse{}
 | 
			
		||||
	if protoimpl.UnsafeEnabled {
 | 
			
		||||
		mi := &file_admin_service_proto_msgTypes[1]
 | 
			
		||||
		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
 | 
			
		||||
		ms.StoreMessageInfo(mi)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (x *LoginResponse) String() string {
 | 
			
		||||
	return protoimpl.X.MessageStringOf(x)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (*LoginResponse) ProtoMessage() {}
 | 
			
		||||
 | 
			
		||||
func (x *LoginResponse) ProtoReflect() protoreflect.Message {
 | 
			
		||||
	mi := &file_admin_service_proto_msgTypes[1]
 | 
			
		||||
	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 LoginResponse.ProtoReflect.Descriptor instead.
 | 
			
		||||
func (*LoginResponse) Descriptor() ([]byte, []int) {
 | 
			
		||||
	return file_admin_service_proto_rawDescGZIP(), []int{1}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (x *LoginResponse) GetAdminId() int64 {
 | 
			
		||||
	if x != nil {
 | 
			
		||||
		return x.AdminId
 | 
			
		||||
	}
 | 
			
		||||
	return 0
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (x *LoginResponse) GetIsOk() bool {
 | 
			
		||||
	if x != nil {
 | 
			
		||||
		return x.IsOk
 | 
			
		||||
	}
 | 
			
		||||
	return false
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (x *LoginResponse) GetMessage() string {
 | 
			
		||||
	if x != nil {
 | 
			
		||||
		return x.Message
 | 
			
		||||
	}
 | 
			
		||||
	return ""
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type CreateLogRequest struct {
 | 
			
		||||
	state         protoimpl.MessageState
 | 
			
		||||
	sizeCache     protoimpl.SizeCache
 | 
			
		||||
	unknownFields protoimpl.UnknownFields
 | 
			
		||||
 | 
			
		||||
	Level       string `protobuf:"bytes,1,opt,name=level,proto3" json:"level,omitempty"`
 | 
			
		||||
	Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"`
 | 
			
		||||
	Action      string `protobuf:"bytes,3,opt,name=action,proto3" json:"action,omitempty"`
 | 
			
		||||
	Ip          string `protobuf:"bytes,4,opt,name=ip,proto3" json:"ip,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (x *CreateLogRequest) Reset() {
 | 
			
		||||
	*x = CreateLogRequest{}
 | 
			
		||||
	if protoimpl.UnsafeEnabled {
 | 
			
		||||
		mi := &file_admin_service_proto_msgTypes[2]
 | 
			
		||||
		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
 | 
			
		||||
		ms.StoreMessageInfo(mi)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (x *CreateLogRequest) String() string {
 | 
			
		||||
	return protoimpl.X.MessageStringOf(x)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (*CreateLogRequest) ProtoMessage() {}
 | 
			
		||||
 | 
			
		||||
func (x *CreateLogRequest) ProtoReflect() protoreflect.Message {
 | 
			
		||||
	mi := &file_admin_service_proto_msgTypes[2]
 | 
			
		||||
	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 CreateLogRequest.ProtoReflect.Descriptor instead.
 | 
			
		||||
func (*CreateLogRequest) Descriptor() ([]byte, []int) {
 | 
			
		||||
	return file_admin_service_proto_rawDescGZIP(), []int{2}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (x *CreateLogRequest) GetLevel() string {
 | 
			
		||||
	if x != nil {
 | 
			
		||||
		return x.Level
 | 
			
		||||
	}
 | 
			
		||||
	return ""
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (x *CreateLogRequest) GetDescription() string {
 | 
			
		||||
	if x != nil {
 | 
			
		||||
		return x.Description
 | 
			
		||||
	}
 | 
			
		||||
	return ""
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (x *CreateLogRequest) GetAction() string {
 | 
			
		||||
	if x != nil {
 | 
			
		||||
		return x.Action
 | 
			
		||||
	}
 | 
			
		||||
	return ""
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (x *CreateLogRequest) GetIp() string {
 | 
			
		||||
	if x != nil {
 | 
			
		||||
		return x.Ip
 | 
			
		||||
	}
 | 
			
		||||
	return ""
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type CreateLogResponse struct {
 | 
			
		||||
	state         protoimpl.MessageState
 | 
			
		||||
	sizeCache     protoimpl.SizeCache
 | 
			
		||||
	unknownFields protoimpl.UnknownFields
 | 
			
		||||
 | 
			
		||||
	IsOk bool `protobuf:"varint,1,opt,name=isOk,proto3" json:"isOk,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (x *CreateLogResponse) Reset() {
 | 
			
		||||
	*x = CreateLogResponse{}
 | 
			
		||||
	if protoimpl.UnsafeEnabled {
 | 
			
		||||
		mi := &file_admin_service_proto_msgTypes[3]
 | 
			
		||||
		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
 | 
			
		||||
		ms.StoreMessageInfo(mi)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (x *CreateLogResponse) String() string {
 | 
			
		||||
	return protoimpl.X.MessageStringOf(x)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (*CreateLogResponse) ProtoMessage() {}
 | 
			
		||||
 | 
			
		||||
func (x *CreateLogResponse) ProtoReflect() protoreflect.Message {
 | 
			
		||||
	mi := &file_admin_service_proto_msgTypes[3]
 | 
			
		||||
	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 CreateLogResponse.ProtoReflect.Descriptor instead.
 | 
			
		||||
func (*CreateLogResponse) Descriptor() ([]byte, []int) {
 | 
			
		||||
	return file_admin_service_proto_rawDescGZIP(), []int{3}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (x *CreateLogResponse) GetIsOk() bool {
 | 
			
		||||
	if x != nil {
 | 
			
		||||
		return x.IsOk
 | 
			
		||||
	}
 | 
			
		||||
	return false
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type CheckAdminExistsRequest struct {
 | 
			
		||||
	state         protoimpl.MessageState
 | 
			
		||||
	sizeCache     protoimpl.SizeCache
 | 
			
		||||
	unknownFields protoimpl.UnknownFields
 | 
			
		||||
 | 
			
		||||
	AdminId int64 `protobuf:"varint,1,opt,name=adminId,proto3" json:"adminId,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (x *CheckAdminExistsRequest) Reset() {
 | 
			
		||||
	*x = CheckAdminExistsRequest{}
 | 
			
		||||
	if protoimpl.UnsafeEnabled {
 | 
			
		||||
		mi := &file_admin_service_proto_msgTypes[4]
 | 
			
		||||
		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
 | 
			
		||||
		ms.StoreMessageInfo(mi)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (x *CheckAdminExistsRequest) String() string {
 | 
			
		||||
	return protoimpl.X.MessageStringOf(x)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (*CheckAdminExistsRequest) ProtoMessage() {}
 | 
			
		||||
 | 
			
		||||
func (x *CheckAdminExistsRequest) ProtoReflect() protoreflect.Message {
 | 
			
		||||
	mi := &file_admin_service_proto_msgTypes[4]
 | 
			
		||||
	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 CheckAdminExistsRequest.ProtoReflect.Descriptor instead.
 | 
			
		||||
func (*CheckAdminExistsRequest) Descriptor() ([]byte, []int) {
 | 
			
		||||
	return file_admin_service_proto_rawDescGZIP(), []int{4}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (x *CheckAdminExistsRequest) GetAdminId() int64 {
 | 
			
		||||
	if x != nil {
 | 
			
		||||
		return x.AdminId
 | 
			
		||||
	}
 | 
			
		||||
	return 0
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type CheckAdminExistsResponse struct {
 | 
			
		||||
	state         protoimpl.MessageState
 | 
			
		||||
	sizeCache     protoimpl.SizeCache
 | 
			
		||||
	unknownFields protoimpl.UnknownFields
 | 
			
		||||
 | 
			
		||||
	IsOk    bool   `protobuf:"varint,1,opt,name=isOk,proto3" json:"isOk,omitempty"`
 | 
			
		||||
	Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (x *CheckAdminExistsResponse) Reset() {
 | 
			
		||||
	*x = CheckAdminExistsResponse{}
 | 
			
		||||
	if protoimpl.UnsafeEnabled {
 | 
			
		||||
		mi := &file_admin_service_proto_msgTypes[5]
 | 
			
		||||
		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
 | 
			
		||||
		ms.StoreMessageInfo(mi)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (x *CheckAdminExistsResponse) String() string {
 | 
			
		||||
	return protoimpl.X.MessageStringOf(x)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (*CheckAdminExistsResponse) ProtoMessage() {}
 | 
			
		||||
 | 
			
		||||
func (x *CheckAdminExistsResponse) ProtoReflect() protoreflect.Message {
 | 
			
		||||
	mi := &file_admin_service_proto_msgTypes[5]
 | 
			
		||||
	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 CheckAdminExistsResponse.ProtoReflect.Descriptor instead.
 | 
			
		||||
func (*CheckAdminExistsResponse) Descriptor() ([]byte, []int) {
 | 
			
		||||
	return file_admin_service_proto_rawDescGZIP(), []int{5}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (x *CheckAdminExistsResponse) GetIsOk() bool {
 | 
			
		||||
	if x != nil {
 | 
			
		||||
		return x.IsOk
 | 
			
		||||
	}
 | 
			
		||||
	return false
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (x *CheckAdminExistsResponse) GetMessage() string {
 | 
			
		||||
	if x != nil {
 | 
			
		||||
		return x.Message
 | 
			
		||||
	}
 | 
			
		||||
	return ""
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type FindAdminNameRequest struct {
 | 
			
		||||
	state         protoimpl.MessageState
 | 
			
		||||
	sizeCache     protoimpl.SizeCache
 | 
			
		||||
	unknownFields protoimpl.UnknownFields
 | 
			
		||||
 | 
			
		||||
	AdminId int64 `protobuf:"varint,1,opt,name=adminId,proto3" json:"adminId,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (x *FindAdminNameRequest) Reset() {
 | 
			
		||||
	*x = FindAdminNameRequest{}
 | 
			
		||||
	if protoimpl.UnsafeEnabled {
 | 
			
		||||
		mi := &file_admin_service_proto_msgTypes[6]
 | 
			
		||||
		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
 | 
			
		||||
		ms.StoreMessageInfo(mi)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (x *FindAdminNameRequest) String() string {
 | 
			
		||||
	return protoimpl.X.MessageStringOf(x)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (*FindAdminNameRequest) ProtoMessage() {}
 | 
			
		||||
 | 
			
		||||
func (x *FindAdminNameRequest) ProtoReflect() protoreflect.Message {
 | 
			
		||||
	mi := &file_admin_service_proto_msgTypes[6]
 | 
			
		||||
	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 FindAdminNameRequest.ProtoReflect.Descriptor instead.
 | 
			
		||||
func (*FindAdminNameRequest) Descriptor() ([]byte, []int) {
 | 
			
		||||
	return file_admin_service_proto_rawDescGZIP(), []int{6}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (x *FindAdminNameRequest) GetAdminId() int64 {
 | 
			
		||||
	if x != nil {
 | 
			
		||||
		return x.AdminId
 | 
			
		||||
	}
 | 
			
		||||
	return 0
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type FindAdminNameResponse struct {
 | 
			
		||||
	state         protoimpl.MessageState
 | 
			
		||||
	sizeCache     protoimpl.SizeCache
 | 
			
		||||
	unknownFields protoimpl.UnknownFields
 | 
			
		||||
 | 
			
		||||
	Fullname string `protobuf:"bytes,1,opt,name=fullname,proto3" json:"fullname,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (x *FindAdminNameResponse) Reset() {
 | 
			
		||||
	*x = FindAdminNameResponse{}
 | 
			
		||||
	if protoimpl.UnsafeEnabled {
 | 
			
		||||
		mi := &file_admin_service_proto_msgTypes[7]
 | 
			
		||||
		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
 | 
			
		||||
		ms.StoreMessageInfo(mi)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (x *FindAdminNameResponse) String() string {
 | 
			
		||||
	return protoimpl.X.MessageStringOf(x)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (*FindAdminNameResponse) ProtoMessage() {}
 | 
			
		||||
 | 
			
		||||
func (x *FindAdminNameResponse) ProtoReflect() protoreflect.Message {
 | 
			
		||||
	mi := &file_admin_service_proto_msgTypes[7]
 | 
			
		||||
	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 FindAdminNameResponse.ProtoReflect.Descriptor instead.
 | 
			
		||||
func (*FindAdminNameResponse) Descriptor() ([]byte, []int) {
 | 
			
		||||
	return file_admin_service_proto_rawDescGZIP(), []int{7}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (x *FindAdminNameResponse) GetFullname() string {
 | 
			
		||||
	if x != nil {
 | 
			
		||||
		return x.Fullname
 | 
			
		||||
	}
 | 
			
		||||
	return ""
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
var File_admin_service_proto protoreflect.FileDescriptor
 | 
			
		||||
 | 
			
		||||
var file_admin_service_proto_rawDesc = []byte{
 | 
			
		||||
	0x0a, 0x13, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e,
 | 
			
		||||
	0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x22, 0x46, 0x0a, 0x0c,
 | 
			
		||||
	0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08,
 | 
			
		||||
	0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08,
 | 
			
		||||
	0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73,
 | 
			
		||||
	0x77, 0x6f, 0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73,
 | 
			
		||||
	0x77, 0x6f, 0x72, 0x64, 0x22, 0x57, 0x0a, 0x0d, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73,
 | 
			
		||||
	0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x49, 0x64,
 | 
			
		||||
	0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x49, 0x64, 0x12,
 | 
			
		||||
	0x12, 0x0a, 0x04, 0x69, 0x73, 0x4f, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x69,
 | 
			
		||||
	0x73, 0x4f, 0x6b, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x03,
 | 
			
		||||
	0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x72, 0x0a,
 | 
			
		||||
	0x10, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
 | 
			
		||||
	0x74, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
 | 
			
		||||
	0x52, 0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72,
 | 
			
		||||
	0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65,
 | 
			
		||||
	0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x63, 0x74,
 | 
			
		||||
	0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f,
 | 
			
		||||
	0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x70, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69,
 | 
			
		||||
	0x70, 0x22, 0x27, 0x0a, 0x11, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4c, 0x6f, 0x67, 0x52, 0x65,
 | 
			
		||||
	0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x73, 0x4f, 0x6b, 0x18, 0x01,
 | 
			
		||||
	0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x69, 0x73, 0x4f, 0x6b, 0x22, 0x33, 0x0a, 0x17, 0x43, 0x68,
 | 
			
		||||
	0x65, 0x63, 0x6b, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x45, 0x78, 0x69, 0x73, 0x74, 0x73, 0x52, 0x65,
 | 
			
		||||
	0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x49, 0x64,
 | 
			
		||||
	0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x49, 0x64, 0x22,
 | 
			
		||||
	0x48, 0x0a, 0x18, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x45, 0x78, 0x69,
 | 
			
		||||
	0x73, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x69,
 | 
			
		||||
	0x73, 0x4f, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x69, 0x73, 0x4f, 0x6b, 0x12,
 | 
			
		||||
	0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
 | 
			
		||||
	0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x30, 0x0a, 0x14, 0x46, 0x69, 0x6e,
 | 
			
		||||
	0x64, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
 | 
			
		||||
	0x74, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01,
 | 
			
		||||
	0x28, 0x03, 0x52, 0x07, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x49, 0x64, 0x22, 0x33, 0x0a, 0x15, 0x46,
 | 
			
		||||
	0x69, 0x6e, 0x64, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x73, 0x70,
 | 
			
		||||
	0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x75, 0x6c, 0x6c, 0x6e, 0x61, 0x6d, 0x65,
 | 
			
		||||
	0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x75, 0x6c, 0x6c, 0x6e, 0x61, 0x6d, 0x65,
 | 
			
		||||
	0x32, 0xaa, 0x02, 0x0a, 0x07, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x34, 0x0a, 0x05,
 | 
			
		||||
	0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x12, 0x13, 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x4c, 0x6f,
 | 
			
		||||
	0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x61, 0x64, 0x6d,
 | 
			
		||||
	0x69, 0x6e, 0x2e, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
 | 
			
		||||
	0x22, 0x00, 0x12, 0x40, 0x0a, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4c, 0x6f, 0x67, 0x12,
 | 
			
		||||
	0x17, 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4c, 0x6f,
 | 
			
		||||
	0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e,
 | 
			
		||||
	0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
 | 
			
		||||
	0x73, 0x65, 0x22, 0x00, 0x12, 0x55, 0x0a, 0x10, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x41, 0x64, 0x6d,
 | 
			
		||||
	0x69, 0x6e, 0x45, 0x78, 0x69, 0x73, 0x74, 0x73, 0x12, 0x1e, 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e,
 | 
			
		||||
	0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x45, 0x78, 0x69, 0x73, 0x74,
 | 
			
		||||
	0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e,
 | 
			
		||||
	0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x45, 0x78, 0x69, 0x73, 0x74,
 | 
			
		||||
	0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x50, 0x0a, 0x11, 0x66,
 | 
			
		||||
	0x69, 0x6e, 0x64, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x46, 0x75, 0x6c, 0x6c, 0x6e, 0x61, 0x6d, 0x65,
 | 
			
		||||
	0x12, 0x1b, 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x41, 0x64, 0x6d,
 | 
			
		||||
	0x69, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e,
 | 
			
		||||
	0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x4e,
 | 
			
		||||
	0x61, 0x6d, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x09, 0x5a,
 | 
			
		||||
	0x07, 0x2e, 0x2f, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
var (
 | 
			
		||||
	file_admin_service_proto_rawDescOnce sync.Once
 | 
			
		||||
	file_admin_service_proto_rawDescData = file_admin_service_proto_rawDesc
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func file_admin_service_proto_rawDescGZIP() []byte {
 | 
			
		||||
	file_admin_service_proto_rawDescOnce.Do(func() {
 | 
			
		||||
		file_admin_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_admin_service_proto_rawDescData)
 | 
			
		||||
	})
 | 
			
		||||
	return file_admin_service_proto_rawDescData
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
var file_admin_service_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
 | 
			
		||||
var file_admin_service_proto_goTypes = []interface{}{
 | 
			
		||||
	(*LoginRequest)(nil),             // 0: admin.LoginRequest
 | 
			
		||||
	(*LoginResponse)(nil),            // 1: admin.LoginResponse
 | 
			
		||||
	(*CreateLogRequest)(nil),         // 2: admin.CreateLogRequest
 | 
			
		||||
	(*CreateLogResponse)(nil),        // 3: admin.CreateLogResponse
 | 
			
		||||
	(*CheckAdminExistsRequest)(nil),  // 4: admin.CheckAdminExistsRequest
 | 
			
		||||
	(*CheckAdminExistsResponse)(nil), // 5: admin.CheckAdminExistsResponse
 | 
			
		||||
	(*FindAdminNameRequest)(nil),     // 6: admin.FindAdminNameRequest
 | 
			
		||||
	(*FindAdminNameResponse)(nil),    // 7: admin.FindAdminNameResponse
 | 
			
		||||
}
 | 
			
		||||
var file_admin_service_proto_depIdxs = []int32{
 | 
			
		||||
	0, // 0: admin.Service.login:input_type -> admin.LoginRequest
 | 
			
		||||
	2, // 1: admin.Service.createLog:input_type -> admin.CreateLogRequest
 | 
			
		||||
	4, // 2: admin.Service.checkAdminExists:input_type -> admin.CheckAdminExistsRequest
 | 
			
		||||
	6, // 3: admin.Service.findAdminFullname:input_type -> admin.FindAdminNameRequest
 | 
			
		||||
	1, // 4: admin.Service.login:output_type -> admin.LoginResponse
 | 
			
		||||
	3, // 5: admin.Service.createLog:output_type -> admin.CreateLogResponse
 | 
			
		||||
	5, // 6: admin.Service.checkAdminExists:output_type -> admin.CheckAdminExistsResponse
 | 
			
		||||
	7, // 7: admin.Service.findAdminFullname:output_type -> admin.FindAdminNameResponse
 | 
			
		||||
	4, // [4:8] is the sub-list for method output_type
 | 
			
		||||
	0, // [0:4] 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_admin_service_proto_init() }
 | 
			
		||||
func file_admin_service_proto_init() {
 | 
			
		||||
	if File_admin_service_proto != nil {
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	if !protoimpl.UnsafeEnabled {
 | 
			
		||||
		file_admin_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
 | 
			
		||||
			switch v := v.(*LoginRequest); i {
 | 
			
		||||
			case 0:
 | 
			
		||||
				return &v.state
 | 
			
		||||
			case 1:
 | 
			
		||||
				return &v.sizeCache
 | 
			
		||||
			case 2:
 | 
			
		||||
				return &v.unknownFields
 | 
			
		||||
			default:
 | 
			
		||||
				return nil
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		file_admin_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
 | 
			
		||||
			switch v := v.(*LoginResponse); i {
 | 
			
		||||
			case 0:
 | 
			
		||||
				return &v.state
 | 
			
		||||
			case 1:
 | 
			
		||||
				return &v.sizeCache
 | 
			
		||||
			case 2:
 | 
			
		||||
				return &v.unknownFields
 | 
			
		||||
			default:
 | 
			
		||||
				return nil
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		file_admin_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
 | 
			
		||||
			switch v := v.(*CreateLogRequest); i {
 | 
			
		||||
			case 0:
 | 
			
		||||
				return &v.state
 | 
			
		||||
			case 1:
 | 
			
		||||
				return &v.sizeCache
 | 
			
		||||
			case 2:
 | 
			
		||||
				return &v.unknownFields
 | 
			
		||||
			default:
 | 
			
		||||
				return nil
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		file_admin_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
 | 
			
		||||
			switch v := v.(*CreateLogResponse); i {
 | 
			
		||||
			case 0:
 | 
			
		||||
				return &v.state
 | 
			
		||||
			case 1:
 | 
			
		||||
				return &v.sizeCache
 | 
			
		||||
			case 2:
 | 
			
		||||
				return &v.unknownFields
 | 
			
		||||
			default:
 | 
			
		||||
				return nil
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		file_admin_service_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
 | 
			
		||||
			switch v := v.(*CheckAdminExistsRequest); i {
 | 
			
		||||
			case 0:
 | 
			
		||||
				return &v.state
 | 
			
		||||
			case 1:
 | 
			
		||||
				return &v.sizeCache
 | 
			
		||||
			case 2:
 | 
			
		||||
				return &v.unknownFields
 | 
			
		||||
			default:
 | 
			
		||||
				return nil
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		file_admin_service_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
 | 
			
		||||
			switch v := v.(*CheckAdminExistsResponse); i {
 | 
			
		||||
			case 0:
 | 
			
		||||
				return &v.state
 | 
			
		||||
			case 1:
 | 
			
		||||
				return &v.sizeCache
 | 
			
		||||
			case 2:
 | 
			
		||||
				return &v.unknownFields
 | 
			
		||||
			default:
 | 
			
		||||
				return nil
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		file_admin_service_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
 | 
			
		||||
			switch v := v.(*FindAdminNameRequest); i {
 | 
			
		||||
			case 0:
 | 
			
		||||
				return &v.state
 | 
			
		||||
			case 1:
 | 
			
		||||
				return &v.sizeCache
 | 
			
		||||
			case 2:
 | 
			
		||||
				return &v.unknownFields
 | 
			
		||||
			default:
 | 
			
		||||
				return nil
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		file_admin_service_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
 | 
			
		||||
			switch v := v.(*FindAdminNameResponse); 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_admin_service_proto_rawDesc,
 | 
			
		||||
			NumEnums:      0,
 | 
			
		||||
			NumMessages:   8,
 | 
			
		||||
			NumExtensions: 0,
 | 
			
		||||
			NumServices:   1,
 | 
			
		||||
		},
 | 
			
		||||
		GoTypes:           file_admin_service_proto_goTypes,
 | 
			
		||||
		DependencyIndexes: file_admin_service_proto_depIdxs,
 | 
			
		||||
		MessageInfos:      file_admin_service_proto_msgTypes,
 | 
			
		||||
	}.Build()
 | 
			
		||||
	File_admin_service_proto = out.File
 | 
			
		||||
	file_admin_service_proto_rawDesc = nil
 | 
			
		||||
	file_admin_service_proto_goTypes = nil
 | 
			
		||||
	file_admin_service_proto_depIdxs = nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Reference imports to suppress errors if they are not otherwise used.
 | 
			
		||||
var _ context.Context
 | 
			
		||||
var _ grpc.ClientConnInterface
 | 
			
		||||
 | 
			
		||||
// This is a compile-time assertion to ensure that this generated file
 | 
			
		||||
// is compatible with the grpc package it is being compiled against.
 | 
			
		||||
const _ = grpc.SupportPackageIsVersion6
 | 
			
		||||
 | 
			
		||||
// ServiceClient is the client API for Service service.
 | 
			
		||||
//
 | 
			
		||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
 | 
			
		||||
type ServiceClient interface {
 | 
			
		||||
	// 登录
 | 
			
		||||
	Login(ctx context.Context, in *LoginRequest, opts ...grpc.CallOption) (*LoginResponse, error)
 | 
			
		||||
	// 创建操作日志
 | 
			
		||||
	CreateLog(ctx context.Context, in *CreateLogRequest, opts ...grpc.CallOption) (*CreateLogResponse, error)
 | 
			
		||||
	// 检查管理员是否存在
 | 
			
		||||
	CheckAdminExists(ctx context.Context, in *CheckAdminExistsRequest, opts ...grpc.CallOption) (*CheckAdminExistsResponse, error)
 | 
			
		||||
	// 获取管理员名称
 | 
			
		||||
	FindAdminFullname(ctx context.Context, in *FindAdminNameRequest, opts ...grpc.CallOption) (*FindAdminNameResponse, error)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type serviceClient struct {
 | 
			
		||||
	cc grpc.ClientConnInterface
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func NewServiceClient(cc grpc.ClientConnInterface) ServiceClient {
 | 
			
		||||
	return &serviceClient{cc}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (c *serviceClient) Login(ctx context.Context, in *LoginRequest, opts ...grpc.CallOption) (*LoginResponse, error) {
 | 
			
		||||
	out := new(LoginResponse)
 | 
			
		||||
	err := c.cc.Invoke(ctx, "/admin.Service/login", in, out, opts...)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
	return out, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (c *serviceClient) CreateLog(ctx context.Context, in *CreateLogRequest, opts ...grpc.CallOption) (*CreateLogResponse, error) {
 | 
			
		||||
	out := new(CreateLogResponse)
 | 
			
		||||
	err := c.cc.Invoke(ctx, "/admin.Service/createLog", in, out, opts...)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
	return out, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (c *serviceClient) CheckAdminExists(ctx context.Context, in *CheckAdminExistsRequest, opts ...grpc.CallOption) (*CheckAdminExistsResponse, error) {
 | 
			
		||||
	out := new(CheckAdminExistsResponse)
 | 
			
		||||
	err := c.cc.Invoke(ctx, "/admin.Service/checkAdminExists", in, out, opts...)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
	return out, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (c *serviceClient) FindAdminFullname(ctx context.Context, in *FindAdminNameRequest, opts ...grpc.CallOption) (*FindAdminNameResponse, error) {
 | 
			
		||||
	out := new(FindAdminNameResponse)
 | 
			
		||||
	err := c.cc.Invoke(ctx, "/admin.Service/findAdminFullname", in, out, opts...)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
	return out, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ServiceServer is the server API for Service service.
 | 
			
		||||
type ServiceServer interface {
 | 
			
		||||
	// 登录
 | 
			
		||||
	Login(context.Context, *LoginRequest) (*LoginResponse, error)
 | 
			
		||||
	// 创建操作日志
 | 
			
		||||
	CreateLog(context.Context, *CreateLogRequest) (*CreateLogResponse, error)
 | 
			
		||||
	// 检查管理员是否存在
 | 
			
		||||
	CheckAdminExists(context.Context, *CheckAdminExistsRequest) (*CheckAdminExistsResponse, error)
 | 
			
		||||
	// 获取管理员名称
 | 
			
		||||
	FindAdminFullname(context.Context, *FindAdminNameRequest) (*FindAdminNameResponse, error)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// UnimplementedServiceServer can be embedded to have forward compatible implementations.
 | 
			
		||||
type UnimplementedServiceServer struct {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (*UnimplementedServiceServer) Login(context.Context, *LoginRequest) (*LoginResponse, error) {
 | 
			
		||||
	return nil, status.Errorf(codes.Unimplemented, "method Login not implemented")
 | 
			
		||||
}
 | 
			
		||||
func (*UnimplementedServiceServer) CreateLog(context.Context, *CreateLogRequest) (*CreateLogResponse, error) {
 | 
			
		||||
	return nil, status.Errorf(codes.Unimplemented, "method CreateLog not implemented")
 | 
			
		||||
}
 | 
			
		||||
func (*UnimplementedServiceServer) CheckAdminExists(context.Context, *CheckAdminExistsRequest) (*CheckAdminExistsResponse, error) {
 | 
			
		||||
	return nil, status.Errorf(codes.Unimplemented, "method CheckAdminExists not implemented")
 | 
			
		||||
}
 | 
			
		||||
func (*UnimplementedServiceServer) FindAdminFullname(context.Context, *FindAdminNameRequest) (*FindAdminNameResponse, error) {
 | 
			
		||||
	return nil, status.Errorf(codes.Unimplemented, "method FindAdminFullname not implemented")
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func RegisterServiceServer(s *grpc.Server, srv ServiceServer) {
 | 
			
		||||
	s.RegisterService(&_Service_serviceDesc, srv)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func _Service_Login_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
 | 
			
		||||
	in := new(LoginRequest)
 | 
			
		||||
	if err := dec(in); err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
	if interceptor == nil {
 | 
			
		||||
		return srv.(ServiceServer).Login(ctx, in)
 | 
			
		||||
	}
 | 
			
		||||
	info := &grpc.UnaryServerInfo{
 | 
			
		||||
		Server:     srv,
 | 
			
		||||
		FullMethod: "/admin.Service/Login",
 | 
			
		||||
	}
 | 
			
		||||
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
 | 
			
		||||
		return srv.(ServiceServer).Login(ctx, req.(*LoginRequest))
 | 
			
		||||
	}
 | 
			
		||||
	return interceptor(ctx, in, info, handler)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func _Service_CreateLog_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
 | 
			
		||||
	in := new(CreateLogRequest)
 | 
			
		||||
	if err := dec(in); err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
	if interceptor == nil {
 | 
			
		||||
		return srv.(ServiceServer).CreateLog(ctx, in)
 | 
			
		||||
	}
 | 
			
		||||
	info := &grpc.UnaryServerInfo{
 | 
			
		||||
		Server:     srv,
 | 
			
		||||
		FullMethod: "/admin.Service/CreateLog",
 | 
			
		||||
	}
 | 
			
		||||
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
 | 
			
		||||
		return srv.(ServiceServer).CreateLog(ctx, req.(*CreateLogRequest))
 | 
			
		||||
	}
 | 
			
		||||
	return interceptor(ctx, in, info, handler)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func _Service_CheckAdminExists_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
 | 
			
		||||
	in := new(CheckAdminExistsRequest)
 | 
			
		||||
	if err := dec(in); err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
	if interceptor == nil {
 | 
			
		||||
		return srv.(ServiceServer).CheckAdminExists(ctx, in)
 | 
			
		||||
	}
 | 
			
		||||
	info := &grpc.UnaryServerInfo{
 | 
			
		||||
		Server:     srv,
 | 
			
		||||
		FullMethod: "/admin.Service/CheckAdminExists",
 | 
			
		||||
	}
 | 
			
		||||
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
 | 
			
		||||
		return srv.(ServiceServer).CheckAdminExists(ctx, req.(*CheckAdminExistsRequest))
 | 
			
		||||
	}
 | 
			
		||||
	return interceptor(ctx, in, info, handler)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func _Service_FindAdminFullname_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
 | 
			
		||||
	in := new(FindAdminNameRequest)
 | 
			
		||||
	if err := dec(in); err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
	if interceptor == nil {
 | 
			
		||||
		return srv.(ServiceServer).FindAdminFullname(ctx, in)
 | 
			
		||||
	}
 | 
			
		||||
	info := &grpc.UnaryServerInfo{
 | 
			
		||||
		Server:     srv,
 | 
			
		||||
		FullMethod: "/admin.Service/FindAdminFullname",
 | 
			
		||||
	}
 | 
			
		||||
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
 | 
			
		||||
		return srv.(ServiceServer).FindAdminFullname(ctx, req.(*FindAdminNameRequest))
 | 
			
		||||
	}
 | 
			
		||||
	return interceptor(ctx, in, info, handler)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
var _Service_serviceDesc = grpc.ServiceDesc{
 | 
			
		||||
	ServiceName: "admin.Service",
 | 
			
		||||
	HandlerType: (*ServiceServer)(nil),
 | 
			
		||||
	Methods: []grpc.MethodDesc{
 | 
			
		||||
		{
 | 
			
		||||
			MethodName: "login",
 | 
			
		||||
			Handler:    _Service_Login_Handler,
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			MethodName: "createLog",
 | 
			
		||||
			Handler:    _Service_CreateLog_Handler,
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			MethodName: "checkAdminExists",
 | 
			
		||||
			Handler:    _Service_CheckAdminExists_Handler,
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			MethodName: "findAdminFullname",
 | 
			
		||||
			Handler:    _Service_FindAdminFullname_Handler,
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
	Streams:  []grpc.StreamDesc{},
 | 
			
		||||
	Metadata: "admin/service.proto",
 | 
			
		||||
}
 | 
			
		||||
@@ -1,64 +0,0 @@
 | 
			
		||||
syntax = "proto3";
 | 
			
		||||
option go_package = "./admin";
 | 
			
		||||
 | 
			
		||||
package admin;
 | 
			
		||||
 | 
			
		||||
service Service {
 | 
			
		||||
	// 登录
 | 
			
		||||
	rpc login (LoginRequest) returns (LoginResponse) {
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// 创建操作日志
 | 
			
		||||
	rpc createLog (CreateLogRequest) returns (CreateLogResponse) {
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// 检查管理员是否存在
 | 
			
		||||
	rpc checkAdminExists (CheckAdminExistsRequest) returns (CheckAdminExistsResponse) {
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// 获取管理员名称
 | 
			
		||||
	rpc findAdminFullname (FindAdminNameRequest) returns (FindAdminNameResponse) {
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
message LoginRequest {
 | 
			
		||||
	string username = 1;
 | 
			
		||||
	string password = 2;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
message LoginResponse {
 | 
			
		||||
	int64 adminId = 1;
 | 
			
		||||
	bool isOk = 2;
 | 
			
		||||
	string message = 3;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
message CreateLogRequest {
 | 
			
		||||
	string level = 1;
 | 
			
		||||
	string description = 2;
 | 
			
		||||
	string action = 3;
 | 
			
		||||
	string ip = 4;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
message CreateLogResponse {
 | 
			
		||||
	bool isOk = 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
message CheckAdminExistsRequest {
 | 
			
		||||
	int64 adminId = 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
message CheckAdminExistsResponse {
 | 
			
		||||
	bool isOk = 1;
 | 
			
		||||
	string message = 2;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
message FindAdminNameRequest {
 | 
			
		||||
	int64 adminId = 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
message FindAdminNameResponse {
 | 
			
		||||
	string fullname = 1;
 | 
			
		||||
}
 | 
			
		||||
@@ -1,4 +0,0 @@
 | 
			
		||||
package dns
 | 
			
		||||
 | 
			
		||||
type Service struct {
 | 
			
		||||
}
 | 
			
		||||
@@ -1,9 +0,0 @@
 | 
			
		||||
syntax = "proto3";
 | 
			
		||||
 | 
			
		||||
package dns;
 | 
			
		||||
 | 
			
		||||
option go_package = "./dns";
 | 
			
		||||
 | 
			
		||||
service Service {
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -1,4 +0,0 @@
 | 
			
		||||
package log
 | 
			
		||||
 | 
			
		||||
type Service struct {
 | 
			
		||||
}
 | 
			
		||||
@@ -1,9 +0,0 @@
 | 
			
		||||
syntax = "proto3";
 | 
			
		||||
 | 
			
		||||
package log;
 | 
			
		||||
 | 
			
		||||
option go_package = "./log";
 | 
			
		||||
 | 
			
		||||
service Service {
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -1,4 +0,0 @@
 | 
			
		||||
package monitor
 | 
			
		||||
 | 
			
		||||
type Service struct {
 | 
			
		||||
}
 | 
			
		||||
@@ -1,111 +0,0 @@
 | 
			
		||||
// Code generated by protoc-gen-go. DO NOT EDIT.
 | 
			
		||||
// versions:
 | 
			
		||||
// 	protoc-gen-go v1.25.0
 | 
			
		||||
// 	protoc        v3.12.3
 | 
			
		||||
// source: monitor/service.proto
 | 
			
		||||
 | 
			
		||||
package monitor
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	context "context"
 | 
			
		||||
	proto "github.com/golang/protobuf/proto"
 | 
			
		||||
	grpc "google.golang.org/grpc"
 | 
			
		||||
	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)
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// This is a compile-time assertion that a sufficiently up-to-date version
 | 
			
		||||
// of the legacy proto package is being used.
 | 
			
		||||
const _ = proto.ProtoPackageIsVersion4
 | 
			
		||||
 | 
			
		||||
var File_monitor_service_proto protoreflect.FileDescriptor
 | 
			
		||||
 | 
			
		||||
var file_monitor_service_proto_rawDesc = []byte{
 | 
			
		||||
	0x0a, 0x15, 0x6d, 0x6f, 0x6e, 0x69, 0x74, 0x6f, 0x72, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63,
 | 
			
		||||
	0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x07, 0x6d, 0x6f, 0x6e, 0x69, 0x74, 0x6f, 0x72,
 | 
			
		||||
	0x32, 0x09, 0x0a, 0x07, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x0b, 0x5a, 0x09, 0x2e,
 | 
			
		||||
	0x2f, 0x6d, 0x6f, 0x6e, 0x69, 0x74, 0x6f, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
var file_monitor_service_proto_goTypes = []interface{}{}
 | 
			
		||||
var file_monitor_service_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_monitor_service_proto_init() }
 | 
			
		||||
func file_monitor_service_proto_init() {
 | 
			
		||||
	if File_monitor_service_proto != nil {
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	type x struct{}
 | 
			
		||||
	out := protoimpl.TypeBuilder{
 | 
			
		||||
		File: protoimpl.DescBuilder{
 | 
			
		||||
			GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
 | 
			
		||||
			RawDescriptor: file_monitor_service_proto_rawDesc,
 | 
			
		||||
			NumEnums:      0,
 | 
			
		||||
			NumMessages:   0,
 | 
			
		||||
			NumExtensions: 0,
 | 
			
		||||
			NumServices:   1,
 | 
			
		||||
		},
 | 
			
		||||
		GoTypes:           file_monitor_service_proto_goTypes,
 | 
			
		||||
		DependencyIndexes: file_monitor_service_proto_depIdxs,
 | 
			
		||||
	}.Build()
 | 
			
		||||
	File_monitor_service_proto = out.File
 | 
			
		||||
	file_monitor_service_proto_rawDesc = nil
 | 
			
		||||
	file_monitor_service_proto_goTypes = nil
 | 
			
		||||
	file_monitor_service_proto_depIdxs = nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Reference imports to suppress errors if they are not otherwise used.
 | 
			
		||||
var _ context.Context
 | 
			
		||||
var _ grpc.ClientConnInterface
 | 
			
		||||
 | 
			
		||||
// This is a compile-time assertion to ensure that this generated file
 | 
			
		||||
// is compatible with the grpc package it is being compiled against.
 | 
			
		||||
const _ = grpc.SupportPackageIsVersion6
 | 
			
		||||
 | 
			
		||||
// ServiceClient is the client API for Service service.
 | 
			
		||||
//
 | 
			
		||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
 | 
			
		||||
type ServiceClient interface {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type serviceClient struct {
 | 
			
		||||
	cc grpc.ClientConnInterface
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func NewServiceClient(cc grpc.ClientConnInterface) ServiceClient {
 | 
			
		||||
	return &serviceClient{cc}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ServiceServer is the server API for Service service.
 | 
			
		||||
type ServiceServer interface {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// UnimplementedServiceServer can be embedded to have forward compatible implementations.
 | 
			
		||||
type UnimplementedServiceServer struct {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func RegisterServiceServer(s *grpc.Server, srv ServiceServer) {
 | 
			
		||||
	s.RegisterService(&_Service_serviceDesc, srv)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
var _Service_serviceDesc = grpc.ServiceDesc{
 | 
			
		||||
	ServiceName: "monitor.Service",
 | 
			
		||||
	HandlerType: (*ServiceServer)(nil),
 | 
			
		||||
	Methods:     []grpc.MethodDesc{},
 | 
			
		||||
	Streams:     []grpc.StreamDesc{},
 | 
			
		||||
	Metadata:    "monitor/service.proto",
 | 
			
		||||
}
 | 
			
		||||
@@ -1,9 +0,0 @@
 | 
			
		||||
syntax = "proto3";
 | 
			
		||||
 | 
			
		||||
package monitor;
 | 
			
		||||
 | 
			
		||||
option go_package = "./monitor";
 | 
			
		||||
 | 
			
		||||
service Service {
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -1,16 +0,0 @@
 | 
			
		||||
package node
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"context"
 | 
			
		||||
	"github.com/iwind/TeaGo/logs"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type Service struct {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (this *Service) Config(ctx context.Context, req *ConfigRequest) (*ConfigResponse, error) {
 | 
			
		||||
	logs.Println("you called me")
 | 
			
		||||
	return &ConfigResponse{
 | 
			
		||||
		Id: req.NodeId,
 | 
			
		||||
	}, nil
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										165
									
								
								internal/rpc/pb/model_cluster.pb.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										165
									
								
								internal/rpc/pb/model_cluster.pb.go
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,165 @@
 | 
			
		||||
// Code generated by protoc-gen-go. DO NOT EDIT.
 | 
			
		||||
// versions:
 | 
			
		||||
// 	protoc-gen-go v1.25.0
 | 
			
		||||
// 	protoc        v3.12.3
 | 
			
		||||
// source: model_cluster.proto
 | 
			
		||||
 | 
			
		||||
package pb
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	proto "github.com/golang/protobuf/proto"
 | 
			
		||||
	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)
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// This is a compile-time assertion that a sufficiently up-to-date version
 | 
			
		||||
// of the legacy proto package is being used.
 | 
			
		||||
const _ = proto.ProtoPackageIsVersion4
 | 
			
		||||
 | 
			
		||||
type Cluster struct {
 | 
			
		||||
	state         protoimpl.MessageState
 | 
			
		||||
	sizeCache     protoimpl.SizeCache
 | 
			
		||||
	unknownFields protoimpl.UnknownFields
 | 
			
		||||
 | 
			
		||||
	Id        int64  `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
 | 
			
		||||
	Name      string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
 | 
			
		||||
	CreatedAt int64  `protobuf:"varint,3,opt,name=createdAt,proto3" json:"createdAt,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (x *Cluster) Reset() {
 | 
			
		||||
	*x = Cluster{}
 | 
			
		||||
	if protoimpl.UnsafeEnabled {
 | 
			
		||||
		mi := &file_model_cluster_proto_msgTypes[0]
 | 
			
		||||
		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
 | 
			
		||||
		ms.StoreMessageInfo(mi)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (x *Cluster) String() string {
 | 
			
		||||
	return protoimpl.X.MessageStringOf(x)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (*Cluster) ProtoMessage() {}
 | 
			
		||||
 | 
			
		||||
func (x *Cluster) ProtoReflect() protoreflect.Message {
 | 
			
		||||
	mi := &file_model_cluster_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 Cluster.ProtoReflect.Descriptor instead.
 | 
			
		||||
func (*Cluster) Descriptor() ([]byte, []int) {
 | 
			
		||||
	return file_model_cluster_proto_rawDescGZIP(), []int{0}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (x *Cluster) GetId() int64 {
 | 
			
		||||
	if x != nil {
 | 
			
		||||
		return x.Id
 | 
			
		||||
	}
 | 
			
		||||
	return 0
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (x *Cluster) GetName() string {
 | 
			
		||||
	if x != nil {
 | 
			
		||||
		return x.Name
 | 
			
		||||
	}
 | 
			
		||||
	return ""
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (x *Cluster) GetCreatedAt() int64 {
 | 
			
		||||
	if x != nil {
 | 
			
		||||
		return x.CreatedAt
 | 
			
		||||
	}
 | 
			
		||||
	return 0
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
var File_model_cluster_proto protoreflect.FileDescriptor
 | 
			
		||||
 | 
			
		||||
var file_model_cluster_proto_rawDesc = []byte{
 | 
			
		||||
	0x0a, 0x13, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x2e,
 | 
			
		||||
	0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, 0x4b, 0x0a, 0x07, 0x43, 0x6c, 0x75,
 | 
			
		||||
	0x73, 0x74, 0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03,
 | 
			
		||||
	0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01,
 | 
			
		||||
	0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x72, 0x65, 0x61,
 | 
			
		||||
	0x74, 0x65, 0x64, 0x41, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x63, 0x72, 0x65,
 | 
			
		||||
	0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06,
 | 
			
		||||
	0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
var (
 | 
			
		||||
	file_model_cluster_proto_rawDescOnce sync.Once
 | 
			
		||||
	file_model_cluster_proto_rawDescData = file_model_cluster_proto_rawDesc
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func file_model_cluster_proto_rawDescGZIP() []byte {
 | 
			
		||||
	file_model_cluster_proto_rawDescOnce.Do(func() {
 | 
			
		||||
		file_model_cluster_proto_rawDescData = protoimpl.X.CompressGZIP(file_model_cluster_proto_rawDescData)
 | 
			
		||||
	})
 | 
			
		||||
	return file_model_cluster_proto_rawDescData
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
var file_model_cluster_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
 | 
			
		||||
var file_model_cluster_proto_goTypes = []interface{}{
 | 
			
		||||
	(*Cluster)(nil), // 0: pb.Cluster
 | 
			
		||||
}
 | 
			
		||||
var file_model_cluster_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_model_cluster_proto_init() }
 | 
			
		||||
func file_model_cluster_proto_init() {
 | 
			
		||||
	if File_model_cluster_proto != nil {
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	if !protoimpl.UnsafeEnabled {
 | 
			
		||||
		file_model_cluster_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
 | 
			
		||||
			switch v := v.(*Cluster); 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_model_cluster_proto_rawDesc,
 | 
			
		||||
			NumEnums:      0,
 | 
			
		||||
			NumMessages:   1,
 | 
			
		||||
			NumExtensions: 0,
 | 
			
		||||
			NumServices:   0,
 | 
			
		||||
		},
 | 
			
		||||
		GoTypes:           file_model_cluster_proto_goTypes,
 | 
			
		||||
		DependencyIndexes: file_model_cluster_proto_depIdxs,
 | 
			
		||||
		MessageInfos:      file_model_cluster_proto_msgTypes,
 | 
			
		||||
	}.Build()
 | 
			
		||||
	File_model_cluster_proto = out.File
 | 
			
		||||
	file_model_cluster_proto_rawDesc = nil
 | 
			
		||||
	file_model_cluster_proto_goTypes = nil
 | 
			
		||||
	file_model_cluster_proto_depIdxs = nil
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										169
									
								
								internal/rpc/pb/model_node.pb.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										169
									
								
								internal/rpc/pb/model_node.pb.go
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,169 @@
 | 
			
		||||
// Code generated by protoc-gen-go. DO NOT EDIT.
 | 
			
		||||
// versions:
 | 
			
		||||
// 	protoc-gen-go v1.25.0
 | 
			
		||||
// 	protoc        v3.12.3
 | 
			
		||||
// source: model_node.proto
 | 
			
		||||
 | 
			
		||||
package pb
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	proto "github.com/golang/protobuf/proto"
 | 
			
		||||
	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)
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// This is a compile-time assertion that a sufficiently up-to-date version
 | 
			
		||||
// of the legacy proto package is being used.
 | 
			
		||||
const _ = proto.ProtoPackageIsVersion4
 | 
			
		||||
 | 
			
		||||
type Node struct {
 | 
			
		||||
	state         protoimpl.MessageState
 | 
			
		||||
	sizeCache     protoimpl.SizeCache
 | 
			
		||||
	unknownFields protoimpl.UnknownFields
 | 
			
		||||
 | 
			
		||||
	Id      int64    `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
 | 
			
		||||
	Name    string   `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
 | 
			
		||||
	Cluster *Cluster `protobuf:"bytes,32,opt,name=cluster,proto3" json:"cluster,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (x *Node) Reset() {
 | 
			
		||||
	*x = Node{}
 | 
			
		||||
	if protoimpl.UnsafeEnabled {
 | 
			
		||||
		mi := &file_model_node_proto_msgTypes[0]
 | 
			
		||||
		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
 | 
			
		||||
		ms.StoreMessageInfo(mi)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (x *Node) String() string {
 | 
			
		||||
	return protoimpl.X.MessageStringOf(x)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (*Node) ProtoMessage() {}
 | 
			
		||||
 | 
			
		||||
func (x *Node) ProtoReflect() protoreflect.Message {
 | 
			
		||||
	mi := &file_model_node_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 Node.ProtoReflect.Descriptor instead.
 | 
			
		||||
func (*Node) Descriptor() ([]byte, []int) {
 | 
			
		||||
	return file_model_node_proto_rawDescGZIP(), []int{0}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (x *Node) GetId() int64 {
 | 
			
		||||
	if x != nil {
 | 
			
		||||
		return x.Id
 | 
			
		||||
	}
 | 
			
		||||
	return 0
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (x *Node) GetName() string {
 | 
			
		||||
	if x != nil {
 | 
			
		||||
		return x.Name
 | 
			
		||||
	}
 | 
			
		||||
	return ""
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (x *Node) GetCluster() *Cluster {
 | 
			
		||||
	if x != nil {
 | 
			
		||||
		return x.Cluster
 | 
			
		||||
	}
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
var File_model_node_proto protoreflect.FileDescriptor
 | 
			
		||||
 | 
			
		||||
var file_model_node_proto_rawDesc = []byte{
 | 
			
		||||
	0x0a, 0x10, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x72, 0x6f,
 | 
			
		||||
	0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x1a, 0x13, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x63, 0x6c,
 | 
			
		||||
	0x75, 0x73, 0x74, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x51, 0x0a, 0x04, 0x4e,
 | 
			
		||||
	0x6f, 0x64, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52,
 | 
			
		||||
	0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28,
 | 
			
		||||
	0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x25, 0x0a, 0x07, 0x63, 0x6c, 0x75, 0x73, 0x74,
 | 
			
		||||
	0x65, 0x72, 0x18, 0x20, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x6c,
 | 
			
		||||
	0x75, 0x73, 0x74, 0x65, 0x72, 0x52, 0x07, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x42, 0x06,
 | 
			
		||||
	0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
var (
 | 
			
		||||
	file_model_node_proto_rawDescOnce sync.Once
 | 
			
		||||
	file_model_node_proto_rawDescData = file_model_node_proto_rawDesc
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func file_model_node_proto_rawDescGZIP() []byte {
 | 
			
		||||
	file_model_node_proto_rawDescOnce.Do(func() {
 | 
			
		||||
		file_model_node_proto_rawDescData = protoimpl.X.CompressGZIP(file_model_node_proto_rawDescData)
 | 
			
		||||
	})
 | 
			
		||||
	return file_model_node_proto_rawDescData
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
var file_model_node_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
 | 
			
		||||
var file_model_node_proto_goTypes = []interface{}{
 | 
			
		||||
	(*Node)(nil),    // 0: pb.Node
 | 
			
		||||
	(*Cluster)(nil), // 1: pb.Cluster
 | 
			
		||||
}
 | 
			
		||||
var file_model_node_proto_depIdxs = []int32{
 | 
			
		||||
	1, // 0: pb.Node.cluster:type_name -> pb.Cluster
 | 
			
		||||
	1, // [1:1] is the sub-list for method output_type
 | 
			
		||||
	1, // [1:1] is the sub-list for method input_type
 | 
			
		||||
	1, // [1:1] is the sub-list for extension type_name
 | 
			
		||||
	1, // [1:1] is the sub-list for extension extendee
 | 
			
		||||
	0, // [0:1] is the sub-list for field type_name
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func init() { file_model_node_proto_init() }
 | 
			
		||||
func file_model_node_proto_init() {
 | 
			
		||||
	if File_model_node_proto != nil {
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	file_model_cluster_proto_init()
 | 
			
		||||
	if !protoimpl.UnsafeEnabled {
 | 
			
		||||
		file_model_node_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
 | 
			
		||||
			switch v := v.(*Node); 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_model_node_proto_rawDesc,
 | 
			
		||||
			NumEnums:      0,
 | 
			
		||||
			NumMessages:   1,
 | 
			
		||||
			NumExtensions: 0,
 | 
			
		||||
			NumServices:   0,
 | 
			
		||||
		},
 | 
			
		||||
		GoTypes:           file_model_node_proto_goTypes,
 | 
			
		||||
		DependencyIndexes: file_model_node_proto_depIdxs,
 | 
			
		||||
		MessageInfos:      file_model_node_proto_msgTypes,
 | 
			
		||||
	}.Build()
 | 
			
		||||
	File_model_node_proto = out.File
 | 
			
		||||
	file_model_node_proto_rawDesc = nil
 | 
			
		||||
	file_model_node_proto_goTypes = nil
 | 
			
		||||
	file_model_node_proto_depIdxs = nil
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										1588
									
								
								internal/rpc/pb/service_admin.pb.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1588
									
								
								internal/rpc/pb/service_admin.pb.go
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -2,9 +2,9 @@
 | 
			
		||||
// versions:
 | 
			
		||||
// 	protoc-gen-go v1.25.0
 | 
			
		||||
// 	protoc        v3.12.3
 | 
			
		||||
// source: dns/service.proto
 | 
			
		||||
// source: service_dns.proto
 | 
			
		||||
 | 
			
		||||
package dns
 | 
			
		||||
package pb
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	context "context"
 | 
			
		||||
@@ -26,17 +26,17 @@ const (
 | 
			
		||||
// of the legacy proto package is being used.
 | 
			
		||||
const _ = proto.ProtoPackageIsVersion4
 | 
			
		||||
 | 
			
		||||
var File_dns_service_proto protoreflect.FileDescriptor
 | 
			
		||||
var File_service_dns_proto protoreflect.FileDescriptor
 | 
			
		||||
 | 
			
		||||
var file_dns_service_proto_rawDesc = []byte{
 | 
			
		||||
	0x0a, 0x11, 0x64, 0x6e, 0x73, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72,
 | 
			
		||||
	0x6f, 0x74, 0x6f, 0x12, 0x03, 0x64, 0x6e, 0x73, 0x32, 0x09, 0x0a, 0x07, 0x53, 0x65, 0x72, 0x76,
 | 
			
		||||
	0x69, 0x63, 0x65, 0x42, 0x07, 0x5a, 0x05, 0x2e, 0x2f, 0x64, 0x6e, 0x73, 0x62, 0x06, 0x70, 0x72,
 | 
			
		||||
	0x6f, 0x74, 0x6f, 0x33,
 | 
			
		||||
var file_service_dns_proto_rawDesc = []byte{
 | 
			
		||||
	0x0a, 0x11, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x64, 0x6e, 0x73, 0x2e, 0x70, 0x72,
 | 
			
		||||
	0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x32, 0x0c, 0x0a, 0x0a, 0x44, 0x6e, 0x73, 0x53, 0x65,
 | 
			
		||||
	0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70,
 | 
			
		||||
	0x72, 0x6f, 0x74, 0x6f, 0x33,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
var file_dns_service_proto_goTypes = []interface{}{}
 | 
			
		||||
var file_dns_service_proto_depIdxs = []int32{
 | 
			
		||||
var file_service_dns_proto_goTypes = []interface{}{}
 | 
			
		||||
var file_service_dns_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
 | 
			
		||||
@@ -44,28 +44,28 @@ var file_dns_service_proto_depIdxs = []int32{
 | 
			
		||||
	0, // [0:0] is the sub-list for field type_name
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func init() { file_dns_service_proto_init() }
 | 
			
		||||
func file_dns_service_proto_init() {
 | 
			
		||||
	if File_dns_service_proto != nil {
 | 
			
		||||
func init() { file_service_dns_proto_init() }
 | 
			
		||||
func file_service_dns_proto_init() {
 | 
			
		||||
	if File_service_dns_proto != nil {
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	type x struct{}
 | 
			
		||||
	out := protoimpl.TypeBuilder{
 | 
			
		||||
		File: protoimpl.DescBuilder{
 | 
			
		||||
			GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
 | 
			
		||||
			RawDescriptor: file_dns_service_proto_rawDesc,
 | 
			
		||||
			RawDescriptor: file_service_dns_proto_rawDesc,
 | 
			
		||||
			NumEnums:      0,
 | 
			
		||||
			NumMessages:   0,
 | 
			
		||||
			NumExtensions: 0,
 | 
			
		||||
			NumServices:   1,
 | 
			
		||||
		},
 | 
			
		||||
		GoTypes:           file_dns_service_proto_goTypes,
 | 
			
		||||
		DependencyIndexes: file_dns_service_proto_depIdxs,
 | 
			
		||||
		GoTypes:           file_service_dns_proto_goTypes,
 | 
			
		||||
		DependencyIndexes: file_service_dns_proto_depIdxs,
 | 
			
		||||
	}.Build()
 | 
			
		||||
	File_dns_service_proto = out.File
 | 
			
		||||
	file_dns_service_proto_rawDesc = nil
 | 
			
		||||
	file_dns_service_proto_goTypes = nil
 | 
			
		||||
	file_dns_service_proto_depIdxs = nil
 | 
			
		||||
	File_service_dns_proto = out.File
 | 
			
		||||
	file_service_dns_proto_rawDesc = nil
 | 
			
		||||
	file_service_dns_proto_goTypes = nil
 | 
			
		||||
	file_service_dns_proto_depIdxs = nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Reference imports to suppress errors if they are not otherwise used.
 | 
			
		||||
@@ -76,36 +76,36 @@ var _ grpc.ClientConnInterface
 | 
			
		||||
// is compatible with the grpc package it is being compiled against.
 | 
			
		||||
const _ = grpc.SupportPackageIsVersion6
 | 
			
		||||
 | 
			
		||||
// ServiceClient is the client API for Service service.
 | 
			
		||||
// DnsServiceClient is the client API for DnsService service.
 | 
			
		||||
//
 | 
			
		||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
 | 
			
		||||
type ServiceClient interface {
 | 
			
		||||
type DnsServiceClient interface {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type serviceClient struct {
 | 
			
		||||
type dnsServiceClient struct {
 | 
			
		||||
	cc grpc.ClientConnInterface
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func NewServiceClient(cc grpc.ClientConnInterface) ServiceClient {
 | 
			
		||||
	return &serviceClient{cc}
 | 
			
		||||
func NewDnsServiceClient(cc grpc.ClientConnInterface) DnsServiceClient {
 | 
			
		||||
	return &dnsServiceClient{cc}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ServiceServer is the server API for Service service.
 | 
			
		||||
type ServiceServer interface {
 | 
			
		||||
// DnsServiceServer is the server API for DnsService service.
 | 
			
		||||
type DnsServiceServer interface {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// UnimplementedServiceServer can be embedded to have forward compatible implementations.
 | 
			
		||||
type UnimplementedServiceServer struct {
 | 
			
		||||
// UnimplementedDnsServiceServer can be embedded to have forward compatible implementations.
 | 
			
		||||
type UnimplementedDnsServiceServer struct {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func RegisterServiceServer(s *grpc.Server, srv ServiceServer) {
 | 
			
		||||
	s.RegisterService(&_Service_serviceDesc, srv)
 | 
			
		||||
func RegisterDnsServiceServer(s *grpc.Server, srv DnsServiceServer) {
 | 
			
		||||
	s.RegisterService(&_DnsService_serviceDesc, srv)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
var _Service_serviceDesc = grpc.ServiceDesc{
 | 
			
		||||
	ServiceName: "dns.Service",
 | 
			
		||||
	HandlerType: (*ServiceServer)(nil),
 | 
			
		||||
var _DnsService_serviceDesc = grpc.ServiceDesc{
 | 
			
		||||
	ServiceName: "pb.DnsService",
 | 
			
		||||
	HandlerType: (*DnsServiceServer)(nil),
 | 
			
		||||
	Methods:     []grpc.MethodDesc{},
 | 
			
		||||
	Streams:     []grpc.StreamDesc{},
 | 
			
		||||
	Metadata:    "dns/service.proto",
 | 
			
		||||
	Metadata:    "service_dns.proto",
 | 
			
		||||
}
 | 
			
		||||
@@ -2,9 +2,9 @@
 | 
			
		||||
// versions:
 | 
			
		||||
// 	protoc-gen-go v1.25.0
 | 
			
		||||
// 	protoc        v3.12.3
 | 
			
		||||
// source: log/service.proto
 | 
			
		||||
// source: service_log.proto
 | 
			
		||||
 | 
			
		||||
package log
 | 
			
		||||
package pb
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	context "context"
 | 
			
		||||
@@ -26,17 +26,17 @@ const (
 | 
			
		||||
// of the legacy proto package is being used.
 | 
			
		||||
const _ = proto.ProtoPackageIsVersion4
 | 
			
		||||
 | 
			
		||||
var File_log_service_proto protoreflect.FileDescriptor
 | 
			
		||||
var File_service_log_proto protoreflect.FileDescriptor
 | 
			
		||||
 | 
			
		||||
var file_log_service_proto_rawDesc = []byte{
 | 
			
		||||
	0x0a, 0x11, 0x6c, 0x6f, 0x67, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72,
 | 
			
		||||
	0x6f, 0x74, 0x6f, 0x12, 0x03, 0x6c, 0x6f, 0x67, 0x32, 0x09, 0x0a, 0x07, 0x53, 0x65, 0x72, 0x76,
 | 
			
		||||
	0x69, 0x63, 0x65, 0x42, 0x07, 0x5a, 0x05, 0x2e, 0x2f, 0x6c, 0x6f, 0x67, 0x62, 0x06, 0x70, 0x72,
 | 
			
		||||
	0x6f, 0x74, 0x6f, 0x33,
 | 
			
		||||
var file_service_log_proto_rawDesc = []byte{
 | 
			
		||||
	0x0a, 0x11, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x6c, 0x6f, 0x67, 0x2e, 0x70, 0x72,
 | 
			
		||||
	0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x32, 0x0c, 0x0a, 0x0a, 0x4c, 0x6f, 0x67, 0x53, 0x65,
 | 
			
		||||
	0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70,
 | 
			
		||||
	0x72, 0x6f, 0x74, 0x6f, 0x33,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
var file_log_service_proto_goTypes = []interface{}{}
 | 
			
		||||
var file_log_service_proto_depIdxs = []int32{
 | 
			
		||||
var file_service_log_proto_goTypes = []interface{}{}
 | 
			
		||||
var file_service_log_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
 | 
			
		||||
@@ -44,28 +44,28 @@ var file_log_service_proto_depIdxs = []int32{
 | 
			
		||||
	0, // [0:0] is the sub-list for field type_name
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func init() { file_log_service_proto_init() }
 | 
			
		||||
func file_log_service_proto_init() {
 | 
			
		||||
	if File_log_service_proto != nil {
 | 
			
		||||
func init() { file_service_log_proto_init() }
 | 
			
		||||
func file_service_log_proto_init() {
 | 
			
		||||
	if File_service_log_proto != nil {
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	type x struct{}
 | 
			
		||||
	out := protoimpl.TypeBuilder{
 | 
			
		||||
		File: protoimpl.DescBuilder{
 | 
			
		||||
			GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
 | 
			
		||||
			RawDescriptor: file_log_service_proto_rawDesc,
 | 
			
		||||
			RawDescriptor: file_service_log_proto_rawDesc,
 | 
			
		||||
			NumEnums:      0,
 | 
			
		||||
			NumMessages:   0,
 | 
			
		||||
			NumExtensions: 0,
 | 
			
		||||
			NumServices:   1,
 | 
			
		||||
		},
 | 
			
		||||
		GoTypes:           file_log_service_proto_goTypes,
 | 
			
		||||
		DependencyIndexes: file_log_service_proto_depIdxs,
 | 
			
		||||
		GoTypes:           file_service_log_proto_goTypes,
 | 
			
		||||
		DependencyIndexes: file_service_log_proto_depIdxs,
 | 
			
		||||
	}.Build()
 | 
			
		||||
	File_log_service_proto = out.File
 | 
			
		||||
	file_log_service_proto_rawDesc = nil
 | 
			
		||||
	file_log_service_proto_goTypes = nil
 | 
			
		||||
	file_log_service_proto_depIdxs = nil
 | 
			
		||||
	File_service_log_proto = out.File
 | 
			
		||||
	file_service_log_proto_rawDesc = nil
 | 
			
		||||
	file_service_log_proto_goTypes = nil
 | 
			
		||||
	file_service_log_proto_depIdxs = nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Reference imports to suppress errors if they are not otherwise used.
 | 
			
		||||
@@ -76,36 +76,36 @@ var _ grpc.ClientConnInterface
 | 
			
		||||
// is compatible with the grpc package it is being compiled against.
 | 
			
		||||
const _ = grpc.SupportPackageIsVersion6
 | 
			
		||||
 | 
			
		||||
// ServiceClient is the client API for Service service.
 | 
			
		||||
// LogServiceClient is the client API for LogService service.
 | 
			
		||||
//
 | 
			
		||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
 | 
			
		||||
type ServiceClient interface {
 | 
			
		||||
type LogServiceClient interface {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type serviceClient struct {
 | 
			
		||||
type logServiceClient struct {
 | 
			
		||||
	cc grpc.ClientConnInterface
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func NewServiceClient(cc grpc.ClientConnInterface) ServiceClient {
 | 
			
		||||
	return &serviceClient{cc}
 | 
			
		||||
func NewLogServiceClient(cc grpc.ClientConnInterface) LogServiceClient {
 | 
			
		||||
	return &logServiceClient{cc}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ServiceServer is the server API for Service service.
 | 
			
		||||
type ServiceServer interface {
 | 
			
		||||
// LogServiceServer is the server API for LogService service.
 | 
			
		||||
type LogServiceServer interface {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// UnimplementedServiceServer can be embedded to have forward compatible implementations.
 | 
			
		||||
type UnimplementedServiceServer struct {
 | 
			
		||||
// UnimplementedLogServiceServer can be embedded to have forward compatible implementations.
 | 
			
		||||
type UnimplementedLogServiceServer struct {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func RegisterServiceServer(s *grpc.Server, srv ServiceServer) {
 | 
			
		||||
	s.RegisterService(&_Service_serviceDesc, srv)
 | 
			
		||||
func RegisterLogServiceServer(s *grpc.Server, srv LogServiceServer) {
 | 
			
		||||
	s.RegisterService(&_LogService_serviceDesc, srv)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
var _Service_serviceDesc = grpc.ServiceDesc{
 | 
			
		||||
	ServiceName: "log.Service",
 | 
			
		||||
	HandlerType: (*ServiceServer)(nil),
 | 
			
		||||
var _LogService_serviceDesc = grpc.ServiceDesc{
 | 
			
		||||
	ServiceName: "pb.LogService",
 | 
			
		||||
	HandlerType: (*LogServiceServer)(nil),
 | 
			
		||||
	Methods:     []grpc.MethodDesc{},
 | 
			
		||||
	Streams:     []grpc.StreamDesc{},
 | 
			
		||||
	Metadata:    "log/service.proto",
 | 
			
		||||
	Metadata:    "service_log.proto",
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										111
									
								
								internal/rpc/pb/service_monitor.pb.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										111
									
								
								internal/rpc/pb/service_monitor.pb.go
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,111 @@
 | 
			
		||||
// Code generated by protoc-gen-go. DO NOT EDIT.
 | 
			
		||||
// versions:
 | 
			
		||||
// 	protoc-gen-go v1.25.0
 | 
			
		||||
// 	protoc        v3.12.3
 | 
			
		||||
// source: service_monitor.proto
 | 
			
		||||
 | 
			
		||||
package pb
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	context "context"
 | 
			
		||||
	proto "github.com/golang/protobuf/proto"
 | 
			
		||||
	grpc "google.golang.org/grpc"
 | 
			
		||||
	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)
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// This is a compile-time assertion that a sufficiently up-to-date version
 | 
			
		||||
// of the legacy proto package is being used.
 | 
			
		||||
const _ = proto.ProtoPackageIsVersion4
 | 
			
		||||
 | 
			
		||||
var File_service_monitor_proto protoreflect.FileDescriptor
 | 
			
		||||
 | 
			
		||||
var file_service_monitor_proto_rawDesc = []byte{
 | 
			
		||||
	0x0a, 0x15, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x6d, 0x6f, 0x6e, 0x69, 0x74, 0x6f,
 | 
			
		||||
	0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x32, 0x10, 0x0a, 0x0e, 0x4d,
 | 
			
		||||
	0x6f, 0x6e, 0x69, 0x74, 0x6f, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x06, 0x5a,
 | 
			
		||||
	0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
var file_service_monitor_proto_goTypes = []interface{}{}
 | 
			
		||||
var file_service_monitor_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_service_monitor_proto_init() }
 | 
			
		||||
func file_service_monitor_proto_init() {
 | 
			
		||||
	if File_service_monitor_proto != nil {
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	type x struct{}
 | 
			
		||||
	out := protoimpl.TypeBuilder{
 | 
			
		||||
		File: protoimpl.DescBuilder{
 | 
			
		||||
			GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
 | 
			
		||||
			RawDescriptor: file_service_monitor_proto_rawDesc,
 | 
			
		||||
			NumEnums:      0,
 | 
			
		||||
			NumMessages:   0,
 | 
			
		||||
			NumExtensions: 0,
 | 
			
		||||
			NumServices:   1,
 | 
			
		||||
		},
 | 
			
		||||
		GoTypes:           file_service_monitor_proto_goTypes,
 | 
			
		||||
		DependencyIndexes: file_service_monitor_proto_depIdxs,
 | 
			
		||||
	}.Build()
 | 
			
		||||
	File_service_monitor_proto = out.File
 | 
			
		||||
	file_service_monitor_proto_rawDesc = nil
 | 
			
		||||
	file_service_monitor_proto_goTypes = nil
 | 
			
		||||
	file_service_monitor_proto_depIdxs = nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Reference imports to suppress errors if they are not otherwise used.
 | 
			
		||||
var _ context.Context
 | 
			
		||||
var _ grpc.ClientConnInterface
 | 
			
		||||
 | 
			
		||||
// This is a compile-time assertion to ensure that this generated file
 | 
			
		||||
// is compatible with the grpc package it is being compiled against.
 | 
			
		||||
const _ = grpc.SupportPackageIsVersion6
 | 
			
		||||
 | 
			
		||||
// MonitorServiceClient is the client API for MonitorService service.
 | 
			
		||||
//
 | 
			
		||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
 | 
			
		||||
type MonitorServiceClient interface {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type monitorServiceClient struct {
 | 
			
		||||
	cc grpc.ClientConnInterface
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func NewMonitorServiceClient(cc grpc.ClientConnInterface) MonitorServiceClient {
 | 
			
		||||
	return &monitorServiceClient{cc}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// MonitorServiceServer is the server API for MonitorService service.
 | 
			
		||||
type MonitorServiceServer interface {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// UnimplementedMonitorServiceServer can be embedded to have forward compatible implementations.
 | 
			
		||||
type UnimplementedMonitorServiceServer struct {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func RegisterMonitorServiceServer(s *grpc.Server, srv MonitorServiceServer) {
 | 
			
		||||
	s.RegisterService(&_MonitorService_serviceDesc, srv)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
var _MonitorService_serviceDesc = grpc.ServiceDesc{
 | 
			
		||||
	ServiceName: "pb.MonitorService",
 | 
			
		||||
	HandlerType: (*MonitorServiceServer)(nil),
 | 
			
		||||
	Methods:     []grpc.MethodDesc{},
 | 
			
		||||
	Streams:     []grpc.StreamDesc{},
 | 
			
		||||
	Metadata:    "service_monitor.proto",
 | 
			
		||||
}
 | 
			
		||||
@@ -2,9 +2,9 @@
 | 
			
		||||
// versions:
 | 
			
		||||
// 	protoc-gen-go v1.25.0
 | 
			
		||||
// 	protoc        v3.12.3
 | 
			
		||||
// source: node/service.proto
 | 
			
		||||
// source: service_node.proto
 | 
			
		||||
 | 
			
		||||
package node
 | 
			
		||||
package pb
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	context "context"
 | 
			
		||||
@@ -40,7 +40,7 @@ type ConfigRequest struct {
 | 
			
		||||
func (x *ConfigRequest) Reset() {
 | 
			
		||||
	*x = ConfigRequest{}
 | 
			
		||||
	if protoimpl.UnsafeEnabled {
 | 
			
		||||
		mi := &file_node_service_proto_msgTypes[0]
 | 
			
		||||
		mi := &file_service_node_proto_msgTypes[0]
 | 
			
		||||
		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
 | 
			
		||||
		ms.StoreMessageInfo(mi)
 | 
			
		||||
	}
 | 
			
		||||
@@ -53,7 +53,7 @@ func (x *ConfigRequest) String() string {
 | 
			
		||||
func (*ConfigRequest) ProtoMessage() {}
 | 
			
		||||
 | 
			
		||||
func (x *ConfigRequest) ProtoReflect() protoreflect.Message {
 | 
			
		||||
	mi := &file_node_service_proto_msgTypes[0]
 | 
			
		||||
	mi := &file_service_node_proto_msgTypes[0]
 | 
			
		||||
	if protoimpl.UnsafeEnabled && x != nil {
 | 
			
		||||
		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
 | 
			
		||||
		if ms.LoadMessageInfo() == nil {
 | 
			
		||||
@@ -66,7 +66,7 @@ func (x *ConfigRequest) ProtoReflect() protoreflect.Message {
 | 
			
		||||
 | 
			
		||||
// Deprecated: Use ConfigRequest.ProtoReflect.Descriptor instead.
 | 
			
		||||
func (*ConfigRequest) Descriptor() ([]byte, []int) {
 | 
			
		||||
	return file_node_service_proto_rawDescGZIP(), []int{0}
 | 
			
		||||
	return file_service_node_proto_rawDescGZIP(), []int{0}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (x *ConfigRequest) GetNodeId() string {
 | 
			
		||||
@@ -87,7 +87,7 @@ type ConfigResponse struct {
 | 
			
		||||
func (x *ConfigResponse) Reset() {
 | 
			
		||||
	*x = ConfigResponse{}
 | 
			
		||||
	if protoimpl.UnsafeEnabled {
 | 
			
		||||
		mi := &file_node_service_proto_msgTypes[1]
 | 
			
		||||
		mi := &file_service_node_proto_msgTypes[1]
 | 
			
		||||
		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
 | 
			
		||||
		ms.StoreMessageInfo(mi)
 | 
			
		||||
	}
 | 
			
		||||
@@ -100,7 +100,7 @@ func (x *ConfigResponse) String() string {
 | 
			
		||||
func (*ConfigResponse) ProtoMessage() {}
 | 
			
		||||
 | 
			
		||||
func (x *ConfigResponse) ProtoReflect() protoreflect.Message {
 | 
			
		||||
	mi := &file_node_service_proto_msgTypes[1]
 | 
			
		||||
	mi := &file_service_node_proto_msgTypes[1]
 | 
			
		||||
	if protoimpl.UnsafeEnabled && x != nil {
 | 
			
		||||
		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
 | 
			
		||||
		if ms.LoadMessageInfo() == nil {
 | 
			
		||||
@@ -113,7 +113,7 @@ func (x *ConfigResponse) ProtoReflect() protoreflect.Message {
 | 
			
		||||
 | 
			
		||||
// Deprecated: Use ConfigResponse.ProtoReflect.Descriptor instead.
 | 
			
		||||
func (*ConfigResponse) Descriptor() ([]byte, []int) {
 | 
			
		||||
	return file_node_service_proto_rawDescGZIP(), []int{1}
 | 
			
		||||
	return file_service_node_proto_rawDescGZIP(), []int{1}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (x *ConfigResponse) GetId() string {
 | 
			
		||||
@@ -123,43 +123,43 @@ func (x *ConfigResponse) GetId() string {
 | 
			
		||||
	return ""
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
var File_node_service_proto protoreflect.FileDescriptor
 | 
			
		||||
var File_service_node_proto protoreflect.FileDescriptor
 | 
			
		||||
 | 
			
		||||
var file_node_service_proto_rawDesc = []byte{
 | 
			
		||||
	0x0a, 0x12, 0x6e, 0x6f, 0x64, 0x65, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70,
 | 
			
		||||
	0x72, 0x6f, 0x74, 0x6f, 0x12, 0x04, 0x6e, 0x6f, 0x64, 0x65, 0x22, 0x27, 0x0a, 0x0d, 0x43, 0x6f,
 | 
			
		||||
	0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x6e,
 | 
			
		||||
	0x6f, 0x64, 0x65, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6e, 0x6f, 0x64,
 | 
			
		||||
	0x65, 0x49, 0x64, 0x22, 0x20, 0x0a, 0x0e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x73,
 | 
			
		||||
	0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
 | 
			
		||||
	0x09, 0x52, 0x02, 0x69, 0x64, 0x32, 0x40, 0x0a, 0x07, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
 | 
			
		||||
	0x12, 0x35, 0x0a, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x13, 0x2e, 0x6e, 0x6f, 0x64,
 | 
			
		||||
	0x65, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
 | 
			
		||||
	0x14, 0x2e, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x73,
 | 
			
		||||
	0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x08, 0x5a, 0x06, 0x2e, 0x2f, 0x6e, 0x6f, 0x64,
 | 
			
		||||
	0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
 | 
			
		||||
var file_service_node_proto_rawDesc = []byte{
 | 
			
		||||
	0x0a, 0x12, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70,
 | 
			
		||||
	0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, 0x27, 0x0a, 0x0d, 0x43, 0x6f, 0x6e, 0x66,
 | 
			
		||||
	0x69, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x6f, 0x64,
 | 
			
		||||
	0x65, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6e, 0x6f, 0x64, 0x65, 0x49,
 | 
			
		||||
	0x64, 0x22, 0x20, 0x0a, 0x0e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f,
 | 
			
		||||
	0x6e, 0x73, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
 | 
			
		||||
	0x02, 0x69, 0x64, 0x32, 0x40, 0x0a, 0x0b, 0x4e, 0x6f, 0x64, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69,
 | 
			
		||||
	0x63, 0x65, 0x12, 0x31, 0x0a, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x11, 0x2e, 0x70,
 | 
			
		||||
	0x62, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
 | 
			
		||||
	0x12, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f,
 | 
			
		||||
	0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70,
 | 
			
		||||
	0x72, 0x6f, 0x74, 0x6f, 0x33,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
var (
 | 
			
		||||
	file_node_service_proto_rawDescOnce sync.Once
 | 
			
		||||
	file_node_service_proto_rawDescData = file_node_service_proto_rawDesc
 | 
			
		||||
	file_service_node_proto_rawDescOnce sync.Once
 | 
			
		||||
	file_service_node_proto_rawDescData = file_service_node_proto_rawDesc
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func file_node_service_proto_rawDescGZIP() []byte {
 | 
			
		||||
	file_node_service_proto_rawDescOnce.Do(func() {
 | 
			
		||||
		file_node_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_node_service_proto_rawDescData)
 | 
			
		||||
func file_service_node_proto_rawDescGZIP() []byte {
 | 
			
		||||
	file_service_node_proto_rawDescOnce.Do(func() {
 | 
			
		||||
		file_service_node_proto_rawDescData = protoimpl.X.CompressGZIP(file_service_node_proto_rawDescData)
 | 
			
		||||
	})
 | 
			
		||||
	return file_node_service_proto_rawDescData
 | 
			
		||||
	return file_service_node_proto_rawDescData
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
var file_node_service_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
 | 
			
		||||
var file_node_service_proto_goTypes = []interface{}{
 | 
			
		||||
	(*ConfigRequest)(nil),  // 0: node.ConfigRequest
 | 
			
		||||
	(*ConfigResponse)(nil), // 1: node.ConfigResponse
 | 
			
		||||
var file_service_node_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
 | 
			
		||||
var file_service_node_proto_goTypes = []interface{}{
 | 
			
		||||
	(*ConfigRequest)(nil),  // 0: pb.ConfigRequest
 | 
			
		||||
	(*ConfigResponse)(nil), // 1: pb.ConfigResponse
 | 
			
		||||
}
 | 
			
		||||
var file_node_service_proto_depIdxs = []int32{
 | 
			
		||||
	0, // 0: node.Service.config:input_type -> node.ConfigRequest
 | 
			
		||||
	1, // 1: node.Service.config:output_type -> node.ConfigResponse
 | 
			
		||||
var file_service_node_proto_depIdxs = []int32{
 | 
			
		||||
	0, // 0: pb.NodeService.config:input_type -> pb.ConfigRequest
 | 
			
		||||
	1, // 1: pb.NodeService.config:output_type -> pb.ConfigResponse
 | 
			
		||||
	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
 | 
			
		||||
@@ -167,13 +167,13 @@ var file_node_service_proto_depIdxs = []int32{
 | 
			
		||||
	0, // [0:0] is the sub-list for field type_name
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func init() { file_node_service_proto_init() }
 | 
			
		||||
func file_node_service_proto_init() {
 | 
			
		||||
	if File_node_service_proto != nil {
 | 
			
		||||
func init() { file_service_node_proto_init() }
 | 
			
		||||
func file_service_node_proto_init() {
 | 
			
		||||
	if File_service_node_proto != nil {
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	if !protoimpl.UnsafeEnabled {
 | 
			
		||||
		file_node_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
 | 
			
		||||
		file_service_node_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
 | 
			
		||||
			switch v := v.(*ConfigRequest); i {
 | 
			
		||||
			case 0:
 | 
			
		||||
				return &v.state
 | 
			
		||||
@@ -185,7 +185,7 @@ func file_node_service_proto_init() {
 | 
			
		||||
				return nil
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		file_node_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
 | 
			
		||||
		file_service_node_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
 | 
			
		||||
			switch v := v.(*ConfigResponse); i {
 | 
			
		||||
			case 0:
 | 
			
		||||
				return &v.state
 | 
			
		||||
@@ -202,20 +202,20 @@ func file_node_service_proto_init() {
 | 
			
		||||
	out := protoimpl.TypeBuilder{
 | 
			
		||||
		File: protoimpl.DescBuilder{
 | 
			
		||||
			GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
 | 
			
		||||
			RawDescriptor: file_node_service_proto_rawDesc,
 | 
			
		||||
			RawDescriptor: file_service_node_proto_rawDesc,
 | 
			
		||||
			NumEnums:      0,
 | 
			
		||||
			NumMessages:   2,
 | 
			
		||||
			NumExtensions: 0,
 | 
			
		||||
			NumServices:   1,
 | 
			
		||||
		},
 | 
			
		||||
		GoTypes:           file_node_service_proto_goTypes,
 | 
			
		||||
		DependencyIndexes: file_node_service_proto_depIdxs,
 | 
			
		||||
		MessageInfos:      file_node_service_proto_msgTypes,
 | 
			
		||||
		GoTypes:           file_service_node_proto_goTypes,
 | 
			
		||||
		DependencyIndexes: file_service_node_proto_depIdxs,
 | 
			
		||||
		MessageInfos:      file_service_node_proto_msgTypes,
 | 
			
		||||
	}.Build()
 | 
			
		||||
	File_node_service_proto = out.File
 | 
			
		||||
	file_node_service_proto_rawDesc = nil
 | 
			
		||||
	file_node_service_proto_goTypes = nil
 | 
			
		||||
	file_node_service_proto_depIdxs = nil
 | 
			
		||||
	File_service_node_proto = out.File
 | 
			
		||||
	file_service_node_proto_rawDesc = nil
 | 
			
		||||
	file_service_node_proto_goTypes = nil
 | 
			
		||||
	file_service_node_proto_depIdxs = nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Reference imports to suppress errors if they are not otherwise used.
 | 
			
		||||
@@ -226,74 +226,74 @@ var _ grpc.ClientConnInterface
 | 
			
		||||
// is compatible with the grpc package it is being compiled against.
 | 
			
		||||
const _ = grpc.SupportPackageIsVersion6
 | 
			
		||||
 | 
			
		||||
// ServiceClient is the client API for Service service.
 | 
			
		||||
// NodeServiceClient is the client API for NodeService service.
 | 
			
		||||
//
 | 
			
		||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
 | 
			
		||||
type ServiceClient interface {
 | 
			
		||||
type NodeServiceClient interface {
 | 
			
		||||
	Config(ctx context.Context, in *ConfigRequest, opts ...grpc.CallOption) (*ConfigResponse, error)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type serviceClient struct {
 | 
			
		||||
type nodeServiceClient struct {
 | 
			
		||||
	cc grpc.ClientConnInterface
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func NewServiceClient(cc grpc.ClientConnInterface) ServiceClient {
 | 
			
		||||
	return &serviceClient{cc}
 | 
			
		||||
func NewNodeServiceClient(cc grpc.ClientConnInterface) NodeServiceClient {
 | 
			
		||||
	return &nodeServiceClient{cc}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (c *serviceClient) Config(ctx context.Context, in *ConfigRequest, opts ...grpc.CallOption) (*ConfigResponse, error) {
 | 
			
		||||
func (c *nodeServiceClient) Config(ctx context.Context, in *ConfigRequest, opts ...grpc.CallOption) (*ConfigResponse, error) {
 | 
			
		||||
	out := new(ConfigResponse)
 | 
			
		||||
	err := c.cc.Invoke(ctx, "/node.Service/config", in, out, opts...)
 | 
			
		||||
	err := c.cc.Invoke(ctx, "/pb.NodeService/config", in, out, opts...)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
	return out, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ServiceServer is the server API for Service service.
 | 
			
		||||
type ServiceServer interface {
 | 
			
		||||
// NodeServiceServer is the server API for NodeService service.
 | 
			
		||||
type NodeServiceServer interface {
 | 
			
		||||
	Config(context.Context, *ConfigRequest) (*ConfigResponse, error)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// UnimplementedServiceServer can be embedded to have forward compatible implementations.
 | 
			
		||||
type UnimplementedServiceServer struct {
 | 
			
		||||
// UnimplementedNodeServiceServer can be embedded to have forward compatible implementations.
 | 
			
		||||
type UnimplementedNodeServiceServer struct {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (*UnimplementedServiceServer) Config(context.Context, *ConfigRequest) (*ConfigResponse, error) {
 | 
			
		||||
func (*UnimplementedNodeServiceServer) Config(context.Context, *ConfigRequest) (*ConfigResponse, error) {
 | 
			
		||||
	return nil, status.Errorf(codes.Unimplemented, "method Config not implemented")
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func RegisterServiceServer(s *grpc.Server, srv ServiceServer) {
 | 
			
		||||
	s.RegisterService(&_Service_serviceDesc, srv)
 | 
			
		||||
func RegisterNodeServiceServer(s *grpc.Server, srv NodeServiceServer) {
 | 
			
		||||
	s.RegisterService(&_NodeService_serviceDesc, srv)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func _Service_Config_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
 | 
			
		||||
func _NodeService_Config_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
 | 
			
		||||
	in := new(ConfigRequest)
 | 
			
		||||
	if err := dec(in); err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
	if interceptor == nil {
 | 
			
		||||
		return srv.(ServiceServer).Config(ctx, in)
 | 
			
		||||
		return srv.(NodeServiceServer).Config(ctx, in)
 | 
			
		||||
	}
 | 
			
		||||
	info := &grpc.UnaryServerInfo{
 | 
			
		||||
		Server:     srv,
 | 
			
		||||
		FullMethod: "/node.Service/Config",
 | 
			
		||||
		FullMethod: "/pb.NodeService/Config",
 | 
			
		||||
	}
 | 
			
		||||
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
 | 
			
		||||
		return srv.(ServiceServer).Config(ctx, req.(*ConfigRequest))
 | 
			
		||||
		return srv.(NodeServiceServer).Config(ctx, req.(*ConfigRequest))
 | 
			
		||||
	}
 | 
			
		||||
	return interceptor(ctx, in, info, handler)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
var _Service_serviceDesc = grpc.ServiceDesc{
 | 
			
		||||
	ServiceName: "node.Service",
 | 
			
		||||
	HandlerType: (*ServiceServer)(nil),
 | 
			
		||||
var _NodeService_serviceDesc = grpc.ServiceDesc{
 | 
			
		||||
	ServiceName: "pb.NodeService",
 | 
			
		||||
	HandlerType: (*NodeServiceServer)(nil),
 | 
			
		||||
	Methods: []grpc.MethodDesc{
 | 
			
		||||
		{
 | 
			
		||||
			MethodName: "config",
 | 
			
		||||
			Handler:    _Service_Config_Handler,
 | 
			
		||||
			Handler:    _NodeService_Config_Handler,
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
	Streams:  []grpc.StreamDesc{},
 | 
			
		||||
	Metadata: "node/service.proto",
 | 
			
		||||
	Metadata: "service_node.proto",
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										111
									
								
								internal/rpc/pb/service_provider.pb.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										111
									
								
								internal/rpc/pb/service_provider.pb.go
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,111 @@
 | 
			
		||||
// Code generated by protoc-gen-go. DO NOT EDIT.
 | 
			
		||||
// versions:
 | 
			
		||||
// 	protoc-gen-go v1.25.0
 | 
			
		||||
// 	protoc        v3.12.3
 | 
			
		||||
// source: service_provider.proto
 | 
			
		||||
 | 
			
		||||
package pb
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	context "context"
 | 
			
		||||
	proto "github.com/golang/protobuf/proto"
 | 
			
		||||
	grpc "google.golang.org/grpc"
 | 
			
		||||
	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)
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// This is a compile-time assertion that a sufficiently up-to-date version
 | 
			
		||||
// of the legacy proto package is being used.
 | 
			
		||||
const _ = proto.ProtoPackageIsVersion4
 | 
			
		||||
 | 
			
		||||
var File_service_provider_proto protoreflect.FileDescriptor
 | 
			
		||||
 | 
			
		||||
var file_service_provider_proto_rawDesc = []byte{
 | 
			
		||||
	0x0a, 0x16, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64,
 | 
			
		||||
	0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x32, 0x11, 0x0a, 0x0f,
 | 
			
		||||
	0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42,
 | 
			
		||||
	0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
var file_service_provider_proto_goTypes = []interface{}{}
 | 
			
		||||
var file_service_provider_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_service_provider_proto_init() }
 | 
			
		||||
func file_service_provider_proto_init() {
 | 
			
		||||
	if File_service_provider_proto != nil {
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	type x struct{}
 | 
			
		||||
	out := protoimpl.TypeBuilder{
 | 
			
		||||
		File: protoimpl.DescBuilder{
 | 
			
		||||
			GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
 | 
			
		||||
			RawDescriptor: file_service_provider_proto_rawDesc,
 | 
			
		||||
			NumEnums:      0,
 | 
			
		||||
			NumMessages:   0,
 | 
			
		||||
			NumExtensions: 0,
 | 
			
		||||
			NumServices:   1,
 | 
			
		||||
		},
 | 
			
		||||
		GoTypes:           file_service_provider_proto_goTypes,
 | 
			
		||||
		DependencyIndexes: file_service_provider_proto_depIdxs,
 | 
			
		||||
	}.Build()
 | 
			
		||||
	File_service_provider_proto = out.File
 | 
			
		||||
	file_service_provider_proto_rawDesc = nil
 | 
			
		||||
	file_service_provider_proto_goTypes = nil
 | 
			
		||||
	file_service_provider_proto_depIdxs = nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Reference imports to suppress errors if they are not otherwise used.
 | 
			
		||||
var _ context.Context
 | 
			
		||||
var _ grpc.ClientConnInterface
 | 
			
		||||
 | 
			
		||||
// This is a compile-time assertion to ensure that this generated file
 | 
			
		||||
// is compatible with the grpc package it is being compiled against.
 | 
			
		||||
const _ = grpc.SupportPackageIsVersion6
 | 
			
		||||
 | 
			
		||||
// ProviderServiceClient is the client API for ProviderService service.
 | 
			
		||||
//
 | 
			
		||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
 | 
			
		||||
type ProviderServiceClient interface {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type providerServiceClient struct {
 | 
			
		||||
	cc grpc.ClientConnInterface
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func NewProviderServiceClient(cc grpc.ClientConnInterface) ProviderServiceClient {
 | 
			
		||||
	return &providerServiceClient{cc}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ProviderServiceServer is the server API for ProviderService service.
 | 
			
		||||
type ProviderServiceServer interface {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// UnimplementedProviderServiceServer can be embedded to have forward compatible implementations.
 | 
			
		||||
type UnimplementedProviderServiceServer struct {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func RegisterProviderServiceServer(s *grpc.Server, srv ProviderServiceServer) {
 | 
			
		||||
	s.RegisterService(&_ProviderService_serviceDesc, srv)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
var _ProviderService_serviceDesc = grpc.ServiceDesc{
 | 
			
		||||
	ServiceName: "pb.ProviderService",
 | 
			
		||||
	HandlerType: (*ProviderServiceServer)(nil),
 | 
			
		||||
	Methods:     []grpc.MethodDesc{},
 | 
			
		||||
	Streams:     []grpc.StreamDesc{},
 | 
			
		||||
	Metadata:    "service_provider.proto",
 | 
			
		||||
}
 | 
			
		||||
@@ -2,9 +2,9 @@
 | 
			
		||||
// versions:
 | 
			
		||||
// 	protoc-gen-go v1.25.0
 | 
			
		||||
// 	protoc        v3.12.3
 | 
			
		||||
// source: stat/service.proto
 | 
			
		||||
// source: service_stat.proto
 | 
			
		||||
 | 
			
		||||
package stat
 | 
			
		||||
package pb
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	context "context"
 | 
			
		||||
@@ -26,17 +26,17 @@ const (
 | 
			
		||||
// of the legacy proto package is being used.
 | 
			
		||||
const _ = proto.ProtoPackageIsVersion4
 | 
			
		||||
 | 
			
		||||
var File_stat_service_proto protoreflect.FileDescriptor
 | 
			
		||||
var File_service_stat_proto protoreflect.FileDescriptor
 | 
			
		||||
 | 
			
		||||
var file_stat_service_proto_rawDesc = []byte{
 | 
			
		||||
	0x0a, 0x12, 0x73, 0x74, 0x61, 0x74, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70,
 | 
			
		||||
	0x72, 0x6f, 0x74, 0x6f, 0x12, 0x04, 0x73, 0x74, 0x61, 0x74, 0x32, 0x09, 0x0a, 0x07, 0x53, 0x65,
 | 
			
		||||
	0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x08, 0x5a, 0x06, 0x2e, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x62,
 | 
			
		||||
var file_service_stat_proto_rawDesc = []byte{
 | 
			
		||||
	0x0a, 0x12, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x2e, 0x70,
 | 
			
		||||
	0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x32, 0x0d, 0x0a, 0x0b, 0x53, 0x74, 0x61, 0x74,
 | 
			
		||||
	0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62,
 | 
			
		||||
	0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
var file_stat_service_proto_goTypes = []interface{}{}
 | 
			
		||||
var file_stat_service_proto_depIdxs = []int32{
 | 
			
		||||
var file_service_stat_proto_goTypes = []interface{}{}
 | 
			
		||||
var file_service_stat_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
 | 
			
		||||
@@ -44,28 +44,28 @@ var file_stat_service_proto_depIdxs = []int32{
 | 
			
		||||
	0, // [0:0] is the sub-list for field type_name
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func init() { file_stat_service_proto_init() }
 | 
			
		||||
func file_stat_service_proto_init() {
 | 
			
		||||
	if File_stat_service_proto != nil {
 | 
			
		||||
func init() { file_service_stat_proto_init() }
 | 
			
		||||
func file_service_stat_proto_init() {
 | 
			
		||||
	if File_service_stat_proto != nil {
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	type x struct{}
 | 
			
		||||
	out := protoimpl.TypeBuilder{
 | 
			
		||||
		File: protoimpl.DescBuilder{
 | 
			
		||||
			GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
 | 
			
		||||
			RawDescriptor: file_stat_service_proto_rawDesc,
 | 
			
		||||
			RawDescriptor: file_service_stat_proto_rawDesc,
 | 
			
		||||
			NumEnums:      0,
 | 
			
		||||
			NumMessages:   0,
 | 
			
		||||
			NumExtensions: 0,
 | 
			
		||||
			NumServices:   1,
 | 
			
		||||
		},
 | 
			
		||||
		GoTypes:           file_stat_service_proto_goTypes,
 | 
			
		||||
		DependencyIndexes: file_stat_service_proto_depIdxs,
 | 
			
		||||
		GoTypes:           file_service_stat_proto_goTypes,
 | 
			
		||||
		DependencyIndexes: file_service_stat_proto_depIdxs,
 | 
			
		||||
	}.Build()
 | 
			
		||||
	File_stat_service_proto = out.File
 | 
			
		||||
	file_stat_service_proto_rawDesc = nil
 | 
			
		||||
	file_stat_service_proto_goTypes = nil
 | 
			
		||||
	file_stat_service_proto_depIdxs = nil
 | 
			
		||||
	File_service_stat_proto = out.File
 | 
			
		||||
	file_service_stat_proto_rawDesc = nil
 | 
			
		||||
	file_service_stat_proto_goTypes = nil
 | 
			
		||||
	file_service_stat_proto_depIdxs = nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Reference imports to suppress errors if they are not otherwise used.
 | 
			
		||||
@@ -76,36 +76,36 @@ var _ grpc.ClientConnInterface
 | 
			
		||||
// is compatible with the grpc package it is being compiled against.
 | 
			
		||||
const _ = grpc.SupportPackageIsVersion6
 | 
			
		||||
 | 
			
		||||
// ServiceClient is the client API for Service service.
 | 
			
		||||
// StatServiceClient is the client API for StatService service.
 | 
			
		||||
//
 | 
			
		||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
 | 
			
		||||
type ServiceClient interface {
 | 
			
		||||
type StatServiceClient interface {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type serviceClient struct {
 | 
			
		||||
type statServiceClient struct {
 | 
			
		||||
	cc grpc.ClientConnInterface
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func NewServiceClient(cc grpc.ClientConnInterface) ServiceClient {
 | 
			
		||||
	return &serviceClient{cc}
 | 
			
		||||
func NewStatServiceClient(cc grpc.ClientConnInterface) StatServiceClient {
 | 
			
		||||
	return &statServiceClient{cc}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ServiceServer is the server API for Service service.
 | 
			
		||||
type ServiceServer interface {
 | 
			
		||||
// StatServiceServer is the server API for StatService service.
 | 
			
		||||
type StatServiceServer interface {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// UnimplementedServiceServer can be embedded to have forward compatible implementations.
 | 
			
		||||
type UnimplementedServiceServer struct {
 | 
			
		||||
// UnimplementedStatServiceServer can be embedded to have forward compatible implementations.
 | 
			
		||||
type UnimplementedStatServiceServer struct {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func RegisterServiceServer(s *grpc.Server, srv ServiceServer) {
 | 
			
		||||
	s.RegisterService(&_Service_serviceDesc, srv)
 | 
			
		||||
func RegisterStatServiceServer(s *grpc.Server, srv StatServiceServer) {
 | 
			
		||||
	s.RegisterService(&_StatService_serviceDesc, srv)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
var _Service_serviceDesc = grpc.ServiceDesc{
 | 
			
		||||
	ServiceName: "stat.Service",
 | 
			
		||||
	HandlerType: (*ServiceServer)(nil),
 | 
			
		||||
var _StatService_serviceDesc = grpc.ServiceDesc{
 | 
			
		||||
	ServiceName: "pb.StatService",
 | 
			
		||||
	HandlerType: (*StatServiceServer)(nil),
 | 
			
		||||
	Methods:     []grpc.MethodDesc{},
 | 
			
		||||
	Streams:     []grpc.StreamDesc{},
 | 
			
		||||
	Metadata:    "stat/service.proto",
 | 
			
		||||
	Metadata:    "service_stat.proto",
 | 
			
		||||
}
 | 
			
		||||
@@ -2,9 +2,9 @@
 | 
			
		||||
// versions:
 | 
			
		||||
// 	protoc-gen-go v1.25.0
 | 
			
		||||
// 	protoc        v3.12.3
 | 
			
		||||
// source: user/service.proto
 | 
			
		||||
// source: service_user.proto
 | 
			
		||||
 | 
			
		||||
package user
 | 
			
		||||
package pb
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	context "context"
 | 
			
		||||
@@ -26,17 +26,17 @@ const (
 | 
			
		||||
// of the legacy proto package is being used.
 | 
			
		||||
const _ = proto.ProtoPackageIsVersion4
 | 
			
		||||
 | 
			
		||||
var File_user_service_proto protoreflect.FileDescriptor
 | 
			
		||||
var File_service_user_proto protoreflect.FileDescriptor
 | 
			
		||||
 | 
			
		||||
var file_user_service_proto_rawDesc = []byte{
 | 
			
		||||
	0x0a, 0x12, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70,
 | 
			
		||||
	0x72, 0x6f, 0x74, 0x6f, 0x12, 0x04, 0x75, 0x73, 0x65, 0x72, 0x32, 0x09, 0x0a, 0x07, 0x53, 0x65,
 | 
			
		||||
	0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x08, 0x5a, 0x06, 0x2e, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x62,
 | 
			
		||||
var file_service_user_proto_rawDesc = []byte{
 | 
			
		||||
	0x0a, 0x12, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x70,
 | 
			
		||||
	0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x32, 0x0d, 0x0a, 0x0b, 0x55, 0x73, 0x65, 0x72,
 | 
			
		||||
	0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62,
 | 
			
		||||
	0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
var file_user_service_proto_goTypes = []interface{}{}
 | 
			
		||||
var file_user_service_proto_depIdxs = []int32{
 | 
			
		||||
var file_service_user_proto_goTypes = []interface{}{}
 | 
			
		||||
var file_service_user_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
 | 
			
		||||
@@ -44,28 +44,28 @@ var file_user_service_proto_depIdxs = []int32{
 | 
			
		||||
	0, // [0:0] is the sub-list for field type_name
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func init() { file_user_service_proto_init() }
 | 
			
		||||
func file_user_service_proto_init() {
 | 
			
		||||
	if File_user_service_proto != nil {
 | 
			
		||||
func init() { file_service_user_proto_init() }
 | 
			
		||||
func file_service_user_proto_init() {
 | 
			
		||||
	if File_service_user_proto != nil {
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	type x struct{}
 | 
			
		||||
	out := protoimpl.TypeBuilder{
 | 
			
		||||
		File: protoimpl.DescBuilder{
 | 
			
		||||
			GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
 | 
			
		||||
			RawDescriptor: file_user_service_proto_rawDesc,
 | 
			
		||||
			RawDescriptor: file_service_user_proto_rawDesc,
 | 
			
		||||
			NumEnums:      0,
 | 
			
		||||
			NumMessages:   0,
 | 
			
		||||
			NumExtensions: 0,
 | 
			
		||||
			NumServices:   1,
 | 
			
		||||
		},
 | 
			
		||||
		GoTypes:           file_user_service_proto_goTypes,
 | 
			
		||||
		DependencyIndexes: file_user_service_proto_depIdxs,
 | 
			
		||||
		GoTypes:           file_service_user_proto_goTypes,
 | 
			
		||||
		DependencyIndexes: file_service_user_proto_depIdxs,
 | 
			
		||||
	}.Build()
 | 
			
		||||
	File_user_service_proto = out.File
 | 
			
		||||
	file_user_service_proto_rawDesc = nil
 | 
			
		||||
	file_user_service_proto_goTypes = nil
 | 
			
		||||
	file_user_service_proto_depIdxs = nil
 | 
			
		||||
	File_service_user_proto = out.File
 | 
			
		||||
	file_service_user_proto_rawDesc = nil
 | 
			
		||||
	file_service_user_proto_goTypes = nil
 | 
			
		||||
	file_service_user_proto_depIdxs = nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Reference imports to suppress errors if they are not otherwise used.
 | 
			
		||||
@@ -76,36 +76,36 @@ var _ grpc.ClientConnInterface
 | 
			
		||||
// is compatible with the grpc package it is being compiled against.
 | 
			
		||||
const _ = grpc.SupportPackageIsVersion6
 | 
			
		||||
 | 
			
		||||
// ServiceClient is the client API for Service service.
 | 
			
		||||
// UserServiceClient is the client API for UserService service.
 | 
			
		||||
//
 | 
			
		||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
 | 
			
		||||
type ServiceClient interface {
 | 
			
		||||
type UserServiceClient interface {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type serviceClient struct {
 | 
			
		||||
type userServiceClient struct {
 | 
			
		||||
	cc grpc.ClientConnInterface
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func NewServiceClient(cc grpc.ClientConnInterface) ServiceClient {
 | 
			
		||||
	return &serviceClient{cc}
 | 
			
		||||
func NewUserServiceClient(cc grpc.ClientConnInterface) UserServiceClient {
 | 
			
		||||
	return &userServiceClient{cc}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ServiceServer is the server API for Service service.
 | 
			
		||||
type ServiceServer interface {
 | 
			
		||||
// UserServiceServer is the server API for UserService service.
 | 
			
		||||
type UserServiceServer interface {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// UnimplementedServiceServer can be embedded to have forward compatible implementations.
 | 
			
		||||
type UnimplementedServiceServer struct {
 | 
			
		||||
// UnimplementedUserServiceServer can be embedded to have forward compatible implementations.
 | 
			
		||||
type UnimplementedUserServiceServer struct {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func RegisterServiceServer(s *grpc.Server, srv ServiceServer) {
 | 
			
		||||
	s.RegisterService(&_Service_serviceDesc, srv)
 | 
			
		||||
func RegisterUserServiceServer(s *grpc.Server, srv UserServiceServer) {
 | 
			
		||||
	s.RegisterService(&_UserService_serviceDesc, srv)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
var _Service_serviceDesc = grpc.ServiceDesc{
 | 
			
		||||
	ServiceName: "user.Service",
 | 
			
		||||
	HandlerType: (*ServiceServer)(nil),
 | 
			
		||||
var _UserService_serviceDesc = grpc.ServiceDesc{
 | 
			
		||||
	ServiceName: "pb.UserService",
 | 
			
		||||
	HandlerType: (*UserServiceServer)(nil),
 | 
			
		||||
	Methods:     []grpc.MethodDesc{},
 | 
			
		||||
	Streams:     []grpc.StreamDesc{},
 | 
			
		||||
	Metadata:    "user/service.proto",
 | 
			
		||||
	Metadata:    "service_user.proto",
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										10
									
								
								internal/rpc/protos/model_cluster.proto
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								internal/rpc/protos/model_cluster.proto
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,10 @@
 | 
			
		||||
syntax = "proto3";
 | 
			
		||||
option go_package = "./pb";
 | 
			
		||||
 | 
			
		||||
package pb;
 | 
			
		||||
 | 
			
		||||
message Cluster {
 | 
			
		||||
	int64 id = 1;
 | 
			
		||||
	string name = 2;
 | 
			
		||||
	int64 createdAt = 3;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										13
									
								
								internal/rpc/protos/model_node.proto
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								internal/rpc/protos/model_node.proto
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,13 @@
 | 
			
		||||
syntax = "proto3";
 | 
			
		||||
option go_package = "./pb";
 | 
			
		||||
 | 
			
		||||
package pb;
 | 
			
		||||
 | 
			
		||||
import "model_cluster.proto";
 | 
			
		||||
 | 
			
		||||
message Node {
 | 
			
		||||
	int64 id = 1;
 | 
			
		||||
	string name = 2;
 | 
			
		||||
 | 
			
		||||
	Cluster cluster = 32;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										119
									
								
								internal/rpc/protos/service_admin.proto
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										119
									
								
								internal/rpc/protos/service_admin.proto
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,119 @@
 | 
			
		||||
syntax = "proto3";
 | 
			
		||||
option go_package = "./pb";
 | 
			
		||||
 | 
			
		||||
package pb;
 | 
			
		||||
 | 
			
		||||
import "model_cluster.proto";
 | 
			
		||||
import "model_node.proto";
 | 
			
		||||
 | 
			
		||||
service AdminService {
 | 
			
		||||
	// 登录
 | 
			
		||||
	rpc login (AdminLoginRequest) returns (AdminLoginResponse) {
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// 创建操作日志
 | 
			
		||||
	rpc createLog (AdminCreateLogRequest) returns (AdminCreateLogResponse) {
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// 检查管理员是否存在
 | 
			
		||||
	rpc checkAdminExists (AdminCheckAdminExistsRequest) returns (AdminCheckAdminExistsResponse) {
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// 获取管理员名称
 | 
			
		||||
	rpc findAdminFullname (AdminFindAdminNameRequest) returns (AdminFindAdminNameResponse) {
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// 获取所有集群的信息
 | 
			
		||||
	rpc findAllEnabledClusters (AdminFindAllEnabledClustersRequest) returns (AdminFindAllEnabledClustersResponse) {
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// 创建节点
 | 
			
		||||
	rpc createNode (AdminCreateNodeRequest) returns (AdminCreateNodeResponse) {
 | 
			
		||||
	};
 | 
			
		||||
 | 
			
		||||
	// 节点数量
 | 
			
		||||
	rpc countAllEnabledNodes (AdminCountAllEnabledNodesRequest) returns (AdminCountAllEnabledNodesResponse) {
 | 
			
		||||
	};
 | 
			
		||||
 | 
			
		||||
	// 列出单页节点
 | 
			
		||||
	rpc listEnabledNodes (AdminListEnabledNodesRequest) returns (AdminListEnabledNodesResponse) {
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
message AdminLoginRequest {
 | 
			
		||||
	string username = 1;
 | 
			
		||||
	string password = 2;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
message AdminLoginResponse {
 | 
			
		||||
	int64 adminId = 1;
 | 
			
		||||
	bool isOk = 2;
 | 
			
		||||
	string message = 3;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
message AdminCreateLogRequest {
 | 
			
		||||
	string level = 1;
 | 
			
		||||
	string description = 2;
 | 
			
		||||
	string action = 3;
 | 
			
		||||
	string ip = 4;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
message AdminCreateLogResponse {
 | 
			
		||||
	bool isOk = 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
message AdminCheckAdminExistsRequest {
 | 
			
		||||
	int64 adminId = 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
message AdminCheckAdminExistsResponse {
 | 
			
		||||
	bool isOk = 1;
 | 
			
		||||
	string message = 2;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
message AdminFindAdminNameRequest {
 | 
			
		||||
	int64 adminId = 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
message AdminFindAdminNameResponse {
 | 
			
		||||
	string fullname = 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
message AdminFindAllEnabledClustersRequest {
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
message AdminFindAllEnabledClustersResponse {
 | 
			
		||||
	repeated Cluster clusters = 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 创建节点
 | 
			
		||||
message AdminCreateNodeRequest {
 | 
			
		||||
	string name = 1;
 | 
			
		||||
	int64 clusterId = 2;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
message AdminCreateNodeResponse {
 | 
			
		||||
	int64 nodeId = 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 节点数量
 | 
			
		||||
message AdminCountAllEnabledNodesRequest {
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
message AdminCountAllEnabledNodesResponse {
 | 
			
		||||
	int64 count = 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 列出单页节点
 | 
			
		||||
message AdminListEnabledNodesRequest {
 | 
			
		||||
	int64 offset = 1;
 | 
			
		||||
	int64 size = 2;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
message AdminListEnabledNodesResponse {
 | 
			
		||||
	repeated Node nodes = 1;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										9
									
								
								internal/rpc/protos/service_dns.proto
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								internal/rpc/protos/service_dns.proto
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,9 @@
 | 
			
		||||
syntax = "proto3";
 | 
			
		||||
 | 
			
		||||
package pb;
 | 
			
		||||
 | 
			
		||||
option go_package = "./pb";
 | 
			
		||||
 | 
			
		||||
service DnsService {
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										9
									
								
								internal/rpc/protos/service_log.proto
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								internal/rpc/protos/service_log.proto
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,9 @@
 | 
			
		||||
syntax = "proto3";
 | 
			
		||||
 | 
			
		||||
package pb;
 | 
			
		||||
 | 
			
		||||
option go_package = "./pb";
 | 
			
		||||
 | 
			
		||||
service LogService {
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										9
									
								
								internal/rpc/protos/service_monitor.proto
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								internal/rpc/protos/service_monitor.proto
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,9 @@
 | 
			
		||||
syntax = "proto3";
 | 
			
		||||
 | 
			
		||||
package pb;
 | 
			
		||||
 | 
			
		||||
option go_package = "./pb";
 | 
			
		||||
 | 
			
		||||
service MonitorService {
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -1,10 +1,10 @@
 | 
			
		||||
syntax = "proto3";
 | 
			
		||||
 | 
			
		||||
package node;
 | 
			
		||||
package pb;
 | 
			
		||||
 | 
			
		||||
option go_package = "./node";
 | 
			
		||||
option go_package = "./pb";
 | 
			
		||||
 | 
			
		||||
service Service {
 | 
			
		||||
service NodeService {
 | 
			
		||||
	rpc config (ConfigRequest) returns (ConfigResponse) {
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
							
								
								
									
										9
									
								
								internal/rpc/protos/service_provider.proto
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								internal/rpc/protos/service_provider.proto
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,9 @@
 | 
			
		||||
syntax = "proto3";
 | 
			
		||||
 | 
			
		||||
package pb;
 | 
			
		||||
 | 
			
		||||
option go_package = "./pb";
 | 
			
		||||
 | 
			
		||||
service ProviderService {
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										9
									
								
								internal/rpc/protos/service_stat.proto
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								internal/rpc/protos/service_stat.proto
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,9 @@
 | 
			
		||||
syntax = "proto3";
 | 
			
		||||
 | 
			
		||||
package pb;
 | 
			
		||||
 | 
			
		||||
option go_package = "./pb";
 | 
			
		||||
 | 
			
		||||
service StatService {
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										8
									
								
								internal/rpc/protos/service_user.proto
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								internal/rpc/protos/service_user.proto
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,8 @@
 | 
			
		||||
syntax = "proto3";
 | 
			
		||||
option go_package = "./pb";
 | 
			
		||||
 | 
			
		||||
package pb;
 | 
			
		||||
 | 
			
		||||
service UserService {
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -1,112 +0,0 @@
 | 
			
		||||
// Code generated by protoc-gen-go. DO NOT EDIT.
 | 
			
		||||
// versions:
 | 
			
		||||
// 	protoc-gen-go v1.25.0
 | 
			
		||||
// 	protoc        v3.12.3
 | 
			
		||||
// source: provider/provider.proto
 | 
			
		||||
 | 
			
		||||
package provider
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	context "context"
 | 
			
		||||
	proto "github.com/golang/protobuf/proto"
 | 
			
		||||
	grpc "google.golang.org/grpc"
 | 
			
		||||
	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)
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// This is a compile-time assertion that a sufficiently up-to-date version
 | 
			
		||||
// of the legacy proto package is being used.
 | 
			
		||||
const _ = proto.ProtoPackageIsVersion4
 | 
			
		||||
 | 
			
		||||
var File_provider_provider_proto protoreflect.FileDescriptor
 | 
			
		||||
 | 
			
		||||
var file_provider_provider_proto_rawDesc = []byte{
 | 
			
		||||
	0x0a, 0x17, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x2f, 0x70, 0x72, 0x6f, 0x76, 0x69,
 | 
			
		||||
	0x64, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x08, 0x70, 0x72, 0x6f, 0x76, 0x69,
 | 
			
		||||
	0x64, 0x65, 0x72, 0x32, 0x09, 0x0a, 0x07, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x42, 0x0c,
 | 
			
		||||
	0x5a, 0x0a, 0x2e, 0x2f, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72,
 | 
			
		||||
	0x6f, 0x74, 0x6f, 0x33,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
var file_provider_provider_proto_goTypes = []interface{}{}
 | 
			
		||||
var file_provider_provider_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_provider_provider_proto_init() }
 | 
			
		||||
func file_provider_provider_proto_init() {
 | 
			
		||||
	if File_provider_provider_proto != nil {
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	type x struct{}
 | 
			
		||||
	out := protoimpl.TypeBuilder{
 | 
			
		||||
		File: protoimpl.DescBuilder{
 | 
			
		||||
			GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
 | 
			
		||||
			RawDescriptor: file_provider_provider_proto_rawDesc,
 | 
			
		||||
			NumEnums:      0,
 | 
			
		||||
			NumMessages:   0,
 | 
			
		||||
			NumExtensions: 0,
 | 
			
		||||
			NumServices:   1,
 | 
			
		||||
		},
 | 
			
		||||
		GoTypes:           file_provider_provider_proto_goTypes,
 | 
			
		||||
		DependencyIndexes: file_provider_provider_proto_depIdxs,
 | 
			
		||||
	}.Build()
 | 
			
		||||
	File_provider_provider_proto = out.File
 | 
			
		||||
	file_provider_provider_proto_rawDesc = nil
 | 
			
		||||
	file_provider_provider_proto_goTypes = nil
 | 
			
		||||
	file_provider_provider_proto_depIdxs = nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Reference imports to suppress errors if they are not otherwise used.
 | 
			
		||||
var _ context.Context
 | 
			
		||||
var _ grpc.ClientConnInterface
 | 
			
		||||
 | 
			
		||||
// This is a compile-time assertion to ensure that this generated file
 | 
			
		||||
// is compatible with the grpc package it is being compiled against.
 | 
			
		||||
const _ = grpc.SupportPackageIsVersion6
 | 
			
		||||
 | 
			
		||||
// ServiceClient is the client API for Service service.
 | 
			
		||||
//
 | 
			
		||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
 | 
			
		||||
type ServiceClient interface {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type serviceClient struct {
 | 
			
		||||
	cc grpc.ClientConnInterface
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func NewServiceClient(cc grpc.ClientConnInterface) ServiceClient {
 | 
			
		||||
	return &serviceClient{cc}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ServiceServer is the server API for Service service.
 | 
			
		||||
type ServiceServer interface {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// UnimplementedServiceServer can be embedded to have forward compatible implementations.
 | 
			
		||||
type UnimplementedServiceServer struct {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func RegisterServiceServer(s *grpc.Server, srv ServiceServer) {
 | 
			
		||||
	s.RegisterService(&_Service_serviceDesc, srv)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
var _Service_serviceDesc = grpc.ServiceDesc{
 | 
			
		||||
	ServiceName: "provider.Service",
 | 
			
		||||
	HandlerType: (*ServiceServer)(nil),
 | 
			
		||||
	Methods:     []grpc.MethodDesc{},
 | 
			
		||||
	Streams:     []grpc.StreamDesc{},
 | 
			
		||||
	Metadata:    "provider/provider.proto",
 | 
			
		||||
}
 | 
			
		||||
@@ -1,9 +0,0 @@
 | 
			
		||||
syntax = "proto3";
 | 
			
		||||
 | 
			
		||||
package provider;
 | 
			
		||||
 | 
			
		||||
option go_package = "./provider";
 | 
			
		||||
 | 
			
		||||
service Service {
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -1,4 +0,0 @@
 | 
			
		||||
package provider
 | 
			
		||||
 | 
			
		||||
type Service struct {
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										270
									
								
								internal/rpc/services/service_admin.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										270
									
								
								internal/rpc/services/service_admin.go
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,270 @@
 | 
			
		||||
package services
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"context"
 | 
			
		||||
	"encoding/base64"
 | 
			
		||||
	"encoding/json"
 | 
			
		||||
	"errors"
 | 
			
		||||
	teaconst "github.com/TeaOSLab/EdgeAPI/internal/const"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeAPI/internal/db/models"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeAPI/internal/encrypt"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeAPI/internal/rpc/pb"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeAPI/internal/utils"
 | 
			
		||||
	"github.com/iwind/TeaGo/maps"
 | 
			
		||||
	"google.golang.org/grpc/metadata"
 | 
			
		||||
	"time"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type AdminService struct {
 | 
			
		||||
	debug bool
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (this *AdminService) Login(ctx context.Context, req *pb.AdminLoginRequest) (*pb.AdminLoginResponse, error) {
 | 
			
		||||
	_, err := this.validateRequest(ctx)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if len(req.Username) == 0 || len(req.Password) == 0 {
 | 
			
		||||
		return &pb.AdminLoginResponse{
 | 
			
		||||
			AdminId: 0,
 | 
			
		||||
			IsOk:    false,
 | 
			
		||||
			Message: "请输入正确的用户名密码",
 | 
			
		||||
		}, nil
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	adminId, err := models.SharedAdminDAO.CheckAdminPassword(req.Username, req.Password)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		utils.PrintError(err)
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if adminId <= 0 {
 | 
			
		||||
		return &pb.AdminLoginResponse{
 | 
			
		||||
			AdminId: 0,
 | 
			
		||||
			IsOk:    false,
 | 
			
		||||
			Message: "请输入正确的用户名密码",
 | 
			
		||||
		}, nil
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return &pb.AdminLoginResponse{
 | 
			
		||||
		AdminId: int64(adminId),
 | 
			
		||||
		IsOk:    true,
 | 
			
		||||
	}, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (this *AdminService) CreateLog(ctx context.Context, req *pb.AdminCreateLogRequest) (*pb.AdminCreateLogResponse, error) {
 | 
			
		||||
	adminId, err := this.validateAdminRequest(ctx)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
	err = models.SharedLogDAO.CreateAdminLog(adminId, req.Level, req.Description, req.Action, req.Ip)
 | 
			
		||||
	return &pb.AdminCreateLogResponse{
 | 
			
		||||
		IsOk: err != nil,
 | 
			
		||||
	}, err
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (this *AdminService) CheckAdminExists(ctx context.Context, req *pb.AdminCheckAdminExistsRequest) (*pb.AdminCheckAdminExistsResponse, error) {
 | 
			
		||||
	_, err := this.validateRequest(ctx)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if req.AdminId <= 0 {
 | 
			
		||||
		return &pb.AdminCheckAdminExistsResponse{
 | 
			
		||||
			IsOk: false,
 | 
			
		||||
		}, nil
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	ok, err := models.SharedAdminDAO.ExistEnabledAdmin(int(req.AdminId))
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return &pb.AdminCheckAdminExistsResponse{
 | 
			
		||||
		IsOk: ok,
 | 
			
		||||
	}, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (this *AdminService) FindAdminFullname(ctx context.Context, req *pb.AdminFindAdminNameRequest) (*pb.AdminFindAdminNameResponse, error) {
 | 
			
		||||
	_, err := this.validateRequest(ctx)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	fullname, err := models.SharedAdminDAO.FindAdminFullname(int(req.AdminId))
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		utils.PrintError(err)
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return &pb.AdminFindAdminNameResponse{
 | 
			
		||||
		Fullname: fullname,
 | 
			
		||||
	}, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (this *AdminService) FindAllEnabledClusters(ctx context.Context, req *pb.AdminFindAllEnabledClustersRequest) (*pb.AdminFindAllEnabledClustersResponse, error) {
 | 
			
		||||
	_ = req
 | 
			
		||||
 | 
			
		||||
	_, err := this.validateAdminRequest(ctx)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	clusters, err := models.SharedNodeClusterDAO.FindAllEnableClusters()
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	result := []*pb.Cluster{}
 | 
			
		||||
	for _, cluster := range clusters {
 | 
			
		||||
		result = append(result, &pb.Cluster{
 | 
			
		||||
			Id:        int64(cluster.Id),
 | 
			
		||||
			Name:      cluster.Name,
 | 
			
		||||
			CreatedAt: int64(cluster.CreatedAt),
 | 
			
		||||
		})
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return &pb.AdminFindAllEnabledClustersResponse{
 | 
			
		||||
		Clusters: result,
 | 
			
		||||
	}, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (this *AdminService) CreateNode(ctx context.Context, req *pb.AdminCreateNodeRequest) (*pb.AdminCreateNodeResponse, error) {
 | 
			
		||||
	_, err := this.validateAdminRequest(ctx)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	nodeId, err := models.SharedNodeDAO.CreateNode(req.Name, int(req.ClusterId))
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return &pb.AdminCreateNodeResponse{
 | 
			
		||||
		NodeId: int64(nodeId),
 | 
			
		||||
	}, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (this *AdminService) CountAllEnabledNodes(ctx context.Context, req *pb.AdminCountAllEnabledNodesRequest) (*pb.AdminCountAllEnabledNodesResponse, error) {
 | 
			
		||||
	_, err := this.validateAdminRequest(ctx)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
	count, err := models.SharedNodeDAO.CountAllEnabledNodes()
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return &pb.AdminCountAllEnabledNodesResponse{Count: count}, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (this *AdminService) ListEnabledNodes(ctx context.Context, req *pb.AdminListEnabledNodesRequest) (*pb.AdminListEnabledNodesResponse, error) {
 | 
			
		||||
	_, err := this.validateAdminRequest(ctx)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
	nodes, err := models.SharedNodeDAO.ListEnabledNodes(req.Offset, req.Size)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
	result := []*pb.Node{}
 | 
			
		||||
	for _, node := range nodes {
 | 
			
		||||
		// 集群信息
 | 
			
		||||
		clusterName, err := models.SharedNodeClusterDAO.FindNodeClusterName(int64(node.ClusterId))
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			return nil, err
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		result = append(result, &pb.Node{
 | 
			
		||||
			Id:   int64(node.Id),
 | 
			
		||||
			Name: node.Name,
 | 
			
		||||
			Cluster: &pb.Cluster{
 | 
			
		||||
				Id:   int64(node.ClusterId),
 | 
			
		||||
				Name: clusterName,
 | 
			
		||||
			},
 | 
			
		||||
		})
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return &pb.AdminListEnabledNodesResponse{
 | 
			
		||||
		Nodes: result,
 | 
			
		||||
	}, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (this *AdminService) validateRequest(ctx context.Context) (adminId int, err error) {
 | 
			
		||||
	var md metadata.MD
 | 
			
		||||
	var ok bool
 | 
			
		||||
	if this.debug {
 | 
			
		||||
		md, ok = metadata.FromOutgoingContext(ctx)
 | 
			
		||||
	} else {
 | 
			
		||||
		md, ok = metadata.FromIncomingContext(ctx)
 | 
			
		||||
	}
 | 
			
		||||
	if !ok {
 | 
			
		||||
		return 0, errors.New("context: need 'nodeId'")
 | 
			
		||||
	}
 | 
			
		||||
	nodeIds := md.Get("nodeid")
 | 
			
		||||
	if len(nodeIds) == 0 || len(nodeIds[0]) == 0 {
 | 
			
		||||
		return 0, errors.New("context: need 'nodeId'")
 | 
			
		||||
	}
 | 
			
		||||
	nodeId := nodeIds[0]
 | 
			
		||||
 | 
			
		||||
	// 获取Node信息
 | 
			
		||||
	apiToken, err := models.SharedApiTokenDAO.FindEnabledTokenWithNode(nodeId)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		utils.PrintError(err)
 | 
			
		||||
		return 0, err
 | 
			
		||||
	}
 | 
			
		||||
	if apiToken == nil {
 | 
			
		||||
		return 0, errors.New("can not find token from node id: " + err.Error())
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	tokens := md.Get("token")
 | 
			
		||||
	if len(tokens) == 0 || len(tokens[0]) == 0 {
 | 
			
		||||
		return 0, errors.New("context: need 'token'")
 | 
			
		||||
	}
 | 
			
		||||
	token := tokens[0]
 | 
			
		||||
 | 
			
		||||
	data, err := base64.StdEncoding.DecodeString(token)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return 0, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	method, err := encrypt.NewMethodInstance(teaconst.EncryptMethod, apiToken.Secret, nodeId)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		utils.PrintError(err)
 | 
			
		||||
		return 0, err
 | 
			
		||||
	}
 | 
			
		||||
	data, err = method.Decrypt(data)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return 0, err
 | 
			
		||||
	}
 | 
			
		||||
	if len(data) == 0 {
 | 
			
		||||
		return 0, errors.New("invalid token")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	m := maps.Map{}
 | 
			
		||||
	err = json.Unmarshal(data, &m)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return 0, errors.New("decode token error: " + err.Error())
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	timestamp := m.GetInt64("timestamp")
 | 
			
		||||
	if time.Now().Unix()-timestamp > 600 {
 | 
			
		||||
		// 请求超过10分钟认为超时
 | 
			
		||||
		return 0, errors.New("authenticate timeout")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	adminId = m.GetInt("adminId")
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (this *AdminService) validateAdminRequest(ctx context.Context) (adminId int, err error) {
 | 
			
		||||
	adminId, err = this.validateRequest(ctx)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return 0, err
 | 
			
		||||
	}
 | 
			
		||||
	if adminId <= 0 {
 | 
			
		||||
		return 0, errors.New("invalid admin id")
 | 
			
		||||
	}
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
@@ -1,10 +1,11 @@
 | 
			
		||||
package admin
 | 
			
		||||
package services
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"context"
 | 
			
		||||
	"encoding/base64"
 | 
			
		||||
	teaconst "github.com/TeaOSLab/EdgeAPI/internal/const"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeAPI/internal/encrypt"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeAPI/internal/rpc/pb"
 | 
			
		||||
	"github.com/iwind/TeaGo/assert"
 | 
			
		||||
	"github.com/iwind/TeaGo/maps"
 | 
			
		||||
	stringutil "github.com/iwind/TeaGo/utils/string"
 | 
			
		||||
@@ -13,12 +14,12 @@ import (
 | 
			
		||||
	"time"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func TestService_Login(t *testing.T) {
 | 
			
		||||
func TestAdminService_Login(t *testing.T) {
 | 
			
		||||
	a := assert.NewAssertion(t)
 | 
			
		||||
	service := &Service{
 | 
			
		||||
	service := &AdminService{
 | 
			
		||||
		debug: true,
 | 
			
		||||
	}
 | 
			
		||||
	resp, err := service.Login(testCtx(t), &LoginRequest{
 | 
			
		||||
	resp, err := service.Login(testCtx(t), &pb.AdminLoginRequest{
 | 
			
		||||
		Username: "admin",
 | 
			
		||||
		Password: stringutil.Md5("123456"),
 | 
			
		||||
	})
 | 
			
		||||
@@ -28,10 +29,10 @@ func TestService_Login(t *testing.T) {
 | 
			
		||||
	a.LogJSON(resp)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func TestService_CreateLog(t *testing.T) {
 | 
			
		||||
	service := &Service{debug: true}
 | 
			
		||||
func TestAdminService_CreateLog(t *testing.T) {
 | 
			
		||||
	service := &AdminService{debug: true}
 | 
			
		||||
 | 
			
		||||
	resp, err := service.CreateLog(testCtx(t), &CreateLogRequest{
 | 
			
		||||
	resp, err := service.CreateLog(testCtx(t), &pb.AdminCreateLogRequest{
 | 
			
		||||
		Level:       "info",
 | 
			
		||||
		Description: "这是一个测试日志",
 | 
			
		||||
		Action:      "/login",
 | 
			
		||||
@@ -43,6 +44,17 @@ func TestService_CreateLog(t *testing.T) {
 | 
			
		||||
	t.Log(resp)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func TestAdminService_FindAllEnabledClusters(t *testing.T) {
 | 
			
		||||
	service := &AdminService{
 | 
			
		||||
		debug: true,
 | 
			
		||||
	}
 | 
			
		||||
	resp, err := service.FindAllEnabledClusters(testCtx(t), &pb.AdminFindAllEnabledClustersRequest{})
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		t.Fatal(err)
 | 
			
		||||
	}
 | 
			
		||||
	t.Log(resp)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func testCtx(t *testing.T) context.Context {
 | 
			
		||||
	ctx := context.Background()
 | 
			
		||||
	nodeId := "H6sjDf779jimnVPnBFSgZxvr6Ca0wQ0z"
 | 
			
		||||
							
								
								
									
										4
									
								
								internal/rpc/services/service_dns.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								internal/rpc/services/service_dns.go
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,4 @@
 | 
			
		||||
package services
 | 
			
		||||
 | 
			
		||||
type DNSService struct {
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										4
									
								
								internal/rpc/services/service_log.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								internal/rpc/services/service_log.go
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,4 @@
 | 
			
		||||
package services
 | 
			
		||||
 | 
			
		||||
type LogService struct {
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										4
									
								
								internal/rpc/services/service_monitor.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								internal/rpc/services/service_monitor.go
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,4 @@
 | 
			
		||||
package services
 | 
			
		||||
 | 
			
		||||
type MonitorService struct {
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										17
									
								
								internal/rpc/services/service_node.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								internal/rpc/services/service_node.go
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,17 @@
 | 
			
		||||
package services
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"context"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeAPI/internal/rpc/pb"
 | 
			
		||||
	"github.com/iwind/TeaGo/logs"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type NodeService struct {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (this *NodeService) Config(ctx context.Context, req *pb.ConfigRequest) (*pb.ConfigResponse, error) {
 | 
			
		||||
	logs.Println("you called me")
 | 
			
		||||
	return &pb.ConfigResponse{
 | 
			
		||||
		Id: req.NodeId,
 | 
			
		||||
	}, nil
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										4
									
								
								internal/rpc/services/service_provider.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								internal/rpc/services/service_provider.go
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,4 @@
 | 
			
		||||
package services
 | 
			
		||||
 | 
			
		||||
type ProviderService struct {
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										4
									
								
								internal/rpc/services/service_stat.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								internal/rpc/services/service_stat.go
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,4 @@
 | 
			
		||||
package services
 | 
			
		||||
 | 
			
		||||
type StatService struct {
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										4
									
								
								internal/rpc/services/service_user.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								internal/rpc/services/service_user.go
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,4 @@
 | 
			
		||||
package services
 | 
			
		||||
 | 
			
		||||
type UserService struct {
 | 
			
		||||
}
 | 
			
		||||
@@ -1,4 +0,0 @@
 | 
			
		||||
package stat
 | 
			
		||||
 | 
			
		||||
type Service struct {
 | 
			
		||||
}
 | 
			
		||||
@@ -1,9 +0,0 @@
 | 
			
		||||
syntax = "proto3";
 | 
			
		||||
 | 
			
		||||
package stat;
 | 
			
		||||
 | 
			
		||||
option go_package = "./stat";
 | 
			
		||||
 | 
			
		||||
service Service {
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -1,4 +0,0 @@
 | 
			
		||||
package user
 | 
			
		||||
 | 
			
		||||
type Service struct {
 | 
			
		||||
}
 | 
			
		||||
@@ -1,9 +0,0 @@
 | 
			
		||||
syntax = "proto3";
 | 
			
		||||
 | 
			
		||||
package user;
 | 
			
		||||
 | 
			
		||||
option go_package = "./user";
 | 
			
		||||
 | 
			
		||||
service Service {
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -3,8 +3,8 @@ package tests
 | 
			
		||||
import (
 | 
			
		||||
	"context"
 | 
			
		||||
	"encoding/json"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeAPI/internal/rpc/admin"
 | 
			
		||||
	nodepb "github.com/TeaOSLab/EdgeAPI/internal/rpc/node"
 | 
			
		||||
	pb2 "github.com/TeaOSLab/EdgeAPI/internal/rpc/pb"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeAPI/internal/rpc/services"
 | 
			
		||||
	pb "github.com/TeaOSLab/EdgeAPI/internal/tests/helloworld"
 | 
			
		||||
	"google.golang.org/grpc"
 | 
			
		||||
	"google.golang.org/grpc/credentials"
 | 
			
		||||
@@ -42,8 +42,7 @@ func TestTCPServer(t *testing.T) {
 | 
			
		||||
 | 
			
		||||
	s := grpc.NewServer()
 | 
			
		||||
	pb.RegisterGreeterServer(s, &server{})
 | 
			
		||||
	nodepb.RegisterServiceServer(s, &nodepb.Service{})
 | 
			
		||||
	admin.RegisterServiceServer(s, &admin.Service{})
 | 
			
		||||
	pb2.RegisterNodeServiceServer(s, &services.NodeService{})
 | 
			
		||||
 | 
			
		||||
	err = s.Serve(listener)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
@@ -85,13 +84,13 @@ func TestTCPClient_Node(t *testing.T) {
 | 
			
		||||
		_ = conn.Close()
 | 
			
		||||
	}()
 | 
			
		||||
 | 
			
		||||
	c := nodepb.NewServiceClient(conn)
 | 
			
		||||
	c := pb2.NewNodeServiceClient(conn)
 | 
			
		||||
 | 
			
		||||
	before := time.Now()
 | 
			
		||||
 | 
			
		||||
	ctx := context.Background()
 | 
			
		||||
	ctx = metadata.AppendToOutgoingContext(ctx, "name", "liu", "age", "20")
 | 
			
		||||
	reply, err := c.Config(ctx, &nodepb.ConfigRequest{
 | 
			
		||||
	reply, err := c.Config(ctx, &pb2.ConfigRequest{
 | 
			
		||||
	})
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		t.Fatal(err)
 | 
			
		||||
 
 | 
			
		||||
@@ -2,9 +2,19 @@ package tests
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"github.com/iwind/TeaGo/rands"
 | 
			
		||||
	"math"
 | 
			
		||||
	"net/url"
 | 
			
		||||
	"testing"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func TestRandString(t *testing.T) {
 | 
			
		||||
	t.Log(rands.HexString(32))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func TestCharset(t *testing.T) {
 | 
			
		||||
	t.Log(url.QueryEscape("中文"))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func TestInt(t *testing.T) {
 | 
			
		||||
	t.Log(math.MaxInt64)
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user