2 changed files with 797 additions and 0 deletions
			
			
		@ -0,0 +1,654 @@ | 
				
			|||||
 | 
					// 指定使用 proto3 语法。
 | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					// Code generated by protoc-gen-go. DO NOT EDIT.
 | 
				
			||||
 | 
					// versions:
 | 
				
			||||
 | 
					// 	protoc-gen-go v1.28.1
 | 
				
			||||
 | 
					// 	protoc        v6.33.0
 | 
				
			||||
 | 
					// source: proto/relay.proto
 | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					// 定义包名。在 Go 中,这会影响生成的代码所在的目录结构和包声明。
 | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					package proto | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					import ( | 
				
			||||
 | 
						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) | 
				
			||||
 | 
					) | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					// ProxyRequestMessage 是从“代理实例”(接收App请求的实例)
 | 
				
			||||
 | 
					// 发送到“目标实例”(持有设备连接的实例)的消息。
 | 
				
			||||
 | 
					//
 | 
				
			||||
 | 
					// 使用 `oneof` 结构可以确保每个消息要么是请求头,要么是请求体的一部分,
 | 
				
			||||
 | 
					// 这使得在接收端处理消息时逻辑更清晰、更安全。
 | 
				
			||||
 | 
					type ProxyRequestMessage struct { | 
				
			||||
 | 
						state         protoimpl.MessageState | 
				
			||||
 | 
						sizeCache     protoimpl.SizeCache | 
				
			||||
 | 
						unknownFields protoimpl.UnknownFields | 
				
			||||
 | 
					
 | 
				
			||||
 | 
						// Types that are assignable to Payload:
 | 
				
			||||
 | 
						//
 | 
				
			||||
 | 
						//	*ProxyRequestMessage_Header
 | 
				
			||||
 | 
						//	*ProxyRequestMessage_BodyChunk
 | 
				
			||||
 | 
						Payload isProxyRequestMessage_Payload `protobuf_oneof:"payload"` | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					func (x *ProxyRequestMessage) Reset() { | 
				
			||||
 | 
						*x = ProxyRequestMessage{} | 
				
			||||
 | 
						if protoimpl.UnsafeEnabled { | 
				
			||||
 | 
							mi := &file_proto_relay_proto_msgTypes[0] | 
				
			||||
 | 
							ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | 
				
			||||
 | 
							ms.StoreMessageInfo(mi) | 
				
			||||
 | 
						} | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					func (x *ProxyRequestMessage) String() string { | 
				
			||||
 | 
						return protoimpl.X.MessageStringOf(x) | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					func (*ProxyRequestMessage) ProtoMessage() {} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					func (x *ProxyRequestMessage) ProtoReflect() protoreflect.Message { | 
				
			||||
 | 
						mi := &file_proto_relay_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 ProxyRequestMessage.ProtoReflect.Descriptor instead.
 | 
				
			||||
 | 
					func (*ProxyRequestMessage) Descriptor() ([]byte, []int) { | 
				
			||||
 | 
						return file_proto_relay_proto_rawDescGZIP(), []int{0} | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					func (m *ProxyRequestMessage) GetPayload() isProxyRequestMessage_Payload { | 
				
			||||
 | 
						if m != nil { | 
				
			||||
 | 
							return m.Payload | 
				
			||||
 | 
						} | 
				
			||||
 | 
						return nil | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					func (x *ProxyRequestMessage) GetHeader() *ProxyRequestHeader { | 
				
			||||
 | 
						if x, ok := x.GetPayload().(*ProxyRequestMessage_Header); ok { | 
				
			||||
 | 
							return x.Header | 
				
			||||
 | 
						} | 
				
			||||
 | 
						return nil | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					func (x *ProxyRequestMessage) GetBodyChunk() *ProxyRequestBodyChunk { | 
				
			||||
 | 
						if x, ok := x.GetPayload().(*ProxyRequestMessage_BodyChunk); ok { | 
				
			||||
 | 
							return x.BodyChunk | 
				
			||||
 | 
						} | 
				
			||||
 | 
						return nil | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					type isProxyRequestMessage_Payload interface { | 
				
			||||
 | 
						isProxyRequestMessage_Payload() | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					type ProxyRequestMessage_Header struct { | 
				
			||||
 | 
						Header *ProxyRequestHeader `protobuf:"bytes,1,opt,name=header,proto3,oneof"` | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					type ProxyRequestMessage_BodyChunk struct { | 
				
			||||
 | 
						BodyChunk *ProxyRequestBodyChunk `protobuf:"bytes,2,opt,name=body_chunk,json=bodyChunk,proto3,oneof"` | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					func (*ProxyRequestMessage_Header) isProxyRequestMessage_Payload() {} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					func (*ProxyRequestMessage_BodyChunk) isProxyRequestMessage_Payload() {} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					// ProxyRequestHeader 包含了重建原始 HTTP 请求所需的所有元数据。
 | 
				
			||||
 | 
					// 这个消息必须是客户端发送的第一个消息。
 | 
				
			||||
 | 
					type ProxyRequestHeader struct { | 
				
			||||
 | 
						state         protoimpl.MessageState | 
				
			||||
 | 
						sizeCache     protoimpl.SizeCache | 
				
			||||
 | 
						unknownFields protoimpl.UnknownFields | 
				
			||||
 | 
					
 | 
				
			||||
 | 
						// HTTP 方法, 例如 "GET", "POST", "PUT" 等。
 | 
				
			||||
 | 
						Method string `protobuf:"bytes,1,opt,name=method,proto3" json:"method,omitempty"` | 
				
			||||
 | 
						// 完整的请求 URL 路径,包括查询参数。
 | 
				
			||||
 | 
						// 例如 "/tunnel/DEVICE_SN_123/api/album?page=1&size=10"
 | 
				
			||||
 | 
						Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"` | 
				
			||||
 | 
						// 原始的 HTTP 请求头。
 | 
				
			||||
 | 
						// `map` 类型非常适合用来表示键值对集合。
 | 
				
			||||
 | 
						Headers map[string]string `protobuf:"bytes,3,rep,name=headers,proto3" json:"headers,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` | 
				
			||||
 | 
						// 原始 App 客户端的 IP 地址和端口,用于日志记录或 X-Forwarded-For 头。
 | 
				
			||||
 | 
						RemoteAddr string `protobuf:"bytes,4,opt,name=remote_addr,json=remoteAddr,proto3" json:"remote_addr,omitempty"` | 
				
			||||
 | 
						// 经过认证的 App 用户的 ID,用于在目标实例上进行授权检查。
 | 
				
			||||
 | 
						AppUserId string `protobuf:"bytes,5,opt,name=app_user_id,json=appUserId,proto3" json:"app_user_id,omitempty"` | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					func (x *ProxyRequestHeader) Reset() { | 
				
			||||
 | 
						*x = ProxyRequestHeader{} | 
				
			||||
 | 
						if protoimpl.UnsafeEnabled { | 
				
			||||
 | 
							mi := &file_proto_relay_proto_msgTypes[1] | 
				
			||||
 | 
							ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | 
				
			||||
 | 
							ms.StoreMessageInfo(mi) | 
				
			||||
 | 
						} | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					func (x *ProxyRequestHeader) String() string { | 
				
			||||
 | 
						return protoimpl.X.MessageStringOf(x) | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					func (*ProxyRequestHeader) ProtoMessage() {} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					func (x *ProxyRequestHeader) ProtoReflect() protoreflect.Message { | 
				
			||||
 | 
						mi := &file_proto_relay_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 ProxyRequestHeader.ProtoReflect.Descriptor instead.
 | 
				
			||||
 | 
					func (*ProxyRequestHeader) Descriptor() ([]byte, []int) { | 
				
			||||
 | 
						return file_proto_relay_proto_rawDescGZIP(), []int{1} | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					func (x *ProxyRequestHeader) GetMethod() string { | 
				
			||||
 | 
						if x != nil { | 
				
			||||
 | 
							return x.Method | 
				
			||||
 | 
						} | 
				
			||||
 | 
						return "" | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					func (x *ProxyRequestHeader) GetUrl() string { | 
				
			||||
 | 
						if x != nil { | 
				
			||||
 | 
							return x.Url | 
				
			||||
 | 
						} | 
				
			||||
 | 
						return "" | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					func (x *ProxyRequestHeader) GetHeaders() map[string]string { | 
				
			||||
 | 
						if x != nil { | 
				
			||||
 | 
							return x.Headers | 
				
			||||
 | 
						} | 
				
			||||
 | 
						return nil | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					func (x *ProxyRequestHeader) GetRemoteAddr() string { | 
				
			||||
 | 
						if x != nil { | 
				
			||||
 | 
							return x.RemoteAddr | 
				
			||||
 | 
						} | 
				
			||||
 | 
						return "" | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					func (x *ProxyRequestHeader) GetAppUserId() string { | 
				
			||||
 | 
						if x != nil { | 
				
			||||
 | 
							return x.AppUserId | 
				
			||||
 | 
						} | 
				
			||||
 | 
						return "" | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					// ProxyRequestBodyChunk 包含了一小块 HTTP 请求体的数据。
 | 
				
			||||
 | 
					// 通过将请求体分割成多个 chunk 进行流式传输,
 | 
				
			||||
 | 
					// 我们可以处理任意大小的上传文件,而不会耗尽服务器内存。
 | 
				
			||||
 | 
					type ProxyRequestBodyChunk struct { | 
				
			||||
 | 
						state         protoimpl.MessageState | 
				
			||||
 | 
						sizeCache     protoimpl.SizeCache | 
				
			||||
 | 
						unknownFields protoimpl.UnknownFields | 
				
			||||
 | 
					
 | 
				
			||||
 | 
						Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					func (x *ProxyRequestBodyChunk) Reset() { | 
				
			||||
 | 
						*x = ProxyRequestBodyChunk{} | 
				
			||||
 | 
						if protoimpl.UnsafeEnabled { | 
				
			||||
 | 
							mi := &file_proto_relay_proto_msgTypes[2] | 
				
			||||
 | 
							ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | 
				
			||||
 | 
							ms.StoreMessageInfo(mi) | 
				
			||||
 | 
						} | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					func (x *ProxyRequestBodyChunk) String() string { | 
				
			||||
 | 
						return protoimpl.X.MessageStringOf(x) | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					func (*ProxyRequestBodyChunk) ProtoMessage() {} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					func (x *ProxyRequestBodyChunk) ProtoReflect() protoreflect.Message { | 
				
			||||
 | 
						mi := &file_proto_relay_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 ProxyRequestBodyChunk.ProtoReflect.Descriptor instead.
 | 
				
			||||
 | 
					func (*ProxyRequestBodyChunk) Descriptor() ([]byte, []int) { | 
				
			||||
 | 
						return file_proto_relay_proto_rawDescGZIP(), []int{2} | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					func (x *ProxyRequestBodyChunk) GetData() []byte { | 
				
			||||
 | 
						if x != nil { | 
				
			||||
 | 
							return x.Data | 
				
			||||
 | 
						} | 
				
			||||
 | 
						return nil | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					// ProxyResponseMessage 是从“目标实例”发送回“代理实例”的消息。
 | 
				
			||||
 | 
					// 同样使用 `oneof` 来区分响应头和响应体。
 | 
				
			||||
 | 
					type ProxyResponseMessage struct { | 
				
			||||
 | 
						state         protoimpl.MessageState | 
				
			||||
 | 
						sizeCache     protoimpl.SizeCache | 
				
			||||
 | 
						unknownFields protoimpl.UnknownFields | 
				
			||||
 | 
					
 | 
				
			||||
 | 
						// Types that are assignable to Payload:
 | 
				
			||||
 | 
						//
 | 
				
			||||
 | 
						//	*ProxyResponseMessage_Header
 | 
				
			||||
 | 
						//	*ProxyResponseMessage_BodyChunk
 | 
				
			||||
 | 
						Payload isProxyResponseMessage_Payload `protobuf_oneof:"payload"` | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					func (x *ProxyResponseMessage) Reset() { | 
				
			||||
 | 
						*x = ProxyResponseMessage{} | 
				
			||||
 | 
						if protoimpl.UnsafeEnabled { | 
				
			||||
 | 
							mi := &file_proto_relay_proto_msgTypes[3] | 
				
			||||
 | 
							ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | 
				
			||||
 | 
							ms.StoreMessageInfo(mi) | 
				
			||||
 | 
						} | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					func (x *ProxyResponseMessage) String() string { | 
				
			||||
 | 
						return protoimpl.X.MessageStringOf(x) | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					func (*ProxyResponseMessage) ProtoMessage() {} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					func (x *ProxyResponseMessage) ProtoReflect() protoreflect.Message { | 
				
			||||
 | 
						mi := &file_proto_relay_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 ProxyResponseMessage.ProtoReflect.Descriptor instead.
 | 
				
			||||
 | 
					func (*ProxyResponseMessage) Descriptor() ([]byte, []int) { | 
				
			||||
 | 
						return file_proto_relay_proto_rawDescGZIP(), []int{3} | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					func (m *ProxyResponseMessage) GetPayload() isProxyResponseMessage_Payload { | 
				
			||||
 | 
						if m != nil { | 
				
			||||
 | 
							return m.Payload | 
				
			||||
 | 
						} | 
				
			||||
 | 
						return nil | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					func (x *ProxyResponseMessage) GetHeader() *ProxyResponseHeader { | 
				
			||||
 | 
						if x, ok := x.GetPayload().(*ProxyResponseMessage_Header); ok { | 
				
			||||
 | 
							return x.Header | 
				
			||||
 | 
						} | 
				
			||||
 | 
						return nil | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					func (x *ProxyResponseMessage) GetBodyChunk() *ProxyResponseBodyChunk { | 
				
			||||
 | 
						if x, ok := x.GetPayload().(*ProxyResponseMessage_BodyChunk); ok { | 
				
			||||
 | 
							return x.BodyChunk | 
				
			||||
 | 
						} | 
				
			||||
 | 
						return nil | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					type isProxyResponseMessage_Payload interface { | 
				
			||||
 | 
						isProxyResponseMessage_Payload() | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					type ProxyResponseMessage_Header struct { | 
				
			||||
 | 
						Header *ProxyResponseHeader `protobuf:"bytes,1,opt,name=header,proto3,oneof"` | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					type ProxyResponseMessage_BodyChunk struct { | 
				
			||||
 | 
						BodyChunk *ProxyResponseBodyChunk `protobuf:"bytes,2,opt,name=body_chunk,json=bodyChunk,proto3,oneof"` | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					func (*ProxyResponseMessage_Header) isProxyResponseMessage_Payload() {} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					func (*ProxyResponseMessage_BodyChunk) isProxyResponseMessage_Payload() {} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					// ProxyResponseHeader 包含了 HTTP 响应的元数据。
 | 
				
			||||
 | 
					// 这个消息必须是服务器端在流中发送的第一个消息。
 | 
				
			||||
 | 
					type ProxyResponseHeader struct { | 
				
			||||
 | 
						state         protoimpl.MessageState | 
				
			||||
 | 
						sizeCache     protoimpl.SizeCache | 
				
			||||
 | 
						unknownFields protoimpl.UnknownFields | 
				
			||||
 | 
					
 | 
				
			||||
 | 
						// HTTP 状态码, 例如 200, 404, 500。
 | 
				
			||||
 | 
						StatusCode int32 `protobuf:"varint,1,opt,name=status_code,json=statusCode,proto3" json:"status_code,omitempty"` | 
				
			||||
 | 
						// HTTP 响应头。
 | 
				
			||||
 | 
						Headers map[string]string `protobuf:"bytes,2,rep,name=headers,proto3" json:"headers,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					func (x *ProxyResponseHeader) Reset() { | 
				
			||||
 | 
						*x = ProxyResponseHeader{} | 
				
			||||
 | 
						if protoimpl.UnsafeEnabled { | 
				
			||||
 | 
							mi := &file_proto_relay_proto_msgTypes[4] | 
				
			||||
 | 
							ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | 
				
			||||
 | 
							ms.StoreMessageInfo(mi) | 
				
			||||
 | 
						} | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					func (x *ProxyResponseHeader) String() string { | 
				
			||||
 | 
						return protoimpl.X.MessageStringOf(x) | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					func (*ProxyResponseHeader) ProtoMessage() {} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					func (x *ProxyResponseHeader) ProtoReflect() protoreflect.Message { | 
				
			||||
 | 
						mi := &file_proto_relay_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 ProxyResponseHeader.ProtoReflect.Descriptor instead.
 | 
				
			||||
 | 
					func (*ProxyResponseHeader) Descriptor() ([]byte, []int) { | 
				
			||||
 | 
						return file_proto_relay_proto_rawDescGZIP(), []int{4} | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					func (x *ProxyResponseHeader) GetStatusCode() int32 { | 
				
			||||
 | 
						if x != nil { | 
				
			||||
 | 
							return x.StatusCode | 
				
			||||
 | 
						} | 
				
			||||
 | 
						return 0 | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					func (x *ProxyResponseHeader) GetHeaders() map[string]string { | 
				
			||||
 | 
						if x != nil { | 
				
			||||
 | 
							return x.Headers | 
				
			||||
 | 
						} | 
				
			||||
 | 
						return nil | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					// ProxyResponseBodyChunk 包含了一小块 HTTP 响应体的数据。
 | 
				
			||||
 | 
					// 这使得视频播放、大文件下载等场景可以实现流式传输,
 | 
				
			||||
 | 
					// App 客户端可以边接收数据边处理,而无需等待整个文件下载完成。
 | 
				
			||||
 | 
					type ProxyResponseBodyChunk struct { | 
				
			||||
 | 
						state         protoimpl.MessageState | 
				
			||||
 | 
						sizeCache     protoimpl.SizeCache | 
				
			||||
 | 
						unknownFields protoimpl.UnknownFields | 
				
			||||
 | 
					
 | 
				
			||||
 | 
						Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					func (x *ProxyResponseBodyChunk) Reset() { | 
				
			||||
 | 
						*x = ProxyResponseBodyChunk{} | 
				
			||||
 | 
						if protoimpl.UnsafeEnabled { | 
				
			||||
 | 
							mi := &file_proto_relay_proto_msgTypes[5] | 
				
			||||
 | 
							ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | 
				
			||||
 | 
							ms.StoreMessageInfo(mi) | 
				
			||||
 | 
						} | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					func (x *ProxyResponseBodyChunk) String() string { | 
				
			||||
 | 
						return protoimpl.X.MessageStringOf(x) | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					func (*ProxyResponseBodyChunk) ProtoMessage() {} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					func (x *ProxyResponseBodyChunk) ProtoReflect() protoreflect.Message { | 
				
			||||
 | 
						mi := &file_proto_relay_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 ProxyResponseBodyChunk.ProtoReflect.Descriptor instead.
 | 
				
			||||
 | 
					func (*ProxyResponseBodyChunk) Descriptor() ([]byte, []int) { | 
				
			||||
 | 
						return file_proto_relay_proto_rawDescGZIP(), []int{5} | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					func (x *ProxyResponseBodyChunk) GetData() []byte { | 
				
			||||
 | 
						if x != nil { | 
				
			||||
 | 
							return x.Data | 
				
			||||
 | 
						} | 
				
			||||
 | 
						return nil | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					var File_proto_relay_proto protoreflect.FileDescriptor | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					var file_proto_relay_proto_rawDesc = []byte{ | 
				
			||||
 | 
						0x0a, 0x11, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x2e, 0x70, 0x72, | 
				
			||||
 | 
						0x6f, 0x74, 0x6f, 0x12, 0x05, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x22, 0x94, 0x01, 0x0a, 0x13, 0x50, | 
				
			||||
 | 
						0x72, 0x6f, 0x78, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, | 
				
			||||
 | 
						0x67, 0x65, 0x12, 0x33, 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, | 
				
			||||
 | 
						0x28, 0x0b, 0x32, 0x19, 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x2e, 0x50, 0x72, 0x6f, 0x78, 0x79, | 
				
			||||
 | 
						0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x48, 0x00, 0x52, | 
				
			||||
 | 
						0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x3d, 0x0a, 0x0a, 0x62, 0x6f, 0x64, 0x79, 0x5f, | 
				
			||||
 | 
						0x63, 0x68, 0x75, 0x6e, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x72, 0x65, | 
				
			||||
 | 
						0x6c, 0x61, 0x79, 0x2e, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, | 
				
			||||
 | 
						0x42, 0x6f, 0x64, 0x79, 0x43, 0x68, 0x75, 0x6e, 0x6b, 0x48, 0x00, 0x52, 0x09, 0x62, 0x6f, 0x64, | 
				
			||||
 | 
						0x79, 0x43, 0x68, 0x75, 0x6e, 0x6b, 0x42, 0x09, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, | 
				
			||||
 | 
						0x64, 0x22, 0xfd, 0x01, 0x0a, 0x12, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, | 
				
			||||
 | 
						0x73, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x6d, 0x65, 0x74, 0x68, | 
				
			||||
 | 
						0x6f, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, | 
				
			||||
 | 
						0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, | 
				
			||||
 | 
						0x72, 0x6c, 0x12, 0x40, 0x0a, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, | 
				
			||||
 | 
						0x03, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x2e, 0x50, 0x72, 0x6f, 0x78, | 
				
			||||
 | 
						0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x2e, 0x48, | 
				
			||||
 | 
						0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, 0x68, 0x65, 0x61, | 
				
			||||
 | 
						0x64, 0x65, 0x72, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x5f, 0x61, | 
				
			||||
 | 
						0x64, 0x64, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x72, 0x65, 0x6d, 0x6f, 0x74, | 
				
			||||
 | 
						0x65, 0x41, 0x64, 0x64, 0x72, 0x12, 0x1e, 0x0a, 0x0b, 0x61, 0x70, 0x70, 0x5f, 0x75, 0x73, 0x65, | 
				
			||||
 | 
						0x72, 0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x70, 0x70, 0x55, | 
				
			||||
 | 
						0x73, 0x65, 0x72, 0x49, 0x64, 0x1a, 0x3a, 0x0a, 0x0c, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, | 
				
			||||
 | 
						0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, | 
				
			||||
 | 
						0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, | 
				
			||||
 | 
						0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, | 
				
			||||
 | 
						0x01, 0x22, 0x2b, 0x0a, 0x15, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, | 
				
			||||
 | 
						0x74, 0x42, 0x6f, 0x64, 0x79, 0x43, 0x68, 0x75, 0x6e, 0x6b, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, | 
				
			||||
 | 
						0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x97, | 
				
			||||
 | 
						0x01, 0x0a, 0x14, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, | 
				
			||||
 | 
						0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x34, 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, | 
				
			||||
 | 
						0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x2e, | 
				
			||||
 | 
						0x50, 0x72, 0x6f, 0x78, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x65, 0x61, | 
				
			||||
 | 
						0x64, 0x65, 0x72, 0x48, 0x00, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x3e, 0x0a, | 
				
			||||
 | 
						0x0a, 0x62, 0x6f, 0x64, 0x79, 0x5f, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, | 
				
			||||
 | 
						0x0b, 0x32, 0x1d, 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x2e, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x52, | 
				
			||||
 | 
						0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x6f, 0x64, 0x79, 0x43, 0x68, 0x75, 0x6e, 0x6b, | 
				
			||||
 | 
						0x48, 0x00, 0x52, 0x09, 0x62, 0x6f, 0x64, 0x79, 0x43, 0x68, 0x75, 0x6e, 0x6b, 0x42, 0x09, 0x0a, | 
				
			||||
 | 
						0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x22, 0xb5, 0x01, 0x0a, 0x13, 0x50, 0x72, 0x6f, | 
				
			||||
 | 
						0x78, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, | 
				
			||||
 | 
						0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, | 
				
			||||
 | 
						0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x43, 0x6f, 0x64, | 
				
			||||
 | 
						0x65, 0x12, 0x41, 0x0a, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x02, 0x20, 0x03, | 
				
			||||
 | 
						0x28, 0x0b, 0x32, 0x27, 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x2e, 0x50, 0x72, 0x6f, 0x78, 0x79, | 
				
			||||
 | 
						0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x2e, 0x48, | 
				
			||||
 | 
						0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, 0x68, 0x65, 0x61, | 
				
			||||
 | 
						0x64, 0x65, 0x72, 0x73, 0x1a, 0x3a, 0x0a, 0x0c, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x45, | 
				
			||||
 | 
						0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, | 
				
			||||
 | 
						0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, | 
				
			||||
 | 
						0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, | 
				
			||||
 | 
						0x22, 0x2c, 0x0a, 0x16, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, | 
				
			||||
 | 
						0x65, 0x42, 0x6f, 0x64, 0x79, 0x43, 0x68, 0x75, 0x6e, 0x6b, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, | 
				
			||||
 | 
						0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x32, 0x5c, | 
				
			||||
 | 
						0x0a, 0x0d, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x52, 0x65, 0x6c, 0x61, 0x79, 0x12, | 
				
			||||
 | 
						0x4b, 0x0a, 0x0c, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, | 
				
			||||
 | 
						0x1a, 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x2e, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x52, 0x65, 0x71, | 
				
			||||
 | 
						0x75, 0x65, 0x73, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x1a, 0x1b, 0x2e, 0x72, 0x65, | 
				
			||||
 | 
						0x6c, 0x61, 0x79, 0x2e, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, | 
				
			||||
 | 
						0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x28, 0x01, 0x30, 0x01, 0x42, 0x14, 0x5a, 0x12, | 
				
			||||
 | 
						0x72, 0x65, 0x6c, 0x61, 0x79, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x70, 0x72, 0x6f, | 
				
			||||
 | 
						0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					var ( | 
				
			||||
 | 
						file_proto_relay_proto_rawDescOnce sync.Once | 
				
			||||
 | 
						file_proto_relay_proto_rawDescData = file_proto_relay_proto_rawDesc | 
				
			||||
 | 
					) | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					func file_proto_relay_proto_rawDescGZIP() []byte { | 
				
			||||
 | 
						file_proto_relay_proto_rawDescOnce.Do(func() { | 
				
			||||
 | 
							file_proto_relay_proto_rawDescData = protoimpl.X.CompressGZIP(file_proto_relay_proto_rawDescData) | 
				
			||||
 | 
						}) | 
				
			||||
 | 
						return file_proto_relay_proto_rawDescData | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					var file_proto_relay_proto_msgTypes = make([]protoimpl.MessageInfo, 8) | 
				
			||||
 | 
					var file_proto_relay_proto_goTypes = []interface{}{ | 
				
			||||
 | 
						(*ProxyRequestMessage)(nil),    // 0: relay.ProxyRequestMessage
 | 
				
			||||
 | 
						(*ProxyRequestHeader)(nil),     // 1: relay.ProxyRequestHeader
 | 
				
			||||
 | 
						(*ProxyRequestBodyChunk)(nil),  // 2: relay.ProxyRequestBodyChunk
 | 
				
			||||
 | 
						(*ProxyResponseMessage)(nil),   // 3: relay.ProxyResponseMessage
 | 
				
			||||
 | 
						(*ProxyResponseHeader)(nil),    // 4: relay.ProxyResponseHeader
 | 
				
			||||
 | 
						(*ProxyResponseBodyChunk)(nil), // 5: relay.ProxyResponseBodyChunk
 | 
				
			||||
 | 
						nil,                            // 6: relay.ProxyRequestHeader.HeadersEntry
 | 
				
			||||
 | 
						nil,                            // 7: relay.ProxyResponseHeader.HeadersEntry
 | 
				
			||||
 | 
					} | 
				
			||||
 | 
					var file_proto_relay_proto_depIdxs = []int32{ | 
				
			||||
 | 
						1, // 0: relay.ProxyRequestMessage.header:type_name -> relay.ProxyRequestHeader
 | 
				
			||||
 | 
						2, // 1: relay.ProxyRequestMessage.body_chunk:type_name -> relay.ProxyRequestBodyChunk
 | 
				
			||||
 | 
						6, // 2: relay.ProxyRequestHeader.headers:type_name -> relay.ProxyRequestHeader.HeadersEntry
 | 
				
			||||
 | 
						4, // 3: relay.ProxyResponseMessage.header:type_name -> relay.ProxyResponseHeader
 | 
				
			||||
 | 
						5, // 4: relay.ProxyResponseMessage.body_chunk:type_name -> relay.ProxyResponseBodyChunk
 | 
				
			||||
 | 
						7, // 5: relay.ProxyResponseHeader.headers:type_name -> relay.ProxyResponseHeader.HeadersEntry
 | 
				
			||||
 | 
						0, // 6: relay.InternalRelay.ProxyRequest:input_type -> relay.ProxyRequestMessage
 | 
				
			||||
 | 
						3, // 7: relay.InternalRelay.ProxyRequest:output_type -> relay.ProxyResponseMessage
 | 
				
			||||
 | 
						7, // [7:8] is the sub-list for method output_type
 | 
				
			||||
 | 
						6, // [6:7] is the sub-list for method input_type
 | 
				
			||||
 | 
						6, // [6:6] is the sub-list for extension type_name
 | 
				
			||||
 | 
						6, // [6:6] is the sub-list for extension extendee
 | 
				
			||||
 | 
						0, // [0:6] is the sub-list for field type_name
 | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					func init() { file_proto_relay_proto_init() } | 
				
			||||
 | 
					func file_proto_relay_proto_init() { | 
				
			||||
 | 
						if File_proto_relay_proto != nil { | 
				
			||||
 | 
							return | 
				
			||||
 | 
						} | 
				
			||||
 | 
						if !protoimpl.UnsafeEnabled { | 
				
			||||
 | 
							file_proto_relay_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { | 
				
			||||
 | 
								switch v := v.(*ProxyRequestMessage); i { | 
				
			||||
 | 
								case 0: | 
				
			||||
 | 
									return &v.state | 
				
			||||
 | 
								case 1: | 
				
			||||
 | 
									return &v.sizeCache | 
				
			||||
 | 
								case 2: | 
				
			||||
 | 
									return &v.unknownFields | 
				
			||||
 | 
								default: | 
				
			||||
 | 
									return nil | 
				
			||||
 | 
								} | 
				
			||||
 | 
							} | 
				
			||||
 | 
							file_proto_relay_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { | 
				
			||||
 | 
								switch v := v.(*ProxyRequestHeader); i { | 
				
			||||
 | 
								case 0: | 
				
			||||
 | 
									return &v.state | 
				
			||||
 | 
								case 1: | 
				
			||||
 | 
									return &v.sizeCache | 
				
			||||
 | 
								case 2: | 
				
			||||
 | 
									return &v.unknownFields | 
				
			||||
 | 
								default: | 
				
			||||
 | 
									return nil | 
				
			||||
 | 
								} | 
				
			||||
 | 
							} | 
				
			||||
 | 
							file_proto_relay_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { | 
				
			||||
 | 
								switch v := v.(*ProxyRequestBodyChunk); i { | 
				
			||||
 | 
								case 0: | 
				
			||||
 | 
									return &v.state | 
				
			||||
 | 
								case 1: | 
				
			||||
 | 
									return &v.sizeCache | 
				
			||||
 | 
								case 2: | 
				
			||||
 | 
									return &v.unknownFields | 
				
			||||
 | 
								default: | 
				
			||||
 | 
									return nil | 
				
			||||
 | 
								} | 
				
			||||
 | 
							} | 
				
			||||
 | 
							file_proto_relay_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { | 
				
			||||
 | 
								switch v := v.(*ProxyResponseMessage); i { | 
				
			||||
 | 
								case 0: | 
				
			||||
 | 
									return &v.state | 
				
			||||
 | 
								case 1: | 
				
			||||
 | 
									return &v.sizeCache | 
				
			||||
 | 
								case 2: | 
				
			||||
 | 
									return &v.unknownFields | 
				
			||||
 | 
								default: | 
				
			||||
 | 
									return nil | 
				
			||||
 | 
								} | 
				
			||||
 | 
							} | 
				
			||||
 | 
							file_proto_relay_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { | 
				
			||||
 | 
								switch v := v.(*ProxyResponseHeader); i { | 
				
			||||
 | 
								case 0: | 
				
			||||
 | 
									return &v.state | 
				
			||||
 | 
								case 1: | 
				
			||||
 | 
									return &v.sizeCache | 
				
			||||
 | 
								case 2: | 
				
			||||
 | 
									return &v.unknownFields | 
				
			||||
 | 
								default: | 
				
			||||
 | 
									return nil | 
				
			||||
 | 
								} | 
				
			||||
 | 
							} | 
				
			||||
 | 
							file_proto_relay_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { | 
				
			||||
 | 
								switch v := v.(*ProxyResponseBodyChunk); i { | 
				
			||||
 | 
								case 0: | 
				
			||||
 | 
									return &v.state | 
				
			||||
 | 
								case 1: | 
				
			||||
 | 
									return &v.sizeCache | 
				
			||||
 | 
								case 2: | 
				
			||||
 | 
									return &v.unknownFields | 
				
			||||
 | 
								default: | 
				
			||||
 | 
									return nil | 
				
			||||
 | 
								} | 
				
			||||
 | 
							} | 
				
			||||
 | 
						} | 
				
			||||
 | 
						file_proto_relay_proto_msgTypes[0].OneofWrappers = []interface{}{ | 
				
			||||
 | 
							(*ProxyRequestMessage_Header)(nil), | 
				
			||||
 | 
							(*ProxyRequestMessage_BodyChunk)(nil), | 
				
			||||
 | 
						} | 
				
			||||
 | 
						file_proto_relay_proto_msgTypes[3].OneofWrappers = []interface{}{ | 
				
			||||
 | 
							(*ProxyResponseMessage_Header)(nil), | 
				
			||||
 | 
							(*ProxyResponseMessage_BodyChunk)(nil), | 
				
			||||
 | 
						} | 
				
			||||
 | 
						type x struct{} | 
				
			||||
 | 
						out := protoimpl.TypeBuilder{ | 
				
			||||
 | 
							File: protoimpl.DescBuilder{ | 
				
			||||
 | 
								GoPackagePath: reflect.TypeOf(x{}).PkgPath(), | 
				
			||||
 | 
								RawDescriptor: file_proto_relay_proto_rawDesc, | 
				
			||||
 | 
								NumEnums:      0, | 
				
			||||
 | 
								NumMessages:   8, | 
				
			||||
 | 
								NumExtensions: 0, | 
				
			||||
 | 
								NumServices:   1, | 
				
			||||
 | 
							}, | 
				
			||||
 | 
							GoTypes:           file_proto_relay_proto_goTypes, | 
				
			||||
 | 
							DependencyIndexes: file_proto_relay_proto_depIdxs, | 
				
			||||
 | 
							MessageInfos:      file_proto_relay_proto_msgTypes, | 
				
			||||
 | 
						}.Build() | 
				
			||||
 | 
						File_proto_relay_proto = out.File | 
				
			||||
 | 
						file_proto_relay_proto_rawDesc = nil | 
				
			||||
 | 
						file_proto_relay_proto_goTypes = nil | 
				
			||||
 | 
						file_proto_relay_proto_depIdxs = nil | 
				
			||||
 | 
					} | 
				
			||||
@ -0,0 +1,143 @@ | 
				
			|||||
 | 
					// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
 | 
				
			||||
 | 
					// versions:
 | 
				
			||||
 | 
					// - protoc-gen-go-grpc v1.2.0
 | 
				
			||||
 | 
					// - protoc             v6.33.0
 | 
				
			||||
 | 
					// source: proto/relay.proto
 | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					package proto | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					import ( | 
				
			||||
 | 
						context "context" | 
				
			||||
 | 
						grpc "google.golang.org/grpc" | 
				
			||||
 | 
						codes "google.golang.org/grpc/codes" | 
				
			||||
 | 
						status "google.golang.org/grpc/status" | 
				
			||||
 | 
					) | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					// This is a compile-time assertion to ensure that this generated file
 | 
				
			||||
 | 
					// is compatible with the grpc package it is being compiled against.
 | 
				
			||||
 | 
					// Requires gRPC-Go v1.32.0 or later.
 | 
				
			||||
 | 
					const _ = grpc.SupportPackageIsVersion7 | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					// InternalRelayClient is the client API for InternalRelay service.
 | 
				
			||||
 | 
					//
 | 
				
			||||
 | 
					// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
 | 
				
			||||
 | 
					type InternalRelayClient interface { | 
				
			||||
 | 
						// ProxyRequest 是一个双向流式 RPC。
 | 
				
			||||
 | 
						// "stream" 关键字表示客户端和服务器都可以连续地发送一系列消息,
 | 
				
			||||
 | 
						// 这对于传输大文件或实时数据流(如视频)至关重要,可以避免将整个内容加载到内存中。
 | 
				
			||||
 | 
						ProxyRequest(ctx context.Context, opts ...grpc.CallOption) (InternalRelay_ProxyRequestClient, error) | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					type internalRelayClient struct { | 
				
			||||
 | 
						cc grpc.ClientConnInterface | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					func NewInternalRelayClient(cc grpc.ClientConnInterface) InternalRelayClient { | 
				
			||||
 | 
						return &internalRelayClient{cc} | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					func (c *internalRelayClient) ProxyRequest(ctx context.Context, opts ...grpc.CallOption) (InternalRelay_ProxyRequestClient, error) { | 
				
			||||
 | 
						stream, err := c.cc.NewStream(ctx, &InternalRelay_ServiceDesc.Streams[0], "/relay.InternalRelay/ProxyRequest", opts...) | 
				
			||||
 | 
						if err != nil { | 
				
			||||
 | 
							return nil, err | 
				
			||||
 | 
						} | 
				
			||||
 | 
						x := &internalRelayProxyRequestClient{stream} | 
				
			||||
 | 
						return x, nil | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					type InternalRelay_ProxyRequestClient interface { | 
				
			||||
 | 
						Send(*ProxyRequestMessage) error | 
				
			||||
 | 
						Recv() (*ProxyResponseMessage, error) | 
				
			||||
 | 
						grpc.ClientStream | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					type internalRelayProxyRequestClient struct { | 
				
			||||
 | 
						grpc.ClientStream | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					func (x *internalRelayProxyRequestClient) Send(m *ProxyRequestMessage) error { | 
				
			||||
 | 
						return x.ClientStream.SendMsg(m) | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					func (x *internalRelayProxyRequestClient) Recv() (*ProxyResponseMessage, error) { | 
				
			||||
 | 
						m := new(ProxyResponseMessage) | 
				
			||||
 | 
						if err := x.ClientStream.RecvMsg(m); err != nil { | 
				
			||||
 | 
							return nil, err | 
				
			||||
 | 
						} | 
				
			||||
 | 
						return m, nil | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					// InternalRelayServer is the server API for InternalRelay service.
 | 
				
			||||
 | 
					// All implementations must embed UnimplementedInternalRelayServer
 | 
				
			||||
 | 
					// for forward compatibility
 | 
				
			||||
 | 
					type InternalRelayServer interface { | 
				
			||||
 | 
						// ProxyRequest 是一个双向流式 RPC。
 | 
				
			||||
 | 
						// "stream" 关键字表示客户端和服务器都可以连续地发送一系列消息,
 | 
				
			||||
 | 
						// 这对于传输大文件或实时数据流(如视频)至关重要,可以避免将整个内容加载到内存中。
 | 
				
			||||
 | 
						ProxyRequest(InternalRelay_ProxyRequestServer) error | 
				
			||||
 | 
						mustEmbedUnimplementedInternalRelayServer() | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					// UnimplementedInternalRelayServer must be embedded to have forward compatible implementations.
 | 
				
			||||
 | 
					type UnimplementedInternalRelayServer struct { | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					func (UnimplementedInternalRelayServer) ProxyRequest(InternalRelay_ProxyRequestServer) error { | 
				
			||||
 | 
						return status.Errorf(codes.Unimplemented, "method ProxyRequest not implemented") | 
				
			||||
 | 
					} | 
				
			||||
 | 
					func (UnimplementedInternalRelayServer) mustEmbedUnimplementedInternalRelayServer() {} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					// UnsafeInternalRelayServer may be embedded to opt out of forward compatibility for this service.
 | 
				
			||||
 | 
					// Use of this interface is not recommended, as added methods to InternalRelayServer will
 | 
				
			||||
 | 
					// result in compilation errors.
 | 
				
			||||
 | 
					type UnsafeInternalRelayServer interface { | 
				
			||||
 | 
						mustEmbedUnimplementedInternalRelayServer() | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					func RegisterInternalRelayServer(s grpc.ServiceRegistrar, srv InternalRelayServer) { | 
				
			||||
 | 
						s.RegisterService(&InternalRelay_ServiceDesc, srv) | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					func _InternalRelay_ProxyRequest_Handler(srv interface{}, stream grpc.ServerStream) error { | 
				
			||||
 | 
						return srv.(InternalRelayServer).ProxyRequest(&internalRelayProxyRequestServer{stream}) | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					type InternalRelay_ProxyRequestServer interface { | 
				
			||||
 | 
						Send(*ProxyResponseMessage) error | 
				
			||||
 | 
						Recv() (*ProxyRequestMessage, error) | 
				
			||||
 | 
						grpc.ServerStream | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					type internalRelayProxyRequestServer struct { | 
				
			||||
 | 
						grpc.ServerStream | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					func (x *internalRelayProxyRequestServer) Send(m *ProxyResponseMessage) error { | 
				
			||||
 | 
						return x.ServerStream.SendMsg(m) | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					func (x *internalRelayProxyRequestServer) Recv() (*ProxyRequestMessage, error) { | 
				
			||||
 | 
						m := new(ProxyRequestMessage) | 
				
			||||
 | 
						if err := x.ServerStream.RecvMsg(m); err != nil { | 
				
			||||
 | 
							return nil, err | 
				
			||||
 | 
						} | 
				
			||||
 | 
						return m, nil | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					// InternalRelay_ServiceDesc is the grpc.ServiceDesc for InternalRelay service.
 | 
				
			||||
 | 
					// It's only intended for direct use with grpc.RegisterService,
 | 
				
			||||
 | 
					// and not to be introspected or modified (even as a copy)
 | 
				
			||||
 | 
					var InternalRelay_ServiceDesc = grpc.ServiceDesc{ | 
				
			||||
 | 
						ServiceName: "relay.InternalRelay", | 
				
			||||
 | 
						HandlerType: (*InternalRelayServer)(nil), | 
				
			||||
 | 
						Methods:     []grpc.MethodDesc{}, | 
				
			||||
 | 
						Streams: []grpc.StreamDesc{ | 
				
			||||
 | 
							{ | 
				
			||||
 | 
								StreamName:    "ProxyRequest", | 
				
			||||
 | 
								Handler:       _InternalRelay_ProxyRequest_Handler, | 
				
			||||
 | 
								ServerStreams: true, | 
				
			||||
 | 
								ClientStreams: true, | 
				
			||||
 | 
							}, | 
				
			||||
 | 
						}, | 
				
			||||
 | 
						Metadata: "proto/relay.proto", | 
				
			||||
 | 
					} | 
				
			||||
					Loading…
					
					
				
		Reference in new issue