阶段性提交

This commit is contained in:
刘祥超
2020-08-21 12:32:16 +08:00
parent d15ff6b246
commit 145f0580fb
181 changed files with 4897 additions and 218 deletions

View File

@@ -0,0 +1,23 @@
package nodes
// 节点状态
type NodeStatus struct {
Hostname string `json:"hostname"`
HostIP string `json:"hostIP"`
CPUUsage float64 `json:"cpuUsage"`
CPULogicalCount int `json:"cpuLogicalCount"`
CPUPhysicalCount int `json:"cpuPhysicalCount"`
MemoryUsage float64 `json:"memoryUsage"`
MemoryTotal uint64 `json:"memoryTotal"`
DiskUsage float64 `json:"diskUsage"`
DiskMaxUsage float64 `json:"diskMaxUsage"`
DiskMaxUsagePartition string `json:"diskMaxUsagePartition"`
DiskTotal uint64 `json:"diskTotal"`
UpdatedAt int64 `json:"updatedAt"`
Load1m float64 `json:"load1m"`
Load5m float64 `json:"load5m"`
Load15m float64 `json:"load15m"`
IsActive bool `json:"isActive"`
Error string `json:"error"`
}

View File

@@ -1,13 +0,0 @@
package nodes
import "encoding/json"
type ServerConfig struct {
Id string `json:"id" yaml:"id"`
IsOn bool `json:"isOn" yaml:"isOn"`
Name string `json:"name" yaml:"name"`
}
func (this *ServerConfig) AsJSON() ([]byte, error) {
return json.Marshal(this)
}

View File

@@ -0,0 +1,4 @@
package serverconfigs
type ComponentConfig struct {
}

View File

@@ -0,0 +1,4 @@
package serverconfigs
type FilterConfig struct {
}

View File

@@ -0,0 +1,8 @@
package serverconfigs
type IPVersion = string
const (
IPv4 IPVersion = "4"
IPv6 IPVersion = "6"
)

View File

@@ -0,0 +1,4 @@
package serverconfigs
type LocationConfig struct {
}

View File

@@ -0,0 +1,5 @@
package serverconfigs
import "sync"
var sharedLocker = &sync.RWMutex{}

View File

@@ -0,0 +1,70 @@
package serverconfigs
import (
"github.com/iwind/TeaGo/types"
"regexp"
"strconv"
"strings"
)
var regexpSinglePort = regexp.MustCompile(`^\d+$`)
// 网络地址配置
type NetworkAddressConfig struct {
Protocol string `yaml:"protocol" json:"protocol"` // 协议http、tcp、tcp4、tcp6、unix、udp等
Host string `yaml:"host" json:"host"` // 主机地址或主机名
PortRange string `yaml:"portRange" json:"portRange"` // 端口范围,支持 8080、8080-8090、8080:8090
minPort int
maxPort int
}
func (this *NetworkAddressConfig) Init() error {
// 8080
if regexpSinglePort.MatchString(this.PortRange) {
this.minPort = types.Int(this.PortRange)
this.maxPort = this.minPort
return nil
}
// 8080:8090
if strings.Contains(this.PortRange, ":") {
pieces := strings.SplitN(this.PortRange, ":", 2)
minPort := types.Int(pieces[0])
maxPort := types.Int(pieces[1])
if minPort > maxPort {
minPort, maxPort = maxPort, minPort
}
this.minPort = minPort
this.maxPort = maxPort
return nil
}
// 8080-8090
if strings.Contains(this.PortRange, "-") {
pieces := strings.SplitN(this.PortRange, "-", 2)
minPort := types.Int(pieces[0])
maxPort := types.Int(pieces[1])
if minPort > maxPort {
minPort, maxPort = maxPort, minPort
}
this.minPort = minPort
this.maxPort = maxPort
return nil
}
return nil
}
func (this *NetworkAddressConfig) FullAddresses() []string {
if this.Protocol == ProtocolUnix {
return []string{this.Protocol + ":" + this.Host}
}
result := []string{}
for i := this.minPort; i <= this.maxPort; i++ {
host := this.Host
result = append(result, this.Protocol+"://"+host+":"+strconv.Itoa(i))
}
return result
}

View File

@@ -0,0 +1,57 @@
package serverconfigs
import "testing"
func TestNetworkAddressConfig_FullAddresses(t *testing.T) {
{
addr := &NetworkAddressConfig{
Protocol: "http",
Host: "127.0.0.1",
PortRange: "8080",
}
err := addr.Init()
if err != nil {
t.Fatal(err)
}
t.Log(addr.FullAddresses())
}
{
addr := &NetworkAddressConfig{
Protocol: "http",
Host: "127.0.0.1",
PortRange: "8080:8090",
}
err := addr.Init()
if err != nil {
t.Fatal(err)
}
t.Log(addr.FullAddresses())
}
{
addr := &NetworkAddressConfig{
Protocol: "http",
Host: "127.0.0.1",
PortRange: "8080-8090",
}
err := addr.Init()
if err != nil {
t.Fatal(err)
}
t.Log(addr.FullAddresses())
}
{
addr := &NetworkAddressConfig{
Protocol: "http",
Host: "127.0.0.1",
PortRange: "8080-8070",
}
err := addr.Init()
if err != nil {
t.Fatal(err)
}
t.Log(addr.FullAddresses())
}
}

View File

@@ -0,0 +1,10 @@
package serverconfigs
// 源站服务配置
type OriginServerConfig struct {
Id string `yaml:"id" json:"id"` // ID
IsOn bool `yaml:"isOn" json:"isOn"` // 是否启用
Name string `yaml:"name" json:"name"` // 名称 TODO
Addr *NetworkAddressConfig `yaml:"addr" json:"addr"` // 地址
Description string `yaml:"description" json:"description"` // 描述 TODO
}

View File

@@ -0,0 +1,6 @@
package serverconfigs
// TODO 需要实现
type OriginServerGroupConfig struct {
Origins []*OriginServerConfig `yaml:"origins" json:"origins"` // 源站列表
}

View File

@@ -0,0 +1,29 @@
package serverconfigs
type Protocol = string
const (
ProtocolHTTP Protocol = "http"
ProtocolHTTPS Protocol = "https"
ProtocolTCP Protocol = "tcp"
ProtocolTLS Protocol = "tls"
ProtocolUnix Protocol = "unix"
ProtocolUDP Protocol = "udp"
// 子协议
ProtocolHTTP4 Protocol = "http4"
ProtocolHTTP6 Protocol = "http6"
ProtocolHTTPS4 Protocol = "https4"
ProtocolHTTPS6 Protocol = "https6"
ProtocolTCP4 Protocol = "tcp4"
ProtocolTCP6 Protocol = "tcp6"
ProtocolTLS4 Protocol = "tls4"
ProtocolTLS6 Protocol = "tls6"
)
func AllProtocols() []Protocol {
return []Protocol{ProtocolHTTP, ProtocolHTTPS, ProtocolTCP, ProtocolTLS, ProtocolUnix, ProtocolUDP, ProtocolHTTP4, ProtocolHTTP6, ProtocolHTTPS4, ProtocolHTTPS6, ProtocolTCP4, ProtocolTCP6, ProtocolTLS4, ProtocolTLS6}
}

View File

@@ -0,0 +1,32 @@
package serverconfigs
// 协议基础数据结构
type BaseProtocol struct {
IsOn bool `yaml:"isOn" json:"isOn"` // 是否开启
Listen []*NetworkAddressConfig `yaml:"listen" json:"listen"` // 绑定的网络地址
}
// 初始化
func (this *BaseProtocol) InitBase() error {
for _, addr := range this.Listen {
err := addr.Init()
if err != nil {
return err
}
}
return nil
}
// 获取完整的地址列表
func (this *BaseProtocol) FullAddresses() []string {
result := []string{}
for _, addr := range this.Listen {
result = append(result, addr.FullAddresses()...)
}
return result
}
// 添加地址
func (this *BaseProtocol) AddListen(addr ...*NetworkAddressConfig) {
this.Listen = append(this.Listen, addr...)
}

View File

@@ -0,0 +1,14 @@
package serverconfigs
type HTTPProtocolConfig struct {
BaseProtocol `yaml:",inline"`
}
func (this *HTTPProtocolConfig) Init() error {
err := this.InitBase()
if err != nil {
return err
}
return nil
}

View File

@@ -0,0 +1,14 @@
package serverconfigs
type HTTPSProtocolConfig struct {
BaseProtocol `yaml:",inline"`
}
func (this *HTTPSProtocolConfig) Init() error {
err := this.InitBase()
if err != nil {
return err
}
return nil
}

View File

@@ -0,0 +1,14 @@
package serverconfigs
type TCPProtocolConfig struct {
BaseProtocol `yaml:",inline"`
}
func (this *TCPProtocolConfig) Init() error {
err := this.InitBase()
if err != nil {
return err
}
return nil
}

View File

@@ -0,0 +1,14 @@
package serverconfigs
type TLSProtocolConfig struct {
BaseProtocol `yaml:",inline"`
}
func (this *TLSProtocolConfig) Init() error {
err := this.InitBase()
if err != nil {
return err
}
return nil
}

View File

@@ -0,0 +1,14 @@
package serverconfigs
type UDPProtocolConfig struct {
BaseProtocol `yaml:",inline"`
}
func (this *UDPProtocolConfig) Init() error {
err := this.InitBase()
if err != nil {
return err
}
return nil
}

View File

@@ -0,0 +1,14 @@
package serverconfigs
type UnixProtocolConfig struct {
BaseProtocol `yaml:",inline"`
}
func (this *UnixProtocolConfig) Init() error {
err := this.InitBase()
if err != nil {
return err
}
return nil
}

View File

@@ -0,0 +1,6 @@
package serverconfigs
type ReverseProxyConfig struct {
IsOn bool `yaml:"isOn" json:"isOn"` // 是否启用
Origins []*OriginServerConfig `yaml:"origins" json:"origins"` // 源站列表
}

View File

@@ -0,0 +1,144 @@
package serverconfigs
import "encoding/json"
type ServerConfig struct {
Id string `yaml:"id" json:"id"` // ID
IsOn bool `yaml:"isOn" json:"isOn"` // 是否开启
Components []*ComponentConfig `yaml:"components" json:"components"` // 组件
Filters []*FilterConfig `yaml:"filters" json:"filters"` // 过滤器
Name string `yaml:"name" json:"name"` // 名称
Description string `yaml:"description" json:"description"` // 描述
ServerNames []*ServerNameConfig `yaml:"serverNames" json:"serverNames"` // 域名
// 前端协议
HTTP *HTTPProtocolConfig `yaml:"http" json:"http"` // HTTP配置
HTTPS *HTTPSProtocolConfig `yaml:"https" json:"https"` // HTTPS配置
TCP *TCPProtocolConfig `yaml:"tcp" json:"tcp"` // TCP配置
TLS *TLSProtocolConfig `yaml:"tls" json:"tls"` // TLS配置
Unix *UnixProtocolConfig `yaml:"unix" json:"unix"` // Unix配置
UDP *UDPProtocolConfig `yaml:"udp" json:"udp"` // UDP配置
// Web配置
Web *WebConfig `yaml:"web" json:"web"`
// 反向代理配置
ReverseProxy *ReverseProxyConfig `yaml:"reverseProxy" json:"reverseProxy"`
}
func NewServerConfig() *ServerConfig {
return &ServerConfig{}
}
func (this *ServerConfig) Init() error {
if this.HTTP != nil {
err := this.HTTP.Init()
if err != nil {
return err
}
}
if this.HTTPS != nil {
err := this.HTTPS.Init()
if err != nil {
return err
}
}
if this.TCP != nil {
err := this.TCP.Init()
if err != nil {
return err
}
}
if this.TLS != nil {
err := this.TLS.Init()
if err != nil {
return err
}
}
if this.Unix != nil {
err := this.Unix.Init()
if err != nil {
return err
}
}
if this.UDP != nil {
err := this.UDP.Init()
if err != nil {
return err
}
}
return nil
}
func (this *ServerConfig) FullAddresses() []string {
result := []Protocol{}
if this.HTTP != nil && this.HTTP.IsOn {
result = append(result, this.HTTP.FullAddresses()...)
}
if this.HTTPS != nil && this.HTTPS.IsOn {
result = append(result, this.HTTPS.FullAddresses()...)
}
if this.TCP != nil && this.TCP.IsOn {
result = append(result, this.TCP.FullAddresses()...)
}
if this.TLS != nil && this.TLS.IsOn {
result = append(result, this.TLS.FullAddresses()...)
}
if this.Unix != nil && this.Unix.IsOn {
result = append(result, this.Unix.FullAddresses()...)
}
if this.UDP != nil && this.UDP.IsOn {
result = append(result, this.UDP.FullAddresses()...)
}
return result
}
func (this *ServerConfig) Listen() []*NetworkAddressConfig {
result := []*NetworkAddressConfig{}
if this.HTTP != nil {
result = append(result, this.HTTP.Listen...)
}
if this.HTTPS != nil {
result = append(result, this.HTTPS.Listen...)
}
if this.TCP != nil {
result = append(result, this.TCP.Listen...)
}
if this.TLS != nil {
result = append(result, this.TLS.Listen...)
}
if this.Unix != nil {
result = append(result, this.Unix.Listen...)
}
if this.UDP != nil {
result = append(result, this.UDP.Listen...)
}
return result
}
func (this *ServerConfig) AsJSON() ([]byte, error) {
return json.Marshal(this)
}
func (this *ServerConfig) IsHTTP() bool {
return this.HTTP != nil || this.HTTPS != nil
}
func (this *ServerConfig) IsTCP() bool {
return this.TCP != nil || this.TLS != nil
}
func (this *ServerConfig) IsUnix() bool {
return this.Unix != nil
}
func (this *ServerConfig) IsUDP() bool {
return this.UDP != nil
}

View File

@@ -0,0 +1,74 @@
package serverconfigs
import "testing"
func TestServerConfig_Protocols(t *testing.T) {
{
server := NewServerConfig()
t.Log(server.FullAddresses())
}
{
server := NewServerConfig()
server.HTTP = &HTTPProtocolConfig{BaseProtocol: BaseProtocol{
IsOn: true,
Listen: []*NetworkAddressConfig{
{
Protocol: ProtocolHTTP,
PortRange: "1234",
},
},
}}
server.HTTPS = &HTTPSProtocolConfig{BaseProtocol: BaseProtocol{
IsOn: true,
Listen: []*NetworkAddressConfig{
{
Protocol: ProtocolUnix,
Host: "/hello.sock",
PortRange: "1235",
},
},
}}
server.TCP = &TCPProtocolConfig{BaseProtocol: BaseProtocol{
IsOn: true,
Listen: []*NetworkAddressConfig{
{
Protocol: ProtocolHTTPS,
PortRange: "1236",
},
},
}}
server.TLS = &TLSProtocolConfig{BaseProtocol: BaseProtocol{
IsOn: true,
Listen: []*NetworkAddressConfig{
{
Protocol: ProtocolTCP,
PortRange: "1234",
},
},
}}
server.Unix = &UnixProtocolConfig{BaseProtocol: BaseProtocol{
IsOn: true,
Listen: []*NetworkAddressConfig{
{
Protocol: ProtocolTLS,
PortRange: "1234",
},
},
}}
server.UDP = &UDPProtocolConfig{BaseProtocol: BaseProtocol{
IsOn: true,
Listen: []*NetworkAddressConfig{
{
Protocol: ProtocolUDP,
PortRange: "1234",
},
},
}}
err := server.Init()
if err != nil {
t.Fatal(err)
}
t.Log(server.FullAddresses())
}
}

View File

