反向代理可以整体设置源站默认超时时间等参数

This commit is contained in:
GoEdgeLab
2021-03-26 22:10:57 +08:00
parent 3d82bfd3c5
commit 7abc85f476
4 changed files with 148 additions and 68 deletions

View File

@@ -511,6 +511,11 @@ type UpdateReverseProxyRequest struct {
StripPrefix string `protobuf:"bytes,4,opt,name=stripPrefix,proto3" json:"stripPrefix,omitempty"`
AutoFlush bool `protobuf:"varint,5,opt,name=autoFlush,proto3" json:"autoFlush,omitempty"`
AddHeaders []string `protobuf:"bytes,7,rep,name=addHeaders,proto3" json:"addHeaders,omitempty"`
ConnTimeoutJSON []byte `protobuf:"bytes,8,opt,name=connTimeoutJSON,proto3" json:"connTimeoutJSON,omitempty"`
ReadTimeoutJSON []byte `protobuf:"bytes,9,opt,name=readTimeoutJSON,proto3" json:"readTimeoutJSON,omitempty"`
IdleTimeoutJSON []byte `protobuf:"bytes,10,opt,name=idleTimeoutJSON,proto3" json:"idleTimeoutJSON,omitempty"`
MaxConns int32 `protobuf:"varint,11,opt,name=maxConns,proto3" json:"maxConns,omitempty"`
MaxIdleConns int32 `protobuf:"varint,12,opt,name=maxIdleConns,proto3" json:"maxIdleConns,omitempty"`
}
func (x *UpdateReverseProxyRequest) Reset() {
@@ -594,6 +599,41 @@ func (x *UpdateReverseProxyRequest) GetAddHeaders() []string {
return nil
}
func (x *UpdateReverseProxyRequest) GetConnTimeoutJSON() []byte {
if x != nil {
return x.ConnTimeoutJSON
}
return nil
}
func (x *UpdateReverseProxyRequest) GetReadTimeoutJSON() []byte {
if x != nil {
return x.ReadTimeoutJSON
}
return nil
}
func (x *UpdateReverseProxyRequest) GetIdleTimeoutJSON() []byte {
if x != nil {
return x.IdleTimeoutJSON
}
return nil
}
func (x *UpdateReverseProxyRequest) GetMaxConns() int32 {
if x != nil {
return x.MaxConns
}
return 0
}
func (x *UpdateReverseProxyRequest) GetMaxIdleConns() int32 {
if x != nil {
return x.MaxIdleConns
}
return 0
}
var File_service_reverse_proxy_proto protoreflect.FileDescriptor
var file_service_reverse_proxy_proto_rawDesc = []byte{
@@ -660,7 +700,7 @@ var file_service_reverse_proxy_proto_rawDesc = []byte{
0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x49, 0x64, 0x12, 0x20,
0x0a, 0x0b, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x73, 0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x02, 0x20,
0x01, 0x28, 0x0c, 0x52, 0x0b, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x73, 0x4a, 0x53, 0x4f, 0x4e,
0x22, 0x8f, 0x02, 0x0a, 0x19, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x76, 0x65, 0x72,
0x22, 0xcd, 0x03, 0x0a, 0x19, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x76, 0x65, 0x72,
0x73, 0x65, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x26,
0x0a, 0x0e, 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x49, 0x64,
0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e, 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x50,
@@ -677,50 +717,62 @@ var file_service_reverse_proxy_proto_rawDesc = []byte{
0x68, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x61, 0x75, 0x74, 0x6f, 0x46, 0x6c, 0x75,
0x73, 0x68, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x64, 0x64, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73,
0x18, 0x07, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x61, 0x64, 0x64, 0x48, 0x65, 0x61, 0x64, 0x65,
0x72, 0x73, 0x32, 0xa2, 0x05, 0x0a, 0x13, 0x52, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x50, 0x72,
0x6f, 0x78, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x53, 0x0a, 0x12, 0x63, 0x72,
0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x50, 0x72, 0x6f, 0x78, 0x79,
0x12, 0x1d, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x76, 0x65,
0x72, 0x73, 0x65, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
0x1e, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x76, 0x65, 0x72,
0x73, 0x65, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
0x62, 0x0a, 0x17, 0x66, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x52, 0x65,
0x76, 0x65, 0x72, 0x73, 0x65, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x12, 0x22, 0x2e, 0x70, 0x62, 0x2e,
0x46, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x52, 0x65, 0x76, 0x65, 0x72,
0x73, 0x65, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23,
0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x52,
0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f,
0x6e, 0x73, 0x65, 0x12, 0x74, 0x0a, 0x1d, 0x66, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c,
0x65, 0x64, 0x52, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x43, 0x6f,
0x6e, 0x66, 0x69, 0x67, 0x12, 0x28, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x45, 0x6e,
0x61, 0x62, 0x6c, 0x65, 0x64, 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, 0x29,
0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 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, 0x57, 0x0a, 0x1c, 0x75, 0x70, 0x64,
0x72, 0x73, 0x12, 0x28, 0x0a, 0x0f, 0x63, 0x6f, 0x6e, 0x6e, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75,
0x74, 0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0f, 0x63, 0x6f, 0x6e,
0x6e, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x4a, 0x53, 0x4f, 0x4e, 0x12, 0x28, 0x0a, 0x0f,
0x72, 0x65, 0x61, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x4a, 0x53, 0x4f, 0x4e, 0x18,
0x09, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0f, 0x72, 0x65, 0x61, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x6f,
0x75, 0x74, 0x4a, 0x53, 0x4f, 0x4e, 0x12, 0x28, 0x0a, 0x0f, 0x69, 0x64, 0x6c, 0x65, 0x54, 0x69,
0x6d, 0x65, 0x6f, 0x75, 0x74, 0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0c, 0x52,
0x0f, 0x69, 0x64, 0x6c, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x4a, 0x53, 0x4f, 0x4e,
0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x61, 0x78, 0x43, 0x6f, 0x6e, 0x6e, 0x73, 0x18, 0x0b, 0x20, 0x01,
0x28, 0x05, 0x52, 0x08, 0x6d, 0x61, 0x78, 0x43, 0x6f, 0x6e, 0x6e, 0x73, 0x12, 0x22, 0x0a, 0x0c,
0x6d, 0x61, 0x78, 0x49, 0x64, 0x6c, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x73, 0x18, 0x0c, 0x20, 0x01,
0x28, 0x05, 0x52, 0x0c, 0x6d, 0x61, 0x78, 0x49, 0x64, 0x6c, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x73,
0x32, 0xa2, 0x05, 0x0a, 0x13, 0x52, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x50, 0x72, 0x6f, 0x78,
0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x53, 0x0a, 0x12, 0x63, 0x72, 0x65, 0x61,
0x74, 0x65, 0x52, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x12, 0x1d,
0x2e, 0x70, 0x62, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x76, 0x65, 0x72, 0x73,
0x65, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e,
0x70, 0x62, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65,
0x50, 0x72, 0x6f, 0x78, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x62, 0x0a,
0x17, 0x66, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x52, 0x65, 0x76, 0x65,
0x72, 0x73, 0x65, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x12, 0x22, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69,
0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x52, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65,
0x50, 0x72, 0x6f, 0x78, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x70,
0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x52, 0x65, 0x76,
0x65, 0x72, 0x73, 0x65, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
0x65, 0x12, 0x74, 0x0a, 0x1d, 0x66, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64,
0x52, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x43, 0x6f, 0x6e, 0x66,
0x69, 0x67, 0x12, 0x28, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62,
0x6c, 0x65, 0x64, 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, 0x29, 0x2e, 0x70,
0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 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, 0x57, 0x0a, 0x1c, 0x75, 0x70, 0x64, 0x61, 0x74,
0x65, 0x52, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x53, 0x63, 0x68,
0x65, 0x64, 0x75, 0x6c, 0x69, 0x6e, 0x67, 0x12, 0x27, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64,
0x61, 0x74, 0x65, 0x52, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x53,
0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x69, 0x6e, 0x67, 0x12, 0x27, 0x2e, 0x70, 0x62, 0x2e, 0x55,
0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x50, 0x72, 0x6f, 0x78,
0x79, 0x53, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65,
0x73, 0x74, 0x1a, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x50, 0x43, 0x53, 0x75, 0x63, 0x63, 0x65,
0x73, 0x73, 0x12, 0x5f, 0x0a, 0x20, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x76, 0x65,
0x72, 0x73, 0x65, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x50, 0x72, 0x69, 0x6d, 0x61, 0x72, 0x79, 0x4f,
0x72, 0x69, 0x67, 0x69, 0x6e, 0x73, 0x12, 0x2b, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61,
0x74, 0x65, 0x52, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x50, 0x72,
0x69, 0x6d, 0x61, 0x72, 0x79, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75,
0x65, 0x73, 0x74, 0x1a, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x50, 0x43, 0x53, 0x75, 0x63, 0x63,
0x65, 0x73, 0x73, 0x12, 0x5d, 0x0a, 0x1f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x76,
0x65, 0x72, 0x73, 0x65, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x4f,
0x72, 0x69, 0x67, 0x69, 0x6e, 0x73, 0x12, 0x2a, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61,
0x74, 0x65, 0x52, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x42, 0x61,
0x63, 0x6b, 0x75, 0x70, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65,
0x73, 0x74, 0x1a, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x50, 0x43, 0x53, 0x75, 0x63, 0x63, 0x65,
0x73, 0x73, 0x12, 0x43, 0x0a, 0x12, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x76, 0x65,
0x72, 0x73, 0x65, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x12, 0x1d, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70,
0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x50, 0x72, 0x6f, 0x78, 0x79,
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x50, 0x43,
0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62,
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x1a, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x50, 0x43, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73,
0x12, 0x5f, 0x0a, 0x20, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x76, 0x65, 0x72, 0x73,
0x65, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x50, 0x72, 0x69, 0x6d, 0x61, 0x72, 0x79, 0x4f, 0x72, 0x69,
0x67, 0x69, 0x6e, 0x73, 0x12, 0x2b, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65,
0x52, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x50, 0x72, 0x69, 0x6d,
0x61, 0x72, 0x79, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x74, 0x1a, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x50, 0x43, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73,
0x73, 0x12, 0x5d, 0x0a, 0x1f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x76, 0x65, 0x72,
0x73, 0x65, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x4f, 0x72, 0x69,
0x67, 0x69, 0x6e, 0x73, 0x12, 0x2a, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65,
0x52, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x42, 0x61, 0x63, 0x6b,
0x75, 0x70, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x1a, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x50, 0x43, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73,
0x12, 0x43, 0x0a, 0x12, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x76, 0x65, 0x72, 0x73,
0x65, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x12, 0x1d, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61,
0x74, 0x65, 0x52, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x52, 0x65,
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x50, 0x43, 0x53, 0x75,
0x63, 0x63, 0x65, 0x73, 0x73, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (

View File

@@ -85,4 +85,9 @@ message UpdateReverseProxyRequest {
string stripPrefix = 4;
bool autoFlush = 5;
repeated string addHeaders = 7;
bytes connTimeoutJSON = 8;
bytes readTimeoutJSON = 9;
bytes idleTimeoutJSON = 10;
int32 maxConns = 11;
int32 maxIdleConns = 12;
}

View File

@@ -13,20 +13,20 @@ import (
// 源站服务配置
type OriginConfig struct {
Id int64 `yaml:"id" json:"id"` // ID
IsOn bool `yaml:"isOn" json:"isOn"` // 是否启用 TODO
IsOn bool `yaml:"isOn" json:"isOn"` // 是否启用
Version int `yaml:"version" json:"version"` // 版本
Name string `yaml:"name" json:"name"` // 名称 TODO
Name string `yaml:"name" json:"name"` // 名称
Addr *NetworkAddressConfig `yaml:"addr" json:"addr"` // 地址
Description string `yaml:"description" json:"description"` // 描述 TODO
Code string `yaml:"code" json:"code"` // 代号 TODO
Weight uint `yaml:"weight" json:"weight"` // 权重 TODO
ConnTimeout *shared.TimeDuration `yaml:"failTimeout" json:"failTimeout"` // 连接失败超时 TODO
ReadTimeout *shared.TimeDuration `yaml:"readTimeout" json:"readTimeout"` // 读取超时时间 TODO
IdleTimeout *shared.TimeDuration `yaml:"idleTimeout" json:"idleTimeout"` // 空闲连接超时时间 TODO
Weight uint `yaml:"weight" json:"weight"` // 权重
ConnTimeout *shared.TimeDuration `yaml:"connTimeout" json:"connTimeout"` // 连接失败超时
ReadTimeout *shared.TimeDuration `yaml:"readTimeout" json:"readTimeout"` // 读取超时时间
IdleTimeout *shared.TimeDuration `yaml:"idleTimeout" json:"idleTimeout"` // 空闲连接超时时间
MaxFails int `yaml:"maxFails" json:"maxFails"` // 最多失败次数 TODO
MaxConns int `yaml:"maxConns" json:"maxConns"` // 最大并发连接数 TODO
MaxIdleConns int `yaml:"idleConns" json:"idleConns"` // 最大空闲连接数 TODO
MaxConns int `yaml:"maxConns" json:"maxConns"` // 最大并发连接数
MaxIdleConns int `yaml:"idleConns" json:"idleConns"` // 最大空闲连接数
StripPrefix string `yaml:"stripPrefix" json:"stripPrefix"` // 去除URL前缀
RequestURI string `yaml:"requestURI" json:"requestURI"` // 转发后的请求URI TODO
@@ -39,14 +39,14 @@ type OriginConfig struct {
// 健康检查URL目前支持
// - http|https 返回2xx-3xx认为成功
HealthCheck *HealthCheckConfig `yaml:"healthCheck" json:"healthCheck"`
HealthCheck *HealthCheckConfig `yaml:"healthCheck" json:"healthCheck"` // TODO
CertRef *sslconfigs.SSLCertRef `yaml:"certRef" json:"certRef"` // 证书的引用
Cert *sslconfigs.SSLCertConfig `yaml:"cert" json:"cert"` // 请求源服务器用的证书
CertRef *sslconfigs.SSLCertRef `yaml:"certRef" json:"certRef"` // 证书的引用 TODO
Cert *sslconfigs.SSLCertConfig `yaml:"cert" json:"cert"` // 请求源服务器用的证书 TODO
// ftp
FTPServerRef *FTPServerRef `yaml:"ftpServerRef" json:"ftpServerRef"`
FTPServer *FTPServerConfig `yaml:"ftpServer" json:"ftpServer"`
FTPServerRef *FTPServerRef `yaml:"ftpServerRef" json:"ftpServerRef"` // TODO
FTPServer *FTPServerConfig `yaml:"ftpServer" json:"ftpServer"` // TODO
connTimeoutDuration time.Duration
readTimeoutDuration time.Duration
@@ -90,7 +90,7 @@ func (this *OriginConfig) Init() error {
}
}
// failTimeout
// connTimeout
if this.ConnTimeout != nil {
this.connTimeoutDuration = this.ConnTimeout.Duration()
}

View File

@@ -26,6 +26,13 @@ type ReverseProxyConfig struct {
BackupOriginRefs []*OriginRef `yaml:"backupOriginRefs" json:"backupOriginRefs"` // 备用源站引用
Scheduling *SchedulingConfig `yaml:"scheduling" json:"scheduling"` // 调度算法选项
ConnTimeout *shared.TimeDuration `yaml:"connTimeout" json:"connTimeout"` // 连接失败超时 TODO
ReadTimeout *shared.TimeDuration `yaml:"readTimeout" json:"readTimeout"` // 读取超时时间 TODO
IdleTimeout *shared.TimeDuration `yaml:"idleTimeout" json:"idleTimeout"` // 空闲连接超时时间 TODO
MaxFails int `yaml:"maxFails" json:"maxFails"` // 最多失败次数 TODO
MaxConns int `yaml:"maxConns" json:"maxConns"` // 最大并发连接数 TODO
MaxIdleConns int `yaml:"maxIdleConns" json:"maxIdleConns"` // 最大空闲连接数 TODO
StripPrefix string `yaml:"stripPrefix" json:"stripPrefix"` // 去除URL前缀
RequestHostType RequestHostType `yaml:"requestHostType" json:"requestHostType"` // 请求Host类型
RequestHost string `yaml:"requestHost" json:"requestHost"` // 请求Host支持变量
@@ -60,17 +67,33 @@ func (this *ReverseProxyConfig) Init() error {
this.hasPrimaryOrigins = len(this.PrimaryOrigins) > 0
this.hasBackupOrigins = len(this.BackupOrigins) > 0
for _, origin := range this.PrimaryOrigins {
err := origin.Init()
if err != nil {
return err
}
}
for _, origins := range [][]*OriginConfig{this.PrimaryOrigins, this.BackupOrigins} {
for _, origin := range origins {
// 覆盖参数设置
if origin.MaxFails <= 0 && this.MaxFails > 0 {
origin.MaxFails = this.MaxFails
}
if origin.MaxConns <= 0 && this.MaxConns > 0 {
origin.MaxConns = this.MaxConns
}
if origin.MaxIdleConns <= 0 && this.MaxIdleConns > 0 {
origin.MaxIdleConns = this.MaxIdleConns
}
if (origin.ConnTimeout == nil || origin.ConnTimeout.Count <= 0) && this.ConnTimeout != nil && this.ConnTimeout.Count > 0 {
origin.ConnTimeout = this.ConnTimeout
}
if (origin.ReadTimeout == nil || origin.ReadTimeout.Count <= 0) && this.ReadTimeout != nil && this.ReadTimeout.Count > 0 {
origin.ReadTimeout = this.ReadTimeout
}
if (origin.IdleTimeout == nil || origin.IdleTimeout.Count <= 0) && this.IdleTimeout != nil && this.IdleTimeout.Count > 0 {
origin.IdleTimeout = this.IdleTimeout
}
for _, origin := range this.BackupOrigins {
err := origin.Init()
if err != nil {
return err
// 初始化
err := origin.Init()
if err != nil {
return err
}
}
}