diff --git a/.env.example b/.env.example index c27966e..34c0b63 100644 --- a/.env.example +++ b/.env.example @@ -8,11 +8,12 @@ NODE_HOST = "0.0.0.0" SSL_CERT_FILE = /var/lib/gozargah-node/certs/ssl_cert.pem SSL_KEY_FILE = /var/lib/gozargah-node/certs/ssl_key.pem -SSL_CLIENT_CERT_FILE = /var/lib/gozargah-node/certs/ssl_client_cert.pem + +# api key must be a valid uuid (you can use any version you want) +API_KEY = xxxxxxxx-yyyy-zzzz-mmmm-aaaaaaaaaaa ### can be rest or grpc # SERVICE_PROTOCOL = grpc -# MAX_LOG_PER_REQUEST = 1000 ### for developers # DEBUG = false diff --git a/common/service.pb.go b/common/service.pb.go index 88be547..2868630 100644 --- a/common/service.pb.go +++ b/common/service.pb.go @@ -108,8 +108,6 @@ type BaseInfoResponse struct { Started bool `protobuf:"varint,1,opt,name=started,proto3" json:"started,omitempty"` CoreVersion string `protobuf:"bytes,2,opt,name=core_version,json=coreVersion,proto3" json:"core_version,omitempty"` NodeVersion string `protobuf:"bytes,3,opt,name=node_version,json=nodeVersion,proto3" json:"node_version,omitempty"` - SessionId string `protobuf:"bytes,4,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"` - Extra string `protobuf:"bytes,5,opt,name=extra,proto3" json:"extra,omitempty"` } func (x *BaseInfoResponse) Reset() { @@ -163,20 +161,6 @@ func (x *BaseInfoResponse) GetNodeVersion() string { return "" } -func (x *BaseInfoResponse) GetSessionId() string { - if x != nil { - return x.SessionId - } - return "" -} - -func (x *BaseInfoResponse) GetExtra() string { - if x != nil { - return x.Extra - } - return "" -} - type Backend struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1145,189 +1129,185 @@ var File_common_service_proto protoreflect.FileDescriptor var file_common_service_proto_rawDesc = []byte{ 0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x22, - 0x07, 0x0a, 0x05, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0xa7, 0x01, 0x0a, 0x10, 0x42, 0x61, 0x73, - 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, - 0x07, 0x73, 0x74, 0x61, 0x72, 0x74, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, - 0x73, 0x74, 0x61, 0x72, 0x74, 0x65, 0x64, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6f, 0x72, 0x65, 0x5f, - 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x63, - 0x6f, 0x72, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x21, 0x0a, 0x0c, 0x6e, 0x6f, - 0x64, 0x65, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0b, 0x6e, 0x6f, 0x64, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1d, 0x0a, - 0x0a, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x09, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, - 0x65, 0x78, 0x74, 0x72, 0x61, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x78, 0x74, - 0x72, 0x61, 0x22, 0x8f, 0x01, 0x0a, 0x07, 0x42, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x12, 0x28, - 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x14, 0x2e, 0x73, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x42, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x54, 0x79, - 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x6f, 0x6e, 0x66, - 0x69, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x12, 0x23, 0x0a, 0x05, 0x75, 0x73, 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x0d, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x05, - 0x75, 0x73, 0x65, 0x72, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x6b, 0x65, 0x65, 0x70, 0x5f, 0x61, 0x6c, - 0x69, 0x76, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x6b, 0x65, 0x65, 0x70, 0x41, - 0x6c, 0x69, 0x76, 0x65, 0x22, 0x1d, 0x0a, 0x03, 0x4c, 0x6f, 0x67, 0x12, 0x16, 0x0a, 0x06, 0x64, - 0x65, 0x74, 0x61, 0x69, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x65, 0x74, - 0x61, 0x69, 0x6c, 0x22, 0x58, 0x0a, 0x04, 0x53, 0x74, 0x61, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, + 0x07, 0x0a, 0x05, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x72, 0x0a, 0x10, 0x42, 0x61, 0x73, 0x65, + 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, + 0x73, 0x74, 0x61, 0x72, 0x74, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x73, + 0x74, 0x61, 0x72, 0x74, 0x65, 0x64, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6f, 0x72, 0x65, 0x5f, 0x76, + 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x6f, + 0x72, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x21, 0x0a, 0x0c, 0x6e, 0x6f, 0x64, + 0x65, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0b, 0x6e, 0x6f, 0x64, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x8f, 0x01, 0x0a, + 0x07, 0x42, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x12, 0x28, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x14, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x2e, 0x42, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, + 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x23, 0x0a, 0x05, 0x75, 0x73, + 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x73, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x05, 0x75, 0x73, 0x65, 0x72, 0x73, 0x12, + 0x1d, 0x0a, 0x0a, 0x6b, 0x65, 0x65, 0x70, 0x5f, 0x61, 0x6c, 0x69, 0x76, 0x65, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x04, 0x52, 0x09, 0x6b, 0x65, 0x65, 0x70, 0x41, 0x6c, 0x69, 0x76, 0x65, 0x22, 0x1d, + 0x0a, 0x03, 0x4c, 0x6f, 0x67, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x22, 0x58, 0x0a, + 0x04, 0x53, 0x74, 0x61, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, + 0x04, 0x6c, 0x69, 0x6e, 0x6b, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6c, 0x69, 0x6e, + 0x6b, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, + 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x33, 0x0a, 0x0c, 0x53, 0x74, 0x61, 0x74, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x23, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x73, + 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x2e, 0x53, 0x74, 0x61, 0x74, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x73, 0x22, 0x37, 0x0a, 0x0b, + 0x53, 0x74, 0x61, 0x74, 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, - 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, - 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6c, 0x69, 0x6e, 0x6b, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x04, 0x6c, 0x69, 0x6e, 0x6b, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x33, 0x0a, - 0x0c, 0x53, 0x74, 0x61, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x23, 0x0a, - 0x05, 0x73, 0x74, 0x61, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x73, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x52, 0x05, 0x73, 0x74, 0x61, - 0x74, 0x73, 0x22, 0x37, 0x0a, 0x0b, 0x53, 0x74, 0x61, 0x74, 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, 0x14, 0x0a, 0x05, 0x72, 0x65, 0x73, 0x65, 0x74, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x72, 0x65, 0x73, 0x65, 0x74, 0x22, 0x3e, 0x0a, 0x12, 0x4f, - 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x53, 0x74, 0x61, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xa6, 0x01, 0x0a, 0x19, - 0x53, 0x74, 0x61, 0x74, 0x73, 0x4f, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x49, 0x70, 0x4c, 0x69, 0x73, - 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x3d, 0x0a, - 0x03, 0x69, 0x70, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x73, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x73, 0x4f, 0x6e, 0x6c, 0x69, 0x6e, 0x65, - 0x49, 0x70, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x49, - 0x70, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x03, 0x69, 0x70, 0x73, 0x1a, 0x36, 0x0a, 0x08, - 0x49, 0x70, 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, 0x03, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x3a, 0x02, 0x38, 0x01, 0x22, 0xac, 0x02, 0x0a, 0x14, 0x42, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, - 0x53, 0x74, 0x61, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x23, 0x0a, - 0x0d, 0x6e, 0x75, 0x6d, 0x5f, 0x67, 0x6f, 0x72, 0x6f, 0x75, 0x74, 0x69, 0x6e, 0x65, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0c, 0x6e, 0x75, 0x6d, 0x47, 0x6f, 0x72, 0x6f, 0x75, 0x74, 0x69, - 0x6e, 0x65, 0x12, 0x15, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x5f, 0x67, 0x63, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0d, 0x52, 0x05, 0x6e, 0x75, 0x6d, 0x47, 0x63, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x6c, 0x6c, - 0x6f, 0x63, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x12, - 0x1f, 0x0a, 0x0b, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x41, 0x6c, 0x6c, 0x6f, 0x63, - 0x12, 0x10, 0x0a, 0x03, 0x73, 0x79, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x73, - 0x79, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x73, 0x18, 0x06, 0x20, - 0x01, 0x28, 0x04, 0x52, 0x07, 0x6d, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x73, 0x12, 0x14, 0x0a, 0x05, - 0x66, 0x72, 0x65, 0x65, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x66, 0x72, 0x65, - 0x65, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x6c, 0x69, 0x76, 0x65, 0x5f, 0x6f, 0x62, 0x6a, 0x65, 0x63, - 0x74, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b, 0x6c, 0x69, 0x76, 0x65, 0x4f, 0x62, - 0x6a, 0x65, 0x63, 0x74, 0x73, 0x12, 0x24, 0x0a, 0x0e, 0x70, 0x61, 0x75, 0x73, 0x65, 0x5f, 0x74, - 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x6e, 0x73, 0x18, 0x09, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0c, 0x70, - 0x61, 0x75, 0x73, 0x65, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x4e, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x75, - 0x70, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x75, 0x70, 0x74, - 0x69, 0x6d, 0x65, 0x22, 0xfb, 0x01, 0x0a, 0x13, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x53, 0x74, - 0x61, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x6d, - 0x65, 0x6d, 0x5f, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, - 0x6d, 0x65, 0x6d, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x12, 0x19, 0x0a, 0x08, 0x6d, 0x65, 0x6d, 0x5f, - 0x75, 0x73, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x07, 0x6d, 0x65, 0x6d, 0x55, - 0x73, 0x65, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x63, 0x70, 0x75, 0x5f, 0x63, 0x6f, 0x72, 0x65, 0x73, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x63, 0x70, 0x75, 0x43, 0x6f, 0x72, 0x65, 0x73, - 0x12, 0x1b, 0x0a, 0x09, 0x63, 0x70, 0x75, 0x5f, 0x75, 0x73, 0x61, 0x67, 0x65, 0x18, 0x04, 0x20, - 0x01, 0x28, 0x01, 0x52, 0x08, 0x63, 0x70, 0x75, 0x55, 0x73, 0x61, 0x67, 0x65, 0x12, 0x38, 0x0a, - 0x18, 0x69, 0x6e, 0x63, 0x6f, 0x6d, 0x69, 0x6e, 0x67, 0x5f, 0x62, 0x61, 0x6e, 0x64, 0x77, 0x69, - 0x64, 0x74, 0x68, 0x5f, 0x73, 0x70, 0x65, 0x65, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, - 0x16, 0x69, 0x6e, 0x63, 0x6f, 0x6d, 0x69, 0x6e, 0x67, 0x42, 0x61, 0x6e, 0x64, 0x77, 0x69, 0x64, - 0x74, 0x68, 0x53, 0x70, 0x65, 0x65, 0x64, 0x12, 0x38, 0x0a, 0x18, 0x6f, 0x75, 0x74, 0x67, 0x6f, + 0x14, 0x0a, 0x05, 0x72, 0x65, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, + 0x72, 0x65, 0x73, 0x65, 0x74, 0x22, 0x3e, 0x0a, 0x12, 0x4f, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x53, + 0x74, 0x61, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, + 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xa6, 0x01, 0x0a, 0x19, 0x53, 0x74, 0x61, 0x74, 0x73, 0x4f, + 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x49, 0x70, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x3d, 0x0a, 0x03, 0x69, 0x70, 0x73, 0x18, 0x02, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x53, + 0x74, 0x61, 0x74, 0x73, 0x4f, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x49, 0x70, 0x4c, 0x69, 0x73, 0x74, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x49, 0x70, 0x73, 0x45, 0x6e, 0x74, 0x72, + 0x79, 0x52, 0x03, 0x69, 0x70, 0x73, 0x1a, 0x36, 0x0a, 0x08, 0x49, 0x70, 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, 0x03, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xac, + 0x02, 0x0a, 0x14, 0x42, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x53, 0x74, 0x61, 0x74, 0x73, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x6e, 0x75, 0x6d, 0x5f, 0x67, + 0x6f, 0x72, 0x6f, 0x75, 0x74, 0x69, 0x6e, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0c, + 0x6e, 0x75, 0x6d, 0x47, 0x6f, 0x72, 0x6f, 0x75, 0x74, 0x69, 0x6e, 0x65, 0x12, 0x15, 0x0a, 0x06, + 0x6e, 0x75, 0x6d, 0x5f, 0x67, 0x63, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x6e, 0x75, + 0x6d, 0x47, 0x63, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x04, 0x52, 0x05, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x12, 0x1f, 0x0a, 0x0b, 0x74, 0x6f, 0x74, + 0x61, 0x6c, 0x5f, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, + 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x41, 0x6c, 0x6c, 0x6f, 0x63, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x79, + 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x73, 0x79, 0x73, 0x12, 0x18, 0x0a, 0x07, + 0x6d, 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x04, 0x52, 0x07, 0x6d, + 0x61, 0x6c, 0x6c, 0x6f, 0x63, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x66, 0x72, 0x65, 0x65, 0x73, 0x18, + 0x07, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x66, 0x72, 0x65, 0x65, 0x73, 0x12, 0x21, 0x0a, 0x0c, + 0x6c, 0x69, 0x76, 0x65, 0x5f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x18, 0x08, 0x20, 0x01, + 0x28, 0x04, 0x52, 0x0b, 0x6c, 0x69, 0x76, 0x65, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x12, + 0x24, 0x0a, 0x0e, 0x70, 0x61, 0x75, 0x73, 0x65, 0x5f, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x6e, + 0x73, 0x18, 0x09, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0c, 0x70, 0x61, 0x75, 0x73, 0x65, 0x54, 0x6f, + 0x74, 0x61, 0x6c, 0x4e, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x18, + 0x0a, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x75, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x22, 0xfb, 0x01, + 0x0a, 0x13, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x53, 0x74, 0x61, 0x74, 0x73, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x65, 0x6d, 0x5f, 0x74, 0x6f, 0x74, + 0x61, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x6d, 0x65, 0x6d, 0x54, 0x6f, 0x74, + 0x61, 0x6c, 0x12, 0x19, 0x0a, 0x08, 0x6d, 0x65, 0x6d, 0x5f, 0x75, 0x73, 0x65, 0x64, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x04, 0x52, 0x07, 0x6d, 0x65, 0x6d, 0x55, 0x73, 0x65, 0x64, 0x12, 0x1b, 0x0a, + 0x09, 0x63, 0x70, 0x75, 0x5f, 0x63, 0x6f, 0x72, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, + 0x52, 0x08, 0x63, 0x70, 0x75, 0x43, 0x6f, 0x72, 0x65, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x63, 0x70, + 0x75, 0x5f, 0x75, 0x73, 0x61, 0x67, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x01, 0x52, 0x08, 0x63, + 0x70, 0x75, 0x55, 0x73, 0x61, 0x67, 0x65, 0x12, 0x38, 0x0a, 0x18, 0x69, 0x6e, 0x63, 0x6f, 0x6d, 0x69, 0x6e, 0x67, 0x5f, 0x62, 0x61, 0x6e, 0x64, 0x77, 0x69, 0x64, 0x74, 0x68, 0x5f, 0x73, 0x70, - 0x65, 0x65, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x04, 0x52, 0x16, 0x6f, 0x75, 0x74, 0x67, 0x6f, + 0x65, 0x65, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x16, 0x69, 0x6e, 0x63, 0x6f, 0x6d, 0x69, 0x6e, 0x67, 0x42, 0x61, 0x6e, 0x64, 0x77, 0x69, 0x64, 0x74, 0x68, 0x53, 0x70, 0x65, 0x65, - 0x64, 0x22, 0x17, 0x0a, 0x05, 0x56, 0x6d, 0x65, 0x73, 0x73, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x2b, 0x0a, 0x05, 0x56, 0x6c, - 0x65, 0x73, 0x73, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x6c, 0x6f, 0x77, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x04, 0x66, 0x6c, 0x6f, 0x77, 0x22, 0x24, 0x0a, 0x06, 0x54, 0x72, 0x6f, 0x6a, 0x61, - 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x22, 0x41, 0x0a, - 0x0b, 0x53, 0x68, 0x61, 0x64, 0x6f, 0x77, 0x73, 0x6f, 0x63, 0x6b, 0x73, 0x12, 0x1a, 0x0a, 0x08, - 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, - 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x6d, 0x65, 0x74, 0x68, - 0x6f, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, - 0x22, 0xb4, 0x01, 0x0a, 0x05, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x12, 0x24, 0x0a, 0x05, 0x76, 0x6d, - 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x73, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0x2e, 0x56, 0x6d, 0x65, 0x73, 0x73, 0x52, 0x05, 0x76, 0x6d, 0x65, 0x73, 0x73, - 0x12, 0x24, 0x0a, 0x05, 0x76, 0x6c, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x0e, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x56, 0x6c, 0x65, 0x73, 0x73, 0x52, - 0x05, 0x76, 0x6c, 0x65, 0x73, 0x73, 0x12, 0x27, 0x0a, 0x06, 0x74, 0x72, 0x6f, 0x6a, 0x61, 0x6e, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0x2e, 0x54, 0x72, 0x6f, 0x6a, 0x61, 0x6e, 0x52, 0x06, 0x74, 0x72, 0x6f, 0x6a, 0x61, 0x6e, 0x12, - 0x36, 0x0a, 0x0b, 0x73, 0x68, 0x61, 0x64, 0x6f, 0x77, 0x73, 0x6f, 0x63, 0x6b, 0x73, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x53, - 0x68, 0x61, 0x64, 0x6f, 0x77, 0x73, 0x6f, 0x63, 0x6b, 0x73, 0x52, 0x0b, 0x73, 0x68, 0x61, 0x64, - 0x6f, 0x77, 0x73, 0x6f, 0x63, 0x6b, 0x73, 0x22, 0x62, 0x0a, 0x04, 0x55, 0x73, 0x65, 0x72, 0x12, - 0x14, 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, - 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x28, 0x0a, 0x07, 0x70, 0x72, 0x6f, 0x78, 0x69, 0x65, 0x73, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0x2e, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x52, 0x07, 0x70, 0x72, 0x6f, 0x78, 0x69, 0x65, 0x73, 0x12, - 0x1a, 0x0a, 0x08, 0x69, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, - 0x09, 0x52, 0x08, 0x69, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x73, 0x22, 0x2c, 0x0a, 0x05, 0x55, - 0x73, 0x65, 0x72, 0x73, 0x12, 0x23, 0x0a, 0x05, 0x75, 0x73, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x55, 0x73, - 0x65, 0x72, 0x52, 0x05, 0x75, 0x73, 0x65, 0x72, 0x73, 0x2a, 0x17, 0x0a, 0x0b, 0x42, 0x61, 0x63, - 0x6b, 0x65, 0x6e, 0x64, 0x54, 0x79, 0x70, 0x65, 0x12, 0x08, 0x0a, 0x04, 0x58, 0x52, 0x41, 0x59, - 0x10, 0x00, 0x32, 0xea, 0x07, 0x0a, 0x0b, 0x4e, 0x6f, 0x64, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x12, 0x36, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x72, 0x74, 0x12, 0x10, 0x2e, 0x73, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x42, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x1a, 0x19, 0x2e, + 0x64, 0x12, 0x38, 0x0a, 0x18, 0x6f, 0x75, 0x74, 0x67, 0x6f, 0x69, 0x6e, 0x67, 0x5f, 0x62, 0x61, + 0x6e, 0x64, 0x77, 0x69, 0x64, 0x74, 0x68, 0x5f, 0x73, 0x70, 0x65, 0x65, 0x64, 0x18, 0x06, 0x20, + 0x01, 0x28, 0x04, 0x52, 0x16, 0x6f, 0x75, 0x74, 0x67, 0x6f, 0x69, 0x6e, 0x67, 0x42, 0x61, 0x6e, + 0x64, 0x77, 0x69, 0x64, 0x74, 0x68, 0x53, 0x70, 0x65, 0x65, 0x64, 0x22, 0x17, 0x0a, 0x05, 0x56, + 0x6d, 0x65, 0x73, 0x73, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x02, 0x69, 0x64, 0x22, 0x2b, 0x0a, 0x05, 0x56, 0x6c, 0x65, 0x73, 0x73, 0x12, 0x0e, 0x0a, + 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, + 0x04, 0x66, 0x6c, 0x6f, 0x77, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x66, 0x6c, 0x6f, + 0x77, 0x22, 0x24, 0x0a, 0x06, 0x54, 0x72, 0x6f, 0x6a, 0x61, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x70, + 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, + 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x22, 0x41, 0x0a, 0x0b, 0x53, 0x68, 0x61, 0x64, 0x6f, + 0x77, 0x73, 0x6f, 0x63, 0x6b, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, + 0x72, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, + 0x72, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x22, 0xb4, 0x01, 0x0a, 0x05, 0x50, + 0x72, 0x6f, 0x78, 0x79, 0x12, 0x24, 0x0a, 0x05, 0x76, 0x6d, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x56, 0x6d, + 0x65, 0x73, 0x73, 0x52, 0x05, 0x76, 0x6d, 0x65, 0x73, 0x73, 0x12, 0x24, 0x0a, 0x05, 0x76, 0x6c, + 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x73, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x2e, 0x56, 0x6c, 0x65, 0x73, 0x73, 0x52, 0x05, 0x76, 0x6c, 0x65, 0x73, 0x73, + 0x12, 0x27, 0x0a, 0x06, 0x74, 0x72, 0x6f, 0x6a, 0x61, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x0f, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x54, 0x72, 0x6f, 0x6a, 0x61, + 0x6e, 0x52, 0x06, 0x74, 0x72, 0x6f, 0x6a, 0x61, 0x6e, 0x12, 0x36, 0x0a, 0x0b, 0x73, 0x68, 0x61, + 0x64, 0x6f, 0x77, 0x73, 0x6f, 0x63, 0x6b, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, + 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x53, 0x68, 0x61, 0x64, 0x6f, 0x77, 0x73, + 0x6f, 0x63, 0x6b, 0x73, 0x52, 0x0b, 0x73, 0x68, 0x61, 0x64, 0x6f, 0x77, 0x73, 0x6f, 0x63, 0x6b, + 0x73, 0x22, 0x62, 0x0a, 0x04, 0x55, 0x73, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6d, 0x61, + 0x69, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x12, + 0x28, 0x0a, 0x07, 0x70, 0x72, 0x6f, 0x78, 0x69, 0x65, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x0e, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x78, 0x79, + 0x52, 0x07, 0x70, 0x72, 0x6f, 0x78, 0x69, 0x65, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x6e, 0x62, + 0x6f, 0x75, 0x6e, 0x64, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x69, 0x6e, 0x62, + 0x6f, 0x75, 0x6e, 0x64, 0x73, 0x22, 0x2c, 0x0a, 0x05, 0x55, 0x73, 0x65, 0x72, 0x73, 0x12, 0x23, + 0x0a, 0x05, 0x75, 0x73, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, + 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x05, 0x75, 0x73, + 0x65, 0x72, 0x73, 0x2a, 0x17, 0x0a, 0x0b, 0x42, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x54, 0x79, + 0x70, 0x65, 0x12, 0x08, 0x0a, 0x04, 0x58, 0x52, 0x41, 0x59, 0x10, 0x00, 0x32, 0xea, 0x07, 0x0a, + 0x0b, 0x4e, 0x6f, 0x64, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x36, 0x0a, 0x05, + 0x53, 0x74, 0x61, 0x72, 0x74, 0x12, 0x10, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, + 0x42, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x1a, 0x19, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x2e, 0x42, 0x61, 0x73, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0x00, 0x12, 0x28, 0x0a, 0x04, 0x53, 0x74, 0x6f, 0x70, 0x12, 0x0e, 0x2e, 0x73, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x0e, 0x2e, 0x73, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x12, 0x3a, + 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x42, 0x61, 0x73, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x0e, 0x2e, + 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x19, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x42, 0x61, 0x73, 0x65, 0x49, 0x6e, 0x66, 0x6f, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x28, 0x0a, 0x04, 0x53, 0x74, - 0x6f, 0x70, 0x12, 0x0e, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6d, 0x70, - 0x74, 0x79, 0x1a, 0x0e, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6d, 0x70, - 0x74, 0x79, 0x22, 0x00, 0x12, 0x3a, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x42, 0x61, 0x73, 0x65, 0x49, - 0x6e, 0x66, 0x6f, 0x12, 0x0e, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6d, - 0x70, 0x74, 0x79, 0x1a, 0x19, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x42, 0x61, - 0x73, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, - 0x12, 0x2b, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x4c, 0x6f, 0x67, 0x73, 0x12, 0x0e, 0x2e, 0x73, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x0c, 0x2e, 0x73, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x4c, 0x6f, 0x67, 0x22, 0x00, 0x30, 0x01, 0x12, 0x40, 0x0a, - 0x0e, 0x47, 0x65, 0x74, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x53, 0x74, 0x61, 0x74, 0x73, 0x12, - 0x0e, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, - 0x1c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, - 0x53, 0x74, 0x61, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, - 0x42, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x42, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x53, 0x74, 0x61, - 0x74, 0x73, 0x12, 0x0e, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6d, 0x70, - 0x74, 0x79, 0x1a, 0x1d, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x42, 0x61, 0x63, - 0x6b, 0x65, 0x6e, 0x64, 0x53, 0x74, 0x61, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0x00, 0x12, 0x42, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x4f, 0x75, 0x74, 0x62, 0x6f, 0x75, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x2b, 0x0a, 0x07, 0x47, 0x65, + 0x74, 0x4c, 0x6f, 0x67, 0x73, 0x12, 0x0e, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, + 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x0c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, + 0x4c, 0x6f, 0x67, 0x22, 0x00, 0x30, 0x01, 0x12, 0x40, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x53, 0x79, + 0x73, 0x74, 0x65, 0x6d, 0x53, 0x74, 0x61, 0x74, 0x73, 0x12, 0x0e, 0x2e, 0x73, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x1c, 0x2e, 0x73, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x2e, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x53, 0x74, 0x61, 0x74, 0x73, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x42, 0x0a, 0x0f, 0x47, 0x65, 0x74, + 0x42, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x53, 0x74, 0x61, 0x74, 0x73, 0x12, 0x0e, 0x2e, 0x73, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x1d, 0x2e, 0x73, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x42, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x53, 0x74, + 0x61, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x42, 0x0a, + 0x11, 0x47, 0x65, 0x74, 0x4f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x73, 0x53, 0x74, 0x61, + 0x74, 0x73, 0x12, 0x14, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x53, 0x74, 0x61, + 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x00, 0x12, 0x41, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x4f, 0x75, 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, + 0x53, 0x74, 0x61, 0x74, 0x73, 0x12, 0x14, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, + 0x53, 0x74, 0x61, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x73, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0x00, 0x12, 0x41, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x73, 0x53, 0x74, 0x61, 0x74, 0x73, 0x12, 0x14, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x41, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x4f, 0x75, - 0x74, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x53, 0x74, 0x61, 0x74, 0x73, 0x12, 0x14, 0x2e, 0x73, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x15, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x53, 0x74, 0x61, 0x74, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x41, 0x0a, 0x10, 0x47, 0x65, - 0x74, 0x49, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x73, 0x53, 0x74, 0x61, 0x74, 0x73, 0x12, 0x14, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x40, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x49, 0x6e, + 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x53, 0x74, 0x61, 0x74, 0x73, 0x12, 0x14, 0x2e, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x15, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3e, 0x0a, 0x0d, 0x47, 0x65, 0x74, + 0x55, 0x73, 0x65, 0x72, 0x73, 0x53, 0x74, 0x61, 0x74, 0x73, 0x12, 0x14, 0x2e, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x15, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3d, 0x0a, 0x0c, 0x47, 0x65, 0x74, + 0x55, 0x73, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x73, 0x12, 0x14, 0x2e, 0x73, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x15, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x49, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x55, + 0x73, 0x65, 0x72, 0x4f, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x53, 0x74, 0x61, 0x74, 0x73, 0x12, 0x14, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x53, - 0x74, 0x61, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x40, 0x0a, - 0x0f, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x53, 0x74, 0x61, 0x74, 0x73, - 0x12, 0x14, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0x2e, 0x53, 0x74, 0x61, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, - 0x3e, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x73, 0x53, 0x74, 0x61, 0x74, 0x73, - 0x12, 0x14, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0x2e, 0x53, 0x74, 0x61, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, - 0x3d, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x73, 0x12, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x4f, + 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x53, 0x74, 0x61, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x00, 0x12, 0x56, 0x0a, 0x18, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x4f, 0x6e, + 0x6c, 0x69, 0x6e, 0x65, 0x49, 0x70, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x74, 0x61, 0x74, 0x73, 0x12, 0x14, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, - 0x53, 0x74, 0x61, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x49, - 0x0a, 0x12, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x4f, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x53, - 0x74, 0x61, 0x74, 0x73, 0x12, 0x14, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x53, - 0x74, 0x61, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x73, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x2e, 0x4f, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x53, 0x74, 0x61, 0x74, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x56, 0x0a, 0x18, 0x47, 0x65, 0x74, - 0x55, 0x73, 0x65, 0x72, 0x4f, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x49, 0x70, 0x4c, 0x69, 0x73, 0x74, - 0x53, 0x74, 0x61, 0x74, 0x73, 0x12, 0x14, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, - 0x53, 0x74, 0x61, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x73, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x73, 0x4f, 0x6e, 0x6c, 0x69, 0x6e, - 0x65, 0x49, 0x70, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0x00, 0x12, 0x2d, 0x0a, 0x08, 0x53, 0x79, 0x6e, 0x63, 0x55, 0x73, 0x65, 0x72, 0x12, 0x0d, 0x2e, - 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x1a, 0x0e, 0x2e, 0x73, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x28, 0x01, - 0x12, 0x2d, 0x0a, 0x09, 0x53, 0x79, 0x6e, 0x63, 0x55, 0x73, 0x65, 0x72, 0x73, 0x12, 0x0e, 0x2e, - 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x73, 0x1a, 0x0e, 0x2e, - 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x42, - 0x18, 0x5a, 0x16, 0x6d, 0x61, 0x72, 0x7a, 0x62, 0x61, 0x6e, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x5f, - 0x67, 0x6f, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, + 0x53, 0x74, 0x61, 0x74, 0x73, 0x4f, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x49, 0x70, 0x4c, 0x69, 0x73, + 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x2d, 0x0a, 0x08, 0x53, + 0x79, 0x6e, 0x63, 0x55, 0x73, 0x65, 0x72, 0x12, 0x0d, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x1a, 0x0e, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x28, 0x01, 0x12, 0x2d, 0x0a, 0x09, 0x53, 0x79, + 0x6e, 0x63, 0x55, 0x73, 0x65, 0x72, 0x73, 0x12, 0x0e, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x73, 0x1a, 0x0e, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x42, 0x18, 0x5a, 0x16, 0x6d, 0x61, 0x72, + 0x7a, 0x62, 0x61, 0x6e, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x67, 0x6f, 0x2f, 0x63, 0x6f, 0x6d, + 0x6d, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/common/service.proto b/common/service.proto index 21e289d..62621f2 100644 --- a/common/service.proto +++ b/common/service.proto @@ -11,8 +11,6 @@ message BaseInfoResponse { bool started = 1; string core_version = 2; string node_version = 3; - string session_id = 4; - string extra = 5; } enum BackendType { diff --git a/config/config.go b/config/config.go index 8dd8b76..82f3955 100644 --- a/config/config.go +++ b/config/config.go @@ -1,6 +1,7 @@ package config import ( + "github.com/google/uuid" "log" "os" "regexp" @@ -20,10 +21,12 @@ func init() { XrayAssetsPath = GetEnv("XRAY_ASSETS_PATH", "/usr/local/share/xray") SslCertFile = GetEnv("SSL_CERT_FILE", "/var/lib/gozargah-node/certs/ssl_cert.pem") SslKeyFile = GetEnv("SSL_KEY_FILE", "/var/lib/gozargah-node/certs/ssl_key.pem") - SslClientCertFile = GetEnv("SSL_CLIENT_CERT_FILE", "/var/lib/gozargah-node/certs/ssl_client_cert.pem") + ApiKey, err = GetEnvAsUUID("API_KEY") + if err != nil { + log.Printf("[Error] Faild to load API Key, error: %v", err) + } GeneratedConfigPath = GetEnv("GENERATED_CONFIG_PATH", "/var/lib/gozargah-node/generated/") ServiceProtocol = GetEnv("SERVICE_PROTOCOL", "grpc") - MaxLogPerRequest = GetEnvAsInt("MAX_LOG_PER_REQUEST", 1000) Debug = GetEnvAsBool("DEBUG", false) nodeHostStr := GetEnv("NODE_HOST", "0.0.0.0") @@ -42,17 +45,16 @@ func init() { } // Warning: only use in tests -func SetEnv(port, maxLogPerRequest int, host, xrayExecutablePath, xrayAssetsPath, sslCertFile, sslKeyFile, sslClientCertFile, - serviceProtocol, generatedConfigPath string, debug bool) { +func SetEnv(port int, host, xrayExecutablePath, xrayAssetsPath, sslCertFile, sslKeyFile, + serviceProtocol, generatedConfigPath string, apiKey uuid.UUID, debug bool) { ServicePort = port NodeHost = host XrayExecutablePath = xrayExecutablePath XrayAssetsPath = xrayAssetsPath SslCertFile = sslCertFile SslKeyFile = sslKeyFile - SslClientCertFile = sslClientCertFile + ApiKey = apiKey ServiceProtocol = serviceProtocol - MaxLogPerRequest = maxLogPerRequest GeneratedConfigPath = generatedConfigPath Debug = debug } @@ -81,6 +83,16 @@ func GetEnvAsInt(name string, defaultVal int) int { return defaultVal } +func GetEnvAsUUID(name string) (uuid.UUID, error) { + valStr := GetEnv(name, "") + + val, err := uuid.Parse(valStr) + if err != nil { + return uuid.Nil, err + } + return val, nil +} + var ( ServicePort int NodeHost string @@ -88,9 +100,8 @@ var ( XrayAssetsPath string SslCertFile string SslKeyFile string - SslClientCertFile string + ApiKey uuid.UUID ServiceProtocol string - MaxLogPerRequest int Debug bool GeneratedConfigPath string ) diff --git a/controller/controller.go b/controller/controller.go index 081932a..8f2d856 100644 --- a/controller/controller.go +++ b/controller/controller.go @@ -24,7 +24,7 @@ type Service interface { type Controller struct { backend backend.Backend - sessionID uuid.UUID + ApiKey uuid.UUID apiPort int clientIP string lastRequest time.Time @@ -36,21 +36,20 @@ type Controller struct { func (c *Controller) Init() { c.mu.Lock() defer c.mu.Unlock() - c.sessionID = uuid.Nil + c.ApiKey = config.ApiKey c.apiPort = tools.FindFreePort() _, c.cancelFunc = context.WithCancel(context.Background()) } -func (c *Controller) GetSessionID() uuid.UUID { +func (c *Controller) GetApiKey() uuid.UUID { c.mu.RLock() defer c.mu.RUnlock() - return c.sessionID + return c.ApiKey } func (c *Controller) Connect(ip string, keepAlive uint64) { c.mu.Lock() defer c.mu.Unlock() - c.sessionID = uuid.New() c.lastRequest = time.Now() c.clientIP = ip @@ -76,7 +75,6 @@ func (c *Controller) Disconnect() { apiPort := tools.FindFreePort() c.apiPort = apiPort - c.sessionID = uuid.Nil c.clientIP = "" } @@ -160,7 +158,7 @@ func (c *Controller) GetStats() *common.SystemStatsResponse { return c.stats } -func (c *Controller) BaseInfoResponse(includeID bool, extra string) *common.BaseInfoResponse { +func (c *Controller) BaseInfoResponse() *common.BaseInfoResponse { c.mu.Lock() defer c.mu.Unlock() @@ -168,16 +166,12 @@ func (c *Controller) BaseInfoResponse(includeID bool, extra string) *common.Base Started: false, CoreVersion: "", NodeVersion: NodeVersion, - Extra: extra, } if c.backend != nil { response.Started = c.backend.Started() response.CoreVersion = c.backend.GetVersion() } - if includeID { - response.SessionId = c.sessionID.String() - } return response } diff --git a/controller/rest/base.go b/controller/rest/base.go index a04d475..eed9ae0 100644 --- a/controller/rest/base.go +++ b/controller/rest/base.go @@ -13,7 +13,7 @@ import ( ) func (s *Service) Base(w http.ResponseWriter, _ *http.Request) { - common.SendProtoResponse(w, s.BaseInfoResponse(false, "")) + common.SendProtoResponse(w, s.BaseInfoResponse()) } func (s *Service) Start(w http.ResponseWriter, r *http.Request) { @@ -36,18 +36,15 @@ func (s *Service) Start(w http.ResponseWriter, r *http.Request) { s.Connect(ip, keepAlive) - log.Println(ip, " connected, Session ID = ", s.GetSessionID()) - if err = s.StartBackend(ctx, backendType); err != nil { http.Error(w, err.Error(), http.StatusServiceUnavailable) return } - common.SendProtoResponse(w, s.BaseInfoResponse(true, "")) + common.SendProtoResponse(w, s.BaseInfoResponse()) } func (s *Service) Stop(w http.ResponseWriter, _ *http.Request) { - log.Println(s.GetIP(), " disconnected, Session ID = ", s.GetSessionID()) s.Disconnect() common.SendProtoResponse(w, &common.Empty{}) diff --git a/controller/rest/middleware.go b/controller/rest/middleware.go index 4a8a72f..23bd777 100644 --- a/controller/rest/middleware.go +++ b/controller/rest/middleware.go @@ -2,56 +2,30 @@ package rest import ( "fmt" - "log" - "net" - "net/http" - "strings" - "github.com/go-chi/chi/v5/middleware" "github.com/google/uuid" + "log" + "net/http" ) -func (s *Service) checkSessionIDMiddleware(next http.Handler) http.Handler { +func (s *Service) validateApiKey(next http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - // check ip - clientIP := s.GetIP() - clientID := s.GetSessionID() - if clientIP == "" || clientID == uuid.Nil { - http.Error(w, "please connect first", http.StatusTooEarly) - return - } - - // check ip - ip, _, err := net.SplitHostPort(r.RemoteAddr) - switch { - case err != nil: - http.Error(w, err.Error(), http.StatusBadRequest) - return - case ip != s.GetIP(): - http.Error(w, "IP address is not valid", http.StatusForbidden) - return - } - - authHeader := r.Header.Get("Authorization") - if authHeader == "" { - http.Error(w, "please connect first", http.StatusUnauthorized) + apiKeyHeader := r.Header.Get("x-api-key") + if apiKeyHeader == "" { + http.Error(w, "missing x-api-key header", http.StatusUnauthorized) return } - parts := strings.Split(authHeader, " ") - if len(parts) != 2 { - http.Error(w, "invalid Authorization header format", http.StatusUnauthorized) - return - } + // check API key + apiKey := s.GetApiKey() - tokenString := parts[1] - sessionID, err := uuid.Parse(tokenString) + key, err := uuid.Parse(apiKeyHeader) switch { case err != nil: - http.Error(w, "please send valid uuid", http.StatusUnprocessableEntity) + http.Error(w, "invalid api key format: must be a valid UUID", http.StatusUnprocessableEntity) return - case sessionID != clientID: - http.Error(w, "session id mismatch.", http.StatusForbidden) + case key != apiKey: + http.Error(w, "api key mismatch", http.StatusForbidden) return } diff --git a/controller/rest/rest_test.go b/controller/rest/rest_test.go index fe515d2..268638e 100644 --- a/controller/rest/rest_test.go +++ b/controller/rest/rest_test.go @@ -30,8 +30,7 @@ var ( xrayAssetsPath = "/usr/local/share/xray" sslCertFile = "../../certs/ssl_cert.pem" sslKeyFile = "../../certs/ssl_key.pem" - sslClientCertFile = "../../certs/ssl_client_cert.pem" - sslClientKeyFile = "../../certs/ssl_client_key.pem" + apiKey = uuid.New() generatedConfigPath = "../../generated/" addr = fmt.Sprintf("%s:%d", nodeHost, servicePort) configPath = "../../backend/xray/config.json" @@ -52,8 +51,8 @@ func createHTTPClient(tlsConfig *tls.Config) *http.Client { } func TestRESTConnection(t *testing.T) { - config.SetEnv(servicePort, 1000, nodeHost, xrayExecutablePath, xrayAssetsPath, - sslCertFile, sslKeyFile, sslClientCertFile, "rest", generatedConfigPath, true) + config.SetEnv(servicePort, nodeHost, xrayExecutablePath, xrayAssetsPath, + sslCertFile, sslKeyFile, "rest", generatedConfigPath, apiKey, true) nodeLogger.SetOutputMode(true) @@ -65,12 +64,7 @@ func TestRESTConnection(t *testing.T) { } } - clientFileExists := tools.FileExists(sslClientCertFile) - if !clientFileExists { - t.Fatal("SSL_CLIENT_CERT_FILE is required.") - } - - tlsConfig, err := tools.LoadTLSCredentials(sslCertFile, sslKeyFile, sslClientCertFile, false) + tlsConfig, err := tools.LoadTLSCredentials(sslCertFile, sslKeyFile) if err != nil { t.Fatal(err) } @@ -81,16 +75,14 @@ func TestRESTConnection(t *testing.T) { } defer s.Disconnect() - creds, err := tools.LoadTLSCredentials(sslClientCertFile, sslClientKeyFile, sslCertFile, true) + certPool, err := tools.LoadClientPool(sslCertFile) if err != nil { t.Fatal(err) } + client := tools.CreateHTTPClient(certPool, nodeHost) url := fmt.Sprintf("https://%s", addr) - client := createHTTPClient(creds) - sessionId := "" - createAuthenticatedRequest := func(method, endpoint string, data proto.Message, response proto.Message) error { body, err := proto.Marshal(data) if err != nil { @@ -101,7 +93,7 @@ func TestRESTConnection(t *testing.T) { if err != nil { return err } - req.Header.Set("Authorization", "Bearer "+sessionId) + req.Header.Set("x-api-key", apiKey.String()) if body != nil { req.Header.Set("Content-Type", "application/x-protobuf") } @@ -124,7 +116,7 @@ func TestRESTConnection(t *testing.T) { if err != nil { return nil, err } - req.Header.Set("Authorization", "Bearer "+sessionId) + req.Header.Set("x-api-key", apiKey.String()) resp, err := client.Do(req) if err != nil { @@ -207,11 +199,6 @@ func TestRESTConnection(t *testing.T) { t.Fatalf("Failed to start backend: %v", err) } - sessionId = baseInfoResp.GetSessionId() - if sessionId == "" { - t.Fatal("No session ID received") - } - var stats common.StatResponse // Try To Get Outbounds Stats if err = createAuthenticatedRequest("GET", "/stats/outbounds", &common.StatRequest{Reset_: true}, &stats); err != nil { diff --git a/controller/rest/service.go b/controller/rest/service.go index 4e3c509..99e5d5f 100644 --- a/controller/rest/service.go +++ b/controller/rest/service.go @@ -22,37 +22,32 @@ func (s *Service) setRouter() { // Api Handlers router.Use(LogRequest) + router.Use(s.validateApiKey) router.Post("/start", s.Start) - - router.Group(func(protected chi.Router) { - // check session and need to return data as context - protected.Use(s.checkSessionIDMiddleware) - - protected.Get("/info", s.Base) - protected.Put("/stop", s.Stop) - protected.Get("/logs", s.GetLogs) - - protected.Get("/stats/system", s.GetSystemStats) - - protected.Group(func(private chi.Router) { - private.Use(s.checkBackendMiddleware) - - // stats api - private.Route("/stats", func(statsGroup chi.Router) { - statsGroup.Get("/inbounds", s.GetInboundsStats) - statsGroup.Get("/inbound", s.GetInboundStats) - statsGroup.Get("/outbounds", s.GetOutboundsStats) - statsGroup.Get("/outbound", s.GetOutboundStats) - statsGroup.Get("/users", s.GetUsersStats) - statsGroup.Get("/user", s.GetUserStats) - statsGroup.Get("/user/online", s.GetUserOnlineStat) - statsGroup.Get("/user/online_ip", s.GetUserOnlineIpListStats) - statsGroup.Get("/backend", s.GetBackendStats) - }) - private.Put("/user/sync", s.SyncUser) - private.Put("/users/sync", s.SyncUsers) + router.Get("/info", s.Base) + router.Put("/stop", s.Stop) + router.Get("/logs", s.GetLogs) + + router.Get("/stats/system", s.GetSystemStats) + + router.Group(func(private chi.Router) { + private.Use(s.checkBackendMiddleware) + + // stats api + private.Route("/stats", func(statsGroup chi.Router) { + statsGroup.Get("/inbounds", s.GetInboundsStats) + statsGroup.Get("/inbound", s.GetInboundStats) + statsGroup.Get("/outbounds", s.GetOutboundsStats) + statsGroup.Get("/outbound", s.GetOutboundStats) + statsGroup.Get("/users", s.GetUsersStats) + statsGroup.Get("/user", s.GetUserStats) + statsGroup.Get("/user/online", s.GetUserOnlineStat) + statsGroup.Get("/user/online_ip", s.GetUserOnlineIpListStats) + statsGroup.Get("/backend", s.GetBackendStats) }) + private.Put("/user/sync", s.SyncUser) + private.Put("/users/sync", s.SyncUsers) }) s.Router = router diff --git a/controller/rpc/base.go b/controller/rpc/base.go index 2867fb0..603591b 100644 --- a/controller/rpc/base.go +++ b/controller/rpc/base.go @@ -46,7 +46,7 @@ func (s *Service) Start(ctx context.Context, detail *common.Backend) (*common.Ba s.Connect(clientIP, detail.GetKeepAlive()) - return s.BaseInfoResponse(true, ""), nil + return s.BaseInfoResponse(), nil } func (s *Service) Stop(_ context.Context, _ *common.Empty) (*common.Empty, error) { @@ -71,5 +71,5 @@ func (s *Service) detectBackend(ctx context.Context, detail *common.Backend) (co } func (s *Service) GetBaseInfo(_ context.Context, _ *common.Empty) (*common.BaseInfoResponse, error) { - return s.BaseInfoResponse(false, ""), nil + return s.BaseInfoResponse(), nil } diff --git a/controller/rpc/middleware.go b/controller/rpc/middleware.go index 19465b1..89dba60 100644 --- a/controller/rpc/middleware.go +++ b/controller/rpc/middleware.go @@ -15,56 +15,43 @@ import ( "google.golang.org/grpc/status" ) -func validateSessionID(ctx context.Context, s *Service) error { +func validateApiKey(ctx context.Context, s *Service) error { // Extract metadata md, ok := metadata.FromIncomingContext(ctx) if !ok { return status.Errorf(codes.Unauthenticated, "missing metadata") } - // Check session ID - sessionID := s.GetSessionID() - if sessionID == uuid.Nil { - return status.Errorf(codes.Unauthenticated, "please connect first") + // Extract x-api-key header + apiKeys, ok := md["x-api-key"] + if !ok || len(apiKeys) == 0 { + return status.Errorf(codes.Unauthenticated, "missing x-api-key header") } - // Extract Authorization header - authHeader, ok := md["authorization"] - if !ok || len(authHeader) == 0 { - return status.Errorf(codes.Unauthenticated, "missing authorization header") - } - - // Validate token format (Bearer ) - tokenParts := strings.Split(authHeader[0], " ") - if len(tokenParts) != 2 || tokenParts[0] != "Bearer" { - return status.Errorf(codes.InvalidArgument, "invalid authorization header format") - } - - // Parse token - tokenString := tokenParts[1] - token, err := uuid.Parse(tokenString) - if err != nil { - return status.Errorf(codes.InvalidArgument, "invalid session ID: %v", err) - } + // Get the first key (there should typically be only one) + apiKeyHeader := apiKeys[0] - // Check if session ID matches - if token != sessionID { - return status.Errorf(codes.PermissionDenied, "session ID mismatch") + apiKey := s.GetApiKey() + key, err := uuid.Parse(apiKeyHeader) + switch { + case err != nil: + return status.Errorf(codes.InvalidArgument, "invalid api key format: must be a valid UUID") + case key != apiKey: + return status.Errorf(codes.PermissionDenied, "api key mismatch") } s.NewRequest() - return nil } -func CheckSessionIDMiddleware(s *Service) grpc.UnaryServerInterceptor { +func validateApiKeyMiddleware(s *Service) grpc.UnaryServerInterceptor { return func( ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler, ) (interface{}, error) { - if err := validateSessionID(ctx, s); err != nil { + if err := validateApiKey(ctx, s); err != nil { return nil, err } @@ -72,7 +59,7 @@ func CheckSessionIDMiddleware(s *Service) grpc.UnaryServerInterceptor { } } -func CheckSessionIDStreamMiddleware(s *Service) grpc.StreamServerInterceptor { +func validateApiKeyStreamMiddleware(s *Service) grpc.StreamServerInterceptor { return func( srv interface{}, ss grpc.ServerStream, @@ -80,8 +67,8 @@ func CheckSessionIDStreamMiddleware(s *Service) grpc.StreamServerInterceptor { handler grpc.StreamHandler, ) error { // Use common session validation logic - if err := validateSessionID(ss.Context(), s); err != nil { - log.Println("invalid session ID stream:", err) + if err := validateApiKey(ss.Context(), s); err != nil { + log.Println("invalid api key stream:", err) return err } @@ -200,24 +187,6 @@ var backendMethods = map[string]bool{ "/service.NodeService/SyncUsers": true, } -var sessionIDMethods = map[string]bool{ - "/service.NodeService/Stop": true, - "/service.NodeService/GetBaseInfo": true, - "/service.NodeService/GetLogs": true, - "/service.NodeService/GetSystemStats": true, - "/service.NodeService/GetOutboundsStats": true, - "/service.NodeService/GetOutboundStats": true, - "/service.NodeService/GetInboundsStats": true, - "/service.NodeService/GetInboundStats": true, - "/service.NodeService/GetUsersStats": true, - "/service.NodeService/GetUserStats": true, - "/service.NodeService/GetUserOnlineStats": true, - "/service.NodeService/GetUserOnlineIpListStats": true, - "/service.NodeService/GetBackendStats": true, - "/service.NodeService/SyncUser": true, - "/service.NodeService/SyncUsers": true, -} - func ConditionalMiddleware(s *Service) grpc.UnaryServerInterceptor { return func( ctx context.Context, @@ -229,9 +198,7 @@ func ConditionalMiddleware(s *Service) grpc.UnaryServerInterceptor { interceptors = append(interceptors, LoggingInterceptor) - if sessionIDMethods[info.FullMethod] { - interceptors = append(interceptors, CheckSessionIDMiddleware(s)) - } + interceptors = append(interceptors, validateApiKeyMiddleware(s)) if backendMethods[info.FullMethod] { interceptors = append(interceptors, CheckBackendMiddleware(s)) @@ -253,9 +220,7 @@ func ConditionalStreamMiddleware(s *Service) grpc.StreamServerInterceptor { interceptors = append(interceptors, LoggingStreamInterceptor()) - if sessionIDMethods[info.FullMethod] { - interceptors = append(interceptors, CheckSessionIDStreamMiddleware(s)) - } + interceptors = append(interceptors, validateApiKeyStreamMiddleware(s)) if backendMethods[info.FullMethod] { interceptors = append(interceptors, CheckBackendStreamMiddleware(s)) diff --git a/controller/rpc/rpc_test.go b/controller/rpc/rpc_test.go index 13c634c..639f8a1 100644 --- a/controller/rpc/rpc_test.go +++ b/controller/rpc/rpc_test.go @@ -23,22 +23,21 @@ import ( ) var ( - servicePort = 8001 + servicePort = 8002 nodeHost = "127.0.0.1" xrayExecutablePath = "/usr/local/bin/xray" xrayAssetsPath = "/usr/local/share/xray" sslCertFile = "../../certs/ssl_cert.pem" sslKeyFile = "../../certs/ssl_key.pem" - sslClientCertFile = "../../certs/ssl_client_cert.pem" - sslClientKeyFile = "../../certs/ssl_client_key.pem" + apiKey = uuid.New() generatedConfigPath = "../../generated/" addr = fmt.Sprintf("%s:%d", nodeHost, servicePort) configPath = "../../backend/xray/config.json" ) func TestGRPCConnection(t *testing.T) { - config.SetEnv(servicePort, 0, nodeHost, xrayExecutablePath, xrayAssetsPath, sslCertFile, - sslKeyFile, sslClientCertFile, "grpc", generatedConfigPath, true) + config.SetEnv(servicePort, nodeHost, xrayExecutablePath, xrayAssetsPath, sslCertFile, + sslKeyFile, "grpc", generatedConfigPath, apiKey, true) nodeLogger.SetOutputMode(true) @@ -50,17 +49,8 @@ func TestGRPCConnection(t *testing.T) { t.Fatal(err) } } - clientCertFileExists := tools.FileExists(sslClientCertFile) - if !clientCertFileExists { - t.Fatal("SSL_CLIENT_CERT_FILE is required.") - } - - clientKeyFileExists := tools.FileExists(sslClientCertFile) - if !clientKeyFileExists { - t.Fatal("SSL_CLIENT_KEY_FILE is required.") - } - tlsConfig, err := tools.LoadTLSCredentials(sslCertFile, sslKeyFile, sslClientCertFile, false) + tlsConfig, err := tools.LoadTLSCredentials(sslCertFile, sslKeyFile) if err != nil { t.Fatal(err) } @@ -71,12 +61,17 @@ func TestGRPCConnection(t *testing.T) { t.Fatal(err) } - creds, err := tools.LoadTLSCredentials(sslClientCertFile, sslClientKeyFile, sslCertFile, true) + certPool, err := tools.LoadClientPool(sslCertFile) if err != nil { t.Fatal(err) } - conn, err := grpc.NewClient(addr, grpc.WithTransportCredentials(credentials.NewTLS(creds))) + creds := credentials.NewClientTLSFromCert(certPool, "") + opts := []grpc.DialOption{ + grpc.WithTransportCredentials(creds), + } + + conn, err := grpc.NewClient(addr, opts...) if err != nil { t.Fatalf("Failed to connect to gRPC server: %v", err) } @@ -89,22 +84,14 @@ func TestGRPCConnection(t *testing.T) { t.Fatal(err) } - baseCtx := context.Background() - - ctx, cancel := context.WithTimeout(baseCtx, 5*time.Second) - defer cancel() - - _, err = client.GetBaseInfo(ctx, &common.Empty{}) - if err != nil { - log.Println("info error: ", err) - } else { - t.Fatal("expected session ID error") - } + // Add SessionId to the metadata + md := metadata.Pairs("x-api-key", apiKey.String()) + ctxWithSession := metadata.NewOutgoingContext(context.Background(), md) - ctx, cancel = context.WithTimeout(baseCtx, 5*time.Second) + ctx, cancel := context.WithTimeout(ctxWithSession, 5*time.Second) defer cancel() - info, err := client.Start(ctx, + _, err = client.Start(ctx, &common.Backend{ Type: common.BackendType_XRAY, Config: string(configFile), @@ -114,13 +101,6 @@ func TestGRPCConnection(t *testing.T) { t.Fatal(err) } - sessionID := info.SessionId - log.Println("Session ID:", sessionID) - - // Add SessionId to the metadata - md := metadata.Pairs("authorization", "Bearer "+info.SessionId) - ctxWithSession := metadata.NewOutgoingContext(context.Background(), md) - // test all methods ctx, cancel = context.WithTimeout(ctxWithSession, 5*time.Second) defer cancel() @@ -314,7 +294,7 @@ loop: // test keep alive time.Sleep(16 * time.Second) - ctx, cancel = context.WithTimeout(ctxWithSession, 5*time.Second) + ctx, cancel = context.WithTimeout(context.Background(), 5*time.Second) defer cancel() _, err = client.GetBaseInfo(ctx, &common.Empty{}) diff --git a/docker-compose.yml b/docker-compose.yml index 150dbd8..7ff33c5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -12,7 +12,8 @@ services: SSL_CERT_FILE: "/var/lib/gozargah-node/certs/ssl_cert.pem" SSL_KEY_FILE: "/var/lib/gozargah-node/certs/ssl_key.pem" - SSL_CLIENT_CERT_FILE: "/var/lib/gozargah-node/certs/ssl_client_cert.pem" + # api key must be a valid uuid (you can use any version you want) + # API_KEY: xxxxxxxx-yyyy-zzzz-mmmm-aaaaaaaaaaa GENERATED_CONFIG_PATH: "/var/lib/gozargah-node/generated" diff --git a/main.go b/main.go index 168af63..6ce3624 100644 --- a/main.go +++ b/main.go @@ -22,13 +22,12 @@ func main() { addr := fmt.Sprintf("%s:%d", config.NodeHost, config.ServicePort) - tlsConfig, err := tools.LoadTLSCredentials(config.SslCertFile, config.SslKeyFile, - config.SslClientCertFile, false) + tlsConfig, err := tools.LoadTLSCredentials(config.SslCertFile, config.SslKeyFile) if err != nil { log.Fatal(err) } - log.Printf("Starting Node Version: %s", controller.NodeVersion) + log.Printf("Starting Node: v%s", controller.NodeVersion) var shutdownFunc func(ctx context.Context) error var service controller.Service diff --git a/tools/tls.go b/tools/tls.go index 9f22925..073730b 100644 --- a/tools/tls.go +++ b/tools/tls.go @@ -4,33 +4,51 @@ import ( "crypto/tls" "crypto/x509" "fmt" + "net/http" "os" + "time" ) -func LoadTLSCredentials(cert, key, poolCert string, isClient bool) (*tls.Config, error) { - pem, err := os.ReadFile(poolCert) +func LoadTLSCredentials(cert, key string) (*tls.Config, error) { + serverCert, err := tls.LoadX509KeyPair(cert, key) if err != nil { return nil, err } - certPool := x509.NewCertPool() - if !certPool.AppendCertsFromPEM(pem) { - return nil, fmt.Errorf("failed to add CA's certificate") + config := &tls.Config{ + Certificates: []tls.Certificate{serverCert}, + ClientAuth: tls.NoClientCert, } + return config, nil +} - serverCert, err := tls.LoadX509KeyPair(cert, key) +func LoadClientPool(cert string) (*x509.CertPool, error) { + pemServerCA, err := os.ReadFile(cert) if err != nil { - return nil, err + return nil, fmt.Errorf("failed to read server certificate: %v", err) } - config := &tls.Config{ - Certificates: []tls.Certificate{serverCert}, + certPool, err := x509.SystemCertPool() + if err != nil { + certPool = x509.NewCertPool() } - if isClient { - config.RootCAs = certPool - } else { - config.ClientAuth = tls.RequireAndVerifyClientCert - config.ClientCAs = certPool + if !certPool.AppendCertsFromPEM(pemServerCA) { + return nil, fmt.Errorf("failed to add server CA's certificate") + } + + return certPool, nil +} + +func CreateHTTPClient(certPool *x509.CertPool, hostname string) *http.Client { + tlsConfig := &tls.Config{RootCAs: certPool, ServerName: hostname} + transport := &http.Transport{ + TLSClientConfig: tlsConfig, + Protocols: new(http.Protocols), + } + transport.Protocols.SetHTTP2(true) + + return &http.Client{ + Transport: transport, + Timeout: 10 * time.Second, } - return config, nil }