阶段性提交

This commit is contained in:
刘祥超
2020-09-15 14:44:38 +08:00
parent dd504b39c8
commit c7a30d7720
32 changed files with 5228 additions and 410 deletions

View File

@@ -0,0 +1,155 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.25.0
// protoc v3.12.3
// source: model_http_web.proto
package pb
import (
proto "github.com/golang/protobuf/proto"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// This is a compile-time assertion that a sufficiently up-to-date version
// of the legacy proto package is being used.
const _ = proto.ProtoPackageIsVersion4
type HTTPWeb struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
Root string `protobuf:"bytes,2,opt,name=root,proto3" json:"root,omitempty"`
}
func (x *HTTPWeb) Reset() {
*x = HTTPWeb{}
if protoimpl.UnsafeEnabled {
mi := &file_model_http_web_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *HTTPWeb) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*HTTPWeb) ProtoMessage() {}
func (x *HTTPWeb) ProtoReflect() protoreflect.Message {
mi := &file_model_http_web_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use HTTPWeb.ProtoReflect.Descriptor instead.
func (*HTTPWeb) Descriptor() ([]byte, []int) {
return file_model_http_web_proto_rawDescGZIP(), []int{0}
}
func (x *HTTPWeb) GetId() int64 {
if x != nil {
return x.Id
}
return 0
}
func (x *HTTPWeb) GetRoot() string {
if x != nil {
return x.Root
}
return ""
}
var File_model_http_web_proto protoreflect.FileDescriptor
var file_model_http_web_proto_rawDesc = []byte{
0x0a, 0x14, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x68, 0x74, 0x74, 0x70, 0x5f, 0x77, 0x65, 0x62,
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, 0x2d, 0x0a, 0x07, 0x48, 0x54,
0x54, 0x50, 0x57, 0x65, 0x62, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x72, 0x6f, 0x6f, 0x74, 0x18, 0x02, 0x20,
0x01, 0x28, 0x09, 0x52, 0x04, 0x72, 0x6f, 0x6f, 0x74, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70,
0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_model_http_web_proto_rawDescOnce sync.Once
file_model_http_web_proto_rawDescData = file_model_http_web_proto_rawDesc
)
func file_model_http_web_proto_rawDescGZIP() []byte {
file_model_http_web_proto_rawDescOnce.Do(func() {
file_model_http_web_proto_rawDescData = protoimpl.X.CompressGZIP(file_model_http_web_proto_rawDescData)
})
return file_model_http_web_proto_rawDescData
}
var file_model_http_web_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
var file_model_http_web_proto_goTypes = []interface{}{
(*HTTPWeb)(nil), // 0: pb.HTTPWeb
}
var file_model_http_web_proto_depIdxs = []int32{
0, // [0:0] is the sub-list for method output_type
0, // [0:0] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
}
func init() { file_model_http_web_proto_init() }
func file_model_http_web_proto_init() {
if File_model_http_web_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_model_http_web_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*HTTPWeb); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_model_http_web_proto_rawDesc,
NumEnums: 0,
NumMessages: 1,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_model_http_web_proto_goTypes,
DependencyIndexes: file_model_http_web_proto_depIdxs,
MessageInfos: file_model_http_web_proto_msgTypes,
}.Build()
File_model_http_web_proto = out.File
file_model_http_web_proto_rawDesc = nil
file_model_http_web_proto_goTypes = nil
file_model_http_web_proto_depIdxs = nil
}

View File

@@ -0,0 +1,179 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.25.0
// protoc v3.12.3
// source: model_reverse_proxy.proto
package pb
import (
proto "github.com/golang/protobuf/proto"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// This is a compile-time assertion that a sufficiently up-to-date version
// of the legacy proto package is being used.
const _ = proto.ProtoPackageIsVersion4
type ReverseProxy struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
SchedulingJSON []byte `protobuf:"bytes,2,opt,name=schedulingJSON,proto3" json:"schedulingJSON,omitempty"`
PrimaryOriginsJSON []byte `protobuf:"bytes,3,opt,name=primaryOriginsJSON,proto3" json:"primaryOriginsJSON,omitempty"`
BackupOriginsJSON []byte `protobuf:"bytes,4,opt,name=backupOriginsJSON,proto3" json:"backupOriginsJSON,omitempty"`
}
func (x *ReverseProxy) Reset() {
*x = ReverseProxy{}
if protoimpl.UnsafeEnabled {
mi := &file_model_reverse_proxy_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ReverseProxy) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ReverseProxy) ProtoMessage() {}
func (x *ReverseProxy) ProtoReflect() protoreflect.Message {
mi := &file_model_reverse_proxy_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ReverseProxy.ProtoReflect.Descriptor instead.
func (*ReverseProxy) Descriptor() ([]byte, []int) {
return file_model_reverse_proxy_proto_rawDescGZIP(), []int{0}
}
func (x *ReverseProxy) GetId() int64 {
if x != nil {
return x.Id
}
return 0
}
func (x *ReverseProxy) GetSchedulingJSON() []byte {
if x != nil {
return x.SchedulingJSON
}
return nil
}
func (x *ReverseProxy) GetPrimaryOriginsJSON() []byte {
if x != nil {
return x.PrimaryOriginsJSON
}
return nil
}
func (x *ReverseProxy) GetBackupOriginsJSON() []byte {
if x != nil {
return x.BackupOriginsJSON
}
return nil
}
var File_model_reverse_proxy_proto protoreflect.FileDescriptor
var file_model_reverse_proxy_proto_rawDesc = []byte{
0x0a, 0x19, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x5f,
0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x22,
0xa4, 0x01, 0x0a, 0x0c, 0x52, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x50, 0x72, 0x6f, 0x78, 0x79,
0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64,
0x12, 0x26, 0x0a, 0x0e, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x69, 0x6e, 0x67, 0x4a, 0x53,
0x4f, 0x4e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0e, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75,
0x6c, 0x69, 0x6e, 0x67, 0x4a, 0x53, 0x4f, 0x4e, 0x12, 0x2e, 0x0a, 0x12, 0x70, 0x72, 0x69, 0x6d,
0x61, 0x72, 0x79, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x73, 0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x03,
0x20, 0x01, 0x28, 0x0c, 0x52, 0x12, 0x70, 0x72, 0x69, 0x6d, 0x61, 0x72, 0x79, 0x4f, 0x72, 0x69,
0x67, 0x69, 0x6e, 0x73, 0x4a, 0x53, 0x4f, 0x4e, 0x12, 0x2c, 0x0a, 0x11, 0x62, 0x61, 0x63, 0x6b,
0x75, 0x70, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x73, 0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x04, 0x20,
0x01, 0x28, 0x0c, 0x52, 0x11, 0x62, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x4f, 0x72, 0x69, 0x67, 0x69,
0x6e, 0x73, 0x4a, 0x53, 0x4f, 0x4e, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_model_reverse_proxy_proto_rawDescOnce sync.Once
file_model_reverse_proxy_proto_rawDescData = file_model_reverse_proxy_proto_rawDesc
)
func file_model_reverse_proxy_proto_rawDescGZIP() []byte {
file_model_reverse_proxy_proto_rawDescOnce.Do(func() {
file_model_reverse_proxy_proto_rawDescData = protoimpl.X.CompressGZIP(file_model_reverse_proxy_proto_rawDescData)
})
return file_model_reverse_proxy_proto_rawDescData
}
var file_model_reverse_proxy_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
var file_model_reverse_proxy_proto_goTypes = []interface{}{
(*ReverseProxy)(nil), // 0: pb.ReverseProxy
}
var file_model_reverse_proxy_proto_depIdxs = []int32{
0, // [0:0] is the sub-list for method output_type
0, // [0:0] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
}
func init() { file_model_reverse_proxy_proto_init() }
func file_model_reverse_proxy_proto_init() {
if File_model_reverse_proxy_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_model_reverse_proxy_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ReverseProxy); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_model_reverse_proxy_proto_rawDesc,
NumEnums: 0,
NumMessages: 1,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_model_reverse_proxy_proto_goTypes,
DependencyIndexes: file_model_reverse_proxy_proto_depIdxs,
MessageInfos: file_model_reverse_proxy_proto_msgTypes,
}.Build()
File_model_reverse_proxy_proto = out.File
file_model_reverse_proxy_proto_rawDesc = nil
file_model_reverse_proxy_proto_goTypes = nil
file_model_reverse_proxy_proto_depIdxs = nil
}

View File

@@ -31,14 +31,24 @@ type Server struct {
unknownFields protoimpl.UnknownFields
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
Config []byte `protobuf:"bytes,2,opt,name=config,proto3" json:"config,omitempty"`
Type string `protobuf:"bytes,3,opt,name=type,proto3" json:"type,omitempty"`
Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"`
Description string `protobuf:"bytes,5,opt,name=description,proto3" json:"description,omitempty"`
IncludeNodes []byte `protobuf:"bytes,6,opt,name=includeNodes,proto3" json:"includeNodes,omitempty"`
ExcludeNodes []byte `protobuf:"bytes,7,opt,name=excludeNodes,proto3" json:"excludeNodes,omitempty"`
CreatedAt int64 `protobuf:"varint,8,opt,name=createdAt,proto3" json:"createdAt,omitempty"`
Cluster *NodeCluster `protobuf:"bytes,10,opt,name=cluster,proto3" json:"cluster,omitempty"`
Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"`
Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"`
Description string `protobuf:"bytes,4,opt,name=description,proto3" json:"description,omitempty"`
IncludeNodes []byte `protobuf:"bytes,5,opt,name=includeNodes,proto3" json:"includeNodes,omitempty"`
ExcludeNodes []byte `protobuf:"bytes,6,opt,name=excludeNodes,proto3" json:"excludeNodes,omitempty"`
CreatedAt int64 `protobuf:"varint,7,opt,name=createdAt,proto3" json:"createdAt,omitempty"`
// 配置相关
Config []byte `protobuf:"bytes,17,opt,name=config,proto3" json:"config,omitempty"`
ServerNamesJON []byte `protobuf:"bytes,8,opt,name=serverNamesJON,proto3" json:"serverNamesJON,omitempty"`
HttpJSON []byte `protobuf:"bytes,9,opt,name=httpJSON,proto3" json:"httpJSON,omitempty"`
HttpsJSON []byte `protobuf:"bytes,10,opt,name=httpsJSON,proto3" json:"httpsJSON,omitempty"`
TcpJSON []byte `protobuf:"bytes,11,opt,name=tcpJSON,proto3" json:"tcpJSON,omitempty"`
TlsJSON []byte `protobuf:"bytes,12,opt,name=tlsJSON,proto3" json:"tlsJSON,omitempty"`
UnixJSON []byte `protobuf:"bytes,13,opt,name=unixJSON,proto3" json:"unixJSON,omitempty"`
UdpJSON []byte `protobuf:"bytes,14,opt,name=udpJSON,proto3" json:"udpJSON,omitempty"`
WebId int64 `protobuf:"varint,15,opt,name=webId,proto3" json:"webId,omitempty"`
ReverseProxyId int64 `protobuf:"varint,16,opt,name=reverseProxyId,proto3" json:"reverseProxyId,omitempty"`
Cluster *NodeCluster `protobuf:"bytes,30,opt,name=cluster,proto3" json:"cluster,omitempty"`
}
func (x *Server) Reset() {
@@ -80,13 +90,6 @@ func (x *Server) GetId() int64 {
return 0
}
func (x *Server) GetConfig() []byte {
if x != nil {
return x.Config
}
return nil
}
func (x *Server) GetType() string {
if x != nil {
return x.Type
@@ -129,6 +132,76 @@ func (x *Server) GetCreatedAt() int64 {
return 0
}
func (x *Server) GetConfig() []byte {
if x != nil {
return x.Config
}
return nil
}
func (x *Server) GetServerNamesJON() []byte {
if x != nil {
return x.ServerNamesJON
}
return nil
}
func (x *Server) GetHttpJSON() []byte {
if x != nil {
return x.HttpJSON
}
return nil
}
func (x *Server) GetHttpsJSON() []byte {
if x != nil {
return x.HttpsJSON
}
return nil
}
func (x *Server) GetTcpJSON() []byte {
if x != nil {
return x.TcpJSON
}
return nil
}
func (x *Server) GetTlsJSON() []byte {
if x != nil {
return x.TlsJSON
}
return nil
}
func (x *Server) GetUnixJSON() []byte {
if x != nil {
return x.UnixJSON
}
return nil
}
func (x *Server) GetUdpJSON() []byte {
if x != nil {
return x.UdpJSON
}
return nil
}
func (x *Server) GetWebId() int64 {
if x != nil {
return x.WebId
}
return 0
}
func (x *Server) GetReverseProxyId() int64 {
if x != nil {
return x.ReverseProxyId
}
return 0
}
func (x *Server) GetCluster() *NodeCluster {
if x != nil {
return x.Cluster
@@ -142,24 +215,41 @@ var file_model_server_proto_rawDesc = []byte{
0x0a, 0x12, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x70,
0x72, 0x6f, 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, 0x22, 0x8b, 0x02, 0x0a, 0x06, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x0e, 0x0a,
0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x16, 0x0a,
0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x63,
0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20,
0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d,
0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a,
0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01,
0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12,
0x22, 0x0a, 0x0c, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x18,
0x06, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0c, 0x69, 0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x4e, 0x6f,
0x64, 0x65, 0x73, 0x12, 0x22, 0x0a, 0x0c, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x4e, 0x6f,
0x64, 0x65, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0c, 0x65, 0x78, 0x63, 0x6c, 0x75,
0x64, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74,
0x65, 0x64, 0x41, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61,
0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x29, 0x0a, 0x07, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72,
0x18, 0x0a, 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,
0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x74, 0x6f, 0x22, 0x95, 0x04, 0x0a, 0x06, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x0e, 0x0a,
0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a,
0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70,
0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52,
0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70,
0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63,
0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x22, 0x0a, 0x0c, 0x69, 0x6e, 0x63, 0x6c, 0x75,
0x64, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0c, 0x69,
0x6e, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x22, 0x0a, 0x0c, 0x65,
0x78, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28,
0x0c, 0x52, 0x0c, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x12,
0x1c, 0x0a, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, 0x07, 0x20, 0x01,
0x28, 0x03, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x16, 0x0a,
0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x11, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x63,
0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x26, 0x0a, 0x0e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x4e,
0x61, 0x6d, 0x65, 0x73, 0x4a, 0x4f, 0x4e, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0e, 0x73,
0x65, 0x72, 0x76, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x4a, 0x4f, 0x4e, 0x12, 0x1a, 0x0a,
0x08, 0x68, 0x74, 0x74, 0x70, 0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0c, 0x52,
0x08, 0x68, 0x74, 0x74, 0x70, 0x4a, 0x53, 0x4f, 0x4e, 0x12, 0x1c, 0x0a, 0x09, 0x68, 0x74, 0x74,
0x70, 0x73, 0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x68, 0x74,
0x74, 0x70, 0x73, 0x4a, 0x53, 0x4f, 0x4e, 0x12, 0x18, 0x0a, 0x07, 0x74, 0x63, 0x70, 0x4a, 0x53,
0x4f, 0x4e, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x74, 0x63, 0x70, 0x4a, 0x53, 0x4f,
0x4e, 0x12, 0x18, 0x0a, 0x07, 0x74, 0x6c, 0x73, 0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x0c, 0x20, 0x01,
0x28, 0x0c, 0x52, 0x07, 0x74, 0x6c, 0x73, 0x4a, 0x53, 0x4f, 0x4e, 0x12, 0x1a, 0x0a, 0x08, 0x75,
0x6e, 0x69, 0x78, 0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x75,
0x6e, 0x69, 0x78, 0x4a, 0x53, 0x4f, 0x4e, 0x12, 0x18, 0x0a, 0x07, 0x75, 0x64, 0x70, 0x4a, 0x53,
0x4f, 0x4e, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x75, 0x64, 0x70, 0x4a, 0x53, 0x4f,
0x4e, 0x12, 0x14, 0x0a, 0x05, 0x77, 0x65, 0x62, 0x49, 0x64, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x03,
0x52, 0x05, 0x77, 0x65, 0x62, 0x49, 0x64, 0x12, 0x26, 0x0a, 0x0e, 0x72, 0x65, 0x76, 0x65, 0x72,
0x73, 0x65, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x49, 0x64, 0x18, 0x10, 0x20, 0x01, 0x28, 0x03, 0x52,
0x0e, 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x49, 0x64, 0x12,
0x29, 0x0a, 0x07, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x18, 0x1e, 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, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f,
0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (

View File

@@ -0,0 +1,652 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.25.0
// protoc v3.12.3
// source: service_http_web.proto
package pb
import (
context "context"
proto "github.com/golang/protobuf/proto"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// This is a compile-time assertion that a sufficiently up-to-date version
// of the legacy proto package is being used.
const _ = proto.ProtoPackageIsVersion4
// 创建Web配置
type CreateHTTPWebRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Root string `protobuf:"bytes,1,opt,name=root,proto3" json:"root,omitempty"`
}
func (x *CreateHTTPWebRequest) Reset() {
*x = CreateHTTPWebRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_service_http_web_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *CreateHTTPWebRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CreateHTTPWebRequest) ProtoMessage() {}
func (x *CreateHTTPWebRequest) ProtoReflect() protoreflect.Message {
mi := &file_service_http_web_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use CreateHTTPWebRequest.ProtoReflect.Descriptor instead.
func (*CreateHTTPWebRequest) Descriptor() ([]byte, []int) {
return file_service_http_web_proto_rawDescGZIP(), []int{0}
}
func (x *CreateHTTPWebRequest) GetRoot() string {
if x != nil {
return x.Root
}
return ""
}
type CreateHTTPWebResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
WebId int64 `protobuf:"varint,1,opt,name=webId,proto3" json:"webId,omitempty"`
}
func (x *CreateHTTPWebResponse) Reset() {
*x = CreateHTTPWebResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_service_http_web_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *CreateHTTPWebResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CreateHTTPWebResponse) ProtoMessage() {}
func (x *CreateHTTPWebResponse) ProtoReflect() protoreflect.Message {
mi := &file_service_http_web_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use CreateHTTPWebResponse.ProtoReflect.Descriptor instead.
func (*CreateHTTPWebResponse) Descriptor() ([]byte, []int) {
return file_service_http_web_proto_rawDescGZIP(), []int{1}
}
func (x *CreateHTTPWebResponse) GetWebId() int64 {
if x != nil {
return x.WebId
}
return 0
}
// 查找Web配置
type FindEnabledHTTPWebRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
WebId int64 `protobuf:"varint,1,opt,name=webId,proto3" json:"webId,omitempty"`
}
func (x *FindEnabledHTTPWebRequest) Reset() {
*x = FindEnabledHTTPWebRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_service_http_web_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *FindEnabledHTTPWebRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*FindEnabledHTTPWebRequest) ProtoMessage() {}
func (x *FindEnabledHTTPWebRequest) ProtoReflect() protoreflect.Message {
mi := &file_service_http_web_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 FindEnabledHTTPWebRequest.ProtoReflect.Descriptor instead.
func (*FindEnabledHTTPWebRequest) Descriptor() ([]byte, []int) {
return file_service_http_web_proto_rawDescGZIP(), []int{2}
}
func (x *FindEnabledHTTPWebRequest) GetWebId() int64 {
if x != nil {
return x.WebId
}
return 0
}
type FindEnabledHTTPWebResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Web *HTTPWeb `protobuf:"bytes,1,opt,name=web,proto3" json:"web,omitempty"`
}
func (x *FindEnabledHTTPWebResponse) Reset() {
*x = FindEnabledHTTPWebResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_service_http_web_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *FindEnabledHTTPWebResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*FindEnabledHTTPWebResponse) ProtoMessage() {}
func (x *FindEnabledHTTPWebResponse) ProtoReflect() protoreflect.Message {
mi := &file_service_http_web_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 FindEnabledHTTPWebResponse.ProtoReflect.Descriptor instead.
func (*FindEnabledHTTPWebResponse) Descriptor() ([]byte, []int) {
return file_service_http_web_proto_rawDescGZIP(), []int{3}
}
func (x *FindEnabledHTTPWebResponse) GetWeb() *HTTPWeb {
if x != nil {
return x.Web
}
return nil
}
// 更新Web配置
type UpdateHTTPWebRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
WebId int64 `protobuf:"varint,1,opt,name=webId,proto3" json:"webId,omitempty"`
Root string `protobuf:"bytes,2,opt,name=root,proto3" json:"root,omitempty"`
}
func (x *UpdateHTTPWebRequest) Reset() {
*x = UpdateHTTPWebRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_service_http_web_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *UpdateHTTPWebRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*UpdateHTTPWebRequest) ProtoMessage() {}
func (x *UpdateHTTPWebRequest) ProtoReflect() protoreflect.Message {
mi := &file_service_http_web_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use UpdateHTTPWebRequest.ProtoReflect.Descriptor instead.
func (*UpdateHTTPWebRequest) Descriptor() ([]byte, []int) {
return file_service_http_web_proto_rawDescGZIP(), []int{4}
}
func (x *UpdateHTTPWebRequest) GetWebId() int64 {
if x != nil {
return x.WebId
}
return 0
}
func (x *UpdateHTTPWebRequest) GetRoot() string {
if x != nil {
return x.Root
}
return ""
}
type UpdateHTTPWebResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *UpdateHTTPWebResponse) Reset() {
*x = UpdateHTTPWebResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_service_http_web_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *UpdateHTTPWebResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*UpdateHTTPWebResponse) ProtoMessage() {}
func (x *UpdateHTTPWebResponse) ProtoReflect() protoreflect.Message {
mi := &file_service_http_web_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use UpdateHTTPWebResponse.ProtoReflect.Descriptor instead.
func (*UpdateHTTPWebResponse) Descriptor() ([]byte, []int) {
return file_service_http_web_proto_rawDescGZIP(), []int{5}
}
var File_service_http_web_proto protoreflect.FileDescriptor
var file_service_http_web_proto_rawDesc = []byte{
0x0a, 0x16, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x68, 0x74, 0x74, 0x70, 0x5f, 0x77,
0x65, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x1a, 0x14, 0x6d, 0x6f,
0x64, 0x65, 0x6c, 0x5f, 0x68, 0x74, 0x74, 0x70, 0x5f, 0x77, 0x65, 0x62, 0x2e, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x22, 0x2a, 0x0a, 0x14, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50,
0x57, 0x65, 0x62, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x72, 0x6f,
0x6f, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x72, 0x6f, 0x6f, 0x74, 0x22, 0x2d,
0x0a, 0x15, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 0x52,
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x77, 0x65, 0x62, 0x49, 0x64,
0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x77, 0x65, 0x62, 0x49, 0x64, 0x22, 0x31, 0x0a,
0x19, 0x46, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x48, 0x54, 0x54, 0x50,
0x57, 0x65, 0x62, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x77, 0x65,
0x62, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x77, 0x65, 0x62, 0x49, 0x64,
0x22, 0x3b, 0x0a, 0x1a, 0x46, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x48,
0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1d,
0x0a, 0x03, 0x77, 0x65, 0x62, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x70, 0x62,
0x2e, 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 0x52, 0x03, 0x77, 0x65, 0x62, 0x22, 0x40, 0x0a,
0x14, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 0x52, 0x65,
0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x77, 0x65, 0x62, 0x49, 0x64, 0x18, 0x01,
0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x77, 0x65, 0x62, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x72,
0x6f, 0x6f, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x72, 0x6f, 0x6f, 0x74, 0x22,
0x17, 0x0a, 0x15, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62,
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xf1, 0x01, 0x0a, 0x0e, 0x48, 0x54, 0x54,
0x50, 0x57, 0x65, 0x62, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x44, 0x0a, 0x0d, 0x63,
0x72, 0x65, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 0x12, 0x18, 0x2e, 0x70,
0x62, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x72, 0x65, 0x61,
0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
0x65, 0x12, 0x53, 0x0a, 0x12, 0x66, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64,
0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 0x12, 0x1d, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6e,
0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64,
0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 0x52, 0x65,
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x44, 0x0a, 0x0d, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65,
0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 0x12, 0x18, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64,
0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x74, 0x1a, 0x19, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54,
0x50, 0x57, 0x65, 0x62, 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 (
file_service_http_web_proto_rawDescOnce sync.Once
file_service_http_web_proto_rawDescData = file_service_http_web_proto_rawDesc
)
func file_service_http_web_proto_rawDescGZIP() []byte {
file_service_http_web_proto_rawDescOnce.Do(func() {
file_service_http_web_proto_rawDescData = protoimpl.X.CompressGZIP(file_service_http_web_proto_rawDescData)
})
return file_service_http_web_proto_rawDescData
}
var file_service_http_web_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
var file_service_http_web_proto_goTypes = []interface{}{
(*CreateHTTPWebRequest)(nil), // 0: pb.CreateHTTPWebRequest
(*CreateHTTPWebResponse)(nil), // 1: pb.CreateHTTPWebResponse
(*FindEnabledHTTPWebRequest)(nil), // 2: pb.FindEnabledHTTPWebRequest
(*FindEnabledHTTPWebResponse)(nil), // 3: pb.FindEnabledHTTPWebResponse
(*UpdateHTTPWebRequest)(nil), // 4: pb.UpdateHTTPWebRequest
(*UpdateHTTPWebResponse)(nil), // 5: pb.UpdateHTTPWebResponse
(*HTTPWeb)(nil), // 6: pb.HTTPWeb
}
var file_service_http_web_proto_depIdxs = []int32{
6, // 0: pb.FindEnabledHTTPWebResponse.web:type_name -> pb.HTTPWeb
0, // 1: pb.HTTPWebService.createHTTPWeb:input_type -> pb.CreateHTTPWebRequest
2, // 2: pb.HTTPWebService.findEnabledHTTPWeb:input_type -> pb.FindEnabledHTTPWebRequest
4, // 3: pb.HTTPWebService.updateHTTPWeb:input_type -> pb.UpdateHTTPWebRequest
1, // 4: pb.HTTPWebService.createHTTPWeb:output_type -> pb.CreateHTTPWebResponse
3, // 5: pb.HTTPWebService.findEnabledHTTPWeb:output_type -> pb.FindEnabledHTTPWebResponse
5, // 6: pb.HTTPWebService.updateHTTPWeb:output_type -> pb.UpdateHTTPWebResponse
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
}
func init() { file_service_http_web_proto_init() }
func file_service_http_web_proto_init() {
if File_service_http_web_proto != nil {
return
}
file_model_http_web_proto_init()
if !protoimpl.UnsafeEnabled {
file_service_http_web_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*CreateHTTPWebRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_service_http_web_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*CreateHTTPWebResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_service_http_web_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*FindEnabledHTTPWebRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_service_http_web_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*FindEnabledHTTPWebResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_service_http_web_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*UpdateHTTPWebRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_service_http_web_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*UpdateHTTPWebResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_service_http_web_proto_rawDesc,
NumEnums: 0,
NumMessages: 6,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_service_http_web_proto_goTypes,
DependencyIndexes: file_service_http_web_proto_depIdxs,
MessageInfos: file_service_http_web_proto_msgTypes,
}.Build()
File_service_http_web_proto = out.File
file_service_http_web_proto_rawDesc = nil
file_service_http_web_proto_goTypes = nil
file_service_http_web_proto_depIdxs = nil
}
// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
var _ grpc.ClientConnInterface
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
const _ = grpc.SupportPackageIsVersion6
// HTTPWebServiceClient is the client API for HTTPWebService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
type HTTPWebServiceClient interface {
// 创建Web配置
CreateHTTPWeb(ctx context.Context, in *CreateHTTPWebRequest, opts ...grpc.CallOption) (*CreateHTTPWebResponse, error)
// 查找Web配置
FindEnabledHTTPWeb(ctx context.Context, in *FindEnabledHTTPWebRequest, opts ...grpc.CallOption) (*FindEnabledHTTPWebResponse, error)
// 更新Web配置
UpdateHTTPWeb(ctx context.Context, in *UpdateHTTPWebRequest, opts ...grpc.CallOption) (*UpdateHTTPWebResponse, error)
}
type hTTPWebServiceClient struct {
cc grpc.ClientConnInterface
}
func NewHTTPWebServiceClient(cc grpc.ClientConnInterface) HTTPWebServiceClient {
return &hTTPWebServiceClient{cc}
}
func (c *hTTPWebServiceClient) CreateHTTPWeb(ctx context.Context, in *CreateHTTPWebRequest, opts ...grpc.CallOption) (*CreateHTTPWebResponse, error) {
out := new(CreateHTTPWebResponse)
err := c.cc.Invoke(ctx, "/pb.HTTPWebService/createHTTPWeb", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *hTTPWebServiceClient) FindEnabledHTTPWeb(ctx context.Context, in *FindEnabledHTTPWebRequest, opts ...grpc.CallOption) (*FindEnabledHTTPWebResponse, error) {
out := new(FindEnabledHTTPWebResponse)
err := c.cc.Invoke(ctx, "/pb.HTTPWebService/findEnabledHTTPWeb", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *hTTPWebServiceClient) UpdateHTTPWeb(ctx context.Context, in *UpdateHTTPWebRequest, opts ...grpc.CallOption) (*UpdateHTTPWebResponse, error) {
out := new(UpdateHTTPWebResponse)
err := c.cc.Invoke(ctx, "/pb.HTTPWebService/updateHTTPWeb", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// HTTPWebServiceServer is the server API for HTTPWebService service.
type HTTPWebServiceServer interface {
// 创建Web配置
CreateHTTPWeb(context.Context, *CreateHTTPWebRequest) (*CreateHTTPWebResponse, error)
// 查找Web配置
FindEnabledHTTPWeb(context.Context, *FindEnabledHTTPWebRequest) (*FindEnabledHTTPWebResponse, error)
// 更新Web配置
UpdateHTTPWeb(context.Context, *UpdateHTTPWebRequest) (*UpdateHTTPWebResponse, error)
}
// UnimplementedHTTPWebServiceServer can be embedded to have forward compatible implementations.
type UnimplementedHTTPWebServiceServer struct {
}
func (*UnimplementedHTTPWebServiceServer) CreateHTTPWeb(context.Context, *CreateHTTPWebRequest) (*CreateHTTPWebResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method CreateHTTPWeb not implemented")
}
func (*UnimplementedHTTPWebServiceServer) FindEnabledHTTPWeb(context.Context, *FindEnabledHTTPWebRequest) (*FindEnabledHTTPWebResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method FindEnabledHTTPWeb not implemented")
}
func (*UnimplementedHTTPWebServiceServer) UpdateHTTPWeb(context.Context, *UpdateHTTPWebRequest) (*UpdateHTTPWebResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateHTTPWeb not implemented")
}
func RegisterHTTPWebServiceServer(s *grpc.Server, srv HTTPWebServiceServer) {
s.RegisterService(&_HTTPWebService_serviceDesc, srv)
}
func _HTTPWebService_CreateHTTPWeb_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CreateHTTPWebRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(HTTPWebServiceServer).CreateHTTPWeb(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/pb.HTTPWebService/CreateHTTPWeb",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(HTTPWebServiceServer).CreateHTTPWeb(ctx, req.(*CreateHTTPWebRequest))
}
return interceptor(ctx, in, info, handler)
}
func _HTTPWebService_FindEnabledHTTPWeb_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(FindEnabledHTTPWebRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(HTTPWebServiceServer).FindEnabledHTTPWeb(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/pb.HTTPWebService/FindEnabledHTTPWeb",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(HTTPWebServiceServer).FindEnabledHTTPWeb(ctx, req.(*FindEnabledHTTPWebRequest))
}
return interceptor(ctx, in, info, handler)
}
func _HTTPWebService_UpdateHTTPWeb_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(UpdateHTTPWebRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(HTTPWebServiceServer).UpdateHTTPWeb(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/pb.HTTPWebService/UpdateHTTPWeb",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(HTTPWebServiceServer).UpdateHTTPWeb(ctx, req.(*UpdateHTTPWebRequest))
}
return interceptor(ctx, in, info, handler)
}
var _HTTPWebService_serviceDesc = grpc.ServiceDesc{
ServiceName: "pb.HTTPWebService",
HandlerType: (*HTTPWebServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "createHTTPWeb",
Handler: _HTTPWebService_CreateHTTPWeb_Handler,
},
{
MethodName: "findEnabledHTTPWeb",
Handler: _HTTPWebService_FindEnabledHTTPWeb_Handler,
},
{
MethodName: "updateHTTPWeb",
Handler: _HTTPWebService_UpdateHTTPWeb_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "service_http_web.proto",
}

View File

@@ -345,6 +345,101 @@ func (x *FindEnabledOriginServerResponse) GetOrigin() *OriginServer {
return nil
}
// 查找源站配置
type FindEnabledOriginServerConfigRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
OriginId int64 `protobuf:"varint,1,opt,name=originId,proto3" json:"originId,omitempty"`
}
func (x *FindEnabledOriginServerConfigRequest) Reset() {
*x = FindEnabledOriginServerConfigRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_service_origin_server_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *FindEnabledOriginServerConfigRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*FindEnabledOriginServerConfigRequest) ProtoMessage() {}
func (x *FindEnabledOriginServerConfigRequest) ProtoReflect() protoreflect.Message {
mi := &file_service_origin_server_proto_msgTypes[6]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use FindEnabledOriginServerConfigRequest.ProtoReflect.Descriptor instead.
func (*FindEnabledOriginServerConfigRequest) Descriptor() ([]byte, []int) {
return file_service_origin_server_proto_rawDescGZIP(), []int{6}
}
func (x *FindEnabledOriginServerConfigRequest) GetOriginId() int64 {
if x != nil {
return x.OriginId
}
return 0
}
type FindEnabledOriginServerConfigResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Config []byte `protobuf:"bytes,1,opt,name=config,proto3" json:"config,omitempty"`
}
func (x *FindEnabledOriginServerConfigResponse) Reset() {
*x = FindEnabledOriginServerConfigResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_service_origin_server_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *FindEnabledOriginServerConfigResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*FindEnabledOriginServerConfigResponse) ProtoMessage() {}
func (x *FindEnabledOriginServerConfigResponse) ProtoReflect() protoreflect.Message {
mi := &file_service_origin_server_proto_msgTypes[7]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use FindEnabledOriginServerConfigResponse.ProtoReflect.Descriptor instead.
func (*FindEnabledOriginServerConfigResponse) Descriptor() ([]byte, []int) {
return file_service_origin_server_proto_rawDescGZIP(), []int{7}
}
func (x *FindEnabledOriginServerConfigResponse) GetConfig() []byte {
if x != nil {
return x.Config
}
return nil
}
var File_service_origin_server_proto protoreflect.FileDescriptor
var file_service_origin_server_proto_rawDesc = []byte{
@@ -384,27 +479,42 @@ var file_service_origin_server_proto_rawDesc = []byte{
0x64, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x28, 0x0a, 0x06, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x18,
0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x62, 0x2e, 0x4f, 0x72, 0x69, 0x67, 0x69,
0x6e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x06, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x32,
0xa3, 0x02, 0x0a, 0x13, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72,
0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x53, 0x0a, 0x12, 0x63, 0x72, 0x65, 0x61, 0x74,
0x65, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x1d, 0x2e,
0x70, 0x62, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x53,
0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x70,
0x62, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x53, 0x65,
0x72, 0x76, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x53, 0x0a, 0x12,
0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x53, 0x65, 0x72, 0x76,
0x65, 0x72, 0x12, 0x1d, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x72,
0x6e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x06, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x22,
0x42, 0x0a, 0x24, 0x46, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4f, 0x72,
0x69, 0x67, 0x69, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67,
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x6f, 0x72, 0x69, 0x67, 0x69,
0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6f, 0x72, 0x69, 0x67, 0x69,
0x6e, 0x49, 0x64, 0x22, 0x3f, 0x0a, 0x25, 0x46, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c,
0x65, 0x64, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x43, 0x6f,
0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x06,
0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x63, 0x6f,
0x6e, 0x66, 0x69, 0x67, 0x32, 0x99, 0x03, 0x0a, 0x13, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x53,
0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x53, 0x0a, 0x12,
0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x53, 0x65, 0x72, 0x76,
0x65, 0x72, 0x12, 0x1d, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x72,
0x69, 0x67, 0x69, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x74, 0x1a, 0x1e, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x72, 0x69,
0x74, 0x1a, 0x1e, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x72, 0x69,
0x67, 0x69, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
0x65, 0x12, 0x62, 0x0a, 0x17, 0x66, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64,
0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x22, 0x2e, 0x70,
0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4f, 0x72, 0x69,
0x67, 0x69, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x1a, 0x23, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65,
0x64, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 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,
0x65, 0x12, 0x53, 0x0a, 0x12, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x72, 0x69, 0x67, 0x69,
0x6e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x1d, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64,
0x61, 0x74, 0x65, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61,
0x74, 0x65, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x65,
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x62, 0x0a, 0x17, 0x66, 0x69, 0x6e, 0x64, 0x45, 0x6e,
0x61, 0x62, 0x6c, 0x65, 0x64, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x65,
0x72, 0x12, 0x22, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c,
0x65, 0x64, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x65,
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x45,
0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x53, 0x65, 0x72, 0x76,
0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x74, 0x0a, 0x1d, 0x66, 0x69,
0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x53,
0x65, 0x72, 0x76, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x28, 0x2e, 0x70, 0x62,
0x2e, 0x46, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4f, 0x72, 0x69, 0x67,
0x69, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65,
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x45,
0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x53, 0x65, 0x72, 0x76,
0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 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 (
@@ -419,7 +529,7 @@ func file_service_origin_server_proto_rawDescGZIP() []byte {
return file_service_origin_server_proto_rawDescData
}
var file_service_origin_server_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
var file_service_origin_server_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
var file_service_origin_server_proto_goTypes = []interface{}{
(*CreateOriginServerRequest)(nil), // 0: pb.CreateOriginServerRequest
(*CreateOriginServerResponse)(nil), // 1: pb.CreateOriginServerResponse
@@ -427,21 +537,25 @@ var file_service_origin_server_proto_goTypes = []interface{}{
(*UpdateOriginServerResponse)(nil), // 3: pb.UpdateOriginServerResponse
(*FindEnabledOriginServerRequest)(nil), // 4: pb.FindEnabledOriginServerRequest
(*FindEnabledOriginServerResponse)(nil), // 5: pb.FindEnabledOriginServerResponse
(*NetworkAddress)(nil), // 6: pb.NetworkAddress
(*OriginServer)(nil), // 7: pb.OriginServer
(*FindEnabledOriginServerConfigRequest)(nil), // 6: pb.FindEnabledOriginServerConfigRequest
(*FindEnabledOriginServerConfigResponse)(nil), // 7: pb.FindEnabledOriginServerConfigResponse
(*NetworkAddress)(nil), // 8: pb.NetworkAddress
(*OriginServer)(nil), // 9: pb.OriginServer
}
var file_service_origin_server_proto_depIdxs = []int32{
6, // 0: pb.CreateOriginServerRequest.addr:type_name -> pb.NetworkAddress
6, // 1: pb.UpdateOriginServerRequest.addr:type_name -> pb.NetworkAddress
7, // 2: pb.FindEnabledOriginServerResponse.Origin:type_name -> pb.OriginServer
8, // 0: pb.CreateOriginServerRequest.addr:type_name -> pb.NetworkAddress
8, // 1: pb.UpdateOriginServerRequest.addr:type_name -> pb.NetworkAddress
9, // 2: pb.FindEnabledOriginServerResponse.Origin:type_name -> pb.OriginServer
0, // 3: pb.OriginServerService.createOriginServer:input_type -> pb.CreateOriginServerRequest
2, // 4: pb.OriginServerService.updateOriginServer:input_type -> pb.UpdateOriginServerRequest
4, // 5: pb.OriginServerService.findEnabledOriginServer:input_type -> pb.FindEnabledOriginServerRequest
1, // 6: pb.OriginServerService.createOriginServer:output_type -> pb.CreateOriginServerResponse
3, // 7: pb.OriginServerService.updateOriginServer:output_type -> pb.UpdateOriginServerResponse
5, // 8: pb.OriginServerService.findEnabledOriginServer:output_type -> pb.FindEnabledOriginServerResponse
6, // [6:9] is the sub-list for method output_type
3, // [3:6] is the sub-list for method input_type
6, // 6: pb.OriginServerService.findEnabledOriginServerConfig:input_type -> pb.FindEnabledOriginServerConfigRequest
1, // 7: pb.OriginServerService.createOriginServer:output_type -> pb.CreateOriginServerResponse
3, // 8: pb.OriginServerService.updateOriginServer:output_type -> pb.UpdateOriginServerResponse
5, // 9: pb.OriginServerService.findEnabledOriginServer:output_type -> pb.FindEnabledOriginServerResponse
7, // 10: pb.OriginServerService.findEnabledOriginServerConfig:output_type -> pb.FindEnabledOriginServerConfigResponse
7, // [7:11] is the sub-list for method output_type
3, // [3:7] is the sub-list for method input_type
3, // [3:3] is the sub-list for extension type_name
3, // [3:3] is the sub-list for extension extendee
0, // [0:3] is the sub-list for field type_name
@@ -527,6 +641,30 @@ func file_service_origin_server_proto_init() {
return nil
}
}
file_service_origin_server_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*FindEnabledOriginServerConfigRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_service_origin_server_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*FindEnabledOriginServerConfigResponse); 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{
@@ -534,7 +672,7 @@ func file_service_origin_server_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_service_origin_server_proto_rawDesc,
NumEnums: 0,
NumMessages: 6,
NumMessages: 8,
NumExtensions: 0,
NumServices: 1,
},
@@ -566,6 +704,8 @@ type OriginServerServiceClient interface {
UpdateOriginServer(ctx context.Context, in *UpdateOriginServerRequest, opts ...grpc.CallOption) (*UpdateOriginServerResponse, error)
// 查找单个源站信息
FindEnabledOriginServer(ctx context.Context, in *FindEnabledOriginServerRequest, opts ...grpc.CallOption) (*FindEnabledOriginServerResponse, error)
// 查找源站配置
FindEnabledOriginServerConfig(ctx context.Context, in *FindEnabledOriginServerConfigRequest, opts ...grpc.CallOption) (*FindEnabledOriginServerConfigResponse, error)
}
type originServerServiceClient struct {
@@ -603,6 +743,15 @@ func (c *originServerServiceClient) FindEnabledOriginServer(ctx context.Context,
return out, nil
}
func (c *originServerServiceClient) FindEnabledOriginServerConfig(ctx context.Context, in *FindEnabledOriginServerConfigRequest, opts ...grpc.CallOption) (*FindEnabledOriginServerConfigResponse, error) {
out := new(FindEnabledOriginServerConfigResponse)
err := c.cc.Invoke(ctx, "/pb.OriginServerService/findEnabledOriginServerConfig", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// OriginServerServiceServer is the server API for OriginServerService service.
type OriginServerServiceServer interface {
// 创建源站
@@ -611,6 +760,8 @@ type OriginServerServiceServer interface {
UpdateOriginServer(context.Context, *UpdateOriginServerRequest) (*UpdateOriginServerResponse, error)
// 查找单个源站信息
FindEnabledOriginServer(context.Context, *FindEnabledOriginServerRequest) (*FindEnabledOriginServerResponse, error)
// 查找源站配置
FindEnabledOriginServerConfig(context.Context, *FindEnabledOriginServerConfigRequest) (*FindEnabledOriginServerConfigResponse, error)
}
// UnimplementedOriginServerServiceServer can be embedded to have forward compatible implementations.
@@ -626,6 +777,9 @@ func (*UnimplementedOriginServerServiceServer) UpdateOriginServer(context.Contex
func (*UnimplementedOriginServerServiceServer) FindEnabledOriginServer(context.Context, *FindEnabledOriginServerRequest) (*FindEnabledOriginServerResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method FindEnabledOriginServer not implemented")
}
func (*UnimplementedOriginServerServiceServer) FindEnabledOriginServerConfig(context.Context, *FindEnabledOriginServerConfigRequest) (*FindEnabledOriginServerConfigResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method FindEnabledOriginServerConfig not implemented")
}
func RegisterOriginServerServiceServer(s *grpc.Server, srv OriginServerServiceServer) {
s.RegisterService(&_OriginServerService_serviceDesc, srv)
@@ -685,6 +839,24 @@ func _OriginServerService_FindEnabledOriginServer_Handler(srv interface{}, ctx c
return interceptor(ctx, in, info, handler)
}
func _OriginServerService_FindEnabledOriginServerConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(FindEnabledOriginServerConfigRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(OriginServerServiceServer).FindEnabledOriginServerConfig(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/pb.OriginServerService/FindEnabledOriginServerConfig",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(OriginServerServiceServer).FindEnabledOriginServerConfig(ctx, req.(*FindEnabledOriginServerConfigRequest))
}
return interceptor(ctx, in, info, handler)
}
var _OriginServerService_serviceDesc = grpc.ServiceDesc{
ServiceName: "pb.OriginServerService",
HandlerType: (*OriginServerServiceServer)(nil),
@@ -701,6 +873,10 @@ var _OriginServerService_serviceDesc = grpc.ServiceDesc{
MethodName: "findEnabledOriginServer",
Handler: _OriginServerService_FindEnabledOriginServer_Handler,
},
{
MethodName: "findEnabledOriginServerConfig",
Handler: _OriginServerService_FindEnabledOriginServerConfig_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "service_origin_server.proto",

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,9 @@
syntax = "proto3";
option go_package = "./pb";
package pb;
message HTTPWeb {
int64 id = 1;
string root = 2;
}

View File

@@ -0,0 +1,11 @@
syntax = "proto3";
option go_package = "./pb";
package pb;
message ReverseProxy {
int64 id = 1;
bytes schedulingJSON = 2;
bytes primaryOriginsJSON = 3;
bytes backupOriginsJSON = 4;
}

View File

@@ -7,13 +7,24 @@ import "model_node_cluster.proto";
message Server {
int64 id = 1;
bytes config = 2;
string type = 3;
string name = 4;
string description = 5;
bytes includeNodes = 6;
bytes excludeNodes = 7;
int64 createdAt = 8;
string type = 2;
string name = 3;
string description = 4;
bytes includeNodes = 5;
bytes excludeNodes = 6;
int64 createdAt = 7;
NodeCluster cluster = 10;
// 配置相关
bytes config = 17;
bytes serverNamesJON = 8;
bytes httpJSON = 9;
bytes httpsJSON = 10;
bytes tcpJSON = 11;
bytes tlsJSON = 12;
bytes unixJSON = 13;
bytes udpJSON = 14;
int64 webId = 15;
int64 reverseProxyId = 16;
NodeCluster cluster = 30;
}

View File

@@ -0,0 +1,45 @@
syntax = "proto3";
option go_package = "./pb";
package pb;
import "model_http_web.proto";
service HTTPWebService {
// 创建Web配置
rpc createHTTPWeb (CreateHTTPWebRequest) returns (CreateHTTPWebResponse);
// 查找Web配置
rpc findEnabledHTTPWeb (FindEnabledHTTPWebRequest) returns (FindEnabledHTTPWebResponse);
// 更新Web配置
rpc updateHTTPWeb (UpdateHTTPWebRequest) returns (UpdateHTTPWebResponse);
}
// 创建Web配置
message CreateHTTPWebRequest {
string root = 1;
}
message CreateHTTPWebResponse {
int64 webId = 1;
}
// 查找Web配置
message FindEnabledHTTPWebRequest {
int64 webId = 1;
}
message FindEnabledHTTPWebResponse {
HTTPWeb web = 1;
}
// 更新Web配置
message UpdateHTTPWebRequest {
int64 webId = 1;
string root = 2;
}
message UpdateHTTPWebResponse {
}

View File

@@ -15,6 +15,9 @@ service OriginServerService {
// 查找单个源站信息
rpc findEnabledOriginServer (FindEnabledOriginServerRequest) returns (FindEnabledOriginServerResponse);
// 查找源站配置
rpc findEnabledOriginServerConfig (FindEnabledOriginServerConfigRequest) returns (FindEnabledOriginServerConfigResponse);
}
// 创建源站
@@ -48,3 +51,12 @@ message FindEnabledOriginServerRequest {
message FindEnabledOriginServerResponse {
OriginServer Origin = 1;
}
// 查找源站配置
message FindEnabledOriginServerConfigRequest {
int64 originId = 1;
}
message FindEnabledOriginServerConfigResponse {
bytes config = 1;
}

View File

@@ -0,0 +1,85 @@
syntax = "proto3";
option go_package = "./pb";
package pb;
import "model_reverse_proxy.proto";
service ReverseProxyService {
// 创建反向代理
rpc createReverseProxy (CreateReverseProxyRequest) returns (CreateReverseProxyResponse);
// 查找反向代理
rpc findEnabledReverseProxy (FindEnabledReverseProxyRequest) returns (FindEnabledReverseProxyResponse);
// 查找反向代理配置
rpc findEnabledReverseProxyConfig (FindEnabledReverseProxyConfigRequest) returns (FindEnabledReverseProxyConfigResponse);
// 修改反向代理的调度算法
rpc updateReverseProxyScheduling (UpdateReverseProxySchedulingRequest) returns (UpdateReverseProxySchedulingResponse);
// 修改主要源站信息
rpc updateReverseProxyPrimaryOrigins (UpdateReverseProxyPrimaryOriginsRequest) returns (UpdateReverseProxyPrimaryOriginsResponse);
// 修改备用源站信息
rpc updateReverseProxyBackupOrigins (UpdateReverseProxyBackupOriginsRequest) returns (UpdateReverseProxyBackupOriginsResponse);
}
// 创建反向代理
message CreateReverseProxyRequest {
bytes schedulingJSON = 1;
bytes primaryOriginsJSON = 2;
bytes backupOriginsJSON = 3;
}
message CreateReverseProxyResponse {
int64 reverseProxyId = 1;
}
// 查找反向代理
message FindEnabledReverseProxyRequest {
int64 reverseProxyId = 1;
}
message FindEnabledReverseProxyResponse {
ReverseProxy reverseProxy = 1;
}
// 查找反向代理配置
message FindEnabledReverseProxyConfigRequest {
int64 reverseProxyId = 1;
}
message FindEnabledReverseProxyConfigResponse {
bytes config = 1;
}
// 修改反向代理调度算法
message UpdateReverseProxySchedulingRequest {
int64 reverseProxyId = 1;
bytes schedulingJSON = 2;
}
message UpdateReverseProxySchedulingResponse {
}
// 修改主要源站信息
message UpdateReverseProxyPrimaryOriginsRequest {
int64 reverseProxyId = 1;
bytes originsJSON = 2;
}
message UpdateReverseProxyPrimaryOriginsResponse {
}
// 修改备用源站信息
message UpdateReverseProxyBackupOriginsRequest {
int64 reverseProxyId = 1;
bytes originsJSON = 2;
}
message UpdateReverseProxyBackupOriginsResponse {
}

View File

@@ -8,8 +8,35 @@ service ServerService {
// 创建服务
rpc createServer (CreateServerRequest) returns (CreateServerResponse);
// 修改服务
rpc updateServer (UpdateServerRequest) returns (UpdateServerResponse);
// 修改服务基本信息
rpc updateServerBasic (UpdateServerBasicRequest) returns (UpdateServerBasicResponse);
// 修改服务的HTTP设置
rpc updateServerHTTP (UpdateServerHTTPRequest) returns (UpdateServerHTTPResponse);
// 修改服务的HTTPS设置
rpc updateServerHTTPS (UpdateServerHTTPSRequest) returns (UpdateServerHTTPSResponse);
// 修改服务的TCP设置
rpc updateServerTCP (UpdateServerTCPRequest) returns (UpdateServerTCPResponse);
// 修改服务的TLS设置
rpc updateServerTLS (UpdateServerTLSRequest) returns (UpdateServerTLSResponse);
// 修改服务的Unix设置
rpc updateServerUnix (UpdateServerUnixRequest) returns (UpdateServerUnixResponse);
// 修改服务的UDP设置
rpc updateServerUDP (UpdateServerUDPRequest) returns (UpdateServerUDPResponse);
// 修改服务的Web设置
rpc updateServerWeb (UpdateServerWebRequest) returns (UpdateServerWebResponse);
// 修改服务的反向代理设置
rpc updateServerReverseProxy (UpdateServerReverseProxyRequest) returns (UpdateServerReverseProxyResponse);
// 修改服务的域名设置
rpc updateServerNames (UpdateServerNamesRequest) returns (UpdateServerNamesResponse);
// 计算服务数量
rpc countAllEnabledServers (CountAllEnabledServersRequest) returns (CountAllEnabledServersResponse);
@@ -22,6 +49,12 @@ service ServerService {
// 查找单个服务
rpc findEnabledServer (FindEnabledServerRequest) returns (FindEnabledServerResponse);
// 查找服务的服务类型
rpc findEnabledServerType (FindEnabledServerTypeRequest) returns (FindEnabledServerTypeResponse);
// 查找反向代理设置
rpc findServerReverseProxy (FindServerReverseProxyRequest) returns (FindServerReverseProxyResponse);
}
// 创建服务
@@ -31,30 +64,118 @@ message CreateServerRequest {
string type = 3;
string name = 4;
string description = 5;
int64 clusterId = 6;
bytes config = 7;
bytes includeNodesJSON = 8;
bytes excludeNodesJSON = 9;
// 配置相关
bytes serverNamesJON = 8;
bytes httpJSON = 9;
bytes httpsJSON = 10;
bytes tcpJSON = 11;
bytes tlsJSON = 12;
bytes unixJSON = 13;
bytes udpJSON = 14;
int64 webId = 15;
int64 reverseProxyId = 16;
int64 clusterId = 30;
bytes includeNodesJSON = 31;
bytes excludeNodesJSON = 32;
}
message CreateServerResponse {
int64 serverId = 1;
}
// 修改服务
message UpdateServerRequest {
// 修改服务基本信息
message UpdateServerBasicRequest {
int64 serverId = 1;
int64 userId = 2;
int64 adminId = 3;
string name = 4;
string description = 5;
int64 clusterId = 6;
bytes config = 7;
bytes includeNodesJSON = 8;
bytes excludeNodesJSON = 9;
string name = 2;
string description = 3;
int64 clusterId = 4;
}
message UpdateServerResponse {
message UpdateServerBasicResponse {
}
// 修改服务的HTTP等设置
message UpdateServerHTTPRequest {
int64 serverId = 1;
bytes config = 2;
}
message UpdateServerHTTPResponse {
}
message UpdateServerHTTPSRequest {
int64 serverId = 1;
bytes config = 2;
}
message UpdateServerHTTPSResponse {
}
message UpdateServerTCPRequest {
int64 serverId = 1;
bytes config = 2;
}
message UpdateServerTCPResponse {
}
message UpdateServerTLSRequest {
int64 serverId = 1;
bytes config = 2;
}
message UpdateServerTLSResponse {
}
message UpdateServerUnixRequest {
int64 serverId = 1;
bytes config = 2;
}
message UpdateServerUnixResponse {
}
message UpdateServerUDPRequest {
int64 serverId = 1;
bytes config = 2;
}
message UpdateServerUDPResponse {
}
message UpdateServerWebRequest {
int64 serverId = 1;
int64 webId = 2;
}
message UpdateServerWebResponse {
}
message UpdateServerReverseProxyRequest {
int64 serverId = 1;
int64 reverseProxyId = 2;
}
message UpdateServerReverseProxyResponse {
}
message UpdateServerNamesRequest {
int64 serverId = 1;
bytes config = 2;
}
message UpdateServerNamesResponse {
}
@@ -94,3 +215,21 @@ message FindEnabledServerRequest {
message FindEnabledServerResponse {
Server server = 1;
}
// 查找服务的服务类型
message FindEnabledServerTypeRequest {
int64 serverId = 1;
}
message FindEnabledServerTypeResponse {
string type = 1;
}
// 查找反向代理设置
message FindServerReverseProxyRequest {
int64 serverId = 1;
}
message FindServerReverseProxyResponse {
bytes config = 1;
}

View File

@@ -11,7 +11,7 @@ var regexpSinglePort = regexp.MustCompile(`^\d+$`)
// 网络地址配置
type NetworkAddressConfig struct {
Protocol string `yaml:"protocol" json:"protocol"` // 协议http、tcp、tcp4、tcp6、unix、udp等
Protocol Protocol `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
@@ -58,13 +58,13 @@ func (this *NetworkAddressConfig) Init() error {
func (this *NetworkAddressConfig) FullAddresses() []string {
if this.Protocol == ProtocolUnix {
return []string{this.Protocol + ":" + this.Host}
return []string{this.Protocol.String() + ":" + this.Host}
}
result := []string{}
for i := this.minPort; i <= this.maxPort; i++ {
host := this.Host
result = append(result, this.Protocol+"://"+host+":"+strconv.Itoa(i))
result = append(result, this.Protocol.String()+"://"+host+":"+strconv.Itoa(i))
}
return result
}

View File

@@ -23,18 +23,12 @@ type OriginServerConfig struct {
Code string `yaml:"code" json:"code"` // 代号 TODO
Weight uint `yaml:"weight" json:"weight"` // 权重 TODO
IsBackup bool `yaml:"backup" json:"isBackup"` // 是否为备份 TODO
ConnTimeout shared.TimeDuration `yaml:"failTimeout" json:"failTimeout"` // 连接失败超时 TODO
ReadTimeout shared.TimeDuration `yaml:"readTimeout" json:"readTimeout"` // 读取超时时间 TODO
IdleTimeout shared.TimeDuration `yaml:"idleTimeout" json:"idleTimeout"` // 空闲连接超时时间 TODO
MaxFails int32 `yaml:"maxFails" json:"maxFails"` // 最多失败次数 TODO
CurrentFails int32 `yaml:"currentFails" json:"currentFails"` // 当前已失败次数 TODO
MaxConns int32 `yaml:"maxConns" json:"maxConns"` // 最大并发连接数 TODO
CurrentConns int32 `yaml:"currentConns" json:"currentConns"` // 当前连接数 TODO
MaxIdleConns int32 `yaml:"idleConns" json:"idleConns"` // 最大空闲连接数 TODO
IsDown bool `yaml:"down" json:"isDown"` // 是否下线 TODO
DownTime time.Time `yaml:"downTime,omitempty" json:"downTime,omitempty"` // 下线时间 TODO
MaxFails int `yaml:"maxFails" json:"maxFails"` // 最多失败次数 TODO
MaxConns int `yaml:"maxConns" json:"maxConns"` // 最大并发连接数 TODO
MaxIdleConns int `yaml:"idleConns" json:"idleConns"` // 最大空闲连接数 TODO
RequestURI string `yaml:"requestURI" json:"requestURI"` // 转发后的请求URI TODO
Host string `yaml:"host" json:"host"` // 自定义主机名 TODO
@@ -172,5 +166,5 @@ func (this *OriginServerConfig) Connect() (net.Conn, error) {
// TODO 支持从Unix、Pipe、HTTP、HTTPS中读取数据
return nil, errors.New("invalid scheme '" + this.Addr.Protocol + "'")
return nil, errors.New("invalid scheme '" + this.Addr.Protocol.String() + "'")
}

View File

@@ -1,6 +1,6 @@
package serverconfigs
type Protocol = string
type Protocol string
const (
ProtocolHTTP Protocol = "http"
@@ -27,3 +27,52 @@ const (
func AllProtocols() []Protocol {
return []Protocol{ProtocolHTTP, ProtocolHTTPS, ProtocolTCP, ProtocolTLS, ProtocolUnix, ProtocolUDP, ProtocolHTTP4, ProtocolHTTP6, ProtocolHTTPS4, ProtocolHTTPS6, ProtocolTCP4, ProtocolTCP6, ProtocolTLS4, ProtocolTLS6}
}
func (this Protocol) IsHTTPFamily() bool {
return this == ProtocolHTTP || this == ProtocolHTTP4 || this == ProtocolHTTP6
}
func (this Protocol) IsHTTPSFamily() bool {
return this == ProtocolHTTPS || this == ProtocolHTTPS4 || this == ProtocolHTTPS6
}
func (this Protocol) IsTCPFamily() bool {
return this == ProtocolTCP || this == ProtocolTCP4 || this == ProtocolTCP6
}
func (this Protocol) IsTLSFamily() bool {
return this == ProtocolTLS || this == ProtocolTLS4 || this == ProtocolTLS6
}
func (this Protocol) IsUnixFamily() bool {
return this == ProtocolUnix
}
func (this Protocol) IsUDPFamily() bool {
return this == ProtocolUDP
}
// 主协议
func (this Protocol) Primary() Protocol {
switch this {
case ProtocolHTTP, ProtocolHTTP4, ProtocolHTTP6:
return ProtocolHTTP
case ProtocolHTTPS, ProtocolHTTPS4, ProtocolHTTPS6:
return ProtocolHTTPS
case ProtocolTCP, ProtocolTCP4, ProtocolTCP6:
return ProtocolTCP
case ProtocolTLS, ProtocolTLS4, ProtocolTLS6:
return ProtocolTLS
case ProtocolUnix:
return ProtocolUnix
case ProtocolUDP:
return ProtocolUDP
default:
return this
}
}
// 转换为字符串
func (this Protocol) String() string {
return string(this)
}

View File

@@ -0,0 +1,22 @@
package serverconfigs
import (
"github.com/iwind/TeaGo/assert"
"testing"
)
func TestProtocol_IsHTTPFamily(t *testing.T) {
a := assert.NewAssertion(t)
t.Log(ProtocolHTTP.String(), ProtocolHTTPS.String(), ProtocolTCP)
a.IsTrue(ProtocolHTTP.IsHTTPFamily())
a.IsTrue(ProtocolHTTP4.IsHTTPFamily())
a.IsTrue(ProtocolHTTP6.IsHTTPFamily())
a.IsTrue(ProtocolHTTPS.IsHTTPSFamily())
a.IsTrue(ProtocolHTTPS4.IsHTTPSFamily())
a.IsTrue(ProtocolHTTPS6.IsHTTPSFamily())
a.IsTrue(ProtocolTCP.IsTCPFamily())
a.IsTrue(ProtocolTCP.IsTCPFamily())
a.IsTrue(ProtocolTCP6.IsTCPFamily())
a.IsTrue(ProtocolUnix.IsUnixFamily())
a.IsTrue(ProtocolUDP.IsUDPFamily())
}

View File

@@ -1,7 +1,7 @@
package serverconfigs
import (
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/scheduling"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/schedulingconfigs"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared"
"sync"
)
@@ -9,20 +9,30 @@ import (
// 反向代理设置
type ReverseProxyConfig struct {
IsOn bool `yaml:"isOn" json:"isOn"` // 是否启用 TODO
Origins []*OriginServerConfig `yaml:"origins" json:"origins"` // 源站列表
PrimaryOrigins []*OriginServerConfig `yaml:"primaryOrigins" json:"primaryOrigins"` // 主要源站列表
BackupOrigins []*OriginServerConfig `yaml:"backupOrigins" json:"backupOrigins"` // 备用源站列表
Scheduling *SchedulingConfig `yaml:"scheduling" json:"scheduling"` // 调度算法选项
hasOrigins bool
hasPrimaryOrigins bool
hasBackupOrigins bool
schedulingIsBackup bool
schedulingObject scheduling.SchedulingInterface
schedulingObject schedulingconfigs.SchedulingInterface
schedulingLocker sync.Mutex
}
// 初始化
func (this *ReverseProxyConfig) Init() error {
this.hasOrigins = len(this.Origins) > 0
this.hasPrimaryOrigins = len(this.PrimaryOrigins) > 0
this.hasBackupOrigins = len(this.BackupOrigins) > 0
for _, origin := range this.Origins {
for _, origin := range this.PrimaryOrigins {
err := origin.Init()
if err != nil {
return err
}
}
for _, origin := range this.BackupOrigins {
err := origin.Init()
if err != nil {
return err
@@ -35,6 +45,16 @@ func (this *ReverseProxyConfig) Init() error {
return nil
}
// 添加主源站配置
func (this *ReverseProxyConfig) AddPrimaryOrigin(origin *OriginServerConfig) {
this.PrimaryOrigins = append(this.PrimaryOrigins, origin)
}
// 添加备用源站配置
func (this *ReverseProxyConfig) AddBackupOrigin(origin *OriginServerConfig) {
this.BackupOrigins = append(this.BackupOrigins, origin)
}
// 取得下一个可用的后端服务
func (this *ReverseProxyConfig) NextOrigin(call *shared.RequestCall) *OriginServerConfig {
this.schedulingLocker.Lock()
@@ -79,23 +99,27 @@ func (this *ReverseProxyConfig) SetupScheduling(isBackup bool) {
this.schedulingIsBackup = isBackup
if this.Scheduling == nil {
this.schedulingObject = &scheduling.RandomScheduling{}
this.schedulingObject = &schedulingconfigs.RandomScheduling{}
} else {
typeCode := this.Scheduling.Code
s := scheduling.FindSchedulingType(typeCode)
s := schedulingconfigs.FindSchedulingType(typeCode)
if s == nil {
this.Scheduling = nil
this.schedulingObject = &scheduling.RandomScheduling{}
this.schedulingObject = &schedulingconfigs.RandomScheduling{}
} else {
this.schedulingObject = s["instance"].(scheduling.SchedulingInterface)
this.schedulingObject = s["instance"].(schedulingconfigs.SchedulingInterface)
}
}
for _, origin := range this.Origins {
if origin.IsOn && !origin.IsDown {
if isBackup && origin.IsBackup {
if !isBackup {
for _, origin := range this.PrimaryOrigins {
if origin.IsOn {
this.schedulingObject.Add(origin)
} else if !isBackup && !origin.IsBackup {
}
}
} else {
for _, origin := range this.BackupOrigins {
if origin.IsOn {
this.schedulingObject.Add(origin)
}
}
@@ -103,3 +127,11 @@ func (this *ReverseProxyConfig) SetupScheduling(isBackup bool) {
this.schedulingObject.Start()
}
// 获取调度配置对象
func (this *ReverseProxyConfig) FindSchedulingConfig() *SchedulingConfig {
if this.Scheduling == nil {
this.Scheduling = &SchedulingConfig{Code: "random"}
}
return this.Scheduling
}

View File

@@ -1,4 +1,4 @@
package scheduling
package schedulingconfigs
// 候选对象接口
type CandidateInterface interface {

View File

@@ -1,4 +1,4 @@
package scheduling
package schedulingconfigs
import (
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared"

View File

@@ -1,4 +1,4 @@
package scheduling
package schedulingconfigs
import (
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared"
@@ -39,7 +39,7 @@ func (this *HashScheduling) Summary() maps.Map {
return maps.Map{
"code": "hash",
"name": "Hash算法",
"description": "根据自定义的键值的Hash值分配后端服务器",
"description": "根据自定义的键值的Hash值分配源站",
"networks": []string{"http"},
}
}

View File

@@ -1,4 +1,4 @@
package scheduling
package schedulingconfigs
import (
"fmt"

View File

@@ -1,4 +1,4 @@
package scheduling
package schedulingconfigs
import (
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared"
@@ -72,7 +72,7 @@ func (this *RandomScheduling) Summary() maps.Map {
return maps.Map{
"code": "random",
"name": "Random随机算法",
"description": "根据权重设置随机分配后端服务器",
"description": "根据权重设置随机分配源站",
"networks": []string{"http", "tcp"},
}
}

View File

@@ -1,4 +1,4 @@
package scheduling
package schedulingconfigs
import (
"sync"

View File

@@ -1,4 +1,4 @@
package scheduling
package schedulingconfigs
import (
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared"
@@ -74,7 +74,7 @@ func (this *RoundRobinScheduling) Summary() maps.Map {
return maps.Map{
"code": "roundRobin",
"name": "RoundRobin轮询算法",
"description": "根据权重,依次分配后端服务器",
"description": "根据权重,依次分配源站",
"networks": []string{"http", "tcp"},
}
}

View File

@@ -1,4 +1,4 @@
package scheduling
package schedulingconfigs
import "testing"

View File

@@ -1,4 +1,4 @@
package scheduling
package schedulingconfigs
import (
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared"
@@ -100,7 +100,7 @@ func (this *StickyScheduling) Summary() maps.Map {
return maps.Map{
"code": "sticky",
"name": "Sticky算法",
"description": "利用Cookie、URL参数或者HTTP Header来指定后端服务器",
"description": "利用Cookie、URL参数或者HTTP Header来指定源站",
"networks": []string{"http"},
}
}

View File

@@ -1,4 +1,4 @@
package scheduling
package schedulingconfigs
import (
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared"
@@ -29,14 +29,14 @@ func TestStickyScheduling_NextArgument(t *testing.T) {
t.Log(s.mapping)
req, err := http.NewRequest("GET", "http://www.example.com/?backend=c", nil)
req, err := http.NewRequest("GET", "http://www.example.com/?origin=c", nil)
if err != nil {
t.Fatal(err)
}
options := maps.Map{
"type": "argument",
"param": "backend",
"param": "origin",
}
call := shared.NewRequestCall()
call.Request = req
@@ -67,19 +67,19 @@ func TestStickyScheduling_NextCookie(t *testing.T) {
t.Log(s.mapping)
req, err := http.NewRequest("GET", "http://www.example.com/?backend=c", nil)
req, err := http.NewRequest("GET", "http://www.example.com/?origin=c", nil)
if err != nil {
t.Fatal(err)
}
req.AddCookie(&http.Cookie{
Name: "backend",
Name: "origin",
Value: "c",
})
options := maps.Map{
"type": "cookie",
"param": "backend",
"param": "origin",
}
call := shared.NewRequestCall()
call.Request = req
@@ -110,15 +110,15 @@ func TestStickyScheduling_NextHeader(t *testing.T) {
t.Log(s.mapping)
req, err := http.NewRequest("GET", "http://www.example.com/?backend=c", nil)
req, err := http.NewRequest("GET", "http://www.example.com/?origin=c", nil)
if err != nil {
t.Fatal(err)
}
req.Header.Set("backend", "c")
req.Header.Set("origin", "c")
options := maps.Map{
"type": "header",
"param": "backend",
"param": "origin",
}
call := shared.NewRequestCall()
call.Request = req

View File

@@ -1,4 +1,4 @@
package scheduling
package schedulingconfigs
import "github.com/iwind/TeaGo/maps"

View File

@@ -2,11 +2,13 @@ package serverconfigs
import (
"encoding/json"
"errors"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/sslconfigs"
)
type ServerConfig struct {
Id string `yaml:"id" json:"id"` // ID
Id int64 `yaml:"id" json:"id"` // ID
Type string `yaml:"type" json:"type"` // 类型
IsOn bool `yaml:"isOn" json:"isOn"` // 是否开启
Components []*ComponentConfig `yaml:"components" json:"components"` // 组件
Filters []*FilterConfig `yaml:"filters" json:"filters"` // 过滤器
@@ -94,7 +96,7 @@ func (this *ServerConfig) Init() error {
}
func (this *ServerConfig) FullAddresses() []string {
result := []Protocol{}
result := []string{}
if this.HTTP != nil && this.HTTP.IsOn {
result = append(result, this.HTTP.FullAddresses()...)
}
@@ -190,3 +192,16 @@ func (this *ServerConfig) SSLConfig() *sslconfigs.SSLConfig {
}
return nil
}
// 根据条件查找ReverseProxy
func (this *ServerConfig) FindAndCheckReverseProxy(dataType string) (*ReverseProxyConfig, error) {
switch dataType {
case "server":
if this.ReverseProxy == nil {
return nil, errors.New("reverse proxy not been configured")
}
return this.ReverseProxy, nil
default:
return nil, errors.New("invalid data type:'" + dataType + "'")
}
}

View File

@@ -24,7 +24,7 @@ func (this *ServerGroup) FullAddr() string {
// 获取当前分组的协议
func (this *ServerGroup) Protocol() Protocol {
for _, p := range AllProtocols() {
if strings.HasPrefix(this.fullAddr, p+":") {
if strings.HasPrefix(this.fullAddr, p.String()+":") {
return p
}
}
@@ -35,9 +35,9 @@ func (this *ServerGroup) Protocol() Protocol {
func (this *ServerGroup) Addr() string {
protocol := this.Protocol()
if protocol == ProtocolUnix {
return strings.TrimPrefix(this.fullAddr, protocol+":")
return strings.TrimPrefix(this.fullAddr, protocol.String()+":")
}
return strings.TrimPrefix(this.fullAddr, protocol+"://")
return strings.TrimPrefix(this.fullAddr, protocol.String()+"://")
}
// 判断当前分组是否为HTTP