diff --git a/pkg/rpc/pb/service_http_location.pb.go b/pkg/rpc/pb/service_http_location.pb.go index a5802d5..844c843 100644 --- a/pkg/rpc/pb/service_http_location.pb.go +++ b/pkg/rpc/pb/service_http_location.pb.go @@ -585,6 +585,62 @@ func (x *FindAndInitHTTPLocationWebConfigResponse) GetWebJSON() []byte { return nil } +// 修改反向代理设置 +type UpdateHTTPLocationReverseProxyRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + LocationId int64 `protobuf:"varint,1,opt,name=locationId,proto3" json:"locationId,omitempty"` + ReverseProxyJSON []byte `protobuf:"bytes,2,opt,name=reverseProxyJSON,proto3" json:"reverseProxyJSON,omitempty"` +} + +func (x *UpdateHTTPLocationReverseProxyRequest) Reset() { + *x = UpdateHTTPLocationReverseProxyRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_service_http_location_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateHTTPLocationReverseProxyRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateHTTPLocationReverseProxyRequest) ProtoMessage() {} + +func (x *UpdateHTTPLocationReverseProxyRequest) ProtoReflect() protoreflect.Message { + mi := &file_service_http_location_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateHTTPLocationReverseProxyRequest.ProtoReflect.Descriptor instead. +func (*UpdateHTTPLocationReverseProxyRequest) Descriptor() ([]byte, []int) { + return file_service_http_location_proto_rawDescGZIP(), []int{10} +} + +func (x *UpdateHTTPLocationReverseProxyRequest) GetLocationId() int64 { + if x != nil { + return x.LocationId + } + return 0 +} + +func (x *UpdateHTTPLocationReverseProxyRequest) GetReverseProxyJSON() []byte { + if x != nil { + return x.ReverseProxyJSON + } + return nil +} + var File_service_http_location_proto protoreflect.FileDescriptor var file_service_http_location_proto_rawDesc = []byte{ @@ -653,50 +709,63 @@ var file_service_http_location_proto_rawDesc = []byte{ 0x41, 0x6e, 0x64, 0x49, 0x6e, 0x69, 0x74, 0x48, 0x54, 0x54, 0x50, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x57, 0x65, 0x62, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x77, 0x65, 0x62, 0x4a, 0x53, 0x4f, 0x4e, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x77, 0x65, 0x62, 0x4a, 0x53, 0x4f, 0x4e, 0x32, 0x90, - 0x05, 0x0a, 0x13, 0x48, 0x54, 0x54, 0x50, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x53, 0x0a, 0x12, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, - 0x48, 0x54, 0x54, 0x50, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1d, 0x2e, 0x70, - 0x62, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x4c, 0x6f, 0x63, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x70, 0x62, - 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x4c, 0x6f, 0x63, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x49, 0x0a, 0x12, 0x75, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x12, 0x1d, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, + 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x77, 0x65, 0x62, 0x4a, 0x53, 0x4f, 0x4e, 0x22, 0x73, + 0x0a, 0x25, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x4c, 0x6f, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x50, 0x72, 0x6f, 0x78, 0x79, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x6c, 0x6f, 0x63, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x6c, 0x6f, 0x63, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x2a, 0x0a, 0x10, 0x72, 0x65, 0x76, 0x65, 0x72, + 0x73, 0x65, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x10, 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x4a, + 0x53, 0x4f, 0x4e, 0x32, 0xf3, 0x05, 0x0a, 0x13, 0x48, 0x54, 0x54, 0x50, 0x4c, 0x6f, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x53, 0x0a, 0x12, 0x63, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x12, 0x1d, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 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, 0x74, 0x0a, 0x1d, 0x66, 0x69, 0x6e, 0x64, 0x45, 0x6e, - 0x61, 0x62, 0x6c, 0x65, 0x64, 0x48, 0x54, 0x54, 0x50, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x28, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6e, - 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x48, 0x54, 0x54, 0x50, 0x4c, 0x6f, 0x63, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 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, 0x48, 0x54, 0x54, 0x50, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x49, 0x0a, 0x12, - 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x12, 0x1d, 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x48, 0x54, - 0x54, 0x50, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x14, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x50, 0x43, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, - 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x98, 0x01, 0x0a, 0x29, 0x66, 0x69, 0x6e, 0x64, - 0x41, 0x6e, 0x64, 0x49, 0x6e, 0x69, 0x74, 0x48, 0x54, 0x54, 0x50, 0x4c, 0x6f, 0x63, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x43, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x34, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x41, - 0x6e, 0x64, 0x49, 0x6e, 0x69, 0x74, 0x48, 0x54, 0x54, 0x50, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x52, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x43, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x35, 0x2e, 0x70, 0x62, - 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x41, 0x6e, 0x64, 0x49, 0x6e, 0x69, 0x74, 0x48, 0x54, 0x54, 0x50, + 0x1a, 0x1e, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, + 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x49, 0x0a, 0x12, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x4c, 0x6f, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1d, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 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, 0x74, 0x0a, 0x1d, 0x66, + 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x48, 0x54, 0x54, 0x50, 0x4c, 0x6f, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x28, 0x2e, 0x70, + 0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x48, 0x54, 0x54, + 0x50, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 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, 0x48, 0x54, 0x54, 0x50, 0x4c, 0x6f, 0x63, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x49, 0x0a, 0x12, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x4c, + 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1d, 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x65, 0x6c, + 0x65, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x50, 0x43, 0x44, + 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x98, 0x01, 0x0a, + 0x29, 0x66, 0x69, 0x6e, 0x64, 0x41, 0x6e, 0x64, 0x49, 0x6e, 0x69, 0x74, 0x48, 0x54, 0x54, 0x50, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x50, - 0x72, 0x6f, 0x78, 0x79, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x7d, 0x0a, 0x20, 0x66, 0x69, 0x6e, 0x64, 0x41, 0x6e, 0x64, 0x49, 0x6e, 0x69, - 0x74, 0x48, 0x54, 0x54, 0x50, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x57, 0x65, 0x62, - 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x2b, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64, - 0x41, 0x6e, 0x64, 0x49, 0x6e, 0x69, 0x74, 0x48, 0x54, 0x54, 0x50, 0x4c, 0x6f, 0x63, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x57, 0x65, 0x62, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x41, 0x6e, 0x64, - 0x49, 0x6e, 0x69, 0x74, 0x48, 0x54, 0x54, 0x50, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x57, 0x65, 0x62, 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, + 0x72, 0x6f, 0x78, 0x79, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x34, 0x2e, 0x70, 0x62, 0x2e, + 0x46, 0x69, 0x6e, 0x64, 0x41, 0x6e, 0x64, 0x49, 0x6e, 0x69, 0x74, 0x48, 0x54, 0x54, 0x50, 0x4c, + 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x50, 0x72, + 0x6f, 0x78, 0x79, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x35, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x41, 0x6e, 0x64, 0x49, 0x6e, 0x69, + 0x74, 0x48, 0x54, 0x54, 0x50, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x76, + 0x65, 0x72, 0x73, 0x65, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x7d, 0x0a, 0x20, 0x66, 0x69, 0x6e, 0x64, 0x41, + 0x6e, 0x64, 0x49, 0x6e, 0x69, 0x74, 0x48, 0x54, 0x54, 0x50, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x57, 0x65, 0x62, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x2b, 0x2e, 0x70, 0x62, + 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x41, 0x6e, 0x64, 0x49, 0x6e, 0x69, 0x74, 0x48, 0x54, 0x54, 0x50, + 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x57, 0x65, 0x62, 0x43, 0x6f, 0x6e, 0x66, 0x69, + 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, + 0x6e, 0x64, 0x41, 0x6e, 0x64, 0x49, 0x6e, 0x69, 0x74, 0x48, 0x54, 0x54, 0x50, 0x4c, 0x6f, 0x63, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x57, 0x65, 0x62, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x61, 0x0a, 0x1e, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x48, 0x54, 0x54, 0x50, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x76, 0x65, + 0x72, 0x73, 0x65, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x12, 0x29, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x48, 0x54, 0x54, 0x50, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x52, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x50, 0x72, 0x6f, 0x78, 0x79, 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 ( @@ -711,7 +780,7 @@ func file_service_http_location_proto_rawDescGZIP() []byte { return file_service_http_location_proto_rawDescData } -var file_service_http_location_proto_msgTypes = make([]protoimpl.MessageInfo, 10) +var file_service_http_location_proto_msgTypes = make([]protoimpl.MessageInfo, 11) var file_service_http_location_proto_goTypes = []interface{}{ (*CreateHTTPLocationRequest)(nil), // 0: pb.CreateHTTPLocationRequest (*CreateHTTPLocationResponse)(nil), // 1: pb.CreateHTTPLocationResponse @@ -723,8 +792,9 @@ var file_service_http_location_proto_goTypes = []interface{}{ (*FindAndInitHTTPLocationReverseProxyConfigResponse)(nil), // 7: pb.FindAndInitHTTPLocationReverseProxyConfigResponse (*FindAndInitHTTPLocationWebConfigRequest)(nil), // 8: pb.FindAndInitHTTPLocationWebConfigRequest (*FindAndInitHTTPLocationWebConfigResponse)(nil), // 9: pb.FindAndInitHTTPLocationWebConfigResponse - (*RPCUpdateSuccess)(nil), // 10: pb.RPCUpdateSuccess - (*RPCDeleteSuccess)(nil), // 11: pb.RPCDeleteSuccess + (*UpdateHTTPLocationReverseProxyRequest)(nil), // 10: pb.UpdateHTTPLocationReverseProxyRequest + (*RPCUpdateSuccess)(nil), // 11: pb.RPCUpdateSuccess + (*RPCDeleteSuccess)(nil), // 12: pb.RPCDeleteSuccess } var file_service_http_location_proto_depIdxs = []int32{ 0, // 0: pb.HTTPLocationService.createHTTPLocation:input_type -> pb.CreateHTTPLocationRequest @@ -733,14 +803,16 @@ var file_service_http_location_proto_depIdxs = []int32{ 5, // 3: pb.HTTPLocationService.deleteHTTPLocation:input_type -> pb.DeleteHTTPLocationRequest 6, // 4: pb.HTTPLocationService.findAndInitHTTPLocationReverseProxyConfig:input_type -> pb.FindAndInitHTTPLocationReverseProxyConfigRequest 8, // 5: pb.HTTPLocationService.findAndInitHTTPLocationWebConfig:input_type -> pb.FindAndInitHTTPLocationWebConfigRequest - 1, // 6: pb.HTTPLocationService.createHTTPLocation:output_type -> pb.CreateHTTPLocationResponse - 10, // 7: pb.HTTPLocationService.updateHTTPLocation:output_type -> pb.RPCUpdateSuccess - 4, // 8: pb.HTTPLocationService.findEnabledHTTPLocationConfig:output_type -> pb.FindEnabledHTTPLocationConfigResponse - 11, // 9: pb.HTTPLocationService.deleteHTTPLocation:output_type -> pb.RPCDeleteSuccess - 7, // 10: pb.HTTPLocationService.findAndInitHTTPLocationReverseProxyConfig:output_type -> pb.FindAndInitHTTPLocationReverseProxyConfigResponse - 9, // 11: pb.HTTPLocationService.findAndInitHTTPLocationWebConfig:output_type -> pb.FindAndInitHTTPLocationWebConfigResponse - 6, // [6:12] is the sub-list for method output_type - 0, // [0:6] is the sub-list for method input_type + 10, // 6: pb.HTTPLocationService.updateHTTPLocationReverseProxy:input_type -> pb.UpdateHTTPLocationReverseProxyRequest + 1, // 7: pb.HTTPLocationService.createHTTPLocation:output_type -> pb.CreateHTTPLocationResponse + 11, // 8: pb.HTTPLocationService.updateHTTPLocation:output_type -> pb.RPCUpdateSuccess + 4, // 9: pb.HTTPLocationService.findEnabledHTTPLocationConfig:output_type -> pb.FindEnabledHTTPLocationConfigResponse + 12, // 10: pb.HTTPLocationService.deleteHTTPLocation:output_type -> pb.RPCDeleteSuccess + 7, // 11: pb.HTTPLocationService.findAndInitHTTPLocationReverseProxyConfig:output_type -> pb.FindAndInitHTTPLocationReverseProxyConfigResponse + 9, // 12: pb.HTTPLocationService.findAndInitHTTPLocationWebConfig:output_type -> pb.FindAndInitHTTPLocationWebConfigResponse + 11, // 13: pb.HTTPLocationService.updateHTTPLocationReverseProxy:output_type -> pb.RPCUpdateSuccess + 7, // [7:14] is the sub-list for method output_type + 0, // [0:7] 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 @@ -873,6 +945,18 @@ func file_service_http_location_proto_init() { return nil } } + file_service_http_location_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateHTTPLocationReverseProxyRequest); 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{ @@ -880,7 +964,7 @@ func file_service_http_location_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_service_http_location_proto_rawDesc, NumEnums: 0, - NumMessages: 10, + NumMessages: 11, NumExtensions: 0, NumServices: 1, }, @@ -918,6 +1002,8 @@ type HTTPLocationServiceClient interface { FindAndInitHTTPLocationReverseProxyConfig(ctx context.Context, in *FindAndInitHTTPLocationReverseProxyConfigRequest, opts ...grpc.CallOption) (*FindAndInitHTTPLocationReverseProxyConfigResponse, error) // 初始化Web设置 FindAndInitHTTPLocationWebConfig(ctx context.Context, in *FindAndInitHTTPLocationWebConfigRequest, opts ...grpc.CallOption) (*FindAndInitHTTPLocationWebConfigResponse, error) + // 修改反向代理设置 + UpdateHTTPLocationReverseProxy(ctx context.Context, in *UpdateHTTPLocationReverseProxyRequest, opts ...grpc.CallOption) (*RPCUpdateSuccess, error) } type hTTPLocationServiceClient struct { @@ -982,6 +1068,15 @@ func (c *hTTPLocationServiceClient) FindAndInitHTTPLocationWebConfig(ctx context return out, nil } +func (c *hTTPLocationServiceClient) UpdateHTTPLocationReverseProxy(ctx context.Context, in *UpdateHTTPLocationReverseProxyRequest, opts ...grpc.CallOption) (*RPCUpdateSuccess, error) { + out := new(RPCUpdateSuccess) + err := c.cc.Invoke(ctx, "/pb.HTTPLocationService/updateHTTPLocationReverseProxy", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // HTTPLocationServiceServer is the server API for HTTPLocationService service. type HTTPLocationServiceServer interface { // 创建路径规则 @@ -996,6 +1091,8 @@ type HTTPLocationServiceServer interface { FindAndInitHTTPLocationReverseProxyConfig(context.Context, *FindAndInitHTTPLocationReverseProxyConfigRequest) (*FindAndInitHTTPLocationReverseProxyConfigResponse, error) // 初始化Web设置 FindAndInitHTTPLocationWebConfig(context.Context, *FindAndInitHTTPLocationWebConfigRequest) (*FindAndInitHTTPLocationWebConfigResponse, error) + // 修改反向代理设置 + UpdateHTTPLocationReverseProxy(context.Context, *UpdateHTTPLocationReverseProxyRequest) (*RPCUpdateSuccess, error) } // UnimplementedHTTPLocationServiceServer can be embedded to have forward compatible implementations. @@ -1020,6 +1117,9 @@ func (*UnimplementedHTTPLocationServiceServer) FindAndInitHTTPLocationReversePro func (*UnimplementedHTTPLocationServiceServer) FindAndInitHTTPLocationWebConfig(context.Context, *FindAndInitHTTPLocationWebConfigRequest) (*FindAndInitHTTPLocationWebConfigResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method FindAndInitHTTPLocationWebConfig not implemented") } +func (*UnimplementedHTTPLocationServiceServer) UpdateHTTPLocationReverseProxy(context.Context, *UpdateHTTPLocationReverseProxyRequest) (*RPCUpdateSuccess, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateHTTPLocationReverseProxy not implemented") +} func RegisterHTTPLocationServiceServer(s *grpc.Server, srv HTTPLocationServiceServer) { s.RegisterService(&_HTTPLocationService_serviceDesc, srv) @@ -1133,6 +1233,24 @@ func _HTTPLocationService_FindAndInitHTTPLocationWebConfig_Handler(srv interface return interceptor(ctx, in, info, handler) } +func _HTTPLocationService_UpdateHTTPLocationReverseProxy_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateHTTPLocationReverseProxyRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(HTTPLocationServiceServer).UpdateHTTPLocationReverseProxy(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.HTTPLocationService/UpdateHTTPLocationReverseProxy", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(HTTPLocationServiceServer).UpdateHTTPLocationReverseProxy(ctx, req.(*UpdateHTTPLocationReverseProxyRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _HTTPLocationService_serviceDesc = grpc.ServiceDesc{ ServiceName: "pb.HTTPLocationService", HandlerType: (*HTTPLocationServiceServer)(nil), @@ -1161,6 +1279,10 @@ var _HTTPLocationService_serviceDesc = grpc.ServiceDesc{ MethodName: "findAndInitHTTPLocationWebConfig", Handler: _HTTPLocationService_FindAndInitHTTPLocationWebConfig_Handler, }, + { + MethodName: "updateHTTPLocationReverseProxy", + Handler: _HTTPLocationService_UpdateHTTPLocationReverseProxy_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "service_http_location.proto", diff --git a/pkg/rpc/protos/service_http_location.proto b/pkg/rpc/protos/service_http_location.proto index f609f82..415af3e 100644 --- a/pkg/rpc/protos/service_http_location.proto +++ b/pkg/rpc/protos/service_http_location.proto @@ -23,6 +23,9 @@ service HTTPLocationService { // 初始化Web设置 rpc findAndInitHTTPLocationWebConfig (FindAndInitHTTPLocationWebConfigRequest) returns (FindAndInitHTTPLocationWebConfigResponse); + + // 修改反向代理设置 + rpc updateHTTPLocationReverseProxy (UpdateHTTPLocationReverseProxyRequest) returns (RPCUpdateSuccess); } // 创建路径规则 @@ -79,4 +82,10 @@ message FindAndInitHTTPLocationWebConfigRequest { message FindAndInitHTTPLocationWebConfigResponse { bytes webJSON = 1; -} \ No newline at end of file +} + +// 修改反向代理设置 +message UpdateHTTPLocationReverseProxyRequest { + int64 locationId = 1; + bytes reverseProxyJSON = 2; +} diff --git a/pkg/serverconfigs/http_location_config.go b/pkg/serverconfigs/http_location_config.go index d5ce354..8f135a2 100644 --- a/pkg/serverconfigs/http_location_config.go +++ b/pkg/serverconfigs/http_location_config.go @@ -1,5 +1,10 @@ package serverconfigs +import ( + "regexp" + "strings" +) + type HTTPLocationConfig struct { Id int64 `yaml:"id" json:"id"` // ID IsOn bool `yaml:"isOn" json:"isOn"` // 是否启用 @@ -12,9 +17,22 @@ type HTTPLocationConfig struct { ReverseProxy *ReverseProxyConfig `yaml:"reverseProxy" json:"reverseProxy"` // 反向代理设置 IsBreak bool `yaml:"isBreak" json:"isBreak"` // 终止向下解析 Children []*HTTPLocationConfig `yaml:"children" json:"children"` // 子规则 + + patternType HTTPLocationPatternType // 规则类型:LocationPattern* + prefix string // 前缀 + path string // 精确的路径 + + reg *regexp.Regexp // 匹配规则 + caseInsensitive bool // 大小写不敏感 + reverse bool // 是否翻转规则,比如非前缀,非路径 } func (this *HTTPLocationConfig) Init() error { + err := this.parsePattern() + if err != nil { + return err + } + if this.Web != nil { err := this.Web.Init() if err != nil { @@ -29,6 +47,14 @@ func (this *HTTPLocationConfig) Init() error { } } + // Children + for _, child := range this.Children { + err := child.Init() + if err != nil { + return err + } + } + return nil } @@ -68,3 +94,118 @@ func (this *HTTPLocationConfig) SetPattern(pattern string, patternType int, case } this.Pattern = pattern } + +// 模式类型 +func (this *HTTPLocationConfig) PatternType() int { + return this.patternType +} + +// 模式字符串 +// 去掉了模式字符 +func (this *HTTPLocationConfig) PatternString() string { + if this.patternType == HTTPLocationPatternTypePrefix { + return this.prefix + } + return this.path +} + +// 是否翻转 +func (this *HTTPLocationConfig) IsReverse() bool { + return this.reverse +} + +// 是否大小写非敏感 +func (this *HTTPLocationConfig) IsCaseInsensitive() bool { + return this.caseInsensitive +} + +// 分析匹配条件 +func (this *HTTPLocationConfig) parsePattern() error { + // 分析pattern + this.reverse = false + this.caseInsensitive = false + if len(this.Pattern) > 0 { + spaceIndex := strings.Index(this.Pattern, " ") + if spaceIndex < 0 { + this.patternType = HTTPLocationPatternTypePrefix + this.prefix = this.Pattern + } else { + cmd := this.Pattern[:spaceIndex] + pattern := strings.TrimSpace(this.Pattern[spaceIndex+1:]) + if cmd == "*" { // 大小写非敏感 + this.patternType = HTTPLocationPatternTypePrefix + this.prefix = pattern + this.caseInsensitive = true + } else if cmd == "!*" { // 大小写非敏感,翻转 + this.patternType = HTTPLocationPatternTypePrefix + this.prefix = pattern + this.caseInsensitive = true + this.reverse = true + } else if cmd == "!" { + this.patternType = HTTPLocationPatternTypePrefix + this.prefix = pattern + this.reverse = true + } else if cmd == "=" { + this.patternType = HTTPLocationPatternTypeExact + this.path = pattern + } else if cmd == "=*" { + this.patternType = HTTPLocationPatternTypeExact + this.path = pattern + this.caseInsensitive = true + } else if cmd == "!=" { + this.patternType = HTTPLocationPatternTypeExact + this.path = pattern + this.reverse = true + } else if cmd == "!=*" { + this.patternType = HTTPLocationPatternTypeExact + this.path = pattern + this.reverse = true + this.caseInsensitive = true + } else if cmd == "~" { // 正则 + this.patternType = HTTPLocationPatternTypeRegexp + reg, err := regexp.Compile(pattern) + if err != nil { + return err + } + this.reg = reg + this.path = pattern + } else if cmd == "!~" { + this.patternType = HTTPLocationPatternTypeRegexp + reg, err := regexp.Compile(pattern) + if err != nil { + return err + } + this.reg = reg + this.reverse = true + this.path = pattern + } else if cmd == "~*" { // 大小写非敏感小写 + this.patternType = HTTPLocationPatternTypeRegexp + reg, err := regexp.Compile("(?i)" + pattern) + if err != nil { + return err + } + this.reg = reg + this.caseInsensitive = true + this.path = pattern + } else if cmd == "!~*" { + this.patternType = HTTPLocationPatternTypeRegexp + reg, err := regexp.Compile("(?i)" + pattern) + if err != nil { + return err + } + this.reg = reg + this.reverse = true + this.caseInsensitive = true + this.path = pattern + } else { + this.patternType = HTTPLocationPatternTypePrefix + this.prefix = pattern + } + } + } else { + this.patternType = HTTPLocationPatternTypePrefix + this.prefix = this.Pattern + } + + return nil +}