@@ -0,0 +1,41 @@
package serverconfigs
import "strings"
type ServerGroup struct {
fullAddr string
Servers []*ServerConfig
}
func NewServerGroup(fullAddr string) *ServerGroup {
return &ServerGroup{fullAddr: fullAddr}
}
// 添加服务
func (this *ServerGroup) Add(server *ServerConfig) {
this.Servers = append(this.Servers, server)
}
// 获取完整的地址
func (this *ServerGroup) FullAddr() string {
return this.fullAddr
}
// 获取当前分组的协议
func (this *ServerGroup) Protocol() Protocol {
for _, p := range AllProtocols() {
if strings.HasPrefix(this.fullAddr, p+":") {
return p
}
}
return ProtocolHTTP
}
// 获取当前分组的地址
func (this *ServerGroup) Addr() string {
protocol := this.Protocol()
if protocol == ProtocolUnix {
return strings.TrimPrefix(this.fullAddr, protocol+":")
}
return strings.TrimPrefix(this.fullAddr, protocol+"://")
}

View File

@@ -0,0 +1,34 @@
package serverconfigs
import (
"github.com/iwind/TeaGo/assert"
"testing"
)
func TestServerGroup_Protocol(t *testing.T) {
a := assert.NewAssertion(t)
{
group := NewServerGroup("tcp://127.0.0.1:1234")
a.IsTrue(group.Protocol() == ProtocolTCP)
a.IsTrue(group.Addr() == "127.0.0.1:1234")
}
{
group := NewServerGroup("http4://127.0.0.1:1234")
a.IsTrue(group.Protocol() == ProtocolHTTP4)
a.IsTrue(group.Addr() == "127.0.0.1:1234")
}
{
group := NewServerGroup("127.0.0.1:1234")
a.IsTrue(group.Protocol() == ProtocolHTTP)
a.IsTrue(group.Addr() == "127.0.0.1:1234")
}
{
group := NewServerGroup("unix:/tmp/my.sock")
a.IsTrue(group.Protocol() == ProtocolUnix)
a.IsTrue(group.Addr() == "/tmp/my.sock")
}
}

View File

@@ -0,0 +1,15 @@
package serverconfigs
type ServerNameType = string
const (
ServerNameTypeFull = "full" // 完整的域名,包含通配符等
ServerNameTypePrefix = "prefix" // 前缀
ServerNameTypeSuffix = "suffix" // 后缀
ServerNameTypeMatch = "match" // 正则匹配
)
type ServerNameConfig struct {
Name string `yaml:"name" json:"name"` // 名称
Type string `yaml:"type" json:"type"` // 类型
}

View File

@@ -0,0 +1,10 @@
package serverconfigs
type WebConfig struct {
IsOn bool `yaml:"isOn" json:"isOn"`
Locations []*LocationConfig `yaml:"locations" json:"locations"` // 路径规则 TODO
// 本地静态资源配置
Root string `yaml:"root" json:"root"` // 资源根目录 TODO
}

View File

@@ -32,6 +32,7 @@ type Node struct {
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
Status string `protobuf:"bytes,3,opt,name=status,proto3" json:"status,omitempty"`
Cluster *NodeCluster `protobuf:"bytes,32,opt,name=cluster,proto3" json:"cluster,omitempty"`
Login *NodeLogin `protobuf:"bytes,33,opt,name=login,proto3" json:"login,omitempty"`
}
@@ -82,6 +83,13 @@ func (x *Node) GetName() string {
return ""
}
func (x *Node) GetStatus() string {
if x != nil {
return x.Status
}
return ""
}
func (x *Node) GetCluster() *NodeCluster {
if x != nil {
return x.Cluster
@@ -103,16 +111,17 @@ var file_model_node_proto_rawDesc = []byte{
0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x1a, 0x18, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x6e, 0x6f,
0x64, 0x65, 0x5f, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x1a, 0x16, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x6c, 0x6f, 0x67,
0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x7a, 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, 0x29, 0x0a, 0x07, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x18,
0x20, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x43,
0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x52, 0x07, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x12,
0x23, 0x0a, 0x05, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x18, 0x21, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d,
0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x05, 0x6c,
0x6f, 0x67, 0x69, 0x6e, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x33,
0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x92, 0x01, 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, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18,
0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x29, 0x0a,
0x07, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x18, 0x20, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f,
0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x52,
0x07, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x12, 0x23, 0x0a, 0x05, 0x6c, 0x6f, 0x67, 0x69,
0x6e, 0x18, 0x21, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x64,
0x65, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x05, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x42, 0x06, 0x5a,
0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (

View File

@@ -620,6 +620,349 @@ func (x *FindEnabledNodeResponse) GetNode() *Node {
return nil
}
// 组合单个节点配置
type ComposeNodeConfigRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *ComposeNodeConfigRequest) Reset() {
*x = ComposeNodeConfigRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_service_node_proto_msgTypes[12]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ComposeNodeConfigRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ComposeNodeConfigRequest) ProtoMessage() {}
func (x *ComposeNodeConfigRequest) ProtoReflect() protoreflect.Message {
mi := &file_service_node_proto_msgTypes[12]
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 ComposeNodeConfigRequest.ProtoReflect.Descriptor instead.
func (*ComposeNodeConfigRequest) Descriptor() ([]byte, []int) {
return file_service_node_proto_rawDescGZIP(), []int{12}
}
type ComposeNodeConfigResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
ConfigJSON []byte `protobuf:"bytes,1,opt,name=configJSON,proto3" json:"configJSON,omitempty"`
}
func (x *ComposeNodeConfigResponse) Reset() {
*x = ComposeNodeConfigResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_service_node_proto_msgTypes[13]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ComposeNodeConfigResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ComposeNodeConfigResponse) ProtoMessage() {}
func (x *ComposeNodeConfigResponse) ProtoReflect() protoreflect.Message {
mi := &file_service_node_proto_msgTypes[13]
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 ComposeNodeConfigResponse.ProtoReflect.Descriptor instead.
func (*ComposeNodeConfigResponse) Descriptor() ([]byte, []int) {
return file_service_node_proto_rawDescGZIP(), []int{13}
}
func (x *ComposeNodeConfigResponse) GetConfigJSON() []byte {
if x != nil {
return x.ConfigJSON
}
return nil
}
// 节点stream
type NodeStreamRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *NodeStreamRequest) Reset() {
*x = NodeStreamRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_service_node_proto_msgTypes[14]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *NodeStreamRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*NodeStreamRequest) ProtoMessage() {}
func (x *NodeStreamRequest) ProtoReflect() protoreflect.Message {
mi := &file_service_node_proto_msgTypes[14]
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 NodeStreamRequest.ProtoReflect.Descriptor instead.
func (*NodeStreamRequest) Descriptor() ([]byte, []int) {
return file_service_node_proto_rawDescGZIP(), []int{14}
}
type NodeStreamResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *NodeStreamResponse) Reset() {
*x = NodeStreamResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_service_node_proto_msgTypes[15]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *NodeStreamResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*NodeStreamResponse) ProtoMessage() {}
func (x *NodeStreamResponse) ProtoReflect() protoreflect.Message {
mi := &file_service_node_proto_msgTypes[15]
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 NodeStreamResponse.ProtoReflect.Descriptor instead.
func (*NodeStreamResponse) Descriptor() ([]byte, []int) {
return file_service_node_proto_rawDescGZIP(), []int{15}
}
// 更新节点状态
type UpdateNodeStatusRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
NodeId int64 `protobuf:"varint,1,opt,name=nodeId,proto3" json:"nodeId,omitempty"`
StatusJSON []byte `protobuf:"bytes,2,opt,name=statusJSON,proto3" json:"statusJSON,omitempty"`
}
func (x *UpdateNodeStatusRequest) Reset() {
*x = UpdateNodeStatusRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_service_node_proto_msgTypes[16]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *UpdateNodeStatusRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*UpdateNodeStatusRequest) ProtoMessage() {}
func (x *UpdateNodeStatusRequest) ProtoReflect() protoreflect.Message {
mi := &file_service_node_proto_msgTypes[16]
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 UpdateNodeStatusRequest.ProtoReflect.Descriptor instead.
func (*UpdateNodeStatusRequest) Descriptor() ([]byte, []int) {
return file_service_node_proto_rawDescGZIP(), []int{16}
}
func (x *UpdateNodeStatusRequest) GetNodeId() int64 {
if x != nil {
return x.NodeId
}
return 0
}
func (x *UpdateNodeStatusRequest) GetStatusJSON() []byte {
if x != nil {
return x.StatusJSON
}
return nil
}
type UpdateNodeStatusResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *UpdateNodeStatusResponse) Reset() {
*x = UpdateNodeStatusResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_service_node_proto_msgTypes[17]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *UpdateNodeStatusResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*UpdateNodeStatusResponse) ProtoMessage() {}
func (x *UpdateNodeStatusResponse) ProtoReflect() protoreflect.Message {
mi := &file_service_node_proto_msgTypes[17]
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 UpdateNodeStatusResponse.ProtoReflect.Descriptor instead.
func (*UpdateNodeStatusResponse) Descriptor() ([]byte, []int) {
return file_service_node_proto_rawDescGZIP(), []int{17}
}
// 同步集群中的节点版本
type SyncNodesVersionWithClusterRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
ClusterId int64 `protobuf:"varint,1,opt,name=clusterId,proto3" json:"clusterId,omitempty"`
}
func (x *SyncNodesVersionWithClusterRequest) Reset() {
*x = SyncNodesVersionWithClusterRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_service_node_proto_msgTypes[18]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *SyncNodesVersionWithClusterRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SyncNodesVersionWithClusterRequest) ProtoMessage() {}
func (x *SyncNodesVersionWithClusterRequest) ProtoReflect() protoreflect.Message {
mi := &file_service_node_proto_msgTypes[18]
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 SyncNodesVersionWithClusterRequest.ProtoReflect.Descriptor instead.
func (*SyncNodesVersionWithClusterRequest) Descriptor() ([]byte, []int) {
return file_service_node_proto_rawDescGZIP(), []int{18}
}
func (x *SyncNodesVersionWithClusterRequest) GetClusterId() int64 {
if x != nil {
return x.ClusterId
}
return 0
}
type SyncNodesVersionWithClusterResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *SyncNodesVersionWithClusterResponse) Reset() {
*x = SyncNodesVersionWithClusterResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_service_node_proto_msgTypes[19]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *SyncNodesVersionWithClusterResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SyncNodesVersionWithClusterResponse) ProtoMessage() {}
func (x *SyncNodesVersionWithClusterResponse) ProtoReflect() protoreflect.Message {
mi := &file_service_node_proto_msgTypes[19]
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 SyncNodesVersionWithClusterResponse.ProtoReflect.Descriptor instead.
func (*SyncNodesVersionWithClusterResponse) Descriptor() ([]byte, []int) {
return file_service_node_proto_rawDescGZIP(), []int{19}
}
var File_service_node_proto protoreflect.FileDescriptor
var file_service_node_proto_rawDesc = []byte{
@@ -670,35 +1013,78 @@ var file_service_node_proto_rawDesc = []byte{
0x6e, 0x6f, 0x64, 0x65, 0x49, 0x64, 0x22, 0x37, 0x0a, 0x17, 0x46, 0x69, 0x6e, 0x64, 0x45, 0x6e,
0x61, 0x62, 0x6c, 0x65, 0x64, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
0x65, 0x12, 0x1c, 0x0a, 0x04, 0x6e, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32,
0x08, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x04, 0x6e, 0x6f, 0x64, 0x65, 0x32,
0xbd, 0x03, 0x0a, 0x0b, 0x4e, 0x6f, 0x64, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12,
0x3b, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x15, 0x2e,
0x70, 0x62, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x71,
0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65,
0x4e, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x59, 0x0a, 0x14,
0x63, 0x6f, 0x75, 0x6e, 0x74, 0x41, 0x6c, 0x6c, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4e,
0x6f, 0x64, 0x65, 0x73, 0x12, 0x1f, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x41,
0x6c, 0x6c, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x52, 0x65,
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x6f, 0x75, 0x6e, 0x74,
0x41, 0x6c, 0x6c, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x52,
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4d, 0x0a, 0x10, 0x6c, 0x69, 0x73, 0x74, 0x45,
0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x1b, 0x2e, 0x70, 0x62,
0x2e, 0x4c, 0x69, 0x73, 0x74, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4e, 0x6f, 0x64, 0x65,
0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x70, 0x62, 0x2e, 0x4c, 0x69,
0x73, 0x74, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x52, 0x65,
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3e, 0x0a, 0x0b, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c,
0x65, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x16, 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x69, 0x73, 0x61, 0x62,
0x6c, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e,
0x70, 0x62, 0x2e, 0x44, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x65,
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3b, 0x0a, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65,
0x4e, 0x6f, 0x64, 0x65, 0x12, 0x15, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65,
0x4e, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x70, 0x62,
0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f,
0x6e, 0x73, 0x65, 0x12, 0x4a, 0x0a, 0x0f, 0x66, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c,
0x65, 0x64, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x1a, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64,
0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65,
0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62,
0x6c, 0x65, 0x64, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42,
0x08, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x04, 0x6e, 0x6f, 0x64, 0x65, 0x22,
0x1a, 0x0a, 0x18, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x73, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x43, 0x6f,
0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x3b, 0x0a, 0x19, 0x43,
0x6f, 0x6d, 0x70, 0x6f, 0x73, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67,
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x6f, 0x6e, 0x66,
0x69, 0x67, 0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x63, 0x6f,
0x6e, 0x66, 0x69, 0x67, 0x4a, 0x53, 0x4f, 0x4e, 0x22, 0x13, 0x0a, 0x11, 0x4e, 0x6f, 0x64, 0x65,
0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x14, 0x0a,
0x12, 0x4e, 0x6f, 0x64, 0x65, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f,
0x6e, 0x73, 0x65, 0x22, 0x51, 0x0a, 0x17, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, 0x6f, 0x64,
0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16,
0x0a, 0x06, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06,
0x6e, 0x6f, 0x64, 0x65, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73,
0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x73, 0x74, 0x61, 0x74,
0x75, 0x73, 0x4a, 0x53, 0x4f, 0x4e, 0x22, 0x1a, 0x0a, 0x18, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65,
0x4e, 0x6f, 0x64, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
0x73, 0x65, 0x22, 0x42, 0x0a, 0x22, 0x53, 0x79, 0x6e, 0x63, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x56,
0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x57, 0x69, 0x74, 0x68, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65,
0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x6c, 0x75, 0x73,
0x74, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x63, 0x6c, 0x75,
0x73, 0x74, 0x65, 0x72, 0x49, 0x64, 0x22, 0x25, 0x0a, 0x23, 0x53, 0x79, 0x6e, 0x63, 0x4e, 0x6f,
0x64, 0x65, 0x73, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x57, 0x69, 0x74, 0x68, 0x43, 0x6c,
0x75, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0x8f, 0x06,
0x0a, 0x0b, 0x4e, 0x6f, 0x64, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x3b, 0x0a,
0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x15, 0x2e, 0x70, 0x62,
0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65,
0x73, 0x74, 0x1a, 0x16, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4e, 0x6f,
0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x59, 0x0a, 0x14, 0x63, 0x6f,
0x75, 0x6e, 0x74, 0x41, 0x6c, 0x6c, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4e, 0x6f, 0x64,
0x65, 0x73, 0x12, 0x1f, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x41, 0x6c, 0x6c,
0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75,
0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x41, 0x6c,
0x6c, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x52, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4d, 0x0a, 0x10, 0x6c, 0x69, 0x73, 0x74, 0x45, 0x6e, 0x61,
0x62, 0x6c, 0x65, 0x64, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x1b, 0x2e, 0x70, 0x62, 0x2e, 0x4c,
0x69, 0x73, 0x74, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x70, 0x62, 0x2e, 0x4c, 0x69, 0x73, 0x74,
0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70,
0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3e, 0x0a, 0x0b, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x4e,
0x6f, 0x64, 0x65, 0x12, 0x16, 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65,
0x4e, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x70, 0x62,
0x2e, 0x44, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x73, 0x70,
0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3b, 0x0a, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, 0x6f,
0x64, 0x65, 0x12, 0x15, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, 0x6f,
0x64, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x70, 0x62, 0x2e, 0x55,
0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
0x65, 0x12, 0x4a, 0x0a, 0x0f, 0x66, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64,
0x4e, 0x6f, 0x64, 0x65, 0x12, 0x1a, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x45, 0x6e,
0x61, 0x62, 0x6c, 0x65, 0x64, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x1a, 0x1b, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65,
0x64, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x50, 0x0a,
0x11, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x73, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x43, 0x6f, 0x6e, 0x66,
0x69, 0x67, 0x12, 0x1c, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x73, 0x65, 0x4e,
0x6f, 0x64, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x1a, 0x1d, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x73, 0x65, 0x4e, 0x6f, 0x64,
0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
0x3f, 0x0a, 0x0a, 0x6e, 0x6f, 0x64, 0x65, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x15, 0x2e,
0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x52, 0x65, 0x71,
0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x53, 0x74,
0x72, 0x65, 0x61, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x28, 0x01, 0x30, 0x01,
0x12, 0x4d, 0x0a, 0x10, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x53, 0x74,
0x61, 0x74, 0x75, 0x73, 0x12, 0x1b, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65,
0x4e, 0x6f, 0x64, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x74, 0x1a, 0x1c, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, 0x6f, 0x64,
0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
0x6e, 0x0a, 0x1b, 0x73, 0x79, 0x6e, 0x63, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x56, 0x65, 0x72, 0x73,
0x69, 0x6f, 0x6e, 0x57, 0x69, 0x74, 0x68, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x12, 0x26,
0x2e, 0x70, 0x62, 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x56, 0x65, 0x72,
0x73, 0x69, 0x6f, 0x6e, 0x57, 0x69, 0x74, 0x68, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x70, 0x62, 0x2e, 0x53, 0x79, 0x6e, 0x63,
0x4e, 0x6f, 0x64, 0x65, 0x73, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x57, 0x69, 0x74, 0x68,
0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42,
0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
@@ -714,42 +1100,58 @@ func file_service_node_proto_rawDescGZIP() []byte {
return file_service_node_proto_rawDescData
}
var file_service_node_proto_msgTypes = make([]protoimpl.MessageInfo, 12)
var file_service_node_proto_msgTypes = make([]protoimpl.MessageInfo, 20)
var file_service_node_proto_goTypes = []interface{}{
(*CreateNodeRequest)(nil), // 0: pb.CreateNodeRequest
(*CreateNodeResponse)(nil), // 1: pb.CreateNodeResponse
(*CountAllEnabledNodesRequest)(nil), // 2: pb.CountAllEnabledNodesRequest
(*CountAllEnabledNodesResponse)(nil), // 3: pb.CountAllEnabledNodesResponse
(*ListEnabledNodesRequest)(nil), // 4: pb.ListEnabledNodesRequest
(*ListEnabledNodesResponse)(nil), // 5: pb.ListEnabledNodesResponse
(*DisableNodeRequest)(nil), // 6: pb.DisableNodeRequest
(*DisableNodeResponse)(nil), // 7: pb.DisableNodeResponse
(*UpdateNodeRequest)(nil), // 8: pb.UpdateNodeRequest
(*UpdateNodeResponse)(nil), // 9: pb.UpdateNodeResponse
(*FindEnabledNodeRequest)(nil), // 10: pb.FindEnabledNodeRequest
(*FindEnabledNodeResponse)(nil), // 11: pb.FindEnabledNodeResponse
(*NodeLogin)(nil), // 12: pb.NodeLogin
(*Node)(nil), // 13: pb.Node
(*CreateNodeRequest)(nil), // 0: pb.CreateNodeRequest
(*CreateNodeResponse)(nil), // 1: pb.CreateNodeResponse
(*CountAllEnabledNodesRequest)(nil), // 2: pb.CountAllEnabledNodesRequest
(*CountAllEnabledNodesResponse)(nil), // 3: pb.CountAllEnabledNodesResponse
(*ListEnabledNodesRequest)(nil), // 4: pb.ListEnabledNodesRequest
(*ListEnabledNodesResponse)(nil), // 5: pb.ListEnabledNodesResponse
(*DisableNodeRequest)(nil), // 6: pb.DisableNodeRequest
(*DisableNodeResponse)(nil), // 7: pb.DisableNodeResponse
(*UpdateNodeRequest)(nil), // 8: pb.UpdateNodeRequest
(*UpdateNodeResponse)(nil), // 9: pb.UpdateNodeResponse
(*FindEnabledNodeRequest)(nil), // 10: pb.FindEnabledNodeRequest
(*FindEnabledNodeResponse)(nil), // 11: pb.FindEnabledNodeResponse
(*ComposeNodeConfigRequest)(nil), // 12: pb.ComposeNodeConfigRequest
(*ComposeNodeConfigResponse)(nil), // 13: pb.ComposeNodeConfigResponse
(*NodeStreamRequest)(nil), // 14: pb.NodeStreamRequest
(*NodeStreamResponse)(nil), // 15: pb.NodeStreamResponse
(*UpdateNodeStatusRequest)(nil), // 16: pb.UpdateNodeStatusRequest
(*UpdateNodeStatusResponse)(nil), // 17: pb.UpdateNodeStatusResponse
(*SyncNodesVersionWithClusterRequest)(nil), // 18: pb.SyncNodesVersionWithClusterRequest
(*SyncNodesVersionWithClusterResponse)(nil), // 19: pb.SyncNodesVersionWithClusterResponse
(*NodeLogin)(nil), // 20: pb.NodeLogin
(*Node)(nil), // 21: pb.Node
}
var file_service_node_proto_depIdxs = []int32{
12, // 0: pb.CreateNodeRequest.Login:type_name -> pb.NodeLogin
13, // 1: pb.ListEnabledNodesResponse.nodes:type_name -> pb.Node
12, // 2: pb.UpdateNodeRequest.Login:type_name -> pb.NodeLogin
13, // 3: pb.FindEnabledNodeResponse.node:type_name -> pb.Node
20, // 0: pb.CreateNodeRequest.Login:type_name -> pb.NodeLogin
21, // 1: pb.ListEnabledNodesResponse.nodes:type_name -> pb.Node
20, // 2: pb.UpdateNodeRequest.Login:type_name -> pb.NodeLogin
21, // 3: pb.FindEnabledNodeResponse.node:type_name -> pb.Node
0, // 4: pb.NodeService.createNode:input_type -> pb.CreateNodeRequest
2, // 5: pb.NodeService.countAllEnabledNodes:input_type -> pb.CountAllEnabledNodesRequest
4, // 6: pb.NodeService.listEnabledNodes:input_type -> pb.ListEnabledNodesRequest
6, // 7: pb.NodeService.disableNode:input_type -> pb.DisableNodeRequest
8, // 8: pb.NodeService.updateNode:input_type -> pb.UpdateNodeRequest
10, // 9: pb.NodeService.findEnabledNode:input_type -> pb.FindEnabledNodeRequest
1, // 10: pb.NodeService.createNode:output_type -> pb.CreateNodeResponse
3, // 11: pb.NodeService.countAllEnabledNodes:output_type -> pb.CountAllEnabledNodesResponse
5, // 12: pb.NodeService.listEnabledNodes:output_type -> pb.ListEnabledNodesResponse
7, // 13: pb.NodeService.disableNode:output_type -> pb.DisableNodeResponse
9, // 14: pb.NodeService.updateNode:output_type -> pb.UpdateNodeResponse
11, // 15: pb.NodeService.findEnabledNode:output_type -> pb.FindEnabledNodeResponse
10, // [10:16] is the sub-list for method output_type
4, // [4:10] is the sub-list for method input_type
12, // 10: pb.NodeService.composeNodeConfig:input_type -> pb.ComposeNodeConfigRequest
14, // 11: pb.NodeService.nodeStream:input_type -> pb.NodeStreamRequest
16, // 12: pb.NodeService.updateNodeStatus:input_type -> pb.UpdateNodeStatusRequest
18, // 13: pb.NodeService.syncNodesVersionWithCluster:input_type -> pb.SyncNodesVersionWithClusterRequest
1, // 14: pb.NodeService.createNode:output_type -> pb.CreateNodeResponse
3, // 15: pb.NodeService.countAllEnabledNodes:output_type -> pb.CountAllEnabledNodesResponse
5, // 16: pb.NodeService.listEnabledNodes:output_type -> pb.ListEnabledNodesResponse
7, // 17: pb.NodeService.disableNode:output_type -> pb.DisableNodeResponse
9, // 18: pb.NodeService.updateNode:output_type -> pb.UpdateNodeResponse
11, // 19: pb.NodeService.findEnabledNode:output_type -> pb.FindEnabledNodeResponse
13, // 20: pb.NodeService.composeNodeConfig:output_type -> pb.ComposeNodeConfigResponse
15, // 21: pb.NodeService.nodeStream:output_type -> pb.NodeStreamResponse
17, // 22: pb.NodeService.updateNodeStatus:output_type -> pb.UpdateNodeStatusResponse
19, // 23: pb.NodeService.syncNodesVersionWithCluster:output_type -> pb.SyncNodesVersionWithClusterResponse
14, // [14:24] is the sub-list for method output_type
4, // [4:14] is the sub-list for method input_type
4, // [4:4] is the sub-list for extension type_name
4, // [4:4] is the sub-list for extension extendee
0, // [0:4] is the sub-list for field type_name
@@ -907,6 +1309,102 @@ func file_service_node_proto_init() {
return nil
}
}
file_service_node_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ComposeNodeConfigRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_service_node_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ComposeNodeConfigResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_service_node_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*NodeStreamRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_service_node_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*NodeStreamResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_service_node_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*UpdateNodeStatusRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_service_node_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*UpdateNodeStatusResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_service_node_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SyncNodesVersionWithClusterRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_service_node_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SyncNodesVersionWithClusterResponse); 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{
@@ -914,7 +1412,7 @@ func file_service_node_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_service_node_proto_rawDesc,
NumEnums: 0,
NumMessages: 12,
NumMessages: 20,
NumExtensions: 0,
NumServices: 1,
},
@@ -952,6 +1450,14 @@ type NodeServiceClient interface {
UpdateNode(ctx context.Context, in *UpdateNodeRequest, opts ...grpc.CallOption) (*UpdateNodeResponse, error)
// 查看单个节点
FindEnabledNode(ctx context.Context, in *FindEnabledNodeRequest, opts ...grpc.CallOption) (*FindEnabledNodeResponse, error)
// 组合单个节点配置
ComposeNodeConfig(ctx context.Context, in *ComposeNodeConfigRequest, opts ...grpc.CallOption) (*ComposeNodeConfigResponse, error)
// 节点stream
NodeStream(ctx context.Context, opts ...grpc.CallOption) (NodeService_NodeStreamClient, error)
// 更新节点状态
UpdateNodeStatus(ctx context.Context, in *UpdateNodeStatusRequest, opts ...grpc.CallOption) (*UpdateNodeStatusResponse, error)
// 同步集群中的节点版本
SyncNodesVersionWithCluster(ctx context.Context, in *SyncNodesVersionWithClusterRequest, opts ...grpc.CallOption) (*SyncNodesVersionWithClusterResponse, error)
}
type nodeServiceClient struct {
@@ -1016,6 +1522,64 @@ func (c *nodeServiceClient) FindEnabledNode(ctx context.Context, in *FindEnabled
return out, nil
}
func (c *nodeServiceClient) ComposeNodeConfig(ctx context.Context, in *ComposeNodeConfigRequest, opts ...grpc.CallOption) (*ComposeNodeConfigResponse, error) {
out := new(ComposeNodeConfigResponse)
err := c.cc.Invoke(ctx, "/pb.NodeService/composeNodeConfig", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *nodeServiceClient) NodeStream(ctx context.Context, opts ...grpc.CallOption) (NodeService_NodeStreamClient, error) {
stream, err := c.cc.NewStream(ctx, &_NodeService_serviceDesc.Streams[0], "/pb.NodeService/nodeStream", opts...)
if err != nil {
return nil, err
}
x := &nodeServiceNodeStreamClient{stream}
return x, nil
}
type NodeService_NodeStreamClient interface {
Send(*NodeStreamRequest) error
Recv() (*NodeStreamResponse, error)
grpc.ClientStream
}
type nodeServiceNodeStreamClient struct {
grpc.ClientStream
}
func (x *nodeServiceNodeStreamClient) Send(m *NodeStreamRequest) error {
return x.ClientStream.SendMsg(m)
}
func (x *nodeServiceNodeStreamClient) Recv() (*NodeStreamResponse, error) {
m := new(NodeStreamResponse)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
func (c *nodeServiceClient) UpdateNodeStatus(ctx context.Context, in *UpdateNodeStatusRequest, opts ...grpc.CallOption) (*UpdateNodeStatusResponse, error) {
out := new(UpdateNodeStatusResponse)
err := c.cc.Invoke(ctx, "/pb.NodeService/updateNodeStatus", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *nodeServiceClient) SyncNodesVersionWithCluster(ctx context.Context, in *SyncNodesVersionWithClusterRequest, opts ...grpc.CallOption) (*SyncNodesVersionWithClusterResponse, error) {
out := new(SyncNodesVersionWithClusterResponse)
err := c.cc.Invoke(ctx, "/pb.NodeService/syncNodesVersionWithCluster", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// NodeServiceServer is the server API for NodeService service.
type NodeServiceServer interface {
// 创建节点
@@ -1030,6 +1594,14 @@ type NodeServiceServer interface {
UpdateNode(context.Context, *UpdateNodeRequest) (*UpdateNodeResponse, error)
// 查看单个节点
FindEnabledNode(context.Context, *FindEnabledNodeRequest) (*FindEnabledNodeResponse, error)
// 组合单个节点配置
ComposeNodeConfig(context.Context, *ComposeNodeConfigRequest) (*ComposeNodeConfigResponse, error)
// 节点stream
NodeStream(NodeService_NodeStreamServer) error
// 更新节点状态
UpdateNodeStatus(context.Context, *UpdateNodeStatusRequest) (*UpdateNodeStatusResponse, error)
// 同步集群中的节点版本
SyncNodesVersionWithCluster(context.Context, *SyncNodesVersionWithClusterRequest) (*SyncNodesVersionWithClusterResponse, error)
}
// UnimplementedNodeServiceServer can be embedded to have forward compatible implementations.
@@ -1054,6 +1626,18 @@ func (*UnimplementedNodeServiceServer) UpdateNode(context.Context, *UpdateNodeRe
func (*UnimplementedNodeServiceServer) FindEnabledNode(context.Context, *FindEnabledNodeRequest) (*FindEnabledNodeResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method FindEnabledNode not implemented")
}
func (*UnimplementedNodeServiceServer) ComposeNodeConfig(context.Context, *ComposeNodeConfigRequest) (*ComposeNodeConfigResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ComposeNodeConfig not implemented")
}
func (*UnimplementedNodeServiceServer) NodeStream(NodeService_NodeStreamServer) error {
return status.Errorf(codes.Unimplemented, "method NodeStream not implemented")
}
func (*UnimplementedNodeServiceServer) UpdateNodeStatus(context.Context, *UpdateNodeStatusRequest) (*UpdateNodeStatusResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateNodeStatus not implemented")
}
func (*UnimplementedNodeServiceServer) SyncNodesVersionWithCluster(context.Context, *SyncNodesVersionWithClusterRequest) (*SyncNodesVersionWithClusterResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method SyncNodesVersionWithCluster not implemented")
}
func RegisterNodeServiceServer(s *grpc.Server, srv NodeServiceServer) {
s.RegisterService(&_NodeService_serviceDesc, srv)
@@ -1167,6 +1751,86 @@ func _NodeService_FindEnabledNode_Handler(srv interface{}, ctx context.Context,
return interceptor(ctx, in, info, handler)
}
func _NodeService_ComposeNodeConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ComposeNodeConfigRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(NodeServiceServer).ComposeNodeConfig(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/pb.NodeService/ComposeNodeConfig",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(NodeServiceServer).ComposeNodeConfig(ctx, req.(*ComposeNodeConfigRequest))
}
return interceptor(ctx, in, info, handler)
}
func _NodeService_NodeStream_Handler(srv interface{}, stream grpc.ServerStream) error {
return srv.(NodeServiceServer).NodeStream(&nodeServiceNodeStreamServer{stream})
}
type NodeService_NodeStreamServer interface {
Send(*NodeStreamResponse) error
Recv() (*NodeStreamRequest, error)
grpc.ServerStream
}
type nodeServiceNodeStreamServer struct {
grpc.ServerStream
}
func (x *nodeServiceNodeStreamServer) Send(m *NodeStreamResponse) error {
return x.ServerStream.SendMsg(m)
}
func (x *nodeServiceNodeStreamServer) Recv() (*NodeStreamRequest, error) {
m := new(NodeStreamRequest)
if err := x.ServerStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
func _NodeService_UpdateNodeStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(UpdateNodeStatusRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(NodeServiceServer).UpdateNodeStatus(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/pb.NodeService/UpdateNodeStatus",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(NodeServiceServer).UpdateNodeStatus(ctx, req.(*UpdateNodeStatusRequest))
}
return interceptor(ctx, in, info, handler)
}
func _NodeService_SyncNodesVersionWithCluster_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(SyncNodesVersionWithClusterRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(NodeServiceServer).SyncNodesVersionWithCluster(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/pb.NodeService/SyncNodesVersionWithCluster",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(NodeServiceServer).SyncNodesVersionWithCluster(ctx, req.(*SyncNodesVersionWithClusterRequest))
}
return interceptor(ctx, in, info, handler)
}
var _NodeService_serviceDesc = grpc.ServiceDesc{
ServiceName: "pb.NodeService",
HandlerType: (*NodeServiceServer)(nil),
@@ -1195,7 +1859,26 @@ var _NodeService_serviceDesc = grpc.ServiceDesc{
MethodName: "findEnabledNode",
Handler: _NodeService_FindEnabledNode_Handler,
},
{
MethodName: "composeNodeConfig",
Handler: _NodeService_ComposeNodeConfig_Handler,
},
{
MethodName: "updateNodeStatus",
Handler: _NodeService_UpdateNodeStatus_Handler,
},
{
MethodName: "syncNodesVersionWithCluster",
Handler: _NodeService_SyncNodesVersionWithCluster_Handler,
},
},
Streams: []grpc.StreamDesc{
{
StreamName: "nodeStream",
Handler: _NodeService_NodeStream_Handler,
ServerStreams: true,
ClientStreams: true,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "service_node.proto",
}

View File

@@ -29,6 +29,7 @@ const (
// of the legacy proto package is being used.
const _ = proto.ProtoPackageIsVersion4
// 获取所有集群的信息
type FindAllEnabledNodeClustersRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@@ -114,6 +115,92 @@ func (x *FindAllEnabledNodeClustersResponse) GetClusters() []*NodeCluster {
return nil
}
// 获取变更的集群
type FindAllChangedClustersRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *FindAllChangedClustersRequest) Reset() {
*x = FindAllChangedClustersRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_service_node_cluster_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *FindAllChangedClustersRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*FindAllChangedClustersRequest) ProtoMessage() {}
func (x *FindAllChangedClustersRequest) ProtoReflect() protoreflect.Message {
mi := &file_service_node_cluster_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 FindAllChangedClustersRequest.ProtoReflect.Descriptor instead.
func (*FindAllChangedClustersRequest) Descriptor() ([]byte, []int) {
return file_service_node_cluster_proto_rawDescGZIP(), []int{2}
}
type FindAllChangedClustersResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Clusters []*NodeCluster `protobuf:"bytes,1,rep,name=clusters,proto3" json:"clusters,omitempty"`
}
func (x *FindAllChangedClustersResponse) Reset() {
*x = FindAllChangedClustersResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_service_node_cluster_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *FindAllChangedClustersResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*FindAllChangedClustersResponse) ProtoMessage() {}
func (x *FindAllChangedClustersResponse) ProtoReflect() protoreflect.Message {
mi := &file_service_node_cluster_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 FindAllChangedClustersResponse.ProtoReflect.Descriptor instead.
func (*FindAllChangedClustersResponse) Descriptor() ([]byte, []int) {
return file_service_node_cluster_proto_rawDescGZIP(), []int{3}
}
func (x *FindAllChangedClustersResponse) GetClusters() []*NodeCluster {
if x != nil {
return x.Clusters
}
return nil
}
var File_service_node_cluster_proto protoreflect.FileDescriptor
var file_service_node_cluster_proto_rawDesc = []byte{
@@ -128,16 +215,29 @@ var file_service_node_cluster_proto_rawDesc = []byte{
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2b, 0x0a, 0x08, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72,
0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x64,
0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x52, 0x08, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65,
0x72, 0x73, 0x32, 0x7d, 0x0a, 0x12, 0x4e, 0x6f, 0x64, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65,
0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x67, 0x0a, 0x16, 0x66, 0x69, 0x6e, 0x64,
0x41, 0x6c, 0x6c, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65,
0x72, 0x73, 0x12, 0x25, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x41, 0x6c, 0x6c, 0x45,
0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4e, 0x6f, 0x64, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65,
0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x70, 0x62, 0x2e, 0x46,
0x69, 0x6e, 0x64, 0x41, 0x6c, 0x6c, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4e, 0x6f, 0x64,
0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
0x65, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x33,
0x72, 0x73, 0x22, 0x1f, 0x0a, 0x1d, 0x46, 0x69, 0x6e, 0x64, 0x41, 0x6c, 0x6c, 0x43, 0x68, 0x61,
0x6e, 0x67, 0x65, 0x64, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75,
0x65, 0x73, 0x74, 0x22, 0x4d, 0x0a, 0x1e, 0x46, 0x69, 0x6e, 0x64, 0x41, 0x6c, 0x6c, 0x43, 0x68,
0x61, 0x6e, 0x67, 0x65, 0x64, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2b, 0x0a, 0x08, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72,
0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x6f, 0x64,
0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x52, 0x08, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65,
0x72, 0x73, 0x32, 0xde, 0x01, 0x0a, 0x12, 0x4e, 0x6f, 0x64, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74,
0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x67, 0x0a, 0x16, 0x66, 0x69, 0x6e,
0x64, 0x41, 0x6c, 0x6c, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x43, 0x6c, 0x75, 0x73, 0x74,
0x65, 0x72, 0x73, 0x12, 0x25, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x41, 0x6c, 0x6c,
0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4e, 0x6f, 0x64, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74,
0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x70, 0x62, 0x2e,
0x46, 0x69, 0x6e, 0x64, 0x41, 0x6c, 0x6c, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4e, 0x6f,
0x64, 0x65, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
0x73, 0x65, 0x12, 0x5f, 0x0a, 0x16, 0x66, 0x69, 0x6e, 0x64, 0x41, 0x6c, 0x6c, 0x43, 0x68, 0x61,
0x6e, 0x67, 0x65, 0x64, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x73, 0x12, 0x21, 0x2e, 0x70,
0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x41, 0x6c, 0x6c, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x64,
0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
0x22, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x41, 0x6c, 0x6c, 0x43, 0x68, 0x61, 0x6e,
0x67, 0x65, 0x64, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f,
0x6e, 0x73, 0x65, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x33,
}
var (
@@ -152,21 +252,26 @@ func file_service_node_cluster_proto_rawDescGZIP() []byte {
return file_service_node_cluster_proto_rawDescData
}
var file_service_node_cluster_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_service_node_cluster_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
var file_service_node_cluster_proto_goTypes = []interface{}{
(*FindAllEnabledNodeClustersRequest)(nil), // 0: pb.FindAllEnabledNodeClustersRequest
(*FindAllEnabledNodeClustersResponse)(nil), // 1: pb.FindAllEnabledNodeClustersResponse
(*NodeCluster)(nil), // 2: pb.NodeCluster
(*FindAllChangedClustersRequest)(nil), // 2: pb.FindAllChangedClustersRequest
(*FindAllChangedClustersResponse)(nil), // 3: pb.FindAllChangedClustersResponse
(*NodeCluster)(nil), // 4: pb.NodeCluster
}
var file_service_node_cluster_proto_depIdxs = []int32{
2, // 0: pb.FindAllEnabledNodeClustersResponse.clusters:type_name -> pb.NodeCluster
0, // 1: pb.NodeClusterService.findAllEnabledClusters:input_type -> pb.FindAllEnabledNodeClustersRequest
1, // 2: pb.NodeClusterService.findAllEnabledClusters:output_type -> pb.FindAllEnabledNodeClustersResponse
2, // [2:3] is the sub-list for method output_type
1, // [1:2] 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
4, // 0: pb.FindAllEnabledNodeClustersResponse.clusters:type_name -> pb.NodeCluster
4, // 1: pb.FindAllChangedClustersResponse.clusters:type_name -> pb.NodeCluster
0, // 2: pb.NodeClusterService.findAllEnabledClusters:input_type -> pb.FindAllEnabledNodeClustersRequest
2, // 3: pb.NodeClusterService.findAllChangedClusters:input_type -> pb.FindAllChangedClustersRequest
1, // 4: pb.NodeClusterService.findAllEnabledClusters:output_type -> pb.FindAllEnabledNodeClustersResponse
3, // 5: pb.NodeClusterService.findAllChangedClusters:output_type -> pb.FindAllChangedClustersResponse
4, // [4:6] is the sub-list for method output_type
2, // [2:4] is the sub-list for method input_type
2, // [2:2] is the sub-list for extension type_name
2, // [2:2] is the sub-list for extension extendee
0, // [0:2] is the sub-list for field type_name
}
func init() { file_service_node_cluster_proto_init() }
@@ -200,6 +305,30 @@ func file_service_node_cluster_proto_init() {
return nil
}
}
file_service_node_cluster_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*FindAllChangedClustersRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_service_node_cluster_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*FindAllChangedClustersResponse); 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{
@@ -207,7 +336,7 @@ func file_service_node_cluster_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_service_node_cluster_proto_rawDesc,
NumEnums: 0,
NumMessages: 2,
NumMessages: 4,
NumExtensions: 0,
NumServices: 1,
},
@@ -235,6 +364,8 @@ const _ = grpc.SupportPackageIsVersion6
type NodeClusterServiceClient interface {
// 获取所有集群的信息
FindAllEnabledClusters(ctx context.Context, in *FindAllEnabledNodeClustersRequest, opts ...grpc.CallOption) (*FindAllEnabledNodeClustersResponse, error)
// 获取变更的集群
FindAllChangedClusters(ctx context.Context, in *FindAllChangedClustersRequest, opts ...grpc.CallOption) (*FindAllChangedClustersResponse, error)
}
type nodeClusterServiceClient struct {
@@ -254,10 +385,21 @@ func (c *nodeClusterServiceClient) FindAllEnabledClusters(ctx context.Context, i
return out, nil
}
func (c *nodeClusterServiceClient) FindAllChangedClusters(ctx context.Context, in *FindAllChangedClustersRequest, opts ...grpc.CallOption) (*FindAllChangedClustersResponse, error) {
out := new(FindAllChangedClustersResponse)
err := c.cc.Invoke(ctx, "/pb.NodeClusterService/findAllChangedClusters", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// NodeClusterServiceServer is the server API for NodeClusterService service.
type NodeClusterServiceServer interface {
// 获取所有集群的信息
FindAllEnabledClusters(context.Context, *FindAllEnabledNodeClustersRequest) (*FindAllEnabledNodeClustersResponse, error)
// 获取变更的集群
FindAllChangedClusters(context.Context, *FindAllChangedClustersRequest) (*FindAllChangedClustersResponse, error)
}
// UnimplementedNodeClusterServiceServer can be embedded to have forward compatible implementations.
@@ -267,6 +409,9 @@ type UnimplementedNodeClusterServiceServer struct {
func (*UnimplementedNodeClusterServiceServer) FindAllEnabledClusters(context.Context, *FindAllEnabledNodeClustersRequest) (*FindAllEnabledNodeClustersResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method FindAllEnabledClusters not implemented")
}
func (*UnimplementedNodeClusterServiceServer) FindAllChangedClusters(context.Context, *FindAllChangedClustersRequest) (*FindAllChangedClustersResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method FindAllChangedClusters not implemented")
}
func RegisterNodeClusterServiceServer(s *grpc.Server, srv NodeClusterServiceServer) {
s.RegisterService(&_NodeClusterService_serviceDesc, srv)
@@ -290,6 +435,24 @@ func _NodeClusterService_FindAllEnabledClusters_Handler(srv interface{}, ctx con
return interceptor(ctx, in, info, handler)
}
func _NodeClusterService_FindAllChangedClusters_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(FindAllChangedClustersRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(NodeClusterServiceServer).FindAllChangedClusters(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/pb.NodeClusterService/FindAllChangedClusters",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(NodeClusterServiceServer).FindAllChangedClusters(ctx, req.(*FindAllChangedClustersRequest))
}
return interceptor(ctx, in, info, handler)
}
var _NodeClusterService_serviceDesc = grpc.ServiceDesc{
ServiceName: "pb.NodeClusterService",
HandlerType: (*NodeClusterServiceServer)(nil),
@@ -298,6 +461,10 @@ var _NodeClusterService_serviceDesc = grpc.ServiceDesc{
MethodName: "findAllEnabledClusters",
Handler: _NodeClusterService_FindAllEnabledClusters_Handler,
},
{
MethodName: "findAllChangedClusters",
Handler: _NodeClusterService_FindAllChangedClusters_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "service_node_cluster.proto",

View File

@@ -164,6 +164,140 @@ func (x *CreateServerResponse) GetServerId() int64 {
return 0
}
// 修改服务
type UpdateServerRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
ServerId int64 `protobuf:"varint,1,opt,name=serverId,proto3" json:"serverId,omitempty"`
UserId int64 `protobuf:"varint,2,opt,name=userId,proto3" json:"userId,omitempty"`
AdminId int64 `protobuf:"varint,3,opt,name=adminId,proto3" json:"adminId,omitempty"`
ClusterId int64 `protobuf:"varint,4,opt,name=clusterId,proto3" json:"clusterId,omitempty"`
Config []byte `protobuf:"bytes,5,opt,name=config,proto3" json:"config,omitempty"`
IncludeNodesJSON []byte `protobuf:"bytes,6,opt,name=includeNodesJSON,proto3" json:"includeNodesJSON,omitempty"`
ExcludeNodesJSON []byte `protobuf:"bytes,7,opt,name=excludeNodesJSON,proto3" json:"excludeNodesJSON,omitempty"`
}
func (x *UpdateServerRequest) Reset() {
*x = UpdateServerRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_service_server_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *UpdateServerRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*UpdateServerRequest) ProtoMessage() {}
func (x *UpdateServerRequest) ProtoReflect() protoreflect.Message {
mi := &file_service_server_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 UpdateServerRequest.ProtoReflect.Descriptor instead.
func (*UpdateServerRequest) Descriptor() ([]byte, []int) {
return file_service_server_proto_rawDescGZIP(), []int{2}
}
func (x *UpdateServerRequest) GetServerId() int64 {
if x != nil {
return x.ServerId
}
return 0
}
func (x *UpdateServerRequest) GetUserId() int64 {
if x != nil {
return x.UserId
}
return 0
}
func (x *UpdateServerRequest) GetAdminId() int64 {
if x != nil {
return x.AdminId
}
return 0
}
func (x *UpdateServerRequest) GetClusterId() int64 {
if x != nil {
return x.ClusterId
}
return 0
}
func (x *UpdateServerRequest) GetConfig() []byte {
if x != nil {
return x.Config
}
return nil
}
func (x *UpdateServerRequest) GetIncludeNodesJSON() []byte {
if x != nil {
return x.IncludeNodesJSON
}
return nil
}
func (x *UpdateServerRequest) GetExcludeNodesJSON() []byte {
if x != nil {
return x.ExcludeNodesJSON
}
return nil
}
type UpdateServerResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *UpdateServerResponse) Reset() {
*x = UpdateServerResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_service_server_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *UpdateServerResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*UpdateServerResponse) ProtoMessage() {}
func (x *UpdateServerResponse) ProtoReflect() protoreflect.Message {
mi := &file_service_server_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 UpdateServerResponse.ProtoReflect.Descriptor instead.
func (*UpdateServerResponse) Descriptor() ([]byte, []int) {
return file_service_server_proto_rawDescGZIP(), []int{3}
}
// 计算服务数量
type CountAllEnabledServersRequest struct {
state protoimpl.MessageState
@@ -174,7 +308,7 @@ type CountAllEnabledServersRequest struct {
func (x *CountAllEnabledServersRequest) Reset() {
*x = CountAllEnabledServersRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_service_server_proto_msgTypes[2]
mi := &file_service_server_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -187,7 +321,7 @@ func (x *CountAllEnabledServersRequest) String() string {
func (*CountAllEnabledServersRequest) ProtoMessage() {}
func (x *CountAllEnabledServersRequest) ProtoReflect() protoreflect.Message {
mi := &file_service_server_proto_msgTypes[2]
mi := &file_service_server_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -200,7 +334,7 @@ func (x *CountAllEnabledServersRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use CountAllEnabledServersRequest.ProtoReflect.Descriptor instead.
func (*CountAllEnabledServersRequest) Descriptor() ([]byte, []int) {
return file_service_server_proto_rawDescGZIP(), []int{2}
return file_service_server_proto_rawDescGZIP(), []int{4}
}
type CountAllEnabledServersResponse struct {
@@ -214,7 +348,7 @@ type CountAllEnabledServersResponse struct {
func (x *CountAllEnabledServersResponse) Reset() {
*x = CountAllEnabledServersResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_service_server_proto_msgTypes[3]
mi := &file_service_server_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -227,7 +361,7 @@ func (x *CountAllEnabledServersResponse) String() string {
func (*CountAllEnabledServersResponse) ProtoMessage() {}
func (x *CountAllEnabledServersResponse) ProtoReflect() protoreflect.Message {
mi := &file_service_server_proto_msgTypes[3]
mi := &file_service_server_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -240,7 +374,7 @@ func (x *CountAllEnabledServersResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use CountAllEnabledServersResponse.ProtoReflect.Descriptor instead.
func (*CountAllEnabledServersResponse) Descriptor() ([]byte, []int) {
return file_service_server_proto_rawDescGZIP(), []int{3}
return file_service_server_proto_rawDescGZIP(), []int{5}
}
func (x *CountAllEnabledServersResponse) GetCount() int64 {
@@ -263,7 +397,7 @@ type ListEnabledServersRequest struct {
func (x *ListEnabledServersRequest) Reset() {
*x = ListEnabledServersRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_service_server_proto_msgTypes[4]
mi := &file_service_server_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -276,7 +410,7 @@ func (x *ListEnabledServersRequest) String() string {
func (*ListEnabledServersRequest) ProtoMessage() {}
func (x *ListEnabledServersRequest) ProtoReflect() protoreflect.Message {
mi := &file_service_server_proto_msgTypes[4]
mi := &file_service_server_proto_msgTypes[6]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -289,7 +423,7 @@ func (x *ListEnabledServersRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use ListEnabledServersRequest.ProtoReflect.Descriptor instead.
func (*ListEnabledServersRequest) Descriptor() ([]byte, []int) {
return file_service_server_proto_rawDescGZIP(), []int{4}
return file_service_server_proto_rawDescGZIP(), []int{6}
}
func (x *ListEnabledServersRequest) GetOffset() int64 {
@@ -317,7 +451,7 @@ type ListEnabledServersResponse struct {
func (x *ListEnabledServersResponse) Reset() {
*x = ListEnabledServersResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_service_server_proto_msgTypes[5]
mi := &file_service_server_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -330,7 +464,7 @@ func (x *ListEnabledServersResponse) String() string {
func (*ListEnabledServersResponse) ProtoMessage() {}
func (x *ListEnabledServersResponse) ProtoReflect() protoreflect.Message {
mi := &file_service_server_proto_msgTypes[5]
mi := &file_service_server_proto_msgTypes[7]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -343,7 +477,7 @@ func (x *ListEnabledServersResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use ListEnabledServersResponse.ProtoReflect.Descriptor instead.
func (*ListEnabledServersResponse) Descriptor() ([]byte, []int) {
return file_service_server_proto_rawDescGZIP(), []int{5}
return file_service_server_proto_rawDescGZIP(), []int{7}
}
func (x *ListEnabledServersResponse) GetServers() []*Server {
@@ -353,6 +487,187 @@ func (x *ListEnabledServersResponse) GetServers() []*Server {
return nil
}
// 禁用服务
type DisableServerRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
ServerId int64 `protobuf:"varint,1,opt,name=serverId,proto3" json:"serverId,omitempty"`
}
func (x *DisableServerRequest) Reset() {
*x = DisableServerRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_service_server_proto_msgTypes[8]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *DisableServerRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DisableServerRequest) ProtoMessage() {}
func (x *DisableServerRequest) ProtoReflect() protoreflect.Message {
mi := &file_service_server_proto_msgTypes[8]
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 DisableServerRequest.ProtoReflect.Descriptor instead.
func (*DisableServerRequest) Descriptor() ([]byte, []int) {
return file_service_server_proto_rawDescGZIP(), []int{8}
}
func (x *DisableServerRequest) GetServerId() int64 {
if x != nil {
return x.ServerId
}
return 0
}
type DisableServerResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *DisableServerResponse) Reset() {
*x = DisableServerResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_service_server_proto_msgTypes[9]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *DisableServerResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DisableServerResponse) ProtoMessage() {}
func (x *DisableServerResponse) ProtoReflect() protoreflect.Message {
mi := &file_service_server_proto_msgTypes[9]
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 DisableServerResponse.ProtoReflect.Descriptor instead.
func (*DisableServerResponse) Descriptor() ([]byte, []int) {
return file_service_server_proto_rawDescGZIP(), []int{9}
}
// 查找单个服务
type FindEnabledServerRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
ServerId int64 `protobuf:"varint,1,opt,name=serverId,proto3" json:"serverId,omitempty"`
}
func (x *FindEnabledServerRequest) Reset() {
*x = FindEnabledServerRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_service_server_proto_msgTypes[10]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *FindEnabledServerRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*FindEnabledServerRequest) ProtoMessage() {}
func (x *FindEnabledServerRequest) ProtoReflect() protoreflect.Message {
mi := &file_service_server_proto_msgTypes[10]
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 FindEnabledServerRequest.ProtoReflect.Descriptor instead.
func (*FindEnabledServerRequest) Descriptor() ([]byte, []int) {
return file_service_server_proto_rawDescGZIP(), []int{10}
}
func (x *FindEnabledServerRequest) GetServerId() int64 {
if x != nil {
return x.ServerId
}
return 0
}
type FindEnabledServerResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Server *Server `protobuf:"bytes,1,opt,name=server,proto3" json:"server,omitempty"`
}
func (x *FindEnabledServerResponse) Reset() {
*x = FindEnabledServerResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_service_server_proto_msgTypes[11]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *FindEnabledServerResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*FindEnabledServerResponse) ProtoMessage() {}
func (x *FindEnabledServerResponse) ProtoReflect() protoreflect.Message {
mi := &file_service_server_proto_msgTypes[11]
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 FindEnabledServerResponse.ProtoReflect.Descriptor instead.
func (*FindEnabledServerResponse) Descriptor() ([]byte, []int) {
return file_service_server_proto_rawDescGZIP(), []int{11}
}
func (x *FindEnabledServerResponse) GetServer() *Server {
if x != nil {
return x.Server
}
return nil
}
var File_service_server_proto protoreflect.FileDescriptor
var file_service_server_proto_rawDesc = []byte{
@@ -375,39 +690,82 @@ var file_service_server_proto_rawDesc = []byte{
0x65, 0x73, 0x4a, 0x53, 0x4f, 0x4e, 0x22, 0x32, 0x0a, 0x14, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65,
0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1a,
0x0a, 0x08, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03,
0x52, 0x08, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x49, 0x64, 0x22, 0x1f, 0x0a, 0x1d, 0x43, 0x6f,
0x75, 0x6e, 0x74, 0x41, 0x6c, 0x6c, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x53, 0x65, 0x72,
0x76, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x36, 0x0a, 0x1e, 0x43,
0x6f, 0x75, 0x6e, 0x74, 0x41, 0x6c, 0x6c, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x53, 0x65,
0x72, 0x76, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a,
0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x63, 0x6f,
0x75, 0x6e, 0x74, 0x22, 0x47, 0x0a, 0x19, 0x4c, 0x69, 0x73, 0x74, 0x45, 0x6e, 0x61, 0x62, 0x6c,
0x65, 0x64, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x12, 0x16, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03,
0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x69, 0x7a, 0x65,
0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x22, 0x42, 0x0a, 0x1a,
0x4c, 0x69, 0x73, 0x74, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x53, 0x65, 0x72, 0x76, 0x65,
0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x24, 0x0a, 0x07, 0x73, 0x65,
0x72, 0x76, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x70, 0x62,
0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x07, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73,
0x32, 0x88, 0x02, 0x0a, 0x0d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69,
0x63, 0x65, 0x12, 0x41, 0x0a, 0x0c, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x65, 0x72, 0x76,
0x65, 0x72, 0x12, 0x17, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x65,
0x72, 0x76, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x70, 0x62,
0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5f, 0x0a, 0x16, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x41, 0x6c,
0x6c, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x12,
0x21, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x41, 0x6c, 0x6c, 0x45, 0x6e, 0x61,
0x62, 0x6c, 0x65, 0x64, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65,
0x73, 0x74, 0x1a, 0x22, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x41, 0x6c, 0x6c,
0x52, 0x08, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x49, 0x64, 0x22, 0xf1, 0x01, 0x0a, 0x13, 0x55,
0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65,
0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01,
0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x49, 0x64, 0x12, 0x16,
0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06,
0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x49,
0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x49, 0x64,
0x12, 0x1c, 0x0a, 0x09, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x49, 0x64, 0x18, 0x04, 0x20,
0x01, 0x28, 0x03, 0x52, 0x09, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x49, 0x64, 0x12, 0x16,
0x0a, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06,
0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x2a, 0x0a, 0x10, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64,
0x65, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c,
0x52, 0x10, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x4a, 0x53,
0x4f, 0x4e, 0x12, 0x2a, 0x0a, 0x10, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x4e, 0x6f, 0x64,
0x65, 0x73, 0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x10, 0x65, 0x78,
0x63, 0x6c, 0x75, 0x64, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x4a, 0x53, 0x4f, 0x4e, 0x22, 0x16,
0x0a, 0x14, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x65,
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1f, 0x0a, 0x1d, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x41,
0x6c, 0x6c, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73,
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x36, 0x0a, 0x1e, 0x43, 0x6f, 0x75, 0x6e, 0x74,
0x41, 0x6c, 0x6c, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72,
0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75,
0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22,
0x47, 0x0a, 0x19, 0x4c, 0x69, 0x73, 0x74, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x53, 0x65,
0x72, 0x76, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06,
0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x6f, 0x66,
0x66, 0x73, 0x65, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x02, 0x20, 0x01,
0x28, 0x03, 0x52, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x22, 0x42, 0x0a, 0x1a, 0x4c, 0x69, 0x73, 0x74,
0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x52, 0x65,
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x53, 0x0a, 0x12, 0x6c, 0x69, 0x73, 0x74, 0x45, 0x6e,
0x61, 0x62, 0x6c, 0x65, 0x64, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x12, 0x1d, 0x2e, 0x70,
0x62, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x53, 0x65, 0x72,
0x76, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x70, 0x62,
0x2e, 0x4c, 0x69, 0x73, 0x74, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x53, 0x65, 0x72, 0x76,
0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x06, 0x5a, 0x04, 0x2e,
0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x24, 0x0a, 0x07, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72,
0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x70, 0x62, 0x2e, 0x53, 0x65, 0x72,
0x76, 0x65, 0x72, 0x52, 0x07, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x22, 0x32, 0x0a, 0x14,
0x44, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x65, 0x71,
0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x49, 0x64,
0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x49, 0x64,
0x22, 0x17, 0x0a, 0x15, 0x44, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x53, 0x65, 0x72, 0x76, 0x65,
0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x36, 0x0a, 0x18, 0x46, 0x69, 0x6e,
0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x65,
0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x49,
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x49,
0x64, 0x22, 0x3f, 0x0a, 0x19, 0x46, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64,
0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x22,
0x0a, 0x06, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a,
0x2e, 0x70, 0x62, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x06, 0x73, 0x65, 0x72, 0x76,
0x65, 0x72, 0x32, 0xe3, 0x03, 0x0a, 0x0d, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x65, 0x72,
0x76, 0x69, 0x63, 0x65, 0x12, 0x41, 0x0a, 0x0c, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x65,
0x72, 0x76, 0x65, 0x72, 0x12, 0x17, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65,
0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e,
0x70, 0x62, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52,
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x41, 0x0a, 0x0c, 0x75, 0x70, 0x64, 0x61, 0x74,
0x65, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x17, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64,
0x61, 0x74, 0x65, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x1a, 0x18, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x65, 0x72, 0x76,
0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5f, 0x0a, 0x16, 0x63, 0x6f,
0x75, 0x6e, 0x74, 0x41, 0x6c, 0x6c, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x53, 0x65, 0x72,
0x76, 0x65, 0x72, 0x73, 0x12, 0x21, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x41,
0x6c, 0x6c, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73,
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x6f, 0x75,
0x6e, 0x74, 0x41, 0x6c, 0x6c, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x53, 0x65, 0x72, 0x76,
0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x53, 0x0a, 0x12, 0x6c,
0x69, 0x73, 0x74, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72,
0x73, 0x12, 0x1d, 0x2e, 0x70, 0x62, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x45, 0x6e, 0x61, 0x62, 0x6c,
0x65, 0x64, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x1a, 0x1e, 0x2e, 0x70, 0x62, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65,
0x64, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
0x12, 0x44, 0x0a, 0x0d, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x53, 0x65, 0x72, 0x76, 0x65,
0x72, 0x12, 0x18, 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x53, 0x65,
0x72, 0x76, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x70, 0x62,
0x2e, 0x44, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x65,
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x50, 0x0a, 0x11, 0x66, 0x69, 0x6e, 0x64, 0x45, 0x6e,
0x61, 0x62, 0x6c, 0x65, 0x64, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x1c, 0x2e, 0x70, 0x62,
0x2e, 0x46, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x53, 0x65, 0x72, 0x76,
0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x70, 0x62, 0x2e, 0x46,
0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72,
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62,
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@@ -422,29 +780,42 @@ func file_service_server_proto_rawDescGZIP() []byte {
return file_service_server_proto_rawDescData
}
var file_service_server_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
var file_service_server_proto_msgTypes = make([]protoimpl.MessageInfo, 12)
var file_service_server_proto_goTypes = []interface{}{
(*CreateServerRequest)(nil), // 0: pb.CreateServerRequest
(*CreateServerResponse)(nil), // 1: pb.CreateServerResponse
(*CountAllEnabledServersRequest)(nil), // 2: pb.CountAllEnabledServersRequest
(*CountAllEnabledServersResponse)(nil), // 3: pb.CountAllEnabledServersResponse
(*ListEnabledServersRequest)(nil), // 4: pb.ListEnabledServersRequest
(*ListEnabledServersResponse)(nil), // 5: pb.ListEnabledServersResponse
(*Server)(nil), // 6: pb.Server
(*UpdateServerRequest)(nil), // 2: pb.UpdateServerRequest
(*UpdateServerResponse)(nil), // 3: pb.UpdateServerResponse
(*CountAllEnabledServersRequest)(nil), // 4: pb.CountAllEnabledServersRequest
(*CountAllEnabledServersResponse)(nil), // 5: pb.CountAllEnabledServersResponse
(*ListEnabledServersRequest)(nil), // 6: pb.ListEnabledServersRequest
(*ListEnabledServersResponse)(nil), // 7: pb.ListEnabledServersResponse
(*DisableServerRequest)(nil), // 8: pb.DisableServerRequest
(*DisableServerResponse)(nil), // 9: pb.DisableServerResponse
(*FindEnabledServerRequest)(nil), // 10: pb.FindEnabledServerRequest
(*FindEnabledServerResponse)(nil), // 11: pb.FindEnabledServerResponse
(*Server)(nil), // 12: pb.Server
}
var file_service_server_proto_depIdxs = []int32{
6, // 0: pb.ListEnabledServersResponse.servers:type_name -> pb.Server
0, // 1: pb.ServerService.createServer:input_type -> pb.CreateServerRequest
2, // 2: pb.ServerService.countAllEnabledServers:input_type -> pb.CountAllEnabledServersRequest
4, // 3: pb.ServerService.listEnabledServers:input_type -> pb.ListEnabledServersRequest
1, // 4: pb.ServerService.createServer:output_type -> pb.CreateServerResponse
3, // 5: pb.ServerService.countAllEnabledServers:output_type -> pb.CountAllEnabledServersResponse
5, // 6: pb.ServerService.listEnabledServers:output_type -> pb.ListEnabledServersResponse
4, // [4:7] is the sub-list for method output_type
1, // [1:4] 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
12, // 0: pb.ListEnabledServersResponse.servers:type_name -> pb.Server
12, // 1: pb.FindEnabledServerResponse.server:type_name -> pb.Server
0, // 2: pb.ServerService.createServer:input_type -> pb.CreateServerRequest
2, // 3: pb.ServerService.updateServer:input_type -> pb.UpdateServerRequest
4, // 4: pb.ServerService.countAllEnabledServers:input_type -> pb.CountAllEnabledServersRequest
6, // 5: pb.ServerService.listEnabledServers:input_type -> pb.ListEnabledServersRequest
8, // 6: pb.ServerService.disableServer:input_type -> pb.DisableServerRequest
10, // 7: pb.ServerService.findEnabledServer:input_type -> pb.FindEnabledServerRequest
1, // 8: pb.ServerService.createServer:output_type -> pb.CreateServerResponse
3, // 9: pb.ServerService.updateServer:output_type -> pb.UpdateServerResponse
5, // 10: pb.ServerService.countAllEnabledServers:output_type -> pb.CountAllEnabledServersResponse
7, // 11: pb.ServerService.listEnabledServers:output_type -> pb.ListEnabledServersResponse
9, // 12: pb.ServerService.disableServer:output_type -> pb.DisableServerResponse
11, // 13: pb.ServerService.findEnabledServer:output_type -> pb.FindEnabledServerResponse
8, // [8:14] is the sub-list for method output_type
2, // [2:8] is the sub-list for method input_type
2, // [2:2] is the sub-list for extension type_name
2, // [2:2] is the sub-list for extension extendee
0, // [0:2] is the sub-list for field type_name
}
func init() { file_service_server_proto_init() }
@@ -479,7 +850,7 @@ func file_service_server_proto_init() {
}
}
file_service_server_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*CountAllEnabledServersRequest); i {
switch v := v.(*UpdateServerRequest); i {
case 0:
return &v.state
case 1:
@@ -491,7 +862,7 @@ func file_service_server_proto_init() {
}
}
file_service_server_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*CountAllEnabledServersResponse); i {
switch v := v.(*UpdateServerResponse); i {
case 0:
return &v.state
case 1:
@@ -503,7 +874,7 @@ func file_service_server_proto_init() {
}
}
file_service_server_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ListEnabledServersRequest); i {
switch v := v.(*CountAllEnabledServersRequest); i {
case 0:
return &v.state
case 1:
@@ -515,6 +886,30 @@ func file_service_server_proto_init() {
}
}
file_service_server_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*CountAllEnabledServersResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_service_server_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ListEnabledServersRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_service_server_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ListEnabledServersResponse); i {
case 0:
return &v.state
@@ -526,6 +921,54 @@ func file_service_server_proto_init() {
return nil
}
}
file_service_server_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DisableServerRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_service_server_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DisableServerResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_service_server_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*FindEnabledServerRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_service_server_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*FindEnabledServerResponse); 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{
@@ -533,7 +976,7 @@ func file_service_server_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_service_server_proto_rawDesc,
NumEnums: 0,
NumMessages: 6,
NumMessages: 12,
NumExtensions: 0,
NumServices: 1,
},
@@ -561,10 +1004,16 @@ const _ = grpc.SupportPackageIsVersion6
type ServerServiceClient interface {
// 创建服务
CreateServer(ctx context.Context, in *CreateServerRequest, opts ...grpc.CallOption) (*CreateServerResponse, error)
// 修改服务
UpdateServer(ctx context.Context, in *UpdateServerRequest, opts ...grpc.CallOption) (*UpdateServerResponse, error)
// 计算服务数量
CountAllEnabledServers(ctx context.Context, in *CountAllEnabledServersRequest, opts ...grpc.CallOption) (*CountAllEnabledServersResponse, error)
// 列出单页服务
ListEnabledServers(ctx context.Context, in *ListEnabledServersRequest, opts ...grpc.CallOption) (*ListEnabledServersResponse, error)
// 禁用某服务
DisableServer(ctx context.Context, in *DisableServerRequest, opts ...grpc.CallOption) (*DisableServerResponse, error)
// 查找单个服务
FindEnabledServer(ctx context.Context, in *FindEnabledServerRequest, opts ...grpc.CallOption) (*FindEnabledServerResponse, error)
}
type serverServiceClient struct {
@@ -584,6 +1033,15 @@ func (c *serverServiceClient) CreateServer(ctx context.Context, in *CreateServer
return out, nil
}
func (c *serverServiceClient) UpdateServer(ctx context.Context, in *UpdateServerRequest, opts ...grpc.CallOption) (*UpdateServerResponse, error) {
out := new(UpdateServerResponse)
err := c.cc.Invoke(ctx, "/pb.ServerService/updateServer", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *serverServiceClient) CountAllEnabledServers(ctx context.Context, in *CountAllEnabledServersRequest, opts ...grpc.CallOption) (*CountAllEnabledServersResponse, error) {
out := new(CountAllEnabledServersResponse)
err := c.cc.Invoke(ctx, "/pb.ServerService/countAllEnabledServers", in, out, opts...)
@@ -602,14 +1060,38 @@ func (c *serverServiceClient) ListEnabledServers(ctx context.Context, in *ListEn
return out, nil
}
func (c *serverServiceClient) DisableServer(ctx context.Context, in *DisableServerRequest, opts ...grpc.CallOption) (*DisableServerResponse, error) {
out := new(DisableServerResponse)
err := c.cc.Invoke(ctx, "/pb.ServerService/disableServer", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *serverServiceClient) FindEnabledServer(ctx context.Context, in *FindEnabledServerRequest, opts ...grpc.CallOption) (*FindEnabledServerResponse, error) {
out := new(FindEnabledServerResponse)
err := c.cc.Invoke(ctx, "/pb.ServerService/findEnabledServer", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// ServerServiceServer is the server API for ServerService service.
type ServerServiceServer interface {
// 创建服务
CreateServer(context.Context, *CreateServerRequest) (*CreateServerResponse, error)
// 修改服务
UpdateServer(context.Context, *UpdateServerRequest) (*UpdateServerResponse, error)
// 计算服务数量
CountAllEnabledServers(context.Context, *CountAllEnabledServersRequest) (*CountAllEnabledServersResponse, error)
// 列出单页服务
ListEnabledServers(context.Context, *ListEnabledServersRequest) (*ListEnabledServersResponse, error)
// 禁用某服务
DisableServer(context.Context, *DisableServerRequest) (*DisableServerResponse, error)
// 查找单个服务
FindEnabledServer(context.Context, *FindEnabledServerRequest) (*FindEnabledServerResponse, error)
}
// UnimplementedServerServiceServer can be embedded to have forward compatible implementations.
@@ -619,12 +1101,21 @@ type UnimplementedServerServiceServer struct {
func (*UnimplementedServerServiceServer) CreateServer(context.Context, *CreateServerRequest) (*CreateServerResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method CreateServer not implemented")
}
func (*UnimplementedServerServiceServer) UpdateServer(context.Context, *UpdateServerRequest) (*UpdateServerResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateServer not implemented")
}
func (*UnimplementedServerServiceServer) CountAllEnabledServers(context.Context, *CountAllEnabledServersRequest) (*CountAllEnabledServersResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method CountAllEnabledServers not implemented")
}
func (*UnimplementedServerServiceServer) ListEnabledServers(context.Context, *ListEnabledServersRequest) (*ListEnabledServersResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ListEnabledServers not implemented")
}
func (*UnimplementedServerServiceServer) DisableServer(context.Context, *DisableServerRequest) (*DisableServerResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method DisableServer not implemented")
}
func (*UnimplementedServerServiceServer) FindEnabledServer(context.Context, *FindEnabledServerRequest) (*FindEnabledServerResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method FindEnabledServer not implemented")
}
func RegisterServerServiceServer(s *grpc.Server, srv ServerServiceServer) {
s.RegisterService(&_ServerService_serviceDesc, srv)
@@ -648,6 +1139,24 @@ func _ServerService_CreateServer_Handler(srv interface{}, ctx context.Context, d
return interceptor(ctx, in, info, handler)
}
func _ServerService_UpdateServer_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(UpdateServerRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ServerServiceServer).UpdateServer(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/pb.ServerService/UpdateServer",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ServerServiceServer).UpdateServer(ctx, req.(*UpdateServerRequest))
}
return interceptor(ctx, in, info, handler)
}
func _ServerService_CountAllEnabledServers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CountAllEnabledServersRequest)
if err := dec(in); err != nil {
@@ -684,6 +1193,42 @@ func _ServerService_ListEnabledServers_Handler(srv interface{}, ctx context.Cont
return interceptor(ctx, in, info, handler)
}
func _ServerService_DisableServer_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DisableServerRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ServerServiceServer).DisableServer(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/pb.ServerService/DisableServer",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ServerServiceServer).DisableServer(ctx, req.(*DisableServerRequest))
}
return interceptor(ctx, in, info, handler)
}
func _ServerService_FindEnabledServer_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(FindEnabledServerRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ServerServiceServer).FindEnabledServer(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/pb.ServerService/FindEnabledServer",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ServerServiceServer).FindEnabledServer(ctx, req.(*FindEnabledServerRequest))
}
return interceptor(ctx, in, info, handler)
}
var _ServerService_serviceDesc = grpc.ServiceDesc{
ServiceName: "pb.ServerService",
HandlerType: (*ServerServiceServer)(nil),
@@ -692,6 +1237,10 @@ var _ServerService_serviceDesc = grpc.ServiceDesc{
MethodName: "createServer",
Handler: _ServerService_CreateServer_Handler,
},
{
MethodName: "updateServer",
Handler: _ServerService_UpdateServer_Handler,
},
{
MethodName: "countAllEnabledServers",
Handler: _ServerService_CountAllEnabledServers_Handler,
@@ -700,6 +1249,14 @@ var _ServerService_serviceDesc = grpc.ServiceDesc{
MethodName: "listEnabledServers",
Handler: _ServerService_ListEnabledServers_Handler,
},
{
MethodName: "disableServer",
Handler: _ServerService_DisableServer_Handler,
},
{
MethodName: "findEnabledServer",
Handler: _ServerService_FindEnabledServer_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "service_server.proto",

View File

@@ -19,10 +19,22 @@ service NodeService {
rpc disableNode (DisableNodeRequest) returns (DisableNodeResponse);
// 修改节点
rpc updateNode(UpdateNodeRequest) returns (UpdateNodeResponse);
rpc updateNode (UpdateNodeRequest) returns (UpdateNodeResponse);
// 查看单个节点
rpc findEnabledNode(FindEnabledNodeRequest) returns (FindEnabledNodeResponse);
rpc findEnabledNode (FindEnabledNodeRequest) returns (FindEnabledNodeResponse);
// 组合单个节点配置
rpc composeNodeConfig (ComposeNodeConfigRequest) returns (ComposeNodeConfigResponse);
// 节点stream
rpc nodeStream (stream NodeStreamRequest) returns (stream NodeStreamResponse);
// 更新节点状态
rpc updateNodeStatus (UpdateNodeStatusRequest) returns (UpdateNodeStatusResponse);
// 同步集群中的节点版本
rpc syncNodesVersionWithCluster (SyncNodesVersionWithClusterRequest) returns (SyncNodesVersionWithClusterResponse);
}
// 创建节点
@@ -83,4 +95,40 @@ message FindEnabledNodeRequest {
message FindEnabledNodeResponse {
Node node = 1;
}
// 组合单个节点配置
message ComposeNodeConfigRequest {
}
message ComposeNodeConfigResponse {
bytes configJSON = 1;
}
// 节点stream
message NodeStreamRequest {
}
message NodeStreamResponse {
}
// 更新节点状态
message UpdateNodeStatusRequest {
int64 nodeId = 1;
bytes statusJSON = 2;
}
message UpdateNodeStatusResponse {
}
// 同步集群中的节点版本
message SyncNodesVersionWithClusterRequest {
int64 clusterId = 1;
}
message SyncNodesVersionWithClusterResponse {
}

View File

@@ -7,8 +7,12 @@ import "model_node_cluster.proto";
service NodeClusterService {
// 获取所有集群的信息
rpc findAllEnabledClusters (FindAllEnabledNodeClustersRequest) returns (FindAllEnabledNodeClustersResponse);
// 获取变更的集群
rpc findAllChangedClusters (FindAllChangedClustersRequest) returns (FindAllChangedClustersResponse);
}
// 获取所有集群的信息
message FindAllEnabledNodeClustersRequest {
}
@@ -16,3 +20,12 @@ message FindAllEnabledNodeClustersRequest {
message FindAllEnabledNodeClustersResponse {
repeated NodeCluster clusters = 1;
}
// 获取变更的集群
message FindAllChangedClustersRequest {
}
message FindAllChangedClustersResponse {
repeated NodeCluster clusters = 1;
}

View File

@@ -8,13 +8,21 @@ service ServerService {
// 创建服务
rpc createServer (CreateServerRequest) returns (CreateServerResponse);
// 修改服务
rpc updateServer (UpdateServerRequest) returns (UpdateServerResponse);
// 计算服务数量
rpc countAllEnabledServers (CountAllEnabledServersRequest) returns (CountAllEnabledServersResponse);
// 列出单页服务
rpc listEnabledServers (ListEnabledServersRequest) returns (ListEnabledServersResponse);
}
// 禁用某服务
rpc disableServer (DisableServerRequest) returns (DisableServerResponse);
// 查找单个服务
rpc findEnabledServer (FindEnabledServerRequest) returns (FindEnabledServerResponse);
}
// 创建服务
message CreateServerRequest {
@@ -30,6 +38,21 @@ message CreateServerResponse {
int64 serverId = 1;
}
// 修改服务
message UpdateServerRequest {
int64 serverId = 1;
int64 userId = 2;
int64 adminId = 3;
int64 clusterId = 4;
bytes config = 5;
bytes includeNodesJSON = 6;
bytes excludeNodesJSON = 7;
}
message UpdateServerResponse {
}
// 计算服务数量
message CountAllEnabledServersRequest {
@@ -48,3 +71,21 @@ message ListEnabledServersRequest {
message ListEnabledServersResponse {
repeated Server servers = 1;
}
// 禁用服务
message DisableServerRequest {
int64 serverId = 1;
}
message DisableServerResponse {
}
// 查找单个服务
message FindEnabledServerRequest {
int64 serverId = 1;
}
message FindEnabledServerResponse {
Server server = 1;
}

View File

@@ -61,7 +61,7 @@ func (this *ParentAction) SecondMenu(menuItem string) {
}
func (this *ParentAction) AdminId() int64 {
return int64(this.Context.GetInt("adminId"))
return this.Context.GetInt64("adminId")
}
func (this *ParentAction) CreateLog(level string, description string, args ...interface{}) {

View File

@@ -25,6 +25,7 @@ func (this *Tabbar) Add(name string, subName string, url string, icon string, ac
"url": url,
"icon": icon,
"active": active,
"right": false,
}
this.items = append(this.items, m)
return m

View File

@@ -0,0 +1,35 @@
package common
import (
"github.com/TeaOSLab/EdgeAdmin/internal/rpc/pb"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/iwind/TeaGo/maps"
)
type ChangedClustersAction struct {
actionutils.ParentAction
}
func (this *ChangedClustersAction) Init() {
this.Nav("", "", "")
}
func (this *ChangedClustersAction) RunGet(params struct{}) {
resp, err := this.RPC().NodeClusterRPC().FindAllChangedClusters(this.AdminContext(), &pb.FindAllChangedClustersRequest{})
if err != nil {
this.ErrorPage(err)
return
}
result := []maps.Map{}
for _, cluster := range resp.Clusters {
result = append(result, maps.Map{
"id": cluster.Id,
"name": cluster.Name,
})
}
this.Data["clusters"] = result
this.Success()
}

View File

@@ -0,0 +1,17 @@
package common
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/helpers"
"github.com/iwind/TeaGo"
)
func init() {
TeaGo.BeforeStart(func(server *TeaGo.Server) {
server.
Helper(new(helpers.UserMustAuth)).
Prefix("/common").
Get("/changedClusters", new(ChangedClustersAction)).
Post("/syncClusters", new(SyncClustersAction)).
EndAll()
})
}

View File

@@ -0,0 +1,34 @@
package common
import (
"github.com/TeaOSLab/EdgeAdmin/internal/rpc/pb"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
)
type SyncClustersAction struct {
actionutils.ParentAction
}
func (this *SyncClustersAction) RunPost(params struct{}) {
// TODO 将来可以单独选择某一个集群进行单独的同步
// 所有有变化的集群
clustersResp, err := this.RPC().NodeClusterRPC().FindAllChangedClusters(this.AdminContext(), &pb.FindAllChangedClustersRequest{})
if err != nil {
this.ErrorPage(err)
return
}
clusters := clustersResp.Clusters
for _, cluster := range clusters {
_, err := this.RPC().NodeRPC().SyncNodesVersionWithCluster(this.AdminContext(), &pb.SyncNodesVersionWithClusterRequest{
ClusterId: cluster.Id,
})
if err != nil {
this.ErrorPage(err)
return
}
}
this.Success()
}

View File

@@ -1,9 +1,14 @@
package nodes
import (
"encoding/json"
"fmt"
"github.com/TeaOSLab/EdgeAdmin/internal/configs/nodes"
"github.com/TeaOSLab/EdgeAdmin/internal/rpc/pb"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/iwind/TeaGo/logs"
"github.com/iwind/TeaGo/maps"
"time"
)
type IndexAction struct {
@@ -30,9 +35,29 @@ func (this *IndexAction) RunGet(params struct{}) {
})
nodeMaps := []maps.Map{}
for _, node := range nodesResp.Nodes {
// 状态
status := &nodes.NodeStatus{}
if len(node.Status) > 0 && node.Status != "null" {
err = json.Unmarshal([]byte(node.Status), &status)
if err != nil {
logs.Error(err)
continue
}
status.IsActive = time.Now().Unix()-status.UpdatedAt < 120 // 2分钟之内认为活跃
}
nodeMaps = append(nodeMaps, maps.Map{
"id": node.Id,
"name": node.Name,
"status": maps.Map{
"isActive": status.IsActive,
"updatedAt": status.UpdatedAt,
"hostname": status.Hostname,
"cpuUsage": status.CPUUsage,
"cpuUsageText": fmt.Sprintf("%.2f%%", status.CPUUsage*100),
"memUsage": status.MemoryUsage,
"memUsageText": fmt.Sprintf("%.2f%%", status.MemoryUsage*100),
},
"cluster": maps.Map{
"id": node.Cluster.Id,
"name": node.Cluster.Name,

View File

@@ -0,0 +1,58 @@
package servers
import (
"github.com/TeaOSLab/EdgeAdmin/internal/configs/serverconfigs"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/iwind/TeaGo/actions"
"github.com/iwind/TeaGo/rands"
"regexp"
"strings"
)
type AddOriginPopupAction struct {
actionutils.ParentAction
}
func (this *AddOriginPopupAction) Init() {
this.Nav("", "", "")
}
func (this *AddOriginPopupAction) RunGet(params struct {
ServerType string
}) {
this.Data["serverType"] = params.ServerType
this.Show()
}
func (this *AddOriginPopupAction) RunPost(params struct {
Protocol string
Addr string
Must *actions.Must
}) {
params.Must.
Field("addr", params.Addr).
Require("请输入源站地址")
addr := regexp.MustCompile(`\s+`).ReplaceAllString(params.Addr, "")
portIndex := strings.LastIndex(params.Addr, ":")
if portIndex < 0 {
this.Fail("地址中需要带有端口")
}
host := addr[:portIndex]
port := addr[portIndex+1:]
origin := &serverconfigs.OriginServerConfig{
Id: rands.HexString(32),
IsOn: true,
Addr: &serverconfigs.NetworkAddressConfig{
Protocol: params.Protocol,
Host: host,
PortRange: port,
},
}
this.Data["origin"] = origin
this.Success()
}

View File

@@ -0,0 +1,61 @@
package servers
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/serverutils"
"github.com/iwind/TeaGo/actions"
"github.com/iwind/TeaGo/maps"
"regexp"
"strings"
)
type AddPortPopupAction struct {
actionutils.ParentAction
}
func (this *AddPortPopupAction) Init() {
this.Nav("", "", "")
}
func (this *AddPortPopupAction) RunGet(params struct {
ServerType string
}) {
this.Data["protocols"] = serverutils.AllServerProtocolsForType(params.ServerType)
this.Show()
}
func (this *AddPortPopupAction) RunPost(params struct {
Protocol string
Address string
Must *actions.Must
}) {
// 校验地址
addr := maps.Map{
"protocol": params.Protocol,
"host": "",
"portRange": "",
}
// TODO 判断端口不能小于1
// TODO 判断端口号不能大于65535
digitRegexp := regexp.MustCompile(`^\d+$`)
if digitRegexp.MatchString(params.Address) {
addr["portRange"] = params.Address
} else if strings.Contains(params.Address, ":") {
index := strings.LastIndex(params.Address, ":")
addr["host"] = strings.TrimSpace(params.Address[:index])
port := strings.TrimSpace(params.Address[index+1:])
if !digitRegexp.MatchString(port) {
this.Fail("端口只能是一个数字")
}
addr["portRange"] = port
} else {
this.Fail("请输入正确的端口或者网络地址")
}
this.Data["address"] = addr
this.Success()
}

View File

@@ -0,0 +1,35 @@
package servers
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/iwind/TeaGo/actions"
"github.com/iwind/TeaGo/maps"
)
type AddServerNamePopupAction struct {
actionutils.ParentAction
}
func (this *AddServerNamePopupAction) Init() {
this.Nav("", "", "")
}
func (this *AddServerNamePopupAction) RunGet(params struct{}) {
this.Show()
}
func (this *AddServerNamePopupAction) RunPost(params struct {
ServerName string
Must *actions.Must
}) {
params.Must.
Field("serverName", params.ServerName).
Require("请输入域名")
this.Data["serverName"] = maps.Map{
"name": params.ServerName,
"type": "full",
}
this.Success()
}

View File

@@ -2,9 +2,10 @@ package servers
import (
"encoding/json"
"github.com/TeaOSLab/EdgeAdmin/internal/configs/nodes"
"github.com/TeaOSLab/EdgeAdmin/internal/configs/serverconfigs"
"github.com/TeaOSLab/EdgeAdmin/internal/rpc/pb"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/serverutils"
"github.com/iwind/TeaGo/actions"
"github.com/iwind/TeaGo/maps"
)
@@ -14,7 +15,7 @@ type CreateAction struct {
}
func (this *CreateAction) Init() {
this.Nav("", "", "create")
this.Nav("", "server", "create")
}
func (this *CreateAction) RunGet(params struct{}) {
@@ -36,12 +37,23 @@ func (this *CreateAction) RunGet(params struct{}) {
}
this.Data["clusters"] = clusterMaps
// 服务类型
this.Data["serverTypes"] = serverutils.AllServerTypes()
this.Show()
}
func (this *CreateAction) RunPost(params struct {
Name string
ClusterId int64
Name string
Description string
ClusterId int64
ServerType string
Addresses string
ServerNames string
Origins string
WebRoot string
Must *actions.Must
}) {
@@ -56,9 +68,114 @@ func (this *CreateAction) RunPost(params struct {
// TODO 验证集群ID
// 配置
serverConfig := &nodes.ServerConfig{}
serverConfig := &serverconfigs.ServerConfig{}
serverConfig.IsOn = true
serverConfig.Name = params.Name
serverConfig.Description = params.Description
// 端口地址
switch params.ServerType {
case serverutils.ServerTypeHTTPProxy, serverutils.ServerTypeHTTPWeb:
listen := []*serverconfigs.NetworkAddressConfig{}
err := json.Unmarshal([]byte(params.Addresses), &listen)
if err != nil {
this.Fail("端口地址解析失败:" + err.Error())
}
for _, addr := range listen {
switch addr.Protocol {
case serverconfigs.ProtocolHTTP, serverconfigs.ProtocolHTTP4, serverconfigs.ProtocolHTTP6:
if serverConfig.HTTP == nil {
serverConfig.HTTP = &serverconfigs.HTTPProtocolConfig{
BaseProtocol: serverconfigs.BaseProtocol{
IsOn: true,
},
}
}
serverConfig.HTTP.AddListen(addr)
case serverconfigs.ProtocolHTTPS, serverconfigs.ProtocolHTTPS4, serverconfigs.ProtocolHTTPS6:
if serverConfig.HTTPS == nil {
serverConfig.HTTPS = &serverconfigs.HTTPSProtocolConfig{
BaseProtocol: serverconfigs.BaseProtocol{
IsOn: true,
},
}
}
serverConfig.HTTPS.AddListen(addr)
}
}
case serverutils.ServerTypeTCPProxy:
listen := []*serverconfigs.NetworkAddressConfig{}
err := json.Unmarshal([]byte(params.Addresses), &listen)
if err != nil {
this.Fail("端口地址解析失败:" + err.Error())
}
for _, addr := range listen {
switch addr.Protocol {
case serverconfigs.ProtocolTCP, serverconfigs.ProtocolTCP4, serverconfigs.ProtocolTCP6:
if serverConfig.TCP == nil {
serverConfig.TCP = &serverconfigs.TCPProtocolConfig{
BaseProtocol: serverconfigs.BaseProtocol{
IsOn: true,
},
}
}
serverConfig.TCP.AddListen(addr)
case serverconfigs.ProtocolTLS, serverconfigs.ProtocolTLS4, serverconfigs.ProtocolTLS6:
if serverConfig.TLS == nil {
serverConfig.TLS = &serverconfigs.TLSProtocolConfig{
BaseProtocol: serverconfigs.BaseProtocol{
IsOn: true,
},
}
}
serverConfig.TLS.AddListen(addr)
}
}
default:
this.Fail("请选择正确的服务类型")
}
// TODO 证书
// 域名
serverNames := []*serverconfigs.ServerNameConfig{}
err := json.Unmarshal([]byte(params.ServerNames), &serverNames)
if err != nil {
this.Fail("域名解析失败:" + err.Error())
}
serverConfig.ServerNames = serverNames
// 源站地址
switch params.ServerType {
case serverutils.ServerTypeHTTPProxy, serverutils.ServerTypeTCPProxy:
origins := []*serverconfigs.OriginServerConfig{}
err = json.Unmarshal([]byte(params.Origins), &origins)
if err != nil {
this.Fail("源站地址解析失败:" + err.Error())
}
serverConfig.ReverseProxy = &serverconfigs.ReverseProxyConfig{
IsOn: true,
Origins: origins,
}
}
// Web地址
switch params.ServerType {
case serverutils.ServerTypeHTTPWeb:
serverConfig.Web = &serverconfigs.WebConfig{
IsOn: true,
Root: params.WebRoot,
}
}
// 校验
err = serverConfig.Init()
if err != nil {
this.Fail("配置校验失败:" + err.Error())
}
serverConfigJSON, err := serverConfig.AsJSON()
if err != nil {
this.ErrorPage(err)

View File

@@ -1,6 +1,7 @@
package servers
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/iwind/TeaGo/actions"
)
@@ -13,4 +14,10 @@ func NewHelper() *Helper {
func (this *Helper) BeforeAction(action *actions.ActionObject) {
action.Data["teaMenu"] = "servers"
selectedTabbar, _ := action.Data["mainTab"]
tabbar := actionutils.NewTabbar()
tabbar.Add("服务管理", "", "/servers", "", selectedTabbar == "server")
actionutils.SetTabbar(action, tabbar)
}

View File

@@ -2,10 +2,12 @@ package servers
import (
"encoding/json"
"github.com/TeaOSLab/EdgeAdmin/internal/configs/nodes"
"github.com/TeaOSLab/EdgeAdmin/internal/configs/serverconfigs"
"github.com/TeaOSLab/EdgeAdmin/internal/rpc/pb"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/iwind/TeaGo/logs"
"github.com/iwind/TeaGo/maps"
"strings"
)
type IndexAction struct {
@@ -13,7 +15,7 @@ type IndexAction struct {
}
func (this *IndexAction) Init() {
this.Nav("", "", "index")
this.Nav("", "server", "index")
}
func (this *IndexAction) RunGet(params struct{}) {
@@ -38,12 +40,75 @@ func (this *IndexAction) RunGet(params struct{}) {
serverMaps := []maps.Map{}
for _, server := range serversResp.Servers {
// 服务名
serverConfig := &nodes.ServerConfig{}
serverConfig := &serverconfigs.ServerConfig{}
err = json.Unmarshal(server.Config, &serverConfig)
if err != nil {
this.ErrorPage(err)
return
}
err = serverConfig.Init()
if err != nil {
logs.Println("init server '" + serverConfig.Name + "' error: " + err.Error())
}
serverTypeNames := []string{}
// 端口列表
portMaps := []maps.Map{}
if serverConfig.HTTP != nil && serverConfig.HTTP.IsOn {
serverTypeNames = append(serverTypeNames, "HTTP")
for _, listen := range serverConfig.HTTP.Listen {
portMaps = append(portMaps, maps.Map{
"protocol": listen.Protocol,
"portRange": listen.PortRange,
})
}
}
if serverConfig.HTTPS != nil && serverConfig.HTTPS.IsOn {
serverTypeNames = append(serverTypeNames, "HTTPS")
for _, listen := range serverConfig.HTTPS.Listen {
portMaps = append(portMaps, maps.Map{
"protocol": listen.Protocol,
"portRange": listen.PortRange,
})
}
}
if serverConfig.TCP != nil && serverConfig.TCP.IsOn {
serverTypeNames = append(serverTypeNames, "TCP")
for _, listen := range serverConfig.TCP.Listen {
portMaps = append(portMaps, maps.Map{
"protocol": listen.Protocol,
"portRange": listen.PortRange,
})
}
}
if serverConfig.TLS != nil && serverConfig.TLS.IsOn {
serverTypeNames = append(serverTypeNames, "TLS")
for _, listen := range serverConfig.TLS.Listen {
portMaps = append(portMaps, maps.Map{
"protocol": listen.Protocol,
"portRange": listen.PortRange,
})
}
}
if serverConfig.Unix != nil && serverConfig.Unix.IsOn {
serverTypeNames = append(serverTypeNames, "Unix")
for _, listen := range serverConfig.Unix.Listen {
portMaps = append(portMaps, maps.Map{
"protocol": listen.Protocol,
"portRange": listen.Host,
})
}
}
if serverConfig.UDP != nil && serverConfig.UDP.IsOn {
serverTypeNames = append(serverTypeNames, "UDP")
for _, listen := range serverConfig.UDP.Listen {
portMaps = append(portMaps, maps.Map{
"protocol": listen.Protocol,
"portRange": listen.PortRange,
})
}
}
serverMaps = append(serverMaps, maps.Map{
"id": server.Id,
@@ -52,6 +117,8 @@ func (this *IndexAction) RunGet(params struct{}) {
"id": server.Cluster.Id,
"name": server.Cluster.Name,
},
"ports": portMaps,
"serverTypeName": strings.Join(serverTypeNames, "+"),
})
}
this.Data["servers"] = serverMaps

View File

@@ -13,6 +13,11 @@ func init() {
Prefix("/servers").
Get("", new(IndexAction)).
GetPost("/create", new(CreateAction)).
GetPost("/update", new(UpdateAction)).
GetPost("/addPortPopup", new(AddPortPopupAction)).
GetPost("/addServerNamePopup", new(AddServerNamePopupAction)).
GetPost("/addOriginPopup", new(AddOriginPopupAction)).
EndAll()
})
}

View File

@@ -0,0 +1,15 @@
package board
import "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
type IndexAction struct {
actionutils.ParentAction
}
func (this *IndexAction) Init() {
this.Nav("", "board", "")
}
func (this *IndexAction) RunGet(params struct{}) {
this.Show()
}

View File

@@ -0,0 +1,18 @@
package board
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/serverutils"
"github.com/TeaOSLab/EdgeAdmin/internal/web/helpers"
"github.com/iwind/TeaGo"
)
func init() {
TeaGo.BeforeStart(func(server *TeaGo.Server) {
server.
Helper(helpers.NewUserMustAuth()).
Helper(serverutils.NewServerHelper()).
Prefix("/servers/server/board").
Get("", new(IndexAction)).
EndAll()
})
}

View File

@@ -0,0 +1,15 @@
package delete
import "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
type IndexAction struct {
actionutils.ParentAction
}
func (this *IndexAction) Init() {
this.Nav("", "delete", "")
}
func (this *IndexAction) RunGet(params struct{}) {
this.Show()
}

View File

@@ -0,0 +1,18 @@
package delete
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/serverutils"
"github.com/TeaOSLab/EdgeAdmin/internal/web/helpers"
"github.com/iwind/TeaGo"
)
func init() {
TeaGo.BeforeStart(func(server *TeaGo.Server) {
server.
Helper(helpers.NewUserMustAuth()).
Helper(serverutils.NewServerHelper()).
Prefix("/servers/server/delete").
Get("", new(IndexAction)).
EndAll()
})
}

View File

@@ -0,0 +1,21 @@
package server
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"strconv"
)
type IndexAction struct {
actionutils.ParentAction
}
func (this *IndexAction) Init() {
this.Nav("", "index", "index")
this.SecondMenu("index")
}
func (this *IndexAction) RunGet(params struct {
ServerId int64
}) {
this.RedirectURL("/servers/server/board?serverId=" + strconv.FormatInt(params.ServerId, 10))
}

View File

@@ -0,0 +1,18 @@
package server
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/serverutils"
"github.com/TeaOSLab/EdgeAdmin/internal/web/helpers"
"github.com/iwind/TeaGo"
)
func init() {
TeaGo.BeforeStart(func(server *TeaGo.Server) {
server.
Helper(helpers.NewUserMustAuth()).
Helper(serverutils.NewServerHelper()).
Prefix("/servers/server").
Get("", new(IndexAction)).
EndAll()
})
}

View File

@@ -0,0 +1,15 @@
package log
import "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
type IndexAction struct {
actionutils.ParentAction
}
func (this *IndexAction) Init() {
this.Nav("", "log", "")
}
func (this *IndexAction) RunGet(params struct{}) {
this.Show()
}

View File

@@ -0,0 +1,18 @@
package log
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/serverutils"
"github.com/TeaOSLab/EdgeAdmin/internal/web/helpers"
"github.com/iwind/TeaGo"
)
func init() {
TeaGo.BeforeStart(func(server *TeaGo.Server) {
server.
Helper(helpers.NewUserMustAuth()).
Helper(serverutils.NewServerHelper()).
Prefix("/servers/server/log").
Get("", new(IndexAction)).
EndAll()
})
}

View File

@@ -0,0 +1,20 @@
package server
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
)
type IndexAction struct {
actionutils.ParentAction
}
func (this *IndexAction) Init() {
this.Nav("", "setting", "index")
this.SecondMenu("http")
}
func (this *IndexAction) RunGet(params struct {
ServerId int64
}) {
this.Show()
}

View File

@@ -0,0 +1,18 @@
package server
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/serverutils"
"github.com/TeaOSLab/EdgeAdmin/internal/web/helpers"
"github.com/iwind/TeaGo"
)
func init() {
TeaGo.BeforeStart(func(server *TeaGo.Server) {
server.
Helper(helpers.NewUserMustAuth()).
Helper(serverutils.NewServerHelper()).
Prefix("/servers/server/http").
Get("", new(IndexAction)).
EndAll()
})
}

View File

@@ -0,0 +1,16 @@
package settings
import "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
type IndexAction struct {
actionutils.ParentAction
}
func (this *IndexAction) Init() {
this.Nav("", "setting", "")
this.SecondMenu("basic")
}
func (this *IndexAction) RunGet(params struct{}) {
this.Show()
}

View File

@@ -0,0 +1,18 @@
package settings
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/serverutils"
"github.com/TeaOSLab/EdgeAdmin/internal/web/helpers"
"github.com/iwind/TeaGo"
)
func init() {
TeaGo.BeforeStart(func(server *TeaGo.Server) {
server.
Helper(helpers.NewUserMustAuth()).
Helper(serverutils.NewServerHelper()).
Prefix("/servers/server/settings").
Get("", new(IndexAction)).
EndAll()
})
}

View File

@@ -0,0 +1,15 @@
package stat
import "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
type IndexAction struct {
actionutils.ParentAction
}
func (this *IndexAction) Init() {
this.Nav("", "stat", "")
}
func (this *IndexAction) RunGet(params struct{}) {
this.Show()
}

View File

@@ -0,0 +1,18 @@
package stat
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/serverutils"
"github.com/TeaOSLab/EdgeAdmin/internal/web/helpers"
"github.com/iwind/TeaGo"
)
func init() {
TeaGo.BeforeStart(func(server *TeaGo.Server) {
server.
Helper(helpers.NewUserMustAuth()).
Helper(serverutils.NewServerHelper()).
Prefix("/servers/server/stat").
Get("", new(IndexAction)).
EndAll()
})
}

View File

@@ -0,0 +1,212 @@
package serverutils
import (
"encoding/json"
"errors"
"github.com/TeaOSLab/EdgeAdmin/internal/configs/serverconfigs"
"github.com/TeaOSLab/EdgeAdmin/internal/rpc"
"github.com/TeaOSLab/EdgeAdmin/internal/rpc/pb"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/iwind/TeaGo/actions"
"github.com/iwind/TeaGo/logs"
"github.com/iwind/TeaGo/maps"
"github.com/iwind/TeaGo/types"
"net/http"
"strconv"
)
type ServerHelper struct {
}
func NewServerHelper() *ServerHelper {
return &ServerHelper{}
}
func (this *ServerHelper) BeforeAction(action *actions.ActionObject) {
if action.Request.Method != http.MethodGet {
return
}
action.Data["teaMenu"] = "servers"
// 左侧菜单
this.createLeftMenu(action)
}
func (this *ServerHelper) createLeftMenu(action *actions.ActionObject) {
// 初始化
action.Data["leftMenuItems"] = []maps.Map{}
mainTab, _ := action.Data["mainTab"]
secondMenuItem, _ := action.Data["secondMenuItem"]
serverId := action.ParamInt64("serverId")
serverIdString := strconv.FormatInt(serverId, 10)
// 读取server信息
rpcClient, err := rpc.SharedRPC()
if err != nil {
logs.Error(err)
return
}
serverResp, err := rpcClient.ServerRPC().FindEnabledServer(rpcClient.Context(action.Context.GetInt64("adminId")), &pb.FindEnabledServerRequest{ServerId: serverId})
if err != nil {
logs.Error(err)
return
}
server := serverResp.Server
if server == nil {
logs.Error(errors.New("can not find the server"))
return
}
// 源站管理
serverConfig := &serverconfigs.ServerConfig{}
err = json.Unmarshal(server.Config, serverConfig)
if err != nil {
logs.Error(err)
return
}
// TABBAR
selectedTabbar, _ := action.Data["mainTab"]
tabbar := actionutils.NewTabbar()
tabbar.Add("当前:"+serverConfig.Name, "", "/servers", "left long alternate arrow", false)
tabbar.Add("看板", "", "/servers/server/board?serverId="+serverIdString, "dashboard", selectedTabbar == "board")
tabbar.Add("日志", "", "/servers/server/log?serverId="+serverIdString, "history", selectedTabbar == "log")
tabbar.Add("统计", "", "/servers/server/stat?serverId="+serverIdString, "chart area", selectedTabbar == "stat")
tabbar.Add("设置", "", "/servers/server/settings?serverId="+serverIdString, "setting", selectedTabbar == "setting")
tabbar.Add("删除", "", "/servers/server/delete?serverId="+serverIdString, "trash", selectedTabbar == "delete")
actionutils.SetTabbar(action, tabbar)
// 左侧操作子菜单
switch types.String(mainTab) {
case "board":
// TODO
case "log":
// TODO
case "stat":
// TODO
case "setting":
action.Data["leftMenuItems"] = this.createSettingsMenu(types.String(secondMenuItem), serverIdString, serverConfig)
case "delete":
// TODO
}
}
func (this *ServerHelper) createSettingsMenu(secondMenuItem string, serverIdString string, serverConfig *serverconfigs.ServerConfig) (items []maps.Map) {
menuItems := []maps.Map{
{
"name": "基本信息",
"url": "/servers/server/settings?serverId=" + serverIdString,
"isActive": secondMenuItem == "basic",
},
}
// HTTP
if serverConfig.IsHTTP() {
menuItems = append(menuItems, maps.Map{
"name": "HTTP",
"url": "/servers/server/http?serverId=" + serverIdString,
"isActive": secondMenuItem == "http",
})
menuItems = append(menuItems, maps.Map{
"name": "HTTPS",
"url": "/servers/server/https?serverId=" + serverIdString,
"isActive": secondMenuItem == "https",
})
menuItems = append(menuItems, maps.Map{
"name": "Web设置",
"url": "/servers/server/web?serverId=" + serverIdString,
"isActive": secondMenuItem == "web",
})
menuItems = append(menuItems, maps.Map{
"name": "字符集",
"url": "/servers/server/charset?serverId=" + serverIdString,
"isActive": secondMenuItem == "charset",
})
menuItems = append(menuItems, maps.Map{
"name": "访问日志",
"url": "/servers/server/accessLog?serverId=" + serverIdString,
"isActive": secondMenuItem == "accessLog",
})
menuItems = append(menuItems, maps.Map{
"name": "统计",
"url": "/servers/server/stat?serverId=" + serverIdString,
"isActive": secondMenuItem == "stat",
})
menuItems = append(menuItems, maps.Map{
"name": "Gzip压缩",
"url": "/servers/server/gzip?serverId=" + serverIdString,
"isActive": secondMenuItem == "gzip",
})
menuItems = append(menuItems, maps.Map{
"name": "特殊页面",
"url": "/servers/server/pages?serverId=" + serverIdString,
"isActive": secondMenuItem == "pages",
})
menuItems = append(menuItems, maps.Map{
"name": "HTTP Header",
"url": "/servers/server/headers?serverId=" + serverIdString,
"isActive": secondMenuItem == "header",
})
menuItems = append(menuItems, maps.Map{
"name": "反向代理",
"url": "/servers/server/reverseProxy?serverId=" + serverIdString,
"isActive": secondMenuItem == "reverseProxy",
})
menuItems = append(menuItems, maps.Map{
"name": "路径规则",
"url": "/servers/server/locations?serverId=" + serverIdString,
"isActive": secondMenuItem == "locations",
})
menuItems = append(menuItems, maps.Map{
"name": "访问控制",
"url": "/servers/server/access?serverId=" + serverIdString,
"isActive": secondMenuItem == "access",
})
menuItems = append(menuItems, maps.Map{
"name": "WAF",
"url": "/servers/server/waf?serverId=" + serverIdString,
"isActive": secondMenuItem == "waf",
})
menuItems = append(menuItems, maps.Map{
"name": "缓存",
"url": "/servers/server/cache?serverId=" + serverIdString,
"isActive": secondMenuItem == "cache",
})
} else if serverConfig.IsTCP() {
menuItems = append(menuItems, maps.Map{
"name": "TCP",
"url": "/servers/server/tcp?serverId=" + serverIdString,
"isActive": secondMenuItem == "tcp",
})
} else if serverConfig.IsUnix() {
menuItems = append(menuItems, maps.Map{
"name": "Unix",
"url": "/servers/server/unix?serverId=" + serverIdString,
"isActive": secondMenuItem == "unix",
})
} else if serverConfig.IsUDP() {
menuItems = append(menuItems, maps.Map{
"name": "UDP",
"url": "/servers/server/udp?serverId=" + serverIdString,
"isActive": secondMenuItem == "udp",
})
}
return menuItems
}

View File

@@ -0,0 +1,97 @@
package serverutils
import (
"github.com/iwind/TeaGo/lists"
"github.com/iwind/TeaGo/maps"
)
type ServerType = string
const (
ServerTypeHTTPProxy ServerType = "httpProxy"
ServerTypeHTTPWeb ServerType = "httpWeb"
ServerTypeTCPProxy ServerType = "tcpProxy"
ServerTypeUnixProxy ServerType = "unixProxy"
ServerTypeUDPProxy ServerType = "udp"
)
// 获取所有的服务类型
func AllServerTypes() []maps.Map {
return []maps.Map{
{
"name": "HTTP反向代理",
"code": ServerTypeHTTPProxy,
},
{
"name": "HTTP Web服务",
"code": ServerTypeHTTPWeb,
},
{
"name": "TCP反向代理",
"code": ServerTypeTCPProxy,
},
/**{
"name": "UNIX协议反向代理",
"code": ServerTypeUnixProxy,
},
{
"name": "UDP反向代理",
"code": ServerTypeUDPProxy,
},**/
}
}
// 查找服务类型
func FindServerType(code string) maps.Map {
for _, m := range AllServerTypes() {
if m.GetString("code") == code {
return m
}
}
return nil
}
// 获取所有协议
func AllServerProtocolsForType(serverType ServerType) []maps.Map {
protocols := []maps.Map{
{
"name": "HTTP",
"code": "http",
"serverTypes": []ServerType{ServerTypeHTTPProxy, ServerTypeHTTPWeb},
},
{
"name": "HTTPS",
"code": "https",
"serverTypes": []ServerType{ServerTypeHTTPProxy, ServerTypeHTTPWeb},
},
{
"name": "TCP",
"code": "tcp",
"serverTypes": []ServerType{ServerTypeTCPProxy},
},
{
"name": "TLS",
"code": "tls",
"serverTypes": []ServerType{ServerTypeTCPProxy},
},
{
"name": "Unix",
"code": "unix",
"serverTypes": []ServerType{ServerTypeUnixProxy},
},
{
"name": "UDP",
"code": "udp",
"serverTypes": []ServerType{ServerTypeUDPProxy},
},
}
result := []maps.Map{}
for _, p := range protocols {
serverTypes := p.GetSlice("serverTypes")
if lists.Contains(serverTypes, serverType) {
result = append(result, p)
}
}
return result
}

View File

@@ -0,0 +1,15 @@
package servers
import "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
type UpdateAction struct {
actionutils.ParentAction
}
func (this *UpdateAction) Init() {
this.Nav("", "", "")
}
func (this *UpdateAction) RunGet(params struct{}) {
this.Show()
}

View File

@@ -1,11 +1,19 @@
package web
import (
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/common"
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/dashboard"
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/index"
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/logout"
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/nodes"
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers"
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/server"
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/server/board"
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/server/delete"
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/server/log"
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/server/settings"
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/server/settings/http"
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/server/stat"
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/settings"
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/ui"
)