diff --git a/pkg/configutils/variable.go b/pkg/configutils/variable.go index a2c6e8a..c187902 100644 --- a/pkg/configutils/variable.go +++ b/pkg/configutils/variable.go @@ -52,3 +52,8 @@ func ParseVariables(source string, replacer func(varName string) (value string)) } return result.String() } + +// 判断是否有变量 +func HasVariables(source string) bool { + return regexpNamedVariable.MatchString(source) +} diff --git a/pkg/rpc/pb/service_http_web.pb.go b/pkg/rpc/pb/service_http_web.pb.go index b508a9f..28371a3 100644 --- a/pkg/rpc/pb/service_http_web.pb.go +++ b/pkg/rpc/pb/service_http_web.pb.go @@ -986,7 +986,7 @@ func (x *UpdateHTTPWebLocationsRequest) GetLocationsJSON() []byte { return nil } -// 跳转到HTTPS +// 更改跳转到HTTPS设置 type UpdateHTTPWebRedirectToHTTPSRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1042,6 +1042,62 @@ func (x *UpdateHTTPWebRedirectToHTTPSRequest) GetRedirectToHTTPSJSON() []byte { return nil } +// 更改Websocket设置 +type UpdateHTTPWebWebsocketRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + WebId int64 `protobuf:"varint,1,opt,name=webId,proto3" json:"webId,omitempty"` + WebsocketJSON []byte `protobuf:"bytes,2,opt,name=websocketJSON,proto3" json:"websocketJSON,omitempty"` +} + +func (x *UpdateHTTPWebWebsocketRequest) Reset() { + *x = UpdateHTTPWebWebsocketRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_service_http_web_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateHTTPWebWebsocketRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateHTTPWebWebsocketRequest) ProtoMessage() {} + +func (x *UpdateHTTPWebWebsocketRequest) ProtoReflect() protoreflect.Message { + mi := &file_service_http_web_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 UpdateHTTPWebWebsocketRequest.ProtoReflect.Descriptor instead. +func (*UpdateHTTPWebWebsocketRequest) Descriptor() ([]byte, []int) { + return file_service_http_web_proto_rawDescGZIP(), []int{19} +} + +func (x *UpdateHTTPWebWebsocketRequest) GetWebId() int64 { + if x != nil { + return x.WebId + } + return 0 +} + +func (x *UpdateHTTPWebWebsocketRequest) GetWebsocketJSON() []byte { + if x != nil { + return x.WebsocketJSON + } + return nil +} + var File_service_http_web_proto protoreflect.FileDescriptor var file_service_http_web_proto_rawDesc = []byte{ @@ -1141,88 +1197,99 @@ var file_service_http_web_proto_rawDesc = []byte{ 0x64, 0x12, 0x30, 0x0a, 0x13, 0x72, 0x65, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x54, 0x6f, 0x48, 0x54, 0x54, 0x50, 0x53, 0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x13, 0x72, 0x65, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x54, 0x6f, 0x48, 0x54, 0x54, 0x50, 0x53, 0x4a, - 0x53, 0x4f, 0x4e, 0x32, 0xa9, 0x0a, 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, 0x65, 0x0a, 0x18, 0x66, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, - 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x23, 0x2e, - 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x48, 0x54, - 0x54, 0x50, 0x57, 0x65, 0x62, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x24, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, - 0x6c, 0x65, 0x64, 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3f, 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, + 0x53, 0x4f, 0x4e, 0x22, 0x5b, 0x0a, 0x1d, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, + 0x50, 0x57, 0x65, 0x62, 0x57, 0x65, 0x62, 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 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, 0x24, 0x0a, 0x0d, 0x77, 0x65, + 0x62, 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x0d, 0x77, 0x65, 0x62, 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x4a, 0x53, 0x4f, 0x4e, + 0x32, 0xfc, 0x0a, 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, 0x65, + 0x0a, 0x18, 0x66, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x48, 0x54, 0x54, + 0x50, 0x57, 0x65, 0x62, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x23, 0x2e, 0x70, 0x62, 0x2e, + 0x46, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x48, 0x54, 0x54, 0x50, 0x57, + 0x65, 0x62, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x24, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, + 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3f, 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, 0x14, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x50, 0x43, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, + 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x47, 0x0a, 0x11, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 0x47, 0x7a, 0x69, 0x70, 0x12, 0x1c, 0x2e, 0x70, 0x62, + 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 0x47, 0x7a, + 0x69, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x70, 0x62, 0x2e, 0x52, + 0x50, 0x43, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, + 0x4d, 0x0a, 0x14, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, + 0x43, 0x68, 0x61, 0x72, 0x73, 0x65, 0x74, 0x12, 0x1f, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 0x43, 0x68, 0x61, 0x72, 0x73, 0x65, + 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x50, + 0x43, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x59, + 0x0a, 0x1a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x25, 0x2e, 0x70, + 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x50, 0x43, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x47, 0x0a, 0x11, 0x75, 0x70, 0x64, - 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 0x47, 0x7a, 0x69, 0x70, 0x12, 0x1c, - 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, - 0x62, 0x47, 0x7a, 0x69, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x70, + 0x74, 0x65, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x5b, 0x0a, 0x1b, 0x75, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x26, 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, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x14, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x50, 0x43, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, + 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x4f, 0x0a, 0x15, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 0x53, 0x68, 0x75, 0x74, 0x64, 0x6f, 0x77, 0x6e, 0x12, + 0x20, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x57, + 0x65, 0x62, 0x53, 0x68, 0x75, 0x74, 0x64, 0x6f, 0x77, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x14, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x50, 0x43, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x49, 0x0a, 0x12, 0x75, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 0x50, 0x61, 0x67, 0x65, 0x73, 0x12, 0x1d, 0x2e, + 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, + 0x50, 0x61, 0x67, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x50, 0x43, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x75, 0x63, 0x63, 0x65, - 0x73, 0x73, 0x12, 0x4d, 0x0a, 0x14, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, - 0x57, 0x65, 0x62, 0x43, 0x68, 0x61, 0x72, 0x73, 0x65, 0x74, 0x12, 0x1f, 0x2e, 0x70, 0x62, 0x2e, - 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 0x43, 0x68, 0x61, - 0x72, 0x73, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x70, 0x62, - 0x2e, 0x52, 0x50, 0x43, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, - 0x73, 0x12, 0x59, 0x0a, 0x1a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x57, - 0x65, 0x62, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, - 0x25, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x57, - 0x65, 0x62, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x50, 0x43, 0x55, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x5b, 0x0a, 0x1b, - 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x26, 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, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, + 0x73, 0x73, 0x12, 0x51, 0x0a, 0x16, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, + 0x57, 0x65, 0x62, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x4c, 0x6f, 0x67, 0x12, 0x21, 0x2e, 0x70, + 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 0x41, + 0x63, 0x63, 0x65, 0x73, 0x73, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x14, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x50, 0x43, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x75, + 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x47, 0x0a, 0x11, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, + 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 0x53, 0x74, 0x61, 0x74, 0x12, 0x1c, 0x2e, 0x70, 0x62, 0x2e, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 0x53, 0x74, 0x61, + 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x50, + 0x43, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x49, + 0x0a, 0x12, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 0x43, + 0x61, 0x63, 0x68, 0x65, 0x12, 0x1d, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 0x43, 0x61, 0x63, 0x68, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x50, 0x43, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x4f, 0x0a, 0x15, 0x75, 0x70, 0x64, - 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 0x53, 0x68, 0x75, 0x74, 0x64, 0x6f, - 0x77, 0x6e, 0x12, 0x20, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x54, - 0x54, 0x50, 0x57, 0x65, 0x62, 0x53, 0x68, 0x75, 0x74, 0x64, 0x6f, 0x77, 0x6e, 0x52, 0x65, 0x71, + 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 0x46, 0x69, 0x72, 0x65, 0x77, 0x61, + 0x6c, 0x6c, 0x12, 0x20, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x54, + 0x54, 0x50, 0x57, 0x65, 0x62, 0x46, 0x69, 0x72, 0x65, 0x77, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x50, 0x43, 0x55, 0x70, 0x64, - 0x61, 0x74, 0x65, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x49, 0x0a, 0x12, 0x75, 0x70, - 0x64, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 0x50, 0x61, 0x67, 0x65, 0x73, - 0x12, 0x1d, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, - 0x57, 0x65, 0x62, 0x50, 0x61, 0x67, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x14, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x50, 0x43, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x75, - 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x51, 0x0a, 0x16, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, - 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x4c, 0x6f, 0x67, 0x12, - 0x21, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x57, - 0x65, 0x62, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x50, 0x43, 0x55, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x47, 0x0a, 0x11, 0x75, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 0x53, 0x74, 0x61, 0x74, 0x12, 0x1c, 0x2e, - 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, - 0x53, 0x74, 0x61, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x70, 0x62, - 0x2e, 0x52, 0x50, 0x43, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, - 0x73, 0x12, 0x49, 0x0a, 0x12, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x57, - 0x65, 0x62, 0x43, 0x61, 0x63, 0x68, 0x65, 0x12, 0x1d, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, - 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 0x43, 0x61, 0x63, 0x68, 0x65, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x50, 0x43, 0x55, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x4f, 0x0a, 0x15, - 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 0x46, 0x69, 0x72, - 0x65, 0x77, 0x61, 0x6c, 0x6c, 0x12, 0x20, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 0x46, 0x69, 0x72, 0x65, 0x77, 0x61, 0x6c, 0x6c, + 0x61, 0x74, 0x65, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x51, 0x0a, 0x16, 0x75, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 0x4c, 0x6f, 0x63, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x21, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x50, 0x43, - 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x51, 0x0a, - 0x16, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 0x4c, 0x6f, - 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x21, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, - 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x70, 0x62, 0x2e, - 0x52, 0x50, 0x43, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, - 0x12, 0x5d, 0x0a, 0x1c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, - 0x62, 0x52, 0x65, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x54, 0x6f, 0x48, 0x54, 0x54, 0x50, 0x53, - 0x12, 0x27, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, - 0x57, 0x65, 0x62, 0x52, 0x65, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x54, 0x6f, 0x48, 0x54, 0x54, - 0x50, 0x53, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x70, 0x62, 0x2e, 0x52, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x5d, 0x0a, + 0x1c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 0x52, 0x65, + 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x54, 0x6f, 0x48, 0x54, 0x54, 0x50, 0x53, 0x12, 0x27, 0x2e, + 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, + 0x52, 0x65, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x54, 0x6f, 0x48, 0x54, 0x54, 0x50, 0x53, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x50, 0x43, 0x55, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x51, 0x0a, 0x16, + 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 0x57, 0x65, 0x62, + 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x12, 0x21, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 0x57, 0x65, 0x62, 0x73, 0x6f, 0x63, 0x6b, + 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x50, 0x43, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } @@ -1239,7 +1306,7 @@ func file_service_http_web_proto_rawDescGZIP() []byte { return file_service_http_web_proto_rawDescData } -var file_service_http_web_proto_msgTypes = make([]protoimpl.MessageInfo, 19) +var file_service_http_web_proto_msgTypes = make([]protoimpl.MessageInfo, 20) var file_service_http_web_proto_goTypes = []interface{}{ (*CreateHTTPWebRequest)(nil), // 0: pb.CreateHTTPWebRequest (*CreateHTTPWebResponse)(nil), // 1: pb.CreateHTTPWebResponse @@ -1260,11 +1327,12 @@ var file_service_http_web_proto_goTypes = []interface{}{ (*UpdateHTTPWebFirewallRequest)(nil), // 16: pb.UpdateHTTPWebFirewallRequest (*UpdateHTTPWebLocationsRequest)(nil), // 17: pb.UpdateHTTPWebLocationsRequest (*UpdateHTTPWebRedirectToHTTPSRequest)(nil), // 18: pb.UpdateHTTPWebRedirectToHTTPSRequest - (*HTTPWeb)(nil), // 19: pb.HTTPWeb - (*RPCUpdateSuccess)(nil), // 20: pb.RPCUpdateSuccess + (*UpdateHTTPWebWebsocketRequest)(nil), // 19: pb.UpdateHTTPWebWebsocketRequest + (*HTTPWeb)(nil), // 20: pb.HTTPWeb + (*RPCUpdateSuccess)(nil), // 21: pb.RPCUpdateSuccess } var file_service_http_web_proto_depIdxs = []int32{ - 19, // 0: pb.FindEnabledHTTPWebResponse.web:type_name -> pb.HTTPWeb + 20, // 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.findEnabledHTTPWebConfig:input_type -> pb.FindEnabledHTTPWebConfigRequest @@ -1281,24 +1349,26 @@ var file_service_http_web_proto_depIdxs = []int32{ 16, // 14: pb.HTTPWebService.updateHTTPWebFirewall:input_type -> pb.UpdateHTTPWebFirewallRequest 17, // 15: pb.HTTPWebService.updateHTTPWebLocations:input_type -> pb.UpdateHTTPWebLocationsRequest 18, // 16: pb.HTTPWebService.updateHTTPWebRedirectToHTTPS:input_type -> pb.UpdateHTTPWebRedirectToHTTPSRequest - 1, // 17: pb.HTTPWebService.createHTTPWeb:output_type -> pb.CreateHTTPWebResponse - 3, // 18: pb.HTTPWebService.findEnabledHTTPWeb:output_type -> pb.FindEnabledHTTPWebResponse - 5, // 19: pb.HTTPWebService.findEnabledHTTPWebConfig:output_type -> pb.FindEnabledHTTPWebConfigResponse - 20, // 20: pb.HTTPWebService.updateHTTPWeb:output_type -> pb.RPCUpdateSuccess - 20, // 21: pb.HTTPWebService.updateHTTPWebGzip:output_type -> pb.RPCUpdateSuccess - 20, // 22: pb.HTTPWebService.updateHTTPWebCharset:output_type -> pb.RPCUpdateSuccess - 20, // 23: pb.HTTPWebService.updateHTTPWebRequestHeader:output_type -> pb.RPCUpdateSuccess - 20, // 24: pb.HTTPWebService.updateHTTPWebResponseHeader:output_type -> pb.RPCUpdateSuccess - 20, // 25: pb.HTTPWebService.updateHTTPWebShutdown:output_type -> pb.RPCUpdateSuccess - 20, // 26: pb.HTTPWebService.updateHTTPWebPages:output_type -> pb.RPCUpdateSuccess - 20, // 27: pb.HTTPWebService.updateHTTPWebAccessLog:output_type -> pb.RPCUpdateSuccess - 20, // 28: pb.HTTPWebService.updateHTTPWebStat:output_type -> pb.RPCUpdateSuccess - 20, // 29: pb.HTTPWebService.updateHTTPWebCache:output_type -> pb.RPCUpdateSuccess - 20, // 30: pb.HTTPWebService.updateHTTPWebFirewall:output_type -> pb.RPCUpdateSuccess - 20, // 31: pb.HTTPWebService.updateHTTPWebLocations:output_type -> pb.RPCUpdateSuccess - 20, // 32: pb.HTTPWebService.updateHTTPWebRedirectToHTTPS:output_type -> pb.RPCUpdateSuccess - 17, // [17:33] is the sub-list for method output_type - 1, // [1:17] is the sub-list for method input_type + 19, // 17: pb.HTTPWebService.updateHTTPWebWebsocket:input_type -> pb.UpdateHTTPWebWebsocketRequest + 1, // 18: pb.HTTPWebService.createHTTPWeb:output_type -> pb.CreateHTTPWebResponse + 3, // 19: pb.HTTPWebService.findEnabledHTTPWeb:output_type -> pb.FindEnabledHTTPWebResponse + 5, // 20: pb.HTTPWebService.findEnabledHTTPWebConfig:output_type -> pb.FindEnabledHTTPWebConfigResponse + 21, // 21: pb.HTTPWebService.updateHTTPWeb:output_type -> pb.RPCUpdateSuccess + 21, // 22: pb.HTTPWebService.updateHTTPWebGzip:output_type -> pb.RPCUpdateSuccess + 21, // 23: pb.HTTPWebService.updateHTTPWebCharset:output_type -> pb.RPCUpdateSuccess + 21, // 24: pb.HTTPWebService.updateHTTPWebRequestHeader:output_type -> pb.RPCUpdateSuccess + 21, // 25: pb.HTTPWebService.updateHTTPWebResponseHeader:output_type -> pb.RPCUpdateSuccess + 21, // 26: pb.HTTPWebService.updateHTTPWebShutdown:output_type -> pb.RPCUpdateSuccess + 21, // 27: pb.HTTPWebService.updateHTTPWebPages:output_type -> pb.RPCUpdateSuccess + 21, // 28: pb.HTTPWebService.updateHTTPWebAccessLog:output_type -> pb.RPCUpdateSuccess + 21, // 29: pb.HTTPWebService.updateHTTPWebStat:output_type -> pb.RPCUpdateSuccess + 21, // 30: pb.HTTPWebService.updateHTTPWebCache:output_type -> pb.RPCUpdateSuccess + 21, // 31: pb.HTTPWebService.updateHTTPWebFirewall:output_type -> pb.RPCUpdateSuccess + 21, // 32: pb.HTTPWebService.updateHTTPWebLocations:output_type -> pb.RPCUpdateSuccess + 21, // 33: pb.HTTPWebService.updateHTTPWebRedirectToHTTPS:output_type -> pb.RPCUpdateSuccess + 21, // 34: pb.HTTPWebService.updateHTTPWebWebsocket:output_type -> pb.RPCUpdateSuccess + 18, // [18:35] is the sub-list for method output_type + 1, // [1:18] 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 @@ -1540,6 +1610,18 @@ func file_service_http_web_proto_init() { return nil } } + file_service_http_web_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateHTTPWebWebsocketRequest); 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{ @@ -1547,7 +1629,7 @@ func file_service_http_web_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_service_http_web_proto_rawDesc, NumEnums: 0, - NumMessages: 19, + NumMessages: 20, NumExtensions: 0, NumServices: 1, }, @@ -1603,8 +1685,10 @@ type HTTPWebServiceClient interface { UpdateHTTPWebFirewall(ctx context.Context, in *UpdateHTTPWebFirewallRequest, opts ...grpc.CallOption) (*RPCUpdateSuccess, error) // 更改路径规则配置 UpdateHTTPWebLocations(ctx context.Context, in *UpdateHTTPWebLocationsRequest, opts ...grpc.CallOption) (*RPCUpdateSuccess, error) - // 跳转到HTTPS + // 更改跳转到HTTPS设置 UpdateHTTPWebRedirectToHTTPS(ctx context.Context, in *UpdateHTTPWebRedirectToHTTPSRequest, opts ...grpc.CallOption) (*RPCUpdateSuccess, error) + // 更改Websocket设置 + UpdateHTTPWebWebsocket(ctx context.Context, in *UpdateHTTPWebWebsocketRequest, opts ...grpc.CallOption) (*RPCUpdateSuccess, error) } type hTTPWebServiceClient struct { @@ -1759,6 +1843,15 @@ func (c *hTTPWebServiceClient) UpdateHTTPWebRedirectToHTTPS(ctx context.Context, return out, nil } +func (c *hTTPWebServiceClient) UpdateHTTPWebWebsocket(ctx context.Context, in *UpdateHTTPWebWebsocketRequest, opts ...grpc.CallOption) (*RPCUpdateSuccess, error) { + out := new(RPCUpdateSuccess) + err := c.cc.Invoke(ctx, "/pb.HTTPWebService/updateHTTPWebWebsocket", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // HTTPWebServiceServer is the server API for HTTPWebService service. type HTTPWebServiceServer interface { // 创建Web配置 @@ -1791,8 +1884,10 @@ type HTTPWebServiceServer interface { UpdateHTTPWebFirewall(context.Context, *UpdateHTTPWebFirewallRequest) (*RPCUpdateSuccess, error) // 更改路径规则配置 UpdateHTTPWebLocations(context.Context, *UpdateHTTPWebLocationsRequest) (*RPCUpdateSuccess, error) - // 跳转到HTTPS + // 更改跳转到HTTPS设置 UpdateHTTPWebRedirectToHTTPS(context.Context, *UpdateHTTPWebRedirectToHTTPSRequest) (*RPCUpdateSuccess, error) + // 更改Websocket设置 + UpdateHTTPWebWebsocket(context.Context, *UpdateHTTPWebWebsocketRequest) (*RPCUpdateSuccess, error) } // UnimplementedHTTPWebServiceServer can be embedded to have forward compatible implementations. @@ -1847,6 +1942,9 @@ func (*UnimplementedHTTPWebServiceServer) UpdateHTTPWebLocations(context.Context func (*UnimplementedHTTPWebServiceServer) UpdateHTTPWebRedirectToHTTPS(context.Context, *UpdateHTTPWebRedirectToHTTPSRequest) (*RPCUpdateSuccess, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateHTTPWebRedirectToHTTPS not implemented") } +func (*UnimplementedHTTPWebServiceServer) UpdateHTTPWebWebsocket(context.Context, *UpdateHTTPWebWebsocketRequest) (*RPCUpdateSuccess, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateHTTPWebWebsocket not implemented") +} func RegisterHTTPWebServiceServer(s *grpc.Server, srv HTTPWebServiceServer) { s.RegisterService(&_HTTPWebService_serviceDesc, srv) @@ -2140,6 +2238,24 @@ func _HTTPWebService_UpdateHTTPWebRedirectToHTTPS_Handler(srv interface{}, ctx c return interceptor(ctx, in, info, handler) } +func _HTTPWebService_UpdateHTTPWebWebsocket_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateHTTPWebWebsocketRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(HTTPWebServiceServer).UpdateHTTPWebWebsocket(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.HTTPWebService/UpdateHTTPWebWebsocket", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(HTTPWebServiceServer).UpdateHTTPWebWebsocket(ctx, req.(*UpdateHTTPWebWebsocketRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _HTTPWebService_serviceDesc = grpc.ServiceDesc{ ServiceName: "pb.HTTPWebService", HandlerType: (*HTTPWebServiceServer)(nil), @@ -2208,6 +2324,10 @@ var _HTTPWebService_serviceDesc = grpc.ServiceDesc{ MethodName: "updateHTTPWebRedirectToHTTPS", Handler: _HTTPWebService_UpdateHTTPWebRedirectToHTTPS_Handler, }, + { + MethodName: "updateHTTPWebWebsocket", + Handler: _HTTPWebService_UpdateHTTPWebWebsocket_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "service_http_web.proto", diff --git a/pkg/rpc/pb/service_http_websocket.pb.go b/pkg/rpc/pb/service_http_websocket.pb.go new file mode 100644 index 0000000..ac8f4cd --- /dev/null +++ b/pkg/rpc/pb/service_http_websocket.pb.go @@ -0,0 +1,519 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.25.0 +// protoc v3.12.3 +// source: service_http_websocket.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 + +// 创建Websocket配置 +type CreateHTTPWebsocketRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + HandshakeTimeoutJSON []byte `protobuf:"bytes,1,opt,name=handshakeTimeoutJSON,proto3" json:"handshakeTimeoutJSON,omitempty"` + AllowAllOrigins bool `protobuf:"varint,2,opt,name=allowAllOrigins,proto3" json:"allowAllOrigins,omitempty"` + AllowedOrigins []string `protobuf:"bytes,3,rep,name=allowedOrigins,proto3" json:"allowedOrigins,omitempty"` + RequestSameOrigin bool `protobuf:"varint,4,opt,name=requestSameOrigin,proto3" json:"requestSameOrigin,omitempty"` + RequestOrigin string `protobuf:"bytes,5,opt,name=requestOrigin,proto3" json:"requestOrigin,omitempty"` +} + +func (x *CreateHTTPWebsocketRequest) Reset() { + *x = CreateHTTPWebsocketRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_service_http_websocket_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateHTTPWebsocketRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateHTTPWebsocketRequest) ProtoMessage() {} + +func (x *CreateHTTPWebsocketRequest) ProtoReflect() protoreflect.Message { + mi := &file_service_http_websocket_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 CreateHTTPWebsocketRequest.ProtoReflect.Descriptor instead. +func (*CreateHTTPWebsocketRequest) Descriptor() ([]byte, []int) { + return file_service_http_websocket_proto_rawDescGZIP(), []int{0} +} + +func (x *CreateHTTPWebsocketRequest) GetHandshakeTimeoutJSON() []byte { + if x != nil { + return x.HandshakeTimeoutJSON + } + return nil +} + +func (x *CreateHTTPWebsocketRequest) GetAllowAllOrigins() bool { + if x != nil { + return x.AllowAllOrigins + } + return false +} + +func (x *CreateHTTPWebsocketRequest) GetAllowedOrigins() []string { + if x != nil { + return x.AllowedOrigins + } + return nil +} + +func (x *CreateHTTPWebsocketRequest) GetRequestSameOrigin() bool { + if x != nil { + return x.RequestSameOrigin + } + return false +} + +func (x *CreateHTTPWebsocketRequest) GetRequestOrigin() string { + if x != nil { + return x.RequestOrigin + } + return "" +} + +type CreateHTTPWebsocketResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + WebsocketId int64 `protobuf:"varint,1,opt,name=websocketId,proto3" json:"websocketId,omitempty"` +} + +func (x *CreateHTTPWebsocketResponse) Reset() { + *x = CreateHTTPWebsocketResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_service_http_websocket_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateHTTPWebsocketResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateHTTPWebsocketResponse) ProtoMessage() {} + +func (x *CreateHTTPWebsocketResponse) ProtoReflect() protoreflect.Message { + mi := &file_service_http_websocket_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 CreateHTTPWebsocketResponse.ProtoReflect.Descriptor instead. +func (*CreateHTTPWebsocketResponse) Descriptor() ([]byte, []int) { + return file_service_http_websocket_proto_rawDescGZIP(), []int{1} +} + +func (x *CreateHTTPWebsocketResponse) GetWebsocketId() int64 { + if x != nil { + return x.WebsocketId + } + return 0 +} + +// 修改Websocket配置 +type UpdateHTTPWebsocketRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + WebsocketId int64 `protobuf:"varint,1,opt,name=websocketId,proto3" json:"websocketId,omitempty"` + HandshakeTimeoutJSON []byte `protobuf:"bytes,2,opt,name=handshakeTimeoutJSON,proto3" json:"handshakeTimeoutJSON,omitempty"` + AllowAllOrigins bool `protobuf:"varint,3,opt,name=allowAllOrigins,proto3" json:"allowAllOrigins,omitempty"` + AllowedOrigins []string `protobuf:"bytes,4,rep,name=allowedOrigins,proto3" json:"allowedOrigins,omitempty"` + RequestSameOrigin bool `protobuf:"varint,5,opt,name=requestSameOrigin,proto3" json:"requestSameOrigin,omitempty"` + RequestOrigin string `protobuf:"bytes,6,opt,name=requestOrigin,proto3" json:"requestOrigin,omitempty"` +} + +func (x *UpdateHTTPWebsocketRequest) Reset() { + *x = UpdateHTTPWebsocketRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_service_http_websocket_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateHTTPWebsocketRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateHTTPWebsocketRequest) ProtoMessage() {} + +func (x *UpdateHTTPWebsocketRequest) ProtoReflect() protoreflect.Message { + mi := &file_service_http_websocket_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 UpdateHTTPWebsocketRequest.ProtoReflect.Descriptor instead. +func (*UpdateHTTPWebsocketRequest) Descriptor() ([]byte, []int) { + return file_service_http_websocket_proto_rawDescGZIP(), []int{2} +} + +func (x *UpdateHTTPWebsocketRequest) GetWebsocketId() int64 { + if x != nil { + return x.WebsocketId + } + return 0 +} + +func (x *UpdateHTTPWebsocketRequest) GetHandshakeTimeoutJSON() []byte { + if x != nil { + return x.HandshakeTimeoutJSON + } + return nil +} + +func (x *UpdateHTTPWebsocketRequest) GetAllowAllOrigins() bool { + if x != nil { + return x.AllowAllOrigins + } + return false +} + +func (x *UpdateHTTPWebsocketRequest) GetAllowedOrigins() []string { + if x != nil { + return x.AllowedOrigins + } + return nil +} + +func (x *UpdateHTTPWebsocketRequest) GetRequestSameOrigin() bool { + if x != nil { + return x.RequestSameOrigin + } + return false +} + +func (x *UpdateHTTPWebsocketRequest) GetRequestOrigin() string { + if x != nil { + return x.RequestOrigin + } + return "" +} + +var File_service_http_websocket_proto protoreflect.FileDescriptor + +var file_service_http_websocket_proto_rawDesc = []byte{ + 0x0a, 0x1c, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x68, 0x74, 0x74, 0x70, 0x5f, 0x77, + 0x65, 0x62, 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, + 0x70, 0x62, 0x1a, 0x12, 0x72, 0x70, 0x63, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xf6, 0x01, 0x0a, 0x1a, 0x43, 0x72, 0x65, 0x61, 0x74, + 0x65, 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x32, 0x0a, 0x14, 0x68, 0x61, 0x6e, 0x64, 0x73, 0x68, 0x61, + 0x6b, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x14, 0x68, 0x61, 0x6e, 0x64, 0x73, 0x68, 0x61, 0x6b, 0x65, 0x54, 0x69, + 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x4a, 0x53, 0x4f, 0x4e, 0x12, 0x28, 0x0a, 0x0f, 0x61, 0x6c, 0x6c, + 0x6f, 0x77, 0x41, 0x6c, 0x6c, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x08, 0x52, 0x0f, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x41, 0x6c, 0x6c, 0x4f, 0x72, 0x69, 0x67, + 0x69, 0x6e, 0x73, 0x12, 0x26, 0x0a, 0x0e, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x4f, 0x72, + 0x69, 0x67, 0x69, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0e, 0x61, 0x6c, 0x6c, + 0x6f, 0x77, 0x65, 0x64, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x73, 0x12, 0x2c, 0x0a, 0x11, 0x72, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x53, 0x61, 0x6d, 0x65, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x11, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x53, + 0x61, 0x6d, 0x65, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x12, 0x24, 0x0a, 0x0d, 0x72, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0d, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x22, + 0x3f, 0x0a, 0x1b, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, + 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x20, + 0x0a, 0x0b, 0x77, 0x65, 0x62, 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x49, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x0b, 0x77, 0x65, 0x62, 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x49, 0x64, + 0x22, 0x98, 0x02, 0x0a, 0x1a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x57, + 0x65, 0x62, 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x20, 0x0a, 0x0b, 0x77, 0x65, 0x62, 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x49, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x77, 0x65, 0x62, 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x49, + 0x64, 0x12, 0x32, 0x0a, 0x14, 0x68, 0x61, 0x6e, 0x64, 0x73, 0x68, 0x61, 0x6b, 0x65, 0x54, 0x69, + 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, + 0x14, 0x68, 0x61, 0x6e, 0x64, 0x73, 0x68, 0x61, 0x6b, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, + 0x74, 0x4a, 0x53, 0x4f, 0x4e, 0x12, 0x28, 0x0a, 0x0f, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x41, 0x6c, + 0x6c, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f, + 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x41, 0x6c, 0x6c, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x73, 0x12, + 0x26, 0x0a, 0x0e, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, + 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0e, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, + 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x73, 0x12, 0x2c, 0x0a, 0x11, 0x72, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x53, 0x61, 0x6d, 0x65, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x18, 0x05, 0x20, 0x01, + 0x28, 0x08, 0x52, 0x11, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x53, 0x61, 0x6d, 0x65, 0x4f, + 0x72, 0x69, 0x67, 0x69, 0x6e, 0x12, 0x24, 0x0a, 0x0d, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x72, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x32, 0xbb, 0x01, 0x0a, 0x14, + 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x53, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x12, 0x56, 0x0a, 0x13, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x48, 0x54, + 0x54, 0x50, 0x57, 0x65, 0x62, 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x12, 0x1e, 0x2e, 0x70, 0x62, + 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 0x73, 0x6f, + 0x63, 0x6b, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x70, 0x62, + 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 0x73, 0x6f, + 0x63, 0x6b, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4b, 0x0a, 0x13, + 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 0x73, 0x6f, 0x63, + 0x6b, 0x65, 0x74, 0x12, 0x1e, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, + 0x54, 0x54, 0x50, 0x57, 0x65, 0x62, 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x50, 0x43, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, + 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_service_http_websocket_proto_rawDescOnce sync.Once + file_service_http_websocket_proto_rawDescData = file_service_http_websocket_proto_rawDesc +) + +func file_service_http_websocket_proto_rawDescGZIP() []byte { + file_service_http_websocket_proto_rawDescOnce.Do(func() { + file_service_http_websocket_proto_rawDescData = protoimpl.X.CompressGZIP(file_service_http_websocket_proto_rawDescData) + }) + return file_service_http_websocket_proto_rawDescData +} + +var file_service_http_websocket_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_service_http_websocket_proto_goTypes = []interface{}{ + (*CreateHTTPWebsocketRequest)(nil), // 0: pb.CreateHTTPWebsocketRequest + (*CreateHTTPWebsocketResponse)(nil), // 1: pb.CreateHTTPWebsocketResponse + (*UpdateHTTPWebsocketRequest)(nil), // 2: pb.UpdateHTTPWebsocketRequest + (*RPCUpdateSuccess)(nil), // 3: pb.RPCUpdateSuccess +} +var file_service_http_websocket_proto_depIdxs = []int32{ + 0, // 0: pb.HTTPWebsocketService.createHTTPWebsocket:input_type -> pb.CreateHTTPWebsocketRequest + 2, // 1: pb.HTTPWebsocketService.updateHTTPWebsocket:input_type -> pb.UpdateHTTPWebsocketRequest + 1, // 2: pb.HTTPWebsocketService.createHTTPWebsocket:output_type -> pb.CreateHTTPWebsocketResponse + 3, // 3: pb.HTTPWebsocketService.updateHTTPWebsocket:output_type -> pb.RPCUpdateSuccess + 2, // [2:4] is the sub-list for method output_type + 0, // [0:2] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_service_http_websocket_proto_init() } +func file_service_http_websocket_proto_init() { + if File_service_http_websocket_proto != nil { + return + } + file_rpc_messages_proto_init() + if !protoimpl.UnsafeEnabled { + file_service_http_websocket_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateHTTPWebsocketRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_http_websocket_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateHTTPWebsocketResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_http_websocket_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateHTTPWebsocketRequest); 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_websocket_proto_rawDesc, + NumEnums: 0, + NumMessages: 3, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_service_http_websocket_proto_goTypes, + DependencyIndexes: file_service_http_websocket_proto_depIdxs, + MessageInfos: file_service_http_websocket_proto_msgTypes, + }.Build() + File_service_http_websocket_proto = out.File + file_service_http_websocket_proto_rawDesc = nil + file_service_http_websocket_proto_goTypes = nil + file_service_http_websocket_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 + +// HTTPWebsocketServiceClient is the client API for HTTPWebsocketService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type HTTPWebsocketServiceClient interface { + // 创建Websocket配置 + CreateHTTPWebsocket(ctx context.Context, in *CreateHTTPWebsocketRequest, opts ...grpc.CallOption) (*CreateHTTPWebsocketResponse, error) + // 修改Websocket配置 + UpdateHTTPWebsocket(ctx context.Context, in *UpdateHTTPWebsocketRequest, opts ...grpc.CallOption) (*RPCUpdateSuccess, error) +} + +type hTTPWebsocketServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewHTTPWebsocketServiceClient(cc grpc.ClientConnInterface) HTTPWebsocketServiceClient { + return &hTTPWebsocketServiceClient{cc} +} + +func (c *hTTPWebsocketServiceClient) CreateHTTPWebsocket(ctx context.Context, in *CreateHTTPWebsocketRequest, opts ...grpc.CallOption) (*CreateHTTPWebsocketResponse, error) { + out := new(CreateHTTPWebsocketResponse) + err := c.cc.Invoke(ctx, "/pb.HTTPWebsocketService/createHTTPWebsocket", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *hTTPWebsocketServiceClient) UpdateHTTPWebsocket(ctx context.Context, in *UpdateHTTPWebsocketRequest, opts ...grpc.CallOption) (*RPCUpdateSuccess, error) { + out := new(RPCUpdateSuccess) + err := c.cc.Invoke(ctx, "/pb.HTTPWebsocketService/updateHTTPWebsocket", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// HTTPWebsocketServiceServer is the server API for HTTPWebsocketService service. +type HTTPWebsocketServiceServer interface { + // 创建Websocket配置 + CreateHTTPWebsocket(context.Context, *CreateHTTPWebsocketRequest) (*CreateHTTPWebsocketResponse, error) + // 修改Websocket配置 + UpdateHTTPWebsocket(context.Context, *UpdateHTTPWebsocketRequest) (*RPCUpdateSuccess, error) +} + +// UnimplementedHTTPWebsocketServiceServer can be embedded to have forward compatible implementations. +type UnimplementedHTTPWebsocketServiceServer struct { +} + +func (*UnimplementedHTTPWebsocketServiceServer) CreateHTTPWebsocket(context.Context, *CreateHTTPWebsocketRequest) (*CreateHTTPWebsocketResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateHTTPWebsocket not implemented") +} +func (*UnimplementedHTTPWebsocketServiceServer) UpdateHTTPWebsocket(context.Context, *UpdateHTTPWebsocketRequest) (*RPCUpdateSuccess, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateHTTPWebsocket not implemented") +} + +func RegisterHTTPWebsocketServiceServer(s *grpc.Server, srv HTTPWebsocketServiceServer) { + s.RegisterService(&_HTTPWebsocketService_serviceDesc, srv) +} + +func _HTTPWebsocketService_CreateHTTPWebsocket_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateHTTPWebsocketRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(HTTPWebsocketServiceServer).CreateHTTPWebsocket(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.HTTPWebsocketService/CreateHTTPWebsocket", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(HTTPWebsocketServiceServer).CreateHTTPWebsocket(ctx, req.(*CreateHTTPWebsocketRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _HTTPWebsocketService_UpdateHTTPWebsocket_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateHTTPWebsocketRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(HTTPWebsocketServiceServer).UpdateHTTPWebsocket(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.HTTPWebsocketService/UpdateHTTPWebsocket", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(HTTPWebsocketServiceServer).UpdateHTTPWebsocket(ctx, req.(*UpdateHTTPWebsocketRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _HTTPWebsocketService_serviceDesc = grpc.ServiceDesc{ + ServiceName: "pb.HTTPWebsocketService", + HandlerType: (*HTTPWebsocketServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "createHTTPWebsocket", + Handler: _HTTPWebsocketService_CreateHTTPWebsocket_Handler, + }, + { + MethodName: "updateHTTPWebsocket", + Handler: _HTTPWebsocketService_UpdateHTTPWebsocket_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "service_http_websocket.proto", +} diff --git a/pkg/rpc/protos/service_http_web.proto b/pkg/rpc/protos/service_http_web.proto index a06f599..be8cba1 100644 --- a/pkg/rpc/protos/service_http_web.proto +++ b/pkg/rpc/protos/service_http_web.proto @@ -52,8 +52,11 @@ service HTTPWebService { // 更改路径规则配置 rpc updateHTTPWebLocations (UpdateHTTPWebLocationsRequest) returns (RPCUpdateSuccess); - // 跳转到HTTPS + // 更改跳转到HTTPS设置 rpc updateHTTPWebRedirectToHTTPS (UpdateHTTPWebRedirectToHTTPSRequest) returns (RPCUpdateSuccess); + + // 更改Websocket设置 + rpc updateHTTPWebWebsocket (UpdateHTTPWebWebsocketRequest) returns (RPCUpdateSuccess); } // 创建Web配置 @@ -155,8 +158,14 @@ message UpdateHTTPWebLocationsRequest { bytes locationsJSON = 3; } -// 跳转到HTTPS +// 更改跳转到HTTPS设置 message UpdateHTTPWebRedirectToHTTPSRequest { int64 webId = 1; bytes redirectToHTTPSJSON = 2; +} + +// 更改Websocket设置 +message UpdateHTTPWebWebsocketRequest { + int64 webId = 1; + bytes websocketJSON = 2; } \ No newline at end of file diff --git a/pkg/rpc/protos/service_http_websocket.proto b/pkg/rpc/protos/service_http_websocket.proto new file mode 100644 index 0000000..78c36f6 --- /dev/null +++ b/pkg/rpc/protos/service_http_websocket.proto @@ -0,0 +1,37 @@ +syntax = "proto3"; +option go_package = "./pb"; + +package pb; + +import "rpc_messages.proto"; + +service HTTPWebsocketService { + // 创建Websocket配置 + rpc createHTTPWebsocket (CreateHTTPWebsocketRequest) returns (CreateHTTPWebsocketResponse); + + // 修改Websocket配置 + rpc updateHTTPWebsocket (UpdateHTTPWebsocketRequest) returns (RPCUpdateSuccess); +} + +// 创建Websocket配置 +message CreateHTTPWebsocketRequest { + bytes handshakeTimeoutJSON = 1; + bool allowAllOrigins = 2; + repeated string allowedOrigins = 3; + bool requestSameOrigin = 4; + string requestOrigin = 5; +} + +message CreateHTTPWebsocketResponse { + int64 websocketId = 1; +} + +// 修改Websocket配置 +message UpdateHTTPWebsocketRequest { + int64 websocketId = 1; + bytes handshakeTimeoutJSON = 2; + bool allowAllOrigins = 3; + repeated string allowedOrigins = 4; + bool requestSameOrigin = 5; + string requestOrigin = 6; +} \ No newline at end of file diff --git a/pkg/serverconfigs/http_charset_config.go b/pkg/serverconfigs/http_charset_config.go index 64a948e..ffedbec 100644 --- a/pkg/serverconfigs/http_charset_config.go +++ b/pkg/serverconfigs/http_charset_config.go @@ -1,11 +1,16 @@ package serverconfigs +// 字符集设置 type HTTPCharsetConfig struct { IsPrior bool `yaml:"isPrior" json:"isPrior"` // 是否覆盖 IsOn bool `yaml:"isOn" json:"isOn"` // 是否启用 Charset string `yaml:"charset" json:"charset"` // 字符集 + IsUpper bool `yaml:"isUpper" json:"isUpper"` // 是否要大写 + + // TODO 支持自定义字符集 } +// 初始化 func (this *HTTPCharsetConfig) Init() error { return nil } diff --git a/pkg/serverconfigs/http_location_config.go b/pkg/serverconfigs/http_location_config.go index e411aba..bca476e 100644 --- a/pkg/serverconfigs/http_location_config.go +++ b/pkg/serverconfigs/http_location_config.go @@ -44,8 +44,15 @@ func (this *HTTPLocationConfig) Init() error { } } + if this.ReverseProxyRef != nil { + err := this.ReverseProxyRef.Init() + if err != nil { + return err + } + } + if this.ReverseProxy != nil { - err := this.Web.Init() + err := this.ReverseProxy.Init() if err != nil { return err } diff --git a/pkg/serverconfigs/http_root_config.go b/pkg/serverconfigs/http_root_config.go index 77b2a09..0ec590a 100644 --- a/pkg/serverconfigs/http_root_config.go +++ b/pkg/serverconfigs/http_root_config.go @@ -1,5 +1,7 @@ package serverconfigs +import "github.com/TeaOSLab/EdgeCommon/pkg/configutils" + // Web文档目录配置 type HTTPRootConfig struct { IsPrior bool `yaml:"isPrior" json:"isPrior"` // 是否优先 @@ -9,9 +11,17 @@ type HTTPRootConfig struct { StripPrefix string `yaml:"stripPrefix" json:"stripPrefix"` // 去除前缀 DecodePath bool `yaml:"decodePath" json:"decodePath"` // 是否对请求路径进行解码 IsBreak bool `yaml:"isBreak" json:"isBreak"` // 找不到文件的情况下是否终止 + + hasVariables bool } // 初始化 -func (ths *HTTPRootConfig) Init() error { +func (this *HTTPRootConfig) Init() error { + this.hasVariables = configutils.HasVariables(this.Dir) return nil } + +// 判断是否有变量 +func (this *HTTPRootConfig) HasVariables() bool { + return this.hasVariables +} diff --git a/pkg/serverconfigs/http_root_config_test.go b/pkg/serverconfigs/http_root_config_test.go new file mode 100644 index 0000000..7148289 --- /dev/null +++ b/pkg/serverconfigs/http_root_config_test.go @@ -0,0 +1,43 @@ +package serverconfigs + +import ( + "github.com/iwind/TeaGo/assert" + "testing" +) + +func TestHTTPRootConfig_HasVariables(t *testing.T) { + a := assert.NewAssertion(t) + + { + rootConfig := &HTTPRootConfig{ + Dir: "", + } + err := rootConfig.Init() + if err != nil { + t.Fatal(err) + } + a.IsFalse(rootConfig.HasVariables()) + } + + { + rootConfig := &HTTPRootConfig{ + Dir: "/home/www", + } + err := rootConfig.Init() + if err != nil { + t.Fatal(err) + } + a.IsFalse(rootConfig.HasVariables()) + } + + { + rootConfig := &HTTPRootConfig{ + Dir: "/home/www/${prefix}/world", + } + err := rootConfig.Init() + if err != nil { + t.Fatal(err) + } + a.IsTrue(rootConfig.HasVariables()) + } +} diff --git a/pkg/serverconfigs/http_websocket_config.go b/pkg/serverconfigs/http_websocket_config.go index beefa58..b090aa1 100644 --- a/pkg/serverconfigs/http_websocket_config.go +++ b/pkg/serverconfigs/http_websocket_config.go @@ -3,7 +3,6 @@ package serverconfigs import ( "github.com/TeaOSLab/EdgeCommon/pkg/configutils" "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared" - "github.com/iwind/TeaGo/maps" "time" ) @@ -15,21 +14,16 @@ type HTTPWebsocketConfig struct { // 握手超时时间 HandshakeTimeout *shared.TimeDuration `yaml:"handshakeTimeout" json:"handshakeTimeout"` - // 允许的域名,支持 www.example.com, example.com, .example.com, *.example.com + // 允许的来源域名,支持 www.example.com, example.com, .example.com, *.example.com AllowAllOrigins bool `yaml:"allowAllOrigins" json:"allowAllOrigins"` - Origins []string `yaml:"origins" json:"origins"` + AllowedOrigins []string `yaml:"allowedOrigins" json:"allowedOrigins"` - // 转发方式 - ForwardMode HTTPWebsocketForwardMode `yaml:"forwardMode" json:"forwardMode"` + // 向后传递的来源 + RequestSameOrigin bool `yaml:"requestSameOrigin" json:"requestSameOrigin"` // 和请求一致 + RequestOrigin string `yaml:"requestOrigin" json:"requestOrigin"` // 自行指定Origin,支持变量 - handshakeTimeoutDuration time.Duration -} - -// 获取新对象 -func NewHTTPWebsocketConfig() *HTTPWebsocketConfig { - return &HTTPWebsocketConfig{ - IsOn: true, - } + handshakeTimeoutDuration time.Duration + requestOriginHasVariables bool } // 校验 @@ -39,6 +33,9 @@ func (this *HTTPWebsocketConfig) Init() error { this.handshakeTimeoutDuration = this.HandshakeTimeout.Duration() } + // requestOrigin + this.requestOriginHasVariables = configutils.HasVariables(this.RequestOrigin) + return nil } @@ -47,20 +44,15 @@ func (this *HTTPWebsocketConfig) HandshakeTimeoutDuration() time.Duration { return this.handshakeTimeoutDuration } -// 转发模式名称 -func (this *HTTPWebsocketConfig) ForwardModeSummary() maps.Map { - for _, mode := range AllWebsocketForwardModes() { - if mode["mode"] == this.ForwardMode { - return mode - } - } - return nil -} - // 匹配域名 func (this *HTTPWebsocketConfig) MatchOrigin(origin string) bool { if this.AllowAllOrigins { return true } - return configutils.MatchDomains(this.Origins, origin) + return configutils.MatchDomains(this.AllowedOrigins, origin) +} + +// 判断请求Origin是否有变量 +func (this *HTTPWebsocketConfig) RequestOriginHasVariables() bool { + return this.requestOriginHasVariables } diff --git a/pkg/serverconfigs/http_websocket_forward_modes.go b/pkg/serverconfigs/http_websocket_forward_modes.go deleted file mode 100644 index 475a9fb..0000000 --- a/pkg/serverconfigs/http_websocket_forward_modes.go +++ /dev/null @@ -1,27 +0,0 @@ -package serverconfigs - -import "github.com/iwind/TeaGo/maps" - -// Websocket转发类型 -type HTTPWebsocketForwardMode = string - -const ( - HTTPWebsocketForwardModeWebsocket = "websocket" - HTTPWebsocketForwardModeHttp = "http" -) - -// 所有的转发方式 -func AllWebsocketForwardModes() []maps.Map { - return []maps.Map{ - { - "name": "Websocket连接", - "mode": HTTPWebsocketForwardModeWebsocket, - "description": "通过Websocket连接后端服务器并发送数据", - }, - { - "name": "HTTP连接", - "mode": HTTPWebsocketForwardModeHttp, - "description": "通过HTTP PUT转发服务器到后端服务器", - }, - } -} diff --git a/pkg/serverconfigs/origin_config.go b/pkg/serverconfigs/origin_config.go index 65d5dcb..a7f3fdd 100644 --- a/pkg/serverconfigs/origin_config.go +++ b/pkg/serverconfigs/origin_config.go @@ -1,12 +1,9 @@ package serverconfigs import ( - "crypto/tls" - "errors" "fmt" "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared" "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/sslconfigs" - "net" "strconv" "strings" "time" @@ -96,12 +93,24 @@ func (this *OriginConfig) Init() error { } // Headers + if this.RequestHeaderPolicyRef != nil { + err := this.RequestHeaderPolicyRef.Init() + if err != nil { + return err + } + } if this.RequestHeaderPolicy != nil { err := this.RequestHeaderPolicy.Init() if err != nil { return err } } + if this.ResponseHeaderPolicyRef != nil { + err := this.ResponseHeaderPolicyRef.Init() + if err != nil { + return err + } + } if this.ResponseHeaderPolicy != nil { err := this.ResponseHeaderPolicy.Init() if err != nil { @@ -150,31 +159,6 @@ func (this *OriginConfig) CandidateWeight() uint { return this.Weight } -// 连接源站 -func (this *OriginConfig) Connect() (net.Conn, error) { - if this.Addr == nil { - return nil, errors.New("origin server address should not be empty") - } - - switch this.Addr.Protocol { - case "", ProtocolTCP: - // TODO 支持TCP4/TCP6 - // TODO 支持指定特定网卡 - // TODO Addr支持端口范围,如果有多个端口时,随机一个端口使用 - return net.DialTimeout("tcp", this.Addr.Host+":"+this.Addr.PortRange, this.connTimeoutDuration) - case ProtocolTLS: - // TODO 支持TCP4/TCP6 - // TODO 支持指定特定网卡 - // TODO Addr支持端口范围,如果有多个端口时,随机一个端口使用 - // TODO 支持使用证书 - return tls.Dial("tcp", this.Addr.Host+":"+this.Addr.PortRange, &tls.Config{}) - } - - // TODO 支持从Unix、Pipe、HTTP、HTTPS中读取数据 - - return nil, errors.New("invalid scheme '" + this.Addr.Protocol.String() + "'") -} - // 获取最终请求的地址 func (this *OriginConfig) RealAddr() string { return this.realAddr @@ -184,3 +168,8 @@ func (this *OriginConfig) RealAddr() string { func (this *OriginConfig) SetRealAddr(realAddr string) { this.realAddr = realAddr } + +// 连接超时时间 +func (this *OriginConfig) ConnTimeoutDuration() time.Duration { + return this.connTimeoutDuration +} diff --git a/pkg/serverconfigs/reverse_proxy_config.go b/pkg/serverconfigs/reverse_proxy_config.go index 51669a6..bfe6dad 100644 --- a/pkg/serverconfigs/reverse_proxy_config.go +++ b/pkg/serverconfigs/reverse_proxy_config.go @@ -16,6 +16,8 @@ type ReverseProxyConfig struct { BackupOriginRefs []*OriginRef `yaml:"backupOriginRefs" json:"backupOriginRefs"` // 备用源站引用 Scheduling *SchedulingConfig `yaml:"scheduling" json:"scheduling"` // 调度算法选项 + // TODO 可以设置同后端交互的主机名(Host),并支持变量 + hasPrimaryOrigins bool hasBackupOrigins bool schedulingIsBackup bool diff --git a/pkg/serverconfigs/reverse_proxy_ref.go b/pkg/serverconfigs/reverse_proxy_ref.go index 2a241c4..445f189 100644 --- a/pkg/serverconfigs/reverse_proxy_ref.go +++ b/pkg/serverconfigs/reverse_proxy_ref.go @@ -6,3 +6,8 @@ type ReverseProxyRef struct { IsOn bool `yaml:"isOn" json:"isOn"` // 是否启用 ReverseProxyId int64 `yaml:"reverseProxyId" json:"reverseProxyId"` // 反向代理ID } + +// 初始化 +func (this *ReverseProxyRef) Init() error { + return nil +} diff --git a/pkg/serverconfigs/server_config.go b/pkg/serverconfigs/server_config.go index f10983d..074dff3 100644 --- a/pkg/serverconfigs/server_config.go +++ b/pkg/serverconfigs/server_config.go @@ -84,6 +84,13 @@ func (this *ServerConfig) Init() error { } } + if this.ReverseProxyRef != nil { + err := this.ReverseProxyRef.Init() + if err != nil { + return err + } + } + if this.ReverseProxy != nil { err := this.ReverseProxy.Init() if err != nil { diff --git a/pkg/serverconfigs/shared/http_header_config.go b/pkg/serverconfigs/shared/http_header_config.go index 5d31b72..a33e1d3 100644 --- a/pkg/serverconfigs/shared/http_header_config.go +++ b/pkg/serverconfigs/shared/http_header_config.go @@ -1,11 +1,9 @@ package shared import ( - "regexp" + "github.com/TeaOSLab/EdgeCommon/pkg/configutils" ) -var regexpNamedVariable = regexp.MustCompile("\\${[\\w.-]+}") - // 头部信息定义 type HTTPHeaderConfig struct { Id int64 `yaml:"id" json:"id"` // ID @@ -26,7 +24,7 @@ func NewHeaderConfig() *HTTPHeaderConfig { // 校验 func (this *HTTPHeaderConfig) Init() error { - this.hasVariables = regexpNamedVariable.MatchString(this.Value) + this.hasVariables = configutils.HasVariables(this.Value) if this.Status != nil { err := this.Status.Init()