From 2a8e703e70eb7096e8b4ecb8551b4badce2d35e9 Mon Sep 17 00:00:00 2001 From: GoEdgeLab Date: Wed, 7 Jun 2023 17:26:34 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E6=AD=A5=E5=AE=9E=E7=8E=B0=E5=AF=B9?= =?UTF-8?q?=E8=B1=A1=E5=AD=98=E5=82=A8=E6=BA=90=E7=AB=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build/rpc.json | 6 +- pkg/rpc/pb/model_origin.pb.go | 32 ++- pkg/rpc/pb/service_origin.pb.go | 269 +++++++++++--------- pkg/rpc/protos/models/model_origin.proto | 3 +- pkg/rpc/protos/service_origin.proto | 60 ++--- pkg/serverconfigs/origin_config.go | 29 +++ pkg/serverconfigs/ossconfigs/oss_config.go | 85 +++++++ pkg/serverconfigs/ossconfigs/oss_options.go | 9 + pkg/serverconfigs/ossconfigs/oss_types.go | 16 ++ pkg/serverconfigs/ossconfigs/oss_utils.go | 9 + pkg/serverconfigs/protocol.go | 10 +- 11 files changed, 357 insertions(+), 171 deletions(-) create mode 100644 pkg/serverconfigs/ossconfigs/oss_config.go create mode 100644 pkg/serverconfigs/ossconfigs/oss_options.go create mode 100644 pkg/serverconfigs/ossconfigs/oss_types.go create mode 100644 pkg/serverconfigs/ossconfigs/oss_utils.go diff --git a/build/rpc.json b/build/rpc.json index 0a48f28..40893ad 100644 --- a/build/rpc.json +++ b/build/rpc.json @@ -15266,7 +15266,7 @@ }, { "name": "CreateOriginRequest", - "code": "message CreateOriginRequest {\n\tstring name = 1;\n\tNetworkAddress addr = 2;\n\tstring description = 3;\n\tint32 weight = 4;\n\tbool isOn = 5;\n\tbytes connTimeoutJSON = 6;\n\tbytes readTimeoutJSON = 7;\n\tbytes idleTimeoutJSON = 8;\n\tint32 maxConns = 9;\n\tint32 maxIdleConns = 10;\n\trepeated string domains = 11;\n\tbytes certRefJSON = 12;\n\tstring host = 13;\n\tbool followPort = 14;\n}", + "code": "message CreateOriginRequest {\n\tstring name = 1; // 名称,为可选项\n\tNetworkAddress addr = 2; // 源站网络地址\n\tbytes ossJSON = 15; // OSS配置信息,源站网络地址中protocol为oss:开头时需要设置此项\n\tstring description = 3; // 描述,为可选项\n\tint32 weight = 4; // 权重,不小于0,一般设置为10\n\tbool isOn = 5; // 是否启用\n\tbytes connTimeoutJSON = 6; // 可选项\n\tbytes readTimeoutJSON = 7; // 可选项\n\tbytes idleTimeoutJSON = 8; // 可选项\n\tint32 maxConns = 9; // 可选项\n\tint32 maxIdleConns = 10; // 可选项\n\trepeated string domains = 11; // 可选项\n\tbytes certRefJSON = 12; // 可选项\n\tstring host = 13; // 可选项\n\tbool followPort = 14; // 可选项\n}", "doc": "创建源站" }, { @@ -20886,7 +20886,7 @@ }, { "name": "Origin", - "code": "message Origin {\n\tint64 id = 1;\n\tbool isOn = 2;\n\tstring name = 3;\n\tNetworkAddress addr = 4;\n\tstring description = 5;\n\trepeated string domains = 6;\n\tstring host = 7;\n\tbool followPort = 8;\n}", + "code": "message Origin {\n\tint64 id = 1;\n\tbool isOn = 2;\n\tstring name = 3;\n\tNetworkAddress addr = 4; // 源站网络地址\n\tbytes ossJSON = 9; // 源站网络地址为oss:开头时有此内容\n\tstring description = 5;\n\trepeated string domains = 6;\n\tstring host = 7;\n\tbool followPort = 8;\n}", "doc": "" }, { @@ -22266,7 +22266,7 @@ }, { "name": "UpdateOriginRequest", - "code": "message UpdateOriginRequest {\n\tint64 originId = 1;\n\tstring name = 2;\n\tNetworkAddress addr = 3;\n\tstring description = 4;\n\tint32 weight = 5;\n\tbool isOn = 6;\n\tbytes connTimeoutJSON = 7;\n\tbytes readTimeoutJSON = 8;\n\tbytes idleTimeoutJSON = 9;\n\tint32 maxConns = 10;\n\tint32 maxIdleConns = 11;\n\trepeated string domains = 12;\n\tbytes certRefJSON = 13;\n\tstring host = 14;\n\tbool followPort = 15;\n}", + "code": "message UpdateOriginRequest {\n\tint64 originId = 1; // 源站ID\n\tstring name = 2; // 可选项\n\tNetworkAddress addr = 3; // 源站网络地址\n\tbytes ossJSON = 16; // OSS配置信息,源站网络地址中protocol为oss:开头时需要设置此项\n\tstring description = 4; // 可选项\n\tint32 weight = 5; // 权重,不小于0,一般设置为10\n\tbool isOn = 6; // 是否启用\n\tbytes connTimeoutJSON = 7; // 可选项\n\tbytes readTimeoutJSON = 8; // 可选项\n\tbytes idleTimeoutJSON = 9; // 可选项\n\tint32 maxConns = 10; // 可选项\n\tint32 maxIdleConns = 11; // 可选项\n\trepeated string domains = 12; // 可选项\n\tbytes certRefJSON = 13; // 可选项\n\tstring host = 14; // 可选项\n\tbool followPort = 15; // 可选项\n}", "doc": "修改源站" }, { diff --git a/pkg/rpc/pb/model_origin.pb.go b/pkg/rpc/pb/model_origin.pb.go index 0864a21..cc77cb0 100644 --- a/pkg/rpc/pb/model_origin.pb.go +++ b/pkg/rpc/pb/model_origin.pb.go @@ -33,7 +33,8 @@ type Origin struct { Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` IsOn bool `protobuf:"varint,2,opt,name=isOn,proto3" json:"isOn,omitempty"` Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` - Addr *NetworkAddress `protobuf:"bytes,4,opt,name=addr,proto3" json:"addr,omitempty"` + Addr *NetworkAddress `protobuf:"bytes,4,opt,name=addr,proto3" json:"addr,omitempty"` // 源站网络地址 + OssJSON []byte `protobuf:"bytes,9,opt,name=ossJSON,proto3" json:"ossJSON,omitempty"` // 源站网络地址为oss:开头时有此内容 Description string `protobuf:"bytes,5,opt,name=description,proto3" json:"description,omitempty"` Domains []string `protobuf:"bytes,6,rep,name=domains,proto3" json:"domains,omitempty"` Host string `protobuf:"bytes,7,opt,name=host,proto3" json:"host,omitempty"` @@ -100,6 +101,13 @@ func (x *Origin) GetAddr() *NetworkAddress { return nil } +func (x *Origin) GetOssJSON() []byte { + if x != nil { + return x.OssJSON + } + return nil +} + func (x *Origin) GetDescription() string { if x != nil { return x.Description @@ -135,21 +143,23 @@ var file_models_model_origin_proto_rawDesc = []byte{ 0x72, 0x69, 0x67, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x1a, 0x22, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x22, 0xd8, 0x01, 0x0a, 0x06, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x12, 0x0e, + 0x6f, 0x74, 0x6f, 0x22, 0xf2, 0x01, 0x0a, 0x06, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x73, 0x4f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x69, 0x73, 0x4f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x26, 0x0a, 0x04, 0x61, 0x64, 0x64, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, - 0x6b, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x04, 0x61, 0x64, 0x64, 0x72, 0x12, 0x20, - 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x12, 0x18, 0x0a, 0x07, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, - 0x09, 0x52, 0x07, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x6f, - 0x73, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x12, 0x1e, - 0x0a, 0x0a, 0x66, 0x6f, 0x6c, 0x6c, 0x6f, 0x77, 0x50, 0x6f, 0x72, 0x74, 0x18, 0x08, 0x20, 0x01, - 0x28, 0x08, 0x52, 0x0a, 0x66, 0x6f, 0x6c, 0x6c, 0x6f, 0x77, 0x50, 0x6f, 0x72, 0x74, 0x42, 0x06, - 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6b, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x04, 0x61, 0x64, 0x64, 0x72, 0x12, 0x18, + 0x0a, 0x07, 0x6f, 0x73, 0x73, 0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0c, 0x52, + 0x07, 0x6f, 0x73, 0x73, 0x4a, 0x53, 0x4f, 0x4e, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, + 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, + 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x64, 0x6f, + 0x6d, 0x61, 0x69, 0x6e, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x64, 0x6f, 0x6d, + 0x61, 0x69, 0x6e, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x18, 0x07, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x66, 0x6f, 0x6c, 0x6c, + 0x6f, 0x77, 0x50, 0x6f, 0x72, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x66, 0x6f, + 0x6c, 0x6c, 0x6f, 0x77, 0x50, 0x6f, 0x72, 0x74, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/pkg/rpc/pb/service_origin.pb.go b/pkg/rpc/pb/service_origin.pb.go index fcd0455..d322463 100644 --- a/pkg/rpc/pb/service_origin.pb.go +++ b/pkg/rpc/pb/service_origin.pb.go @@ -35,20 +35,21 @@ type CreateOriginRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Addr *NetworkAddress `protobuf:"bytes,2,opt,name=addr,proto3" json:"addr,omitempty"` - Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` - Weight int32 `protobuf:"varint,4,opt,name=weight,proto3" json:"weight,omitempty"` - IsOn bool `protobuf:"varint,5,opt,name=isOn,proto3" json:"isOn,omitempty"` - ConnTimeoutJSON []byte `protobuf:"bytes,6,opt,name=connTimeoutJSON,proto3" json:"connTimeoutJSON,omitempty"` - ReadTimeoutJSON []byte `protobuf:"bytes,7,opt,name=readTimeoutJSON,proto3" json:"readTimeoutJSON,omitempty"` - IdleTimeoutJSON []byte `protobuf:"bytes,8,opt,name=idleTimeoutJSON,proto3" json:"idleTimeoutJSON,omitempty"` - MaxConns int32 `protobuf:"varint,9,opt,name=maxConns,proto3" json:"maxConns,omitempty"` - MaxIdleConns int32 `protobuf:"varint,10,opt,name=maxIdleConns,proto3" json:"maxIdleConns,omitempty"` - Domains []string `protobuf:"bytes,11,rep,name=domains,proto3" json:"domains,omitempty"` - CertRefJSON []byte `protobuf:"bytes,12,opt,name=certRefJSON,proto3" json:"certRefJSON,omitempty"` - Host string `protobuf:"bytes,13,opt,name=host,proto3" json:"host,omitempty"` - FollowPort bool `protobuf:"varint,14,opt,name=followPort,proto3" json:"followPort,omitempty"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // 名称,为可选项 + Addr *NetworkAddress `protobuf:"bytes,2,opt,name=addr,proto3" json:"addr,omitempty"` // 源站网络地址 + OssJSON []byte `protobuf:"bytes,15,opt,name=ossJSON,proto3" json:"ossJSON,omitempty"` // OSS配置信息,源站网络地址中protocol为oss:开头时需要设置此项 + Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` // 描述,为可选项 + Weight int32 `protobuf:"varint,4,opt,name=weight,proto3" json:"weight,omitempty"` // 权重,不小于0,一般设置为10 + IsOn bool `protobuf:"varint,5,opt,name=isOn,proto3" json:"isOn,omitempty"` // 是否启用 + ConnTimeoutJSON []byte `protobuf:"bytes,6,opt,name=connTimeoutJSON,proto3" json:"connTimeoutJSON,omitempty"` // 可选项 + ReadTimeoutJSON []byte `protobuf:"bytes,7,opt,name=readTimeoutJSON,proto3" json:"readTimeoutJSON,omitempty"` // 可选项 + IdleTimeoutJSON []byte `protobuf:"bytes,8,opt,name=idleTimeoutJSON,proto3" json:"idleTimeoutJSON,omitempty"` // 可选项 + MaxConns int32 `protobuf:"varint,9,opt,name=maxConns,proto3" json:"maxConns,omitempty"` // 可选项 + MaxIdleConns int32 `protobuf:"varint,10,opt,name=maxIdleConns,proto3" json:"maxIdleConns,omitempty"` // 可选项 + Domains []string `protobuf:"bytes,11,rep,name=domains,proto3" json:"domains,omitempty"` // 可选项 + CertRefJSON []byte `protobuf:"bytes,12,opt,name=certRefJSON,proto3" json:"certRefJSON,omitempty"` // 可选项 + Host string `protobuf:"bytes,13,opt,name=host,proto3" json:"host,omitempty"` // 可选项 + FollowPort bool `protobuf:"varint,14,opt,name=followPort,proto3" json:"followPort,omitempty"` // 可选项 } func (x *CreateOriginRequest) Reset() { @@ -97,6 +98,13 @@ func (x *CreateOriginRequest) GetAddr() *NetworkAddress { return nil } +func (x *CreateOriginRequest) GetOssJSON() []byte { + if x != nil { + return x.OssJSON + } + return nil +} + func (x *CreateOriginRequest) GetDescription() string { if x != nil { return x.Description @@ -234,21 +242,22 @@ type UpdateOriginRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - OriginId int64 `protobuf:"varint,1,opt,name=originId,proto3" json:"originId,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - Addr *NetworkAddress `protobuf:"bytes,3,opt,name=addr,proto3" json:"addr,omitempty"` - Description string `protobuf:"bytes,4,opt,name=description,proto3" json:"description,omitempty"` - Weight int32 `protobuf:"varint,5,opt,name=weight,proto3" json:"weight,omitempty"` - IsOn bool `protobuf:"varint,6,opt,name=isOn,proto3" json:"isOn,omitempty"` - ConnTimeoutJSON []byte `protobuf:"bytes,7,opt,name=connTimeoutJSON,proto3" json:"connTimeoutJSON,omitempty"` - ReadTimeoutJSON []byte `protobuf:"bytes,8,opt,name=readTimeoutJSON,proto3" json:"readTimeoutJSON,omitempty"` - IdleTimeoutJSON []byte `protobuf:"bytes,9,opt,name=idleTimeoutJSON,proto3" json:"idleTimeoutJSON,omitempty"` - MaxConns int32 `protobuf:"varint,10,opt,name=maxConns,proto3" json:"maxConns,omitempty"` - MaxIdleConns int32 `protobuf:"varint,11,opt,name=maxIdleConns,proto3" json:"maxIdleConns,omitempty"` - Domains []string `protobuf:"bytes,12,rep,name=domains,proto3" json:"domains,omitempty"` - CertRefJSON []byte `protobuf:"bytes,13,opt,name=certRefJSON,proto3" json:"certRefJSON,omitempty"` - Host string `protobuf:"bytes,14,opt,name=host,proto3" json:"host,omitempty"` - FollowPort bool `protobuf:"varint,15,opt,name=followPort,proto3" json:"followPort,omitempty"` + OriginId int64 `protobuf:"varint,1,opt,name=originId,proto3" json:"originId,omitempty"` // 源站ID + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` // 可选项 + Addr *NetworkAddress `protobuf:"bytes,3,opt,name=addr,proto3" json:"addr,omitempty"` // 源站网络地址 + OssJSON []byte `protobuf:"bytes,16,opt,name=ossJSON,proto3" json:"ossJSON,omitempty"` // OSS配置信息,源站网络地址中protocol为oss:开头时需要设置此项 + Description string `protobuf:"bytes,4,opt,name=description,proto3" json:"description,omitempty"` // 可选项 + Weight int32 `protobuf:"varint,5,opt,name=weight,proto3" json:"weight,omitempty"` // 权重,不小于0,一般设置为10 + IsOn bool `protobuf:"varint,6,opt,name=isOn,proto3" json:"isOn,omitempty"` // 是否启用 + ConnTimeoutJSON []byte `protobuf:"bytes,7,opt,name=connTimeoutJSON,proto3" json:"connTimeoutJSON,omitempty"` // 可选项 + ReadTimeoutJSON []byte `protobuf:"bytes,8,opt,name=readTimeoutJSON,proto3" json:"readTimeoutJSON,omitempty"` // 可选项 + IdleTimeoutJSON []byte `protobuf:"bytes,9,opt,name=idleTimeoutJSON,proto3" json:"idleTimeoutJSON,omitempty"` // 可选项 + MaxConns int32 `protobuf:"varint,10,opt,name=maxConns,proto3" json:"maxConns,omitempty"` // 可选项 + MaxIdleConns int32 `protobuf:"varint,11,opt,name=maxIdleConns,proto3" json:"maxIdleConns,omitempty"` // 可选项 + Domains []string `protobuf:"bytes,12,rep,name=domains,proto3" json:"domains,omitempty"` // 可选项 + CertRefJSON []byte `protobuf:"bytes,13,opt,name=certRefJSON,proto3" json:"certRefJSON,omitempty"` // 可选项 + Host string `protobuf:"bytes,14,opt,name=host,proto3" json:"host,omitempty"` // 可选项 + FollowPort bool `protobuf:"varint,15,opt,name=followPort,proto3" json:"followPort,omitempty"` // 可选项 } func (x *UpdateOriginRequest) Reset() { @@ -304,6 +313,13 @@ func (x *UpdateOriginRequest) GetAddr() *NetworkAddress { return nil } +func (x *UpdateOriginRequest) GetOssJSON() []byte { + if x != nil { + return x.OssJSON + } + return nil +} + func (x *UpdateOriginRequest) GetDescription() string { if x != nil { return x.Description @@ -588,107 +604,110 @@ var file_service_origin_proto_rawDesc = []byte{ 0x64, 0x65, 0x6c, 0x5f, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x72, 0x70, 0x63, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xcd, 0x03, 0x0a, 0x13, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, + 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xe7, 0x03, 0x0a, 0x13, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x26, 0x0a, 0x04, 0x61, 0x64, 0x64, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x41, 0x64, 0x64, 0x72, 0x65, - 0x73, 0x73, 0x52, 0x04, 0x61, 0x64, 0x64, 0x72, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, - 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, - 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x77, 0x65, - 0x69, 0x67, 0x68, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x77, 0x65, 0x69, 0x67, - 0x68, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x73, 0x4f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, - 0x52, 0x04, 0x69, 0x73, 0x4f, 0x6e, 0x12, 0x28, 0x0a, 0x0f, 0x63, 0x6f, 0x6e, 0x6e, 0x54, 0x69, - 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x06, 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, 0x07, 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, 0x08, 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, 0x09, 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, 0x0a, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x6d, 0x61, 0x78, 0x49, 0x64, 0x6c, 0x65, 0x43, - 0x6f, 0x6e, 0x6e, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x73, 0x18, - 0x0b, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x73, 0x12, 0x20, - 0x0a, 0x0b, 0x63, 0x65, 0x72, 0x74, 0x52, 0x65, 0x66, 0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x0c, 0x20, - 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x63, 0x65, 0x72, 0x74, 0x52, 0x65, 0x66, 0x4a, 0x53, 0x4f, 0x4e, - 0x12, 0x12, 0x0a, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, - 0x68, 0x6f, 0x73, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x66, 0x6f, 0x6c, 0x6c, 0x6f, 0x77, 0x50, 0x6f, - 0x72, 0x74, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x66, 0x6f, 0x6c, 0x6c, 0x6f, 0x77, - 0x50, 0x6f, 0x72, 0x74, 0x22, 0x32, 0x0a, 0x14, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x72, - 0x69, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1a, 0x0a, 0x08, - 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, - 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x49, 0x64, 0x22, 0xe9, 0x03, 0x0a, 0x13, 0x55, 0x70, 0x64, - 0x61, 0x74, 0x65, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x12, 0x1a, 0x0a, 0x08, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x03, 0x52, 0x08, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, - 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x12, 0x26, 0x0a, 0x04, 0x61, 0x64, 0x64, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, - 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x41, 0x64, 0x64, 0x72, 0x65, - 0x73, 0x73, 0x52, 0x04, 0x61, 0x64, 0x64, 0x72, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, - 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, - 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x77, 0x65, - 0x69, 0x67, 0x68, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x77, 0x65, 0x69, 0x67, - 0x68, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x73, 0x4f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, - 0x52, 0x04, 0x69, 0x73, 0x4f, 0x6e, 0x12, 0x28, 0x0a, 0x0f, 0x63, 0x6f, 0x6e, 0x6e, 0x54, 0x69, - 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x07, 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, 0x08, 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, 0x09, 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, 0x0a, 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, 0x0b, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x6d, 0x61, 0x78, 0x49, 0x64, 0x6c, 0x65, 0x43, - 0x6f, 0x6e, 0x6e, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x73, 0x18, - 0x0c, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x73, 0x12, 0x20, - 0x0a, 0x0b, 0x63, 0x65, 0x72, 0x74, 0x52, 0x65, 0x66, 0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x0d, 0x20, - 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x63, 0x65, 0x72, 0x74, 0x52, 0x65, 0x66, 0x4a, 0x53, 0x4f, 0x4e, - 0x12, 0x12, 0x0a, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, - 0x68, 0x6f, 0x73, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x66, 0x6f, 0x6c, 0x6c, 0x6f, 0x77, 0x50, 0x6f, - 0x72, 0x74, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x66, 0x6f, 0x6c, 0x6c, 0x6f, 0x77, - 0x50, 0x6f, 0x72, 0x74, 0x22, 0x36, 0x0a, 0x18, 0x46, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, - 0x6c, 0x65, 0x64, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x12, 0x1a, 0x0a, 0x08, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x03, 0x52, 0x08, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x49, 0x64, 0x22, 0x3f, 0x0a, 0x19, - 0x46, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4f, 0x72, 0x69, 0x67, 0x69, - 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x22, 0x0a, 0x06, 0x4f, 0x72, 0x69, - 0x67, 0x69, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x70, 0x62, 0x2e, 0x4f, - 0x72, 0x69, 0x67, 0x69, 0x6e, 0x52, 0x06, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x22, 0x3c, 0x0a, - 0x1e, 0x46, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4f, 0x72, 0x69, 0x67, - 0x69, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, - 0x1a, 0x0a, 0x08, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x03, 0x52, 0x08, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x49, 0x64, 0x22, 0x41, 0x0a, 0x1f, 0x46, - 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, - 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1e, - 0x0a, 0x0a, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0c, 0x52, 0x0a, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x4a, 0x53, 0x4f, 0x4e, 0x32, 0xc1, - 0x02, 0x0a, 0x0d, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0x12, 0x41, 0x0a, 0x0c, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, - 0x12, 0x17, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x72, 0x69, 0x67, - 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x70, 0x62, 0x2e, 0x43, - 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x37, 0x0a, 0x0c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x72, 0x69, - 0x67, 0x69, 0x6e, 0x12, 0x17, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, - 0x72, 0x69, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0e, 0x2e, 0x70, - 0x62, 0x2e, 0x52, 0x50, 0x43, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x50, 0x0a, 0x11, - 0x66, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4f, 0x72, 0x69, 0x67, 0x69, - 0x6e, 0x12, 0x1c, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, - 0x65, 0x64, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x1d, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, - 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x62, - 0x0a, 0x17, 0x66, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4f, 0x72, 0x69, - 0x67, 0x69, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x22, 0x2e, 0x70, 0x62, 0x2e, 0x46, - 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, - 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, - 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4f, 0x72, + 0x73, 0x73, 0x52, 0x04, 0x61, 0x64, 0x64, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x6f, 0x73, 0x73, 0x4a, + 0x53, 0x4f, 0x4e, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x6f, 0x73, 0x73, 0x4a, 0x53, + 0x4f, 0x4e, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x77, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x77, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0x12, 0x0a, 0x04, + 0x69, 0x73, 0x4f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x69, 0x73, 0x4f, 0x6e, + 0x12, 0x28, 0x0a, 0x0f, 0x63, 0x6f, 0x6e, 0x6e, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x4a, + 0x53, 0x4f, 0x4e, 0x18, 0x06, 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, 0x07, 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, 0x08, 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, 0x09, 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, 0x0a, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x0c, 0x6d, 0x61, 0x78, 0x49, 0x64, 0x6c, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x73, 0x12, 0x18, + 0x0a, 0x07, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x73, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x09, 0x52, + 0x07, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x73, 0x12, 0x20, 0x0a, 0x0b, 0x63, 0x65, 0x72, 0x74, + 0x52, 0x65, 0x66, 0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x63, + 0x65, 0x72, 0x74, 0x52, 0x65, 0x66, 0x4a, 0x53, 0x4f, 0x4e, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x6f, + 0x73, 0x74, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x12, 0x1e, + 0x0a, 0x0a, 0x66, 0x6f, 0x6c, 0x6c, 0x6f, 0x77, 0x50, 0x6f, 0x72, 0x74, 0x18, 0x0e, 0x20, 0x01, + 0x28, 0x08, 0x52, 0x0a, 0x66, 0x6f, 0x6c, 0x6c, 0x6f, 0x77, 0x50, 0x6f, 0x72, 0x74, 0x22, 0x32, + 0x0a, 0x14, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, + 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, + 0x49, 0x64, 0x22, 0x83, 0x04, 0x0a, 0x13, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x72, 0x69, + 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x6f, 0x72, + 0x69, 0x67, 0x69, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6f, 0x72, + 0x69, 0x67, 0x69, 0x6e, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x26, 0x0a, 0x04, 0x61, 0x64, + 0x64, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x62, 0x2e, 0x4e, 0x65, + 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x04, 0x61, 0x64, + 0x64, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x6f, 0x73, 0x73, 0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x10, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x07, 0x6f, 0x73, 0x73, 0x4a, 0x53, 0x4f, 0x4e, 0x12, 0x20, 0x0a, 0x0b, + 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, + 0x0a, 0x06, 0x77, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, + 0x77, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x73, 0x4f, 0x6e, 0x18, 0x06, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x69, 0x73, 0x4f, 0x6e, 0x12, 0x28, 0x0a, 0x0f, 0x63, 0x6f, + 0x6e, 0x6e, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x07, 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, 0x08, 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, 0x09, 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, 0x0a, 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, 0x0b, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x6d, 0x61, 0x78, 0x49, + 0x64, 0x6c, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x64, 0x6f, 0x6d, 0x61, + 0x69, 0x6e, 0x73, 0x18, 0x0c, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x64, 0x6f, 0x6d, 0x61, 0x69, + 0x6e, 0x73, 0x12, 0x20, 0x0a, 0x0b, 0x63, 0x65, 0x72, 0x74, 0x52, 0x65, 0x66, 0x4a, 0x53, 0x4f, + 0x4e, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x63, 0x65, 0x72, 0x74, 0x52, 0x65, 0x66, + 0x4a, 0x53, 0x4f, 0x4e, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x18, 0x0e, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x66, 0x6f, 0x6c, 0x6c, + 0x6f, 0x77, 0x50, 0x6f, 0x72, 0x74, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x66, 0x6f, + 0x6c, 0x6c, 0x6f, 0x77, 0x50, 0x6f, 0x72, 0x74, 0x22, 0x36, 0x0a, 0x18, 0x46, 0x69, 0x6e, 0x64, + 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x49, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x49, 0x64, + 0x22, 0x3f, 0x0a, 0x19, 0x46, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4f, + 0x72, 0x69, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x22, 0x0a, + 0x06, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, + 0x70, 0x62, 0x2e, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x52, 0x06, 0x4f, 0x72, 0x69, 0x67, 0x69, + 0x6e, 0x22, 0x3c, 0x0a, 0x1e, 0x46, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, + 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x49, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x49, 0x64, 0x22, + 0x41, 0x0a, 0x1f, 0x46, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 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, + 0x73, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x4a, 0x53, 0x4f, 0x4e, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x4a, 0x53, + 0x4f, 0x4e, 0x32, 0xc1, 0x02, 0x0a, 0x0d, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x53, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x12, 0x41, 0x0a, 0x0c, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x72, + 0x69, 0x67, 0x69, 0x6e, 0x12, 0x17, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, + 0x70, 0x62, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x37, 0x0a, 0x0c, 0x75, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x12, 0x17, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x50, 0x43, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, + 0x12, 0x50, 0x0a, 0x11, 0x66, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4f, + 0x72, 0x69, 0x67, 0x69, 0x6e, 0x12, 0x1c, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x45, + 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, + 0x62, 0x6c, 0x65, 0x64, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x62, 0x0a, 0x17, 0x66, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, + 0x64, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x22, 0x2e, + 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4f, 0x72, + 0x69, 0x67, 0x69, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x23, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, + 0x65, 0x64, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/pkg/rpc/protos/models/model_origin.proto b/pkg/rpc/protos/models/model_origin.proto index 0cf1ecc..3963416 100644 --- a/pkg/rpc/protos/models/model_origin.proto +++ b/pkg/rpc/protos/models/model_origin.proto @@ -9,7 +9,8 @@ message Origin { int64 id = 1; bool isOn = 2; string name = 3; - NetworkAddress addr = 4; + NetworkAddress addr = 4; // 源站网络地址 + bytes ossJSON = 9; // 源站网络地址为oss:开头时有此内容 string description = 5; repeated string domains = 6; string host = 7; diff --git a/pkg/rpc/protos/service_origin.proto b/pkg/rpc/protos/service_origin.proto index b38b370..862ce90 100644 --- a/pkg/rpc/protos/service_origin.proto +++ b/pkg/rpc/protos/service_origin.proto @@ -24,20 +24,21 @@ service OriginService { // 创建源站 message CreateOriginRequest { - string name = 1; - NetworkAddress addr = 2; - string description = 3; - int32 weight = 4; - bool isOn = 5; - bytes connTimeoutJSON = 6; - bytes readTimeoutJSON = 7; - bytes idleTimeoutJSON = 8; - int32 maxConns = 9; - int32 maxIdleConns = 10; - repeated string domains = 11; - bytes certRefJSON = 12; - string host = 13; - bool followPort = 14; + string name = 1; // 名称,为可选项 + NetworkAddress addr = 2; // 源站网络地址 + bytes ossJSON = 15; // OSS配置信息,源站网络地址中protocol为oss:开头时需要设置此项 + string description = 3; // 描述,为可选项 + int32 weight = 4; // 权重,不小于0,一般设置为10 + bool isOn = 5; // 是否启用 + bytes connTimeoutJSON = 6; // 可选项 + bytes readTimeoutJSON = 7; // 可选项 + bytes idleTimeoutJSON = 8; // 可选项 + int32 maxConns = 9; // 可选项 + int32 maxIdleConns = 10; // 可选项 + repeated string domains = 11; // 可选项 + bytes certRefJSON = 12; // 可选项 + string host = 13; // 可选项 + bool followPort = 14; // 可选项 } message CreateOriginResponse { @@ -46,21 +47,22 @@ message CreateOriginResponse { // 修改源站 message UpdateOriginRequest { - int64 originId = 1; - string name = 2; - NetworkAddress addr = 3; - string description = 4; - int32 weight = 5; - bool isOn = 6; - bytes connTimeoutJSON = 7; - bytes readTimeoutJSON = 8; - bytes idleTimeoutJSON = 9; - int32 maxConns = 10; - int32 maxIdleConns = 11; - repeated string domains = 12; - bytes certRefJSON = 13; - string host = 14; - bool followPort = 15; + int64 originId = 1; // 源站ID + string name = 2; // 可选项 + NetworkAddress addr = 3; // 源站网络地址 + bytes ossJSON = 16; // OSS配置信息,源站网络地址中protocol为oss:开头时需要设置此项 + string description = 4; // 可选项 + int32 weight = 5; // 权重,不小于0,一般设置为10 + bool isOn = 6; // 是否启用 + bytes connTimeoutJSON = 7; // 可选项 + bytes readTimeoutJSON = 8; // 可选项 + bytes idleTimeoutJSON = 9; // 可选项 + int32 maxConns = 10; // 可选项 + int32 maxIdleConns = 11; // 可选项 + repeated string domains = 12; // 可选项 + bytes certRefJSON = 13; // 可选项 + string host = 14; // 可选项 + bool followPort = 15; // 可选项 } // 查找单个源站信息 diff --git a/pkg/serverconfigs/origin_config.go b/pkg/serverconfigs/origin_config.go index c4f4af5..bb541fe 100644 --- a/pkg/serverconfigs/origin_config.go +++ b/pkg/serverconfigs/origin_config.go @@ -4,6 +4,7 @@ import ( "context" "fmt" "github.com/TeaOSLab/EdgeCommon/pkg/configutils" + "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/ossconfigs" "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared" "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/sslconfigs" "strconv" @@ -18,6 +19,7 @@ type OriginConfig struct { Version int `yaml:"version" json:"version"` // 版本 Name string `yaml:"name" json:"name"` // 名称 Addr *NetworkAddressConfig `yaml:"addr" json:"addr"` // 地址 + OSS *ossconfigs.OSSConfig `yaml:"oss" json:"oss"` // 对象存储配置 Description string `yaml:"description" json:"description"` // 描述 TODO Code string `yaml:"code" json:"code"` // 代号 TODO @@ -171,6 +173,14 @@ func (this *OriginConfig) Init(ctx context.Context) error { } } + // oss + if this.OSS != nil { + err := this.OSS.Init() + if err != nil { + return err + } + } + return nil } @@ -217,3 +227,22 @@ func (this *OriginConfig) RequestURIHasVariables() bool { func (this *OriginConfig) UniqueKey() string { return this.uniqueKey } + +// IsOSS 判断当前源站是否为OSS +func (this *OriginConfig) IsOSS() bool { + return this.Addr != nil && ossconfigs.IsOSSProtocol(this.Addr.Protocol.String()) +} + +// AddrSummary 地址描述 +func (this *OriginConfig) AddrSummary() string { + if this.Addr == nil { + return "" + } + + // OSS + if ossconfigs.IsOSSProtocol(this.Addr.Protocol.String()) && this.OSS != nil { + return this.OSS.Summary() + } + + return this.Addr.Protocol.String() + "://" + this.Addr.Host + ":" + this.Addr.PortRange +} diff --git a/pkg/serverconfigs/ossconfigs/oss_config.go b/pkg/serverconfigs/ossconfigs/oss_config.go new file mode 100644 index 0000000..2fb6bfb --- /dev/null +++ b/pkg/serverconfigs/ossconfigs/oss_config.go @@ -0,0 +1,85 @@ +// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . + +package ossconfigs + +import ( + "encoding/json" + "reflect" +) + +type OSSConfig struct { + Type OSSType `yaml:"oss" json:"type"` + Options any `yaml:"options" json:"options"` +} + +func NewOSSConfig() *OSSConfig { + return &OSSConfig{} +} + +func (this *OSSConfig) Init() error { + if this.Options != nil { + // decode options + if reflect.TypeOf(this.Options).Kind() == reflect.Map { + optionsJSON, err := json.Marshal(this.Options) + if err != nil { + return err + } + + newOptions, decodeErr := DecodeOSSOptions(this.Type, optionsJSON) + if decodeErr != nil { + return decodeErr + } + if newOptions != nil { + this.Options = newOptions + } + } + + options, ok := this.Options.(OSSOptions) + if ok { + err := options.Init() + if err != nil { + return err + } + } + } + + return nil +} + +func (this *OSSConfig) Summary() string { + var name = "" + var found = false + for _, def := range FindAllOSSTypes() { + if def.Code == this.Type { + name = def.Name + found = true + break + } + } + if !found { + return "" + } + + var summary = "" + if this.Options != nil { + // decode options + if reflect.TypeOf(this.Options).Kind() == reflect.Map { + optionsJSON, err := json.Marshal(this.Options) + if err == nil { // ignore error + newOptions, decodeErr := DecodeOSSOptions(this.Type, optionsJSON) + if decodeErr == nil && newOptions != nil { + this.Options = newOptions + } + } + } + options, ok := this.Options.(OSSOptions) + if ok { + summary = options.Summary() + } + } + + if len(summary) == 0 { + return name + } + return name + " - " + summary +} diff --git a/pkg/serverconfigs/ossconfigs/oss_options.go b/pkg/serverconfigs/ossconfigs/oss_options.go new file mode 100644 index 0000000..b0cd7ca --- /dev/null +++ b/pkg/serverconfigs/ossconfigs/oss_options.go @@ -0,0 +1,9 @@ +// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . + +package ossconfigs + +type OSSOptions interface { + Init() error // 初始化 + Summary() string // 内容简述 + UniqueId() string // 唯一标识 +} diff --git a/pkg/serverconfigs/ossconfigs/oss_types.go b/pkg/serverconfigs/ossconfigs/oss_types.go new file mode 100644 index 0000000..7eb9ceb --- /dev/null +++ b/pkg/serverconfigs/ossconfigs/oss_types.go @@ -0,0 +1,16 @@ +// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . +//go:build !plus + +package ossconfigs + +import "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared" + +type OSSType = string + +func FindAllOSSTypes() []*shared.Definition { + return []*shared.Definition{} +} + +func DecodeOSSOptions(ossType OSSType, optionsJSON []byte) (any, error) { + return nil, nil +} diff --git a/pkg/serverconfigs/ossconfigs/oss_utils.go b/pkg/serverconfigs/ossconfigs/oss_utils.go new file mode 100644 index 0000000..759339d --- /dev/null +++ b/pkg/serverconfigs/ossconfigs/oss_utils.go @@ -0,0 +1,9 @@ +// Copyright 2023 GoEdge CDN goedge.cdn@gmail.com. All rights reserved. Official site: https://goedge.cn . + +package ossconfigs + +import "strings" + +func IsOSSProtocol(protocol string) bool { + return strings.HasPrefix(protocol, "oss:") +} diff --git a/pkg/serverconfigs/protocol.go b/pkg/serverconfigs/protocol.go index 266b1b1..c91d4d1 100644 --- a/pkg/serverconfigs/protocol.go +++ b/pkg/serverconfigs/protocol.go @@ -1,5 +1,7 @@ package serverconfigs +import "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/ossconfigs" + type Protocol string const ( @@ -52,7 +54,11 @@ func (this Protocol) IsUDPFamily() bool { return this == ProtocolUDP } -// 主协议 +func (this Protocol) IsOSS() bool { + return ossconfigs.IsOSSProtocol(this.String()) +} + +// Primary 主协议 func (this Protocol) Primary() Protocol { switch this { case ProtocolHTTP, ProtocolHTTP4, ProtocolHTTP6: @@ -72,7 +78,7 @@ func (this Protocol) Primary() Protocol { } } -// Scheme +// Scheme schema func (this Protocol) Scheme() string { return string(this) }