diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml index db8eee2..0efeb2b 100644 --- a/.github/workflows/check.yaml +++ b/.github/workflows/check.yaml @@ -43,4 +43,6 @@ jobs: with: github_token: ${{ github.token }} - run: rm -rf ./gen && buf generate && go mod tidy - - uses: stefanzweifel/git-auto-commit-action@v4 \ No newline at end of file + - uses: stefanzweifel/git-auto-commit-action@v4 + with: + commit_message: 'update: automatic generate new proto' \ No newline at end of file diff --git a/gen/openapi/sync/v1/host.swagger.json b/gen/openapi/sync/v1/host.swagger.json new file mode 100644 index 0000000..55b0a9f --- /dev/null +++ b/gen/openapi/sync/v1/host.swagger.json @@ -0,0 +1,44 @@ +{ + "swagger": "2.0", + "info": { + "title": "sync/v1/host.proto", + "version": "version not set" + }, + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "paths": {}, + "definitions": { + "protobufAny": { + "type": "object", + "properties": { + "@type": { + "type": "string" + } + }, + "additionalProperties": {} + }, + "rpcStatus": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string" + }, + "details": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/protobufAny" + } + } + } + } + } +} diff --git a/gen/openapi/sync/v1/keychain.swagger.json b/gen/openapi/sync/v1/keychain.swagger.json new file mode 100644 index 0000000..122164c --- /dev/null +++ b/gen/openapi/sync/v1/keychain.swagger.json @@ -0,0 +1,44 @@ +{ + "swagger": "2.0", + "info": { + "title": "sync/v1/keychain.proto", + "version": "version not set" + }, + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "paths": {}, + "definitions": { + "protobufAny": { + "type": "object", + "properties": { + "@type": { + "type": "string" + } + }, + "additionalProperties": {} + }, + "rpcStatus": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string" + }, + "details": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/protobufAny" + } + } + } + } + } +} diff --git a/gen/openapi/sync/v1/known_hosts.swagger.json b/gen/openapi/sync/v1/known_hosts.swagger.json new file mode 100644 index 0000000..8bd3a94 --- /dev/null +++ b/gen/openapi/sync/v1/known_hosts.swagger.json @@ -0,0 +1,44 @@ +{ + "swagger": "2.0", + "info": { + "title": "sync/v1/known_hosts.proto", + "version": "version not set" + }, + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "paths": {}, + "definitions": { + "protobufAny": { + "type": "object", + "properties": { + "@type": { + "type": "string" + } + }, + "additionalProperties": {} + }, + "rpcStatus": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string" + }, + "details": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/protobufAny" + } + } + } + } + } +} diff --git a/gen/openapi/sync/v1/sync_service.swagger.json b/gen/openapi/sync/v1/sync_service.swagger.json new file mode 100644 index 0000000..b784475 --- /dev/null +++ b/gen/openapi/sync/v1/sync_service.swagger.json @@ -0,0 +1,595 @@ +{ + "swagger": "2.0", + "info": { + "title": "sync/v1/sync_service.proto", + "version": "version not set" + }, + "tags": [ + { + "name": "SyncService" + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "paths": { + "/gapi/sync/v1/sync": { + "get": { + "summary": "拉取指定时间点之后的配置变动信息", + "operationId": "SyncService_Sync", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1SyncResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "after", + "description": "获取该时间之后的设置变化,若不设置该字段,则拉取全量配置信息", + "in": "query", + "required": false, + "type": "string", + "format": "date-time" + } + ], + "tags": [ + "SyncService" + ] + } + }, + "/gapi/sync/v1/update": { + "post": { + "summary": "提交最新配置 若配置的ID为空,则创建新配置。若配置的删除时间不为空,则代表该配置已被删除。", + "operationId": "SyncService_Update", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1UpdateResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "host.id", + "description": "内部唯一ID ulid", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "host.createdAt", + "description": "创建时间", + "in": "query", + "required": false, + "type": "string", + "format": "date-time" + }, + { + "name": "host.updatedAt", + "description": "更新时间", + "in": "query", + "required": false, + "type": "string", + "format": "date-time" + }, + { + "name": "host.deletedAt", + "description": "删除时间", + "in": "query", + "required": false, + "type": "string", + "format": "date-time" + }, + { + "name": "host.label", + "description": "标签", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "host.tags", + "in": "query", + "required": false, + "type": "array", + "items": { + "type": "string" + }, + "collectionFormat": "multi" + }, + { + "name": "host.address", + "description": "ip或host", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "host.port", + "in": "query", + "required": false, + "type": "string", + "format": "int64" + }, + { + "name": "host.charset", + "description": "字符集", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "host.username", + "description": "用户名", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "host.password", + "description": "密码", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "host.keyId", + "description": "密钥ID", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "host.identityId", + "description": "身份ID 若身份ID不为空,则覆盖手动配置", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "knownHost.id", + "description": "内部唯一ID ulid", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "knownHost.createdAt", + "description": "创建时间", + "in": "query", + "required": false, + "type": "string", + "format": "date-time" + }, + { + "name": "knownHost.updatedAt", + "description": "更新时间", + "in": "query", + "required": false, + "type": "string", + "format": "date-time" + }, + { + "name": "knownHost.deletedAt", + "description": "删除时间", + "in": "query", + "required": false, + "type": "string", + "format": "date-time" + }, + { + "name": "knownHost.address", + "description": "ip或host", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "knownHost.publicKey", + "description": "公钥", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "sshKey.id", + "description": "内部唯一ID ulid", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "sshKey.createdAt", + "description": "创建时间", + "in": "query", + "required": false, + "type": "string", + "format": "date-time" + }, + { + "name": "sshKey.updatedAt", + "description": "更新时间", + "in": "query", + "required": false, + "type": "string", + "format": "date-time" + }, + { + "name": "sshKey.deletedAt", + "description": "删除时间", + "in": "query", + "required": false, + "type": "string", + "format": "date-time" + }, + { + "name": "sshKey.label", + "description": "标签", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "sshKey.privateKey", + "description": "私钥", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "sshKey.publicKey", + "description": "公钥", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "sshKey.certificate", + "description": "证书", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "identity.id", + "description": "内部唯一ID ulid", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "identity.createdAt", + "description": "创建时间", + "in": "query", + "required": false, + "type": "string", + "format": "date-time" + }, + { + "name": "identity.updatedAt", + "description": "更新时间", + "in": "query", + "required": false, + "type": "string", + "format": "date-time" + }, + { + "name": "identity.deletedAt", + "description": "删除时间", + "in": "query", + "required": false, + "type": "string", + "format": "date-time" + }, + { + "name": "identity.label", + "description": "标签", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "identity.username", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "identity.password", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "identity.keyId", + "description": "密钥ID", + "in": "query", + "required": false, + "type": "string" + } + ], + "tags": [ + "SyncService" + ] + } + } + }, + "definitions": { + "protobufAny": { + "type": "object", + "properties": { + "@type": { + "type": "string" + } + }, + "additionalProperties": {} + }, + "rpcStatus": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string" + }, + "details": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/protobufAny" + } + } + } + }, + "v1Host": { + "type": "object", + "properties": { + "id": { + "type": "string", + "title": "内部唯一ID ulid" + }, + "createdAt": { + "type": "string", + "format": "date-time", + "title": "创建时间" + }, + "updatedAt": { + "type": "string", + "format": "date-time", + "title": "更新时间" + }, + "deletedAt": { + "type": "string", + "format": "date-time", + "title": "删除时间" + }, + "label": { + "type": "string", + "title": "标签" + }, + "tags": { + "type": "array", + "items": { + "type": "string" + } + }, + "address": { + "type": "string", + "title": "ip或host" + }, + "port": { + "type": "string", + "format": "int64" + }, + "charset": { + "type": "string", + "title": "字符集" + }, + "username": { + "type": "string", + "title": "用户名" + }, + "password": { + "type": "string", + "title": "密码" + }, + "keyId": { + "type": "string", + "title": "密钥ID" + }, + "identityId": { + "type": "string", + "title": "身份ID 若身份ID不为空,则覆盖手动配置" + } + } + }, + "v1Identity": { + "type": "object", + "properties": { + "id": { + "type": "string", + "title": "内部唯一ID ulid" + }, + "createdAt": { + "type": "string", + "format": "date-time", + "title": "创建时间" + }, + "updatedAt": { + "type": "string", + "format": "date-time", + "title": "更新时间" + }, + "deletedAt": { + "type": "string", + "format": "date-time", + "title": "删除时间" + }, + "label": { + "type": "string", + "title": "标签" + }, + "username": { + "type": "string" + }, + "password": { + "type": "string" + }, + "keyId": { + "type": "string", + "title": "密钥ID" + } + }, + "title": "Identity(身份) 包含身份验证详细信息,如果某些服务器需要提供同一组凭据,则可以节省配置的时间。\n这些凭据可以快速添加为身份并与主机条目链接。当凭据发生更改时,不必更新每台主机而只需更新身份即可。" + }, + "v1KnownHost": { + "type": "object", + "properties": { + "id": { + "type": "string", + "title": "内部唯一ID ulid" + }, + "createdAt": { + "type": "string", + "format": "date-time", + "title": "创建时间" + }, + "updatedAt": { + "type": "string", + "format": "date-time", + "title": "更新时间" + }, + "deletedAt": { + "type": "string", + "format": "date-time", + "title": "删除时间" + }, + "address": { + "type": "string", + "title": "ip或host" + }, + "publicKey": { + "type": "string", + "title": "公钥" + } + } + }, + "v1SshKey": { + "type": "object", + "properties": { + "id": { + "type": "string", + "title": "内部唯一ID ulid" + }, + "createdAt": { + "type": "string", + "format": "date-time", + "title": "创建时间" + }, + "updatedAt": { + "type": "string", + "format": "date-time", + "title": "更新时间" + }, + "deletedAt": { + "type": "string", + "format": "date-time", + "title": "删除时间" + }, + "label": { + "type": "string", + "title": "标签" + }, + "privateKey": { + "type": "string", + "title": "私钥" + }, + "publicKey": { + "type": "string", + "title": "公钥" + }, + "certificate": { + "type": "string", + "title": "证书" + } + }, + "title": "SSH 密钥" + }, + "v1SyncResponse": { + "type": "object", + "properties": { + "serverTime": { + "type": "string", + "format": "date-time", + "title": "当前服务器时间,用于给客户端下一次拉取变动时做一个参照,避免因客户端时间偏差导致同步混乱" + }, + "hostSet": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/v1Host" + } + }, + "knownHostSet": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/v1KnownHost" + } + }, + "sshKeySet": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/v1SshKey" + } + }, + "identitySet": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/v1Identity" + } + } + } + }, + "v1UpdateResponse": { + "type": "object", + "properties": { + "host": { + "$ref": "#/definitions/v1Host" + }, + "knownHost": { + "$ref": "#/definitions/v1KnownHost" + }, + "sshKey": { + "$ref": "#/definitions/v1SshKey" + }, + "identity": { + "$ref": "#/definitions/v1Identity" + } + } + } + } +} diff --git a/gen/openapi/user/v1/user_service.swagger.json b/gen/openapi/user/v1/user_service.swagger.json index 0d615f6..7ef032a 100644 --- a/gen/openapi/user/v1/user_service.swagger.json +++ b/gen/openapi/user/v1/user_service.swagger.json @@ -16,7 +16,7 @@ "application/json" ], "paths": { - "/gapi/user/info": { + "/gapi/user/v1/info": { "get": { "operationId": "UserService_GetInfo", "responses": { diff --git a/gen/proto/sync/v1/host.pb.go b/gen/proto/sync/v1/host.pb.go new file mode 100644 index 0000000..87202f1 --- /dev/null +++ b/gen/proto/sync/v1/host.pb.go @@ -0,0 +1,272 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.31.0 +// protoc (unknown) +// source: sync/v1/host.proto + +package syncV1 + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type Host struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // 内部唯一ID ulid + CreatedAt *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` // 创建时间 + UpdatedAt *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"` // 更新时间 + DeletedAt *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=deleted_at,json=deletedAt,proto3" json:"deleted_at,omitempty"` // 删除时间 + Label string `protobuf:"bytes,11,opt,name=label,proto3" json:"label,omitempty"` // 标签 + Tags []string `protobuf:"bytes,12,rep,name=tags,proto3" json:"tags,omitempty"` + Address string `protobuf:"bytes,13,opt,name=address,proto3" json:"address,omitempty"` // ip或host + Port int64 `protobuf:"varint,14,opt,name=port,proto3" json:"port,omitempty"` + Charset string `protobuf:"bytes,15,opt,name=charset,proto3" json:"charset,omitempty"` // 字符集 + Username string `protobuf:"bytes,21,opt,name=username,proto3" json:"username,omitempty"` // 用户名 + Password string `protobuf:"bytes,22,opt,name=password,proto3" json:"password,omitempty"` // 密码 + KeyId string `protobuf:"bytes,23,opt,name=key_id,json=keyId,proto3" json:"key_id,omitempty"` // 密钥ID + IdentityId string `protobuf:"bytes,24,opt,name=identity_id,json=identityId,proto3" json:"identity_id,omitempty"` // 身份ID 若身份ID不为空,则覆盖手动配置 +} + +func (x *Host) Reset() { + *x = Host{} + if protoimpl.UnsafeEnabled { + mi := &file_sync_v1_host_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Host) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Host) ProtoMessage() {} + +func (x *Host) ProtoReflect() protoreflect.Message { + mi := &file_sync_v1_host_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Host.ProtoReflect.Descriptor instead. +func (*Host) Descriptor() ([]byte, []int) { + return file_sync_v1_host_proto_rawDescGZIP(), []int{0} +} + +func (x *Host) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *Host) GetCreatedAt() *timestamppb.Timestamp { + if x != nil { + return x.CreatedAt + } + return nil +} + +func (x *Host) GetUpdatedAt() *timestamppb.Timestamp { + if x != nil { + return x.UpdatedAt + } + return nil +} + +func (x *Host) GetDeletedAt() *timestamppb.Timestamp { + if x != nil { + return x.DeletedAt + } + return nil +} + +func (x *Host) GetLabel() string { + if x != nil { + return x.Label + } + return "" +} + +func (x *Host) GetTags() []string { + if x != nil { + return x.Tags + } + return nil +} + +func (x *Host) GetAddress() string { + if x != nil { + return x.Address + } + return "" +} + +func (x *Host) GetPort() int64 { + if x != nil { + return x.Port + } + return 0 +} + +func (x *Host) GetCharset() string { + if x != nil { + return x.Charset + } + return "" +} + +func (x *Host) GetUsername() string { + if x != nil { + return x.Username + } + return "" +} + +func (x *Host) GetPassword() string { + if x != nil { + return x.Password + } + return "" +} + +func (x *Host) GetKeyId() string { + if x != nil { + return x.KeyId + } + return "" +} + +func (x *Host) GetIdentityId() string { + if x != nil { + return x.IdentityId + } + return "" +} + +var File_sync_v1_host_proto protoreflect.FileDescriptor + +var file_sync_v1_host_proto_rawDesc = []byte{ + 0x0a, 0x12, 0x73, 0x79, 0x6e, 0x63, 0x2f, 0x76, 0x31, 0x2f, 0x68, 0x6f, 0x73, 0x74, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x07, 0x73, 0x79, 0x6e, 0x63, 0x2e, 0x76, 0x31, 0x1a, 0x1f, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, + 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xa9, + 0x03, 0x0a, 0x04, 0x48, 0x6f, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x39, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, + 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, + 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, + 0x41, 0x74, 0x12, 0x39, 0x0a, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, + 0x6d, 0x70, 0x52, 0x09, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x39, 0x0a, + 0x0a, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x64, + 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x61, 0x62, 0x65, + 0x6c, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x12, 0x12, + 0x0a, 0x04, 0x74, 0x61, 0x67, 0x73, 0x18, 0x0c, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x74, 0x61, + 0x67, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x0d, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x12, 0x0a, 0x04, + 0x70, 0x6f, 0x72, 0x74, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x70, 0x6f, 0x72, 0x74, + 0x12, 0x18, 0x0a, 0x07, 0x63, 0x68, 0x61, 0x72, 0x73, 0x65, 0x74, 0x18, 0x0f, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x07, 0x63, 0x68, 0x61, 0x72, 0x73, 0x65, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, + 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x15, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, + 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, + 0x72, 0x64, 0x18, 0x16, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, + 0x72, 0x64, 0x12, 0x15, 0x0a, 0x06, 0x6b, 0x65, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x17, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x05, 0x6b, 0x65, 0x79, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x69, 0x64, 0x65, + 0x6e, 0x74, 0x69, 0x74, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x18, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, + 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x49, 0x64, 0x42, 0x3c, 0x5a, 0x3a, 0x67, 0x69, + 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6a, 0x75, 0x61, 0x6e, 0x6a, 0x69, 0x54, + 0x65, 0x63, 0x68, 0x2f, 0x6a, 0x54, 0x65, 0x72, 0x6d, 0x2d, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, + 0x67, 0x65, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73, 0x79, 0x6e, 0x63, 0x2f, 0x76, + 0x31, 0x3b, 0x73, 0x79, 0x6e, 0x63, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_sync_v1_host_proto_rawDescOnce sync.Once + file_sync_v1_host_proto_rawDescData = file_sync_v1_host_proto_rawDesc +) + +func file_sync_v1_host_proto_rawDescGZIP() []byte { + file_sync_v1_host_proto_rawDescOnce.Do(func() { + file_sync_v1_host_proto_rawDescData = protoimpl.X.CompressGZIP(file_sync_v1_host_proto_rawDescData) + }) + return file_sync_v1_host_proto_rawDescData +} + +var file_sync_v1_host_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_sync_v1_host_proto_goTypes = []interface{}{ + (*Host)(nil), // 0: sync.v1.Host + (*timestamppb.Timestamp)(nil), // 1: google.protobuf.Timestamp +} +var file_sync_v1_host_proto_depIdxs = []int32{ + 1, // 0: sync.v1.Host.created_at:type_name -> google.protobuf.Timestamp + 1, // 1: sync.v1.Host.updated_at:type_name -> google.protobuf.Timestamp + 1, // 2: sync.v1.Host.deleted_at:type_name -> google.protobuf.Timestamp + 3, // [3:3] is the sub-list for method output_type + 3, // [3:3] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_sync_v1_host_proto_init() } +func file_sync_v1_host_proto_init() { + if File_sync_v1_host_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_sync_v1_host_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Host); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_sync_v1_host_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_sync_v1_host_proto_goTypes, + DependencyIndexes: file_sync_v1_host_proto_depIdxs, + MessageInfos: file_sync_v1_host_proto_msgTypes, + }.Build() + File_sync_v1_host_proto = out.File + file_sync_v1_host_proto_rawDesc = nil + file_sync_v1_host_proto_goTypes = nil + file_sync_v1_host_proto_depIdxs = nil +} diff --git a/gen/proto/sync/v1/host.pb.ts b/gen/proto/sync/v1/host.pb.ts new file mode 100644 index 0000000..f28903c --- /dev/null +++ b/gen/proto/sync/v1/host.pb.ts @@ -0,0 +1,22 @@ +/* eslint-disable */ +// @ts-nocheck +/* +* This file is a generated Typescript file for GRPC Gateway, DO NOT MODIFY +*/ + +import * as GoogleProtobufTimestamp from "../../google/protobuf/timestamp.pb" +export type Host = { + id?: string + createdAt?: GoogleProtobufTimestamp.Timestamp + updatedAt?: GoogleProtobufTimestamp.Timestamp + deletedAt?: GoogleProtobufTimestamp.Timestamp + label?: string + tags?: string[] + address?: string + port?: string + charset?: string + username?: string + password?: string + keyId?: string + identityId?: string +} \ No newline at end of file diff --git a/gen/proto/sync/v1/keychain.pb.go b/gen/proto/sync/v1/keychain.pb.go new file mode 100644 index 0000000..acbc60d --- /dev/null +++ b/gen/proto/sync/v1/keychain.pb.go @@ -0,0 +1,367 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.31.0 +// protoc (unknown) +// source: sync/v1/keychain.proto + +package syncV1 + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// SSH 密钥 +type SshKey struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // 内部唯一ID ulid + CreatedAt *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` // 创建时间 + UpdatedAt *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"` // 更新时间 + DeletedAt *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=deleted_at,json=deletedAt,proto3" json:"deleted_at,omitempty"` // 删除时间 + Label string `protobuf:"bytes,11,opt,name=label,proto3" json:"label,omitempty"` // 标签 + PrivateKey string `protobuf:"bytes,12,opt,name=private_key,json=privateKey,proto3" json:"private_key,omitempty"` // 私钥 + PublicKey string `protobuf:"bytes,13,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"` // 公钥 + Certificate string `protobuf:"bytes,14,opt,name=certificate,proto3" json:"certificate,omitempty"` // 证书 +} + +func (x *SshKey) Reset() { + *x = SshKey{} + if protoimpl.UnsafeEnabled { + mi := &file_sync_v1_keychain_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SshKey) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SshKey) ProtoMessage() {} + +func (x *SshKey) ProtoReflect() protoreflect.Message { + mi := &file_sync_v1_keychain_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SshKey.ProtoReflect.Descriptor instead. +func (*SshKey) Descriptor() ([]byte, []int) { + return file_sync_v1_keychain_proto_rawDescGZIP(), []int{0} +} + +func (x *SshKey) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *SshKey) GetCreatedAt() *timestamppb.Timestamp { + if x != nil { + return x.CreatedAt + } + return nil +} + +func (x *SshKey) GetUpdatedAt() *timestamppb.Timestamp { + if x != nil { + return x.UpdatedAt + } + return nil +} + +func (x *SshKey) GetDeletedAt() *timestamppb.Timestamp { + if x != nil { + return x.DeletedAt + } + return nil +} + +func (x *SshKey) GetLabel() string { + if x != nil { + return x.Label + } + return "" +} + +func (x *SshKey) GetPrivateKey() string { + if x != nil { + return x.PrivateKey + } + return "" +} + +func (x *SshKey) GetPublicKey() string { + if x != nil { + return x.PublicKey + } + return "" +} + +func (x *SshKey) GetCertificate() string { + if x != nil { + return x.Certificate + } + return "" +} + +// Identity(身份) 包含身份验证详细信息,如果某些服务器需要提供同一组凭据,则可以节省配置的时间。 +// 这些凭据可以快速添加为身份并与主机条目链接。当凭据发生更改时,不必更新每台主机而只需更新身份即可。 +type Identity struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // 内部唯一ID ulid + CreatedAt *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` // 创建时间 + UpdatedAt *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"` // 更新时间 + DeletedAt *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=deleted_at,json=deletedAt,proto3" json:"deleted_at,omitempty"` // 删除时间 + Label string `protobuf:"bytes,11,opt,name=label,proto3" json:"label,omitempty"` // 标签 + Username string `protobuf:"bytes,12,opt,name=username,proto3" json:"username,omitempty"` + Password string `protobuf:"bytes,13,opt,name=password,proto3" json:"password,omitempty"` + KeyId string `protobuf:"bytes,14,opt,name=key_id,json=keyId,proto3" json:"key_id,omitempty"` // 密钥ID +} + +func (x *Identity) Reset() { + *x = Identity{} + if protoimpl.UnsafeEnabled { + mi := &file_sync_v1_keychain_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Identity) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Identity) ProtoMessage() {} + +func (x *Identity) ProtoReflect() protoreflect.Message { + mi := &file_sync_v1_keychain_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Identity.ProtoReflect.Descriptor instead. +func (*Identity) Descriptor() ([]byte, []int) { + return file_sync_v1_keychain_proto_rawDescGZIP(), []int{1} +} + +func (x *Identity) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *Identity) GetCreatedAt() *timestamppb.Timestamp { + if x != nil { + return x.CreatedAt + } + return nil +} + +func (x *Identity) GetUpdatedAt() *timestamppb.Timestamp { + if x != nil { + return x.UpdatedAt + } + return nil +} + +func (x *Identity) GetDeletedAt() *timestamppb.Timestamp { + if x != nil { + return x.DeletedAt + } + return nil +} + +func (x *Identity) GetLabel() string { + if x != nil { + return x.Label + } + return "" +} + +func (x *Identity) GetUsername() string { + if x != nil { + return x.Username + } + return "" +} + +func (x *Identity) GetPassword() string { + if x != nil { + return x.Password + } + return "" +} + +func (x *Identity) GetKeyId() string { + if x != nil { + return x.KeyId + } + return "" +} + +var File_sync_v1_keychain_proto protoreflect.FileDescriptor + +var file_sync_v1_keychain_proto_rawDesc = []byte{ + 0x0a, 0x16, 0x73, 0x79, 0x6e, 0x63, 0x2f, 0x76, 0x31, 0x2f, 0x6b, 0x65, 0x79, 0x63, 0x68, 0x61, + 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x07, 0x73, 0x79, 0x6e, 0x63, 0x2e, 0x76, + 0x31, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x22, 0xc1, 0x02, 0x0a, 0x06, 0x53, 0x73, 0x68, 0x4b, 0x65, 0x79, 0x12, 0x0e, 0x0a, + 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x39, 0x0a, + 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x63, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x39, 0x0a, 0x0a, 0x75, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, + 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x64, 0x41, 0x74, 0x12, 0x39, 0x0a, 0x0a, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x61, + 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, + 0x61, 0x6d, 0x70, 0x52, 0x09, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x14, + 0x0a, 0x05, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6c, + 0x61, 0x62, 0x65, 0x6c, 0x12, 0x1f, 0x0a, 0x0b, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x5f, + 0x6b, 0x65, 0x79, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x70, 0x72, 0x69, 0x76, 0x61, + 0x74, 0x65, 0x4b, 0x65, 0x79, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, + 0x6b, 0x65, 0x79, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69, + 0x63, 0x4b, 0x65, 0x79, 0x12, 0x20, 0x0a, 0x0b, 0x63, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, + 0x61, 0x74, 0x65, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x65, 0x72, 0x74, 0x69, + 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x22, 0xb0, 0x02, 0x0a, 0x08, 0x49, 0x64, 0x65, 0x6e, 0x74, + 0x69, 0x74, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x02, 0x69, 0x64, 0x12, 0x39, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, + 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, + 0x61, 0x6d, 0x70, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x39, + 0x0a, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, + 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x39, 0x0a, 0x0a, 0x64, 0x65, 0x6c, + 0x65, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, + 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x64, 0x65, 0x6c, 0x65, 0x74, + 0x65, 0x64, 0x41, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x18, 0x0b, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x05, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, + 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, + 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, + 0x72, 0x64, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, + 0x72, 0x64, 0x12, 0x15, 0x0a, 0x06, 0x6b, 0x65, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x0e, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x05, 0x6b, 0x65, 0x79, 0x49, 0x64, 0x42, 0x3c, 0x5a, 0x3a, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6a, 0x75, 0x61, 0x6e, 0x6a, 0x69, 0x54, 0x65, + 0x63, 0x68, 0x2f, 0x6a, 0x54, 0x65, 0x72, 0x6d, 0x2d, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, + 0x65, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73, 0x79, 0x6e, 0x63, 0x2f, 0x76, 0x31, + 0x3b, 0x73, 0x79, 0x6e, 0x63, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_sync_v1_keychain_proto_rawDescOnce sync.Once + file_sync_v1_keychain_proto_rawDescData = file_sync_v1_keychain_proto_rawDesc +) + +func file_sync_v1_keychain_proto_rawDescGZIP() []byte { + file_sync_v1_keychain_proto_rawDescOnce.Do(func() { + file_sync_v1_keychain_proto_rawDescData = protoimpl.X.CompressGZIP(file_sync_v1_keychain_proto_rawDescData) + }) + return file_sync_v1_keychain_proto_rawDescData +} + +var file_sync_v1_keychain_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_sync_v1_keychain_proto_goTypes = []interface{}{ + (*SshKey)(nil), // 0: sync.v1.SshKey + (*Identity)(nil), // 1: sync.v1.Identity + (*timestamppb.Timestamp)(nil), // 2: google.protobuf.Timestamp +} +var file_sync_v1_keychain_proto_depIdxs = []int32{ + 2, // 0: sync.v1.SshKey.created_at:type_name -> google.protobuf.Timestamp + 2, // 1: sync.v1.SshKey.updated_at:type_name -> google.protobuf.Timestamp + 2, // 2: sync.v1.SshKey.deleted_at:type_name -> google.protobuf.Timestamp + 2, // 3: sync.v1.Identity.created_at:type_name -> google.protobuf.Timestamp + 2, // 4: sync.v1.Identity.updated_at:type_name -> google.protobuf.Timestamp + 2, // 5: sync.v1.Identity.deleted_at:type_name -> google.protobuf.Timestamp + 6, // [6:6] is the sub-list for method output_type + 6, // [6:6] is the sub-list for method input_type + 6, // [6:6] is the sub-list for extension type_name + 6, // [6:6] is the sub-list for extension extendee + 0, // [0:6] is the sub-list for field type_name +} + +func init() { file_sync_v1_keychain_proto_init() } +func file_sync_v1_keychain_proto_init() { + if File_sync_v1_keychain_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_sync_v1_keychain_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SshKey); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sync_v1_keychain_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Identity); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_sync_v1_keychain_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_sync_v1_keychain_proto_goTypes, + DependencyIndexes: file_sync_v1_keychain_proto_depIdxs, + MessageInfos: file_sync_v1_keychain_proto_msgTypes, + }.Build() + File_sync_v1_keychain_proto = out.File + file_sync_v1_keychain_proto_rawDesc = nil + file_sync_v1_keychain_proto_goTypes = nil + file_sync_v1_keychain_proto_depIdxs = nil +} diff --git a/gen/proto/sync/v1/keychain.pb.ts b/gen/proto/sync/v1/keychain.pb.ts new file mode 100644 index 0000000..6d420b8 --- /dev/null +++ b/gen/proto/sync/v1/keychain.pb.ts @@ -0,0 +1,28 @@ +/* eslint-disable */ +// @ts-nocheck +/* +* This file is a generated Typescript file for GRPC Gateway, DO NOT MODIFY +*/ + +import * as GoogleProtobufTimestamp from "../../google/protobuf/timestamp.pb" +export type SshKey = { + id?: string + createdAt?: GoogleProtobufTimestamp.Timestamp + updatedAt?: GoogleProtobufTimestamp.Timestamp + deletedAt?: GoogleProtobufTimestamp.Timestamp + label?: string + privateKey?: string + publicKey?: string + certificate?: string +} + +export type Identity = { + id?: string + createdAt?: GoogleProtobufTimestamp.Timestamp + updatedAt?: GoogleProtobufTimestamp.Timestamp + deletedAt?: GoogleProtobufTimestamp.Timestamp + label?: string + username?: string + password?: string + keyId?: string +} \ No newline at end of file diff --git a/gen/proto/sync/v1/known_hosts.pb.go b/gen/proto/sync/v1/known_hosts.pb.go new file mode 100644 index 0000000..9f36317 --- /dev/null +++ b/gen/proto/sync/v1/known_hosts.pb.go @@ -0,0 +1,207 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.31.0 +// protoc (unknown) +// source: sync/v1/known_hosts.proto + +package syncV1 + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type KnownHost struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // 内部唯一ID ulid + CreatedAt *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` // 创建时间 + UpdatedAt *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"` // 更新时间 + DeletedAt *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=deleted_at,json=deletedAt,proto3" json:"deleted_at,omitempty"` // 删除时间 + Address string `protobuf:"bytes,11,opt,name=address,proto3" json:"address,omitempty"` // ip或host + PublicKey string `protobuf:"bytes,12,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"` // 公钥 +} + +func (x *KnownHost) Reset() { + *x = KnownHost{} + if protoimpl.UnsafeEnabled { + mi := &file_sync_v1_known_hosts_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *KnownHost) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KnownHost) ProtoMessage() {} + +func (x *KnownHost) ProtoReflect() protoreflect.Message { + mi := &file_sync_v1_known_hosts_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KnownHost.ProtoReflect.Descriptor instead. +func (*KnownHost) Descriptor() ([]byte, []int) { + return file_sync_v1_known_hosts_proto_rawDescGZIP(), []int{0} +} + +func (x *KnownHost) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *KnownHost) GetCreatedAt() *timestamppb.Timestamp { + if x != nil { + return x.CreatedAt + } + return nil +} + +func (x *KnownHost) GetUpdatedAt() *timestamppb.Timestamp { + if x != nil { + return x.UpdatedAt + } + return nil +} + +func (x *KnownHost) GetDeletedAt() *timestamppb.Timestamp { + if x != nil { + return x.DeletedAt + } + return nil +} + +func (x *KnownHost) GetAddress() string { + if x != nil { + return x.Address + } + return "" +} + +func (x *KnownHost) GetPublicKey() string { + if x != nil { + return x.PublicKey + } + return "" +} + +var File_sync_v1_known_hosts_proto protoreflect.FileDescriptor + +var file_sync_v1_known_hosts_proto_rawDesc = []byte{ + 0x0a, 0x19, 0x73, 0x79, 0x6e, 0x63, 0x2f, 0x76, 0x31, 0x2f, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x5f, + 0x68, 0x6f, 0x73, 0x74, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x07, 0x73, 0x79, 0x6e, + 0x63, 0x2e, 0x76, 0x31, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x85, 0x02, 0x0a, 0x09, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x48, + 0x6f, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x02, 0x69, 0x64, 0x12, 0x39, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, + 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, + 0x61, 0x6d, 0x70, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x39, + 0x0a, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, + 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x39, 0x0a, 0x0a, 0x64, 0x65, 0x6c, + 0x65, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, + 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x64, 0x65, 0x6c, 0x65, 0x74, + 0x65, 0x64, 0x41, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, + 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1d, + 0x0a, 0x0a, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x0c, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x42, 0x3c, 0x5a, + 0x3a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6a, 0x75, 0x61, 0x6e, + 0x6a, 0x69, 0x54, 0x65, 0x63, 0x68, 0x2f, 0x6a, 0x54, 0x65, 0x72, 0x6d, 0x2d, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73, 0x79, 0x6e, + 0x63, 0x2f, 0x76, 0x31, 0x3b, 0x73, 0x79, 0x6e, 0x63, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, +} + +var ( + file_sync_v1_known_hosts_proto_rawDescOnce sync.Once + file_sync_v1_known_hosts_proto_rawDescData = file_sync_v1_known_hosts_proto_rawDesc +) + +func file_sync_v1_known_hosts_proto_rawDescGZIP() []byte { + file_sync_v1_known_hosts_proto_rawDescOnce.Do(func() { + file_sync_v1_known_hosts_proto_rawDescData = protoimpl.X.CompressGZIP(file_sync_v1_known_hosts_proto_rawDescData) + }) + return file_sync_v1_known_hosts_proto_rawDescData +} + +var file_sync_v1_known_hosts_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_sync_v1_known_hosts_proto_goTypes = []interface{}{ + (*KnownHost)(nil), // 0: sync.v1.KnownHost + (*timestamppb.Timestamp)(nil), // 1: google.protobuf.Timestamp +} +var file_sync_v1_known_hosts_proto_depIdxs = []int32{ + 1, // 0: sync.v1.KnownHost.created_at:type_name -> google.protobuf.Timestamp + 1, // 1: sync.v1.KnownHost.updated_at:type_name -> google.protobuf.Timestamp + 1, // 2: sync.v1.KnownHost.deleted_at:type_name -> google.protobuf.Timestamp + 3, // [3:3] is the sub-list for method output_type + 3, // [3:3] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_sync_v1_known_hosts_proto_init() } +func file_sync_v1_known_hosts_proto_init() { + if File_sync_v1_known_hosts_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_sync_v1_known_hosts_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*KnownHost); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_sync_v1_known_hosts_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_sync_v1_known_hosts_proto_goTypes, + DependencyIndexes: file_sync_v1_known_hosts_proto_depIdxs, + MessageInfos: file_sync_v1_known_hosts_proto_msgTypes, + }.Build() + File_sync_v1_known_hosts_proto = out.File + file_sync_v1_known_hosts_proto_rawDesc = nil + file_sync_v1_known_hosts_proto_goTypes = nil + file_sync_v1_known_hosts_proto_depIdxs = nil +} diff --git a/gen/proto/sync/v1/known_hosts.pb.ts b/gen/proto/sync/v1/known_hosts.pb.ts new file mode 100644 index 0000000..2ff346d --- /dev/null +++ b/gen/proto/sync/v1/known_hosts.pb.ts @@ -0,0 +1,15 @@ +/* eslint-disable */ +// @ts-nocheck +/* +* This file is a generated Typescript file for GRPC Gateway, DO NOT MODIFY +*/ + +import * as GoogleProtobufTimestamp from "../../google/protobuf/timestamp.pb" +export type KnownHost = { + id?: string + createdAt?: GoogleProtobufTimestamp.Timestamp + updatedAt?: GoogleProtobufTimestamp.Timestamp + deletedAt?: GoogleProtobufTimestamp.Timestamp + address?: string + publicKey?: string +} \ No newline at end of file diff --git a/gen/proto/sync/v1/sync_service.pb.go b/gen/proto/sync/v1/sync_service.pb.go new file mode 100644 index 0000000..7b8aede --- /dev/null +++ b/gen/proto/sync/v1/sync_service.pb.go @@ -0,0 +1,587 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.31.0 +// protoc (unknown) +// source: sync/v1/sync_service.proto + +package syncV1 + +import ( + _ "google.golang.org/genproto/googleapis/api/annotations" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type SyncRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + After *timestamppb.Timestamp `protobuf:"bytes,1,opt,name=after,proto3" json:"after,omitempty"` // 获取该时间之后的设置变化,若不设置该字段,则拉取全量配置信息 +} + +func (x *SyncRequest) Reset() { + *x = SyncRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_sync_v1_sync_service_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SyncRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SyncRequest) ProtoMessage() {} + +func (x *SyncRequest) ProtoReflect() protoreflect.Message { + mi := &file_sync_v1_sync_service_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SyncRequest.ProtoReflect.Descriptor instead. +func (*SyncRequest) Descriptor() ([]byte, []int) { + return file_sync_v1_sync_service_proto_rawDescGZIP(), []int{0} +} + +func (x *SyncRequest) GetAfter() *timestamppb.Timestamp { + if x != nil { + return x.After + } + return nil +} + +type SyncResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ServerTime *timestamppb.Timestamp `protobuf:"bytes,1,opt,name=server_time,json=serverTime,proto3" json:"server_time,omitempty"` // 当前服务器时间,用于给客户端下一次拉取变动时做一个参照,避免因客户端时间偏差导致同步混乱 + HostSet []*Host `protobuf:"bytes,11,rep,name=host_set,json=hostSet,proto3" json:"host_set,omitempty"` + KnownHostSet []*KnownHost `protobuf:"bytes,12,rep,name=known_host_set,json=knownHostSet,proto3" json:"known_host_set,omitempty"` + SshKeySet []*SshKey `protobuf:"bytes,13,rep,name=ssh_key_set,json=sshKeySet,proto3" json:"ssh_key_set,omitempty"` + IdentitySet []*Identity `protobuf:"bytes,14,rep,name=identity_set,json=identitySet,proto3" json:"identity_set,omitempty"` +} + +func (x *SyncResponse) Reset() { + *x = SyncResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_sync_v1_sync_service_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SyncResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SyncResponse) ProtoMessage() {} + +func (x *SyncResponse) ProtoReflect() protoreflect.Message { + mi := &file_sync_v1_sync_service_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SyncResponse.ProtoReflect.Descriptor instead. +func (*SyncResponse) Descriptor() ([]byte, []int) { + return file_sync_v1_sync_service_proto_rawDescGZIP(), []int{1} +} + +func (x *SyncResponse) GetServerTime() *timestamppb.Timestamp { + if x != nil { + return x.ServerTime + } + return nil +} + +func (x *SyncResponse) GetHostSet() []*Host { + if x != nil { + return x.HostSet + } + return nil +} + +func (x *SyncResponse) GetKnownHostSet() []*KnownHost { + if x != nil { + return x.KnownHostSet + } + return nil +} + +func (x *SyncResponse) GetSshKeySet() []*SshKey { + if x != nil { + return x.SshKeySet + } + return nil +} + +func (x *SyncResponse) GetIdentitySet() []*Identity { + if x != nil { + return x.IdentitySet + } + return nil +} + +type UpdateRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Types that are assignable to Data: + // + // *UpdateRequest_Host + // *UpdateRequest_KnownHost + // *UpdateRequest_SshKey + // *UpdateRequest_Identity + Data isUpdateRequest_Data `protobuf_oneof:"data"` +} + +func (x *UpdateRequest) Reset() { + *x = UpdateRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_sync_v1_sync_service_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateRequest) ProtoMessage() {} + +func (x *UpdateRequest) ProtoReflect() protoreflect.Message { + mi := &file_sync_v1_sync_service_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateRequest.ProtoReflect.Descriptor instead. +func (*UpdateRequest) Descriptor() ([]byte, []int) { + return file_sync_v1_sync_service_proto_rawDescGZIP(), []int{2} +} + +func (m *UpdateRequest) GetData() isUpdateRequest_Data { + if m != nil { + return m.Data + } + return nil +} + +func (x *UpdateRequest) GetHost() *Host { + if x, ok := x.GetData().(*UpdateRequest_Host); ok { + return x.Host + } + return nil +} + +func (x *UpdateRequest) GetKnownHost() *KnownHost { + if x, ok := x.GetData().(*UpdateRequest_KnownHost); ok { + return x.KnownHost + } + return nil +} + +func (x *UpdateRequest) GetSshKey() *SshKey { + if x, ok := x.GetData().(*UpdateRequest_SshKey); ok { + return x.SshKey + } + return nil +} + +func (x *UpdateRequest) GetIdentity() *Identity { + if x, ok := x.GetData().(*UpdateRequest_Identity); ok { + return x.Identity + } + return nil +} + +type isUpdateRequest_Data interface { + isUpdateRequest_Data() +} + +type UpdateRequest_Host struct { + Host *Host `protobuf:"bytes,11,opt,name=host,proto3,oneof"` +} + +type UpdateRequest_KnownHost struct { + KnownHost *KnownHost `protobuf:"bytes,12,opt,name=known_host,json=knownHost,proto3,oneof"` +} + +type UpdateRequest_SshKey struct { + SshKey *SshKey `protobuf:"bytes,13,opt,name=ssh_key,json=sshKey,proto3,oneof"` +} + +type UpdateRequest_Identity struct { + Identity *Identity `protobuf:"bytes,14,opt,name=identity,proto3,oneof"` +} + +func (*UpdateRequest_Host) isUpdateRequest_Data() {} + +func (*UpdateRequest_KnownHost) isUpdateRequest_Data() {} + +func (*UpdateRequest_SshKey) isUpdateRequest_Data() {} + +func (*UpdateRequest_Identity) isUpdateRequest_Data() {} + +type UpdateResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Types that are assignable to Data: + // + // *UpdateResponse_Host + // *UpdateResponse_KnownHost + // *UpdateResponse_SshKey + // *UpdateResponse_Identity + Data isUpdateResponse_Data `protobuf_oneof:"data"` +} + +func (x *UpdateResponse) Reset() { + *x = UpdateResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_sync_v1_sync_service_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateResponse) ProtoMessage() {} + +func (x *UpdateResponse) ProtoReflect() protoreflect.Message { + mi := &file_sync_v1_sync_service_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateResponse.ProtoReflect.Descriptor instead. +func (*UpdateResponse) Descriptor() ([]byte, []int) { + return file_sync_v1_sync_service_proto_rawDescGZIP(), []int{3} +} + +func (m *UpdateResponse) GetData() isUpdateResponse_Data { + if m != nil { + return m.Data + } + return nil +} + +func (x *UpdateResponse) GetHost() *Host { + if x, ok := x.GetData().(*UpdateResponse_Host); ok { + return x.Host + } + return nil +} + +func (x *UpdateResponse) GetKnownHost() *KnownHost { + if x, ok := x.GetData().(*UpdateResponse_KnownHost); ok { + return x.KnownHost + } + return nil +} + +func (x *UpdateResponse) GetSshKey() *SshKey { + if x, ok := x.GetData().(*UpdateResponse_SshKey); ok { + return x.SshKey + } + return nil +} + +func (x *UpdateResponse) GetIdentity() *Identity { + if x, ok := x.GetData().(*UpdateResponse_Identity); ok { + return x.Identity + } + return nil +} + +type isUpdateResponse_Data interface { + isUpdateResponse_Data() +} + +type UpdateResponse_Host struct { + Host *Host `protobuf:"bytes,11,opt,name=host,proto3,oneof"` +} + +type UpdateResponse_KnownHost struct { + KnownHost *KnownHost `protobuf:"bytes,12,opt,name=known_host,json=knownHost,proto3,oneof"` +} + +type UpdateResponse_SshKey struct { + SshKey *SshKey `protobuf:"bytes,13,opt,name=ssh_key,json=sshKey,proto3,oneof"` +} + +type UpdateResponse_Identity struct { + Identity *Identity `protobuf:"bytes,14,opt,name=identity,proto3,oneof"` +} + +func (*UpdateResponse_Host) isUpdateResponse_Data() {} + +func (*UpdateResponse_KnownHost) isUpdateResponse_Data() {} + +func (*UpdateResponse_SshKey) isUpdateResponse_Data() {} + +func (*UpdateResponse_Identity) isUpdateResponse_Data() {} + +var File_sync_v1_sync_service_proto protoreflect.FileDescriptor + +var file_sync_v1_sync_service_proto_rawDesc = []byte{ + 0x0a, 0x1a, 0x73, 0x79, 0x6e, 0x63, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x79, 0x6e, 0x63, 0x5f, 0x73, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x07, 0x73, 0x79, + 0x6e, 0x63, 0x2e, 0x76, 0x31, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, + 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x12, 0x73, 0x79, 0x6e, 0x63, 0x2f, 0x76, 0x31, 0x2f, 0x68, 0x6f, + 0x73, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x16, 0x73, 0x79, 0x6e, 0x63, 0x2f, 0x76, + 0x31, 0x2f, 0x6b, 0x65, 0x79, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x1a, 0x19, 0x73, 0x79, 0x6e, 0x63, 0x2f, 0x76, 0x31, 0x2f, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x5f, + 0x68, 0x6f, 0x73, 0x74, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x3f, 0x0a, 0x0b, 0x53, + 0x79, 0x6e, 0x63, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x30, 0x0a, 0x05, 0x61, 0x66, + 0x74, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, + 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, + 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x05, 0x61, 0x66, 0x74, 0x65, 0x72, 0x22, 0x96, 0x02, 0x0a, + 0x0c, 0x53, 0x79, 0x6e, 0x63, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3b, 0x0a, + 0x0b, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0a, + 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x28, 0x0a, 0x08, 0x68, 0x6f, + 0x73, 0x74, 0x5f, 0x73, 0x65, 0x74, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x73, + 0x79, 0x6e, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x6f, 0x73, 0x74, 0x52, 0x07, 0x68, 0x6f, 0x73, + 0x74, 0x53, 0x65, 0x74, 0x12, 0x38, 0x0a, 0x0e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x5f, 0x68, 0x6f, + 0x73, 0x74, 0x5f, 0x73, 0x65, 0x74, 0x18, 0x0c, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x73, + 0x79, 0x6e, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x48, 0x6f, 0x73, 0x74, + 0x52, 0x0c, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x48, 0x6f, 0x73, 0x74, 0x53, 0x65, 0x74, 0x12, 0x2f, + 0x0a, 0x0b, 0x73, 0x73, 0x68, 0x5f, 0x6b, 0x65, 0x79, 0x5f, 0x73, 0x65, 0x74, 0x18, 0x0d, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x73, 0x79, 0x6e, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x73, + 0x68, 0x4b, 0x65, 0x79, 0x52, 0x09, 0x73, 0x73, 0x68, 0x4b, 0x65, 0x79, 0x53, 0x65, 0x74, 0x12, + 0x34, 0x0a, 0x0c, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x5f, 0x73, 0x65, 0x74, 0x18, + 0x0e, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x73, 0x79, 0x6e, 0x63, 0x2e, 0x76, 0x31, 0x2e, + 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x52, 0x0b, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, + 0x74, 0x79, 0x53, 0x65, 0x74, 0x22, 0xce, 0x01, 0x0a, 0x0d, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x23, 0x0a, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x18, + 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x73, 0x79, 0x6e, 0x63, 0x2e, 0x76, 0x31, 0x2e, + 0x48, 0x6f, 0x73, 0x74, 0x48, 0x00, 0x52, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x12, 0x33, 0x0a, 0x0a, + 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x5f, 0x68, 0x6f, 0x73, 0x74, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x12, 0x2e, 0x73, 0x79, 0x6e, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, + 0x48, 0x6f, 0x73, 0x74, 0x48, 0x00, 0x52, 0x09, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x48, 0x6f, 0x73, + 0x74, 0x12, 0x2a, 0x0a, 0x07, 0x73, 0x73, 0x68, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x0d, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x73, 0x79, 0x6e, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x73, 0x68, + 0x4b, 0x65, 0x79, 0x48, 0x00, 0x52, 0x06, 0x73, 0x73, 0x68, 0x4b, 0x65, 0x79, 0x12, 0x2f, 0x0a, + 0x08, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x11, 0x2e, 0x73, 0x79, 0x6e, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, + 0x74, 0x79, 0x48, 0x00, 0x52, 0x08, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x42, 0x06, + 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0xcf, 0x01, 0x0a, 0x0e, 0x55, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x23, 0x0a, 0x04, 0x68, 0x6f, 0x73, + 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x73, 0x79, 0x6e, 0x63, 0x2e, 0x76, + 0x31, 0x2e, 0x48, 0x6f, 0x73, 0x74, 0x48, 0x00, 0x52, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x12, 0x33, + 0x0a, 0x0a, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x5f, 0x68, 0x6f, 0x73, 0x74, 0x18, 0x0c, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x73, 0x79, 0x6e, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x4b, 0x6e, 0x6f, + 0x77, 0x6e, 0x48, 0x6f, 0x73, 0x74, 0x48, 0x00, 0x52, 0x09, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x48, + 0x6f, 0x73, 0x74, 0x12, 0x2a, 0x0a, 0x07, 0x73, 0x73, 0x68, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x0d, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x73, 0x79, 0x6e, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x53, + 0x73, 0x68, 0x4b, 0x65, 0x79, 0x48, 0x00, 0x52, 0x06, 0x73, 0x73, 0x68, 0x4b, 0x65, 0x79, 0x12, + 0x2f, 0x0a, 0x08, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x18, 0x0e, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x11, 0x2e, 0x73, 0x79, 0x6e, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x64, 0x65, 0x6e, + 0x74, 0x69, 0x74, 0x79, 0x48, 0x00, 0x52, 0x08, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, + 0x42, 0x06, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x32, 0xb7, 0x01, 0x0a, 0x0b, 0x53, 0x79, 0x6e, + 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x4f, 0x0a, 0x04, 0x53, 0x79, 0x6e, 0x63, + 0x12, 0x14, 0x2e, 0x73, 0x79, 0x6e, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x73, 0x79, 0x6e, 0x63, 0x2e, 0x76, 0x31, + 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1a, 0x82, + 0xd3, 0xe4, 0x93, 0x02, 0x14, 0x12, 0x12, 0x2f, 0x67, 0x61, 0x70, 0x69, 0x2f, 0x73, 0x79, 0x6e, + 0x63, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x79, 0x6e, 0x63, 0x12, 0x57, 0x0a, 0x06, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x12, 0x16, 0x2e, 0x73, 0x79, 0x6e, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x73, 0x79, + 0x6e, 0x63, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1c, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x16, 0x22, 0x14, 0x2f, 0x67, + 0x61, 0x70, 0x69, 0x2f, 0x73, 0x79, 0x6e, 0x63, 0x2f, 0x76, 0x31, 0x2f, 0x75, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x42, 0x3c, 0x5a, 0x3a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, + 0x2f, 0x6a, 0x75, 0x61, 0x6e, 0x6a, 0x69, 0x54, 0x65, 0x63, 0x68, 0x2f, 0x6a, 0x54, 0x65, 0x72, + 0x6d, 0x2d, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x2f, 0x73, 0x79, 0x6e, 0x63, 0x2f, 0x76, 0x31, 0x3b, 0x73, 0x79, 0x6e, 0x63, 0x56, 0x31, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_sync_v1_sync_service_proto_rawDescOnce sync.Once + file_sync_v1_sync_service_proto_rawDescData = file_sync_v1_sync_service_proto_rawDesc +) + +func file_sync_v1_sync_service_proto_rawDescGZIP() []byte { + file_sync_v1_sync_service_proto_rawDescOnce.Do(func() { + file_sync_v1_sync_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_sync_v1_sync_service_proto_rawDescData) + }) + return file_sync_v1_sync_service_proto_rawDescData +} + +var file_sync_v1_sync_service_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_sync_v1_sync_service_proto_goTypes = []interface{}{ + (*SyncRequest)(nil), // 0: sync.v1.SyncRequest + (*SyncResponse)(nil), // 1: sync.v1.SyncResponse + (*UpdateRequest)(nil), // 2: sync.v1.UpdateRequest + (*UpdateResponse)(nil), // 3: sync.v1.UpdateResponse + (*timestamppb.Timestamp)(nil), // 4: google.protobuf.Timestamp + (*Host)(nil), // 5: sync.v1.Host + (*KnownHost)(nil), // 6: sync.v1.KnownHost + (*SshKey)(nil), // 7: sync.v1.SshKey + (*Identity)(nil), // 8: sync.v1.Identity +} +var file_sync_v1_sync_service_proto_depIdxs = []int32{ + 4, // 0: sync.v1.SyncRequest.after:type_name -> google.protobuf.Timestamp + 4, // 1: sync.v1.SyncResponse.server_time:type_name -> google.protobuf.Timestamp + 5, // 2: sync.v1.SyncResponse.host_set:type_name -> sync.v1.Host + 6, // 3: sync.v1.SyncResponse.known_host_set:type_name -> sync.v1.KnownHost + 7, // 4: sync.v1.SyncResponse.ssh_key_set:type_name -> sync.v1.SshKey + 8, // 5: sync.v1.SyncResponse.identity_set:type_name -> sync.v1.Identity + 5, // 6: sync.v1.UpdateRequest.host:type_name -> sync.v1.Host + 6, // 7: sync.v1.UpdateRequest.known_host:type_name -> sync.v1.KnownHost + 7, // 8: sync.v1.UpdateRequest.ssh_key:type_name -> sync.v1.SshKey + 8, // 9: sync.v1.UpdateRequest.identity:type_name -> sync.v1.Identity + 5, // 10: sync.v1.UpdateResponse.host:type_name -> sync.v1.Host + 6, // 11: sync.v1.UpdateResponse.known_host:type_name -> sync.v1.KnownHost + 7, // 12: sync.v1.UpdateResponse.ssh_key:type_name -> sync.v1.SshKey + 8, // 13: sync.v1.UpdateResponse.identity:type_name -> sync.v1.Identity + 0, // 14: sync.v1.SyncService.Sync:input_type -> sync.v1.SyncRequest + 2, // 15: sync.v1.SyncService.Update:input_type -> sync.v1.UpdateRequest + 1, // 16: sync.v1.SyncService.Sync:output_type -> sync.v1.SyncResponse + 3, // 17: sync.v1.SyncService.Update:output_type -> sync.v1.UpdateResponse + 16, // [16:18] is the sub-list for method output_type + 14, // [14:16] is the sub-list for method input_type + 14, // [14:14] is the sub-list for extension type_name + 14, // [14:14] is the sub-list for extension extendee + 0, // [0:14] is the sub-list for field type_name +} + +func init() { file_sync_v1_sync_service_proto_init() } +func file_sync_v1_sync_service_proto_init() { + if File_sync_v1_sync_service_proto != nil { + return + } + file_sync_v1_host_proto_init() + file_sync_v1_keychain_proto_init() + file_sync_v1_known_hosts_proto_init() + if !protoimpl.UnsafeEnabled { + file_sync_v1_sync_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SyncRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sync_v1_sync_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SyncResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sync_v1_sync_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_sync_v1_sync_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_sync_v1_sync_service_proto_msgTypes[2].OneofWrappers = []interface{}{ + (*UpdateRequest_Host)(nil), + (*UpdateRequest_KnownHost)(nil), + (*UpdateRequest_SshKey)(nil), + (*UpdateRequest_Identity)(nil), + } + file_sync_v1_sync_service_proto_msgTypes[3].OneofWrappers = []interface{}{ + (*UpdateResponse_Host)(nil), + (*UpdateResponse_KnownHost)(nil), + (*UpdateResponse_SshKey)(nil), + (*UpdateResponse_Identity)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_sync_v1_sync_service_proto_rawDesc, + NumEnums: 0, + NumMessages: 4, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_sync_v1_sync_service_proto_goTypes, + DependencyIndexes: file_sync_v1_sync_service_proto_depIdxs, + MessageInfos: file_sync_v1_sync_service_proto_msgTypes, + }.Build() + File_sync_v1_sync_service_proto = out.File + file_sync_v1_sync_service_proto_rawDesc = nil + file_sync_v1_sync_service_proto_goTypes = nil + file_sync_v1_sync_service_proto_depIdxs = nil +} diff --git a/gen/proto/sync/v1/sync_service.pb.gw.go b/gen/proto/sync/v1/sync_service.pb.gw.go new file mode 100644 index 0000000..c2a2c22 --- /dev/null +++ b/gen/proto/sync/v1/sync_service.pb.gw.go @@ -0,0 +1,260 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: sync/v1/sync_service.proto + +/* +Package syncV1 is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package syncV1 + +import ( + "context" + "io" + "net/http" + + "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" + "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/proto" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = metadata.Join + +var ( + filter_SyncService_Sync_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_SyncService_Sync_0(ctx context.Context, marshaler runtime.Marshaler, client SyncServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq SyncRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_SyncService_Sync_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.Sync(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_SyncService_Sync_0(ctx context.Context, marshaler runtime.Marshaler, server SyncServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq SyncRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_SyncService_Sync_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.Sync(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_SyncService_Update_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_SyncService_Update_0(ctx context.Context, marshaler runtime.Marshaler, client SyncServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq UpdateRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_SyncService_Update_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.Update(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_SyncService_Update_0(ctx context.Context, marshaler runtime.Marshaler, server SyncServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq UpdateRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_SyncService_Update_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.Update(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterSyncServiceHandlerServer registers the http handlers for service SyncService to "mux". +// UnaryRPC :call SyncServiceServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterSyncServiceHandlerFromEndpoint instead. +func RegisterSyncServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server SyncServiceServer) error { + + mux.Handle("GET", pattern_SyncService_Sync_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/sync.v1.SyncService/Sync", runtime.WithHTTPPathPattern("/gapi/sync/v1/sync")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_SyncService_Sync_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_SyncService_Sync_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_SyncService_Update_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/sync.v1.SyncService/Update", runtime.WithHTTPPathPattern("/gapi/sync/v1/update")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_SyncService_Update_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_SyncService_Update_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterSyncServiceHandlerFromEndpoint is same as RegisterSyncServiceHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterSyncServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.DialContext(ctx, endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterSyncServiceHandler(ctx, mux, conn) +} + +// RegisterSyncServiceHandler registers the http handlers for service SyncService to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterSyncServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterSyncServiceHandlerClient(ctx, mux, NewSyncServiceClient(conn)) +} + +// RegisterSyncServiceHandlerClient registers the http handlers for service SyncService +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "SyncServiceClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "SyncServiceClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "SyncServiceClient" to call the correct interceptors. +func RegisterSyncServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client SyncServiceClient) error { + + mux.Handle("GET", pattern_SyncService_Sync_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/sync.v1.SyncService/Sync", runtime.WithHTTPPathPattern("/gapi/sync/v1/sync")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_SyncService_Sync_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_SyncService_Sync_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_SyncService_Update_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/sync.v1.SyncService/Update", runtime.WithHTTPPathPattern("/gapi/sync/v1/update")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_SyncService_Update_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_SyncService_Update_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_SyncService_Sync_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 1}, []string{"gapi", "sync", "v1"}, "")) + + pattern_SyncService_Update_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"gapi", "sync", "v1", "update"}, "")) +) + +var ( + forward_SyncService_Sync_0 = runtime.ForwardResponseMessage + + forward_SyncService_Update_0 = runtime.ForwardResponseMessage +) diff --git a/gen/proto/sync/v1/sync_service.pb.ts b/gen/proto/sync/v1/sync_service.pb.ts new file mode 100644 index 0000000..a188290 --- /dev/null +++ b/gen/proto/sync/v1/sync_service.pb.ts @@ -0,0 +1,54 @@ +/* eslint-disable */ +// @ts-nocheck +/* +* This file is a generated Typescript file for GRPC Gateway, DO NOT MODIFY +*/ + +import * as fm from "../../fetch.pb" +import * as GoogleProtobufTimestamp from "../../google/protobuf/timestamp.pb" +import * as SyncV1Host from "./host.pb" +import * as SyncV1Keychain from "./keychain.pb" +import * as SyncV1Known_hosts from "./known_hosts.pb" + +type Absent = { [k in Exclude]?: undefined }; +type OneOf = + | { [k in keyof T]?: undefined } + | ( + keyof T extends infer K ? + (K extends string & keyof T ? { [k in K]: T[K] } & Absent + : never) + : never); +export type SyncRequest = { + after?: GoogleProtobufTimestamp.Timestamp +} + +export type SyncResponse = { + serverTime?: GoogleProtobufTimestamp.Timestamp + hostSet?: SyncV1Host.Host[] + knownHostSet?: SyncV1Known_hosts.KnownHost[] + sshKeySet?: SyncV1Keychain.SshKey[] + identitySet?: SyncV1Keychain.Identity[] +} + + +type BaseUpdateRequest = { +} + +export type UpdateRequest = BaseUpdateRequest + & OneOf<{ host: SyncV1Host.Host; knownHost: SyncV1Known_hosts.KnownHost; sshKey: SyncV1Keychain.SshKey; identity: SyncV1Keychain.Identity }> + + +type BaseUpdateResponse = { +} + +export type UpdateResponse = BaseUpdateResponse + & OneOf<{ host: SyncV1Host.Host; knownHost: SyncV1Known_hosts.KnownHost; sshKey: SyncV1Keychain.SshKey; identity: SyncV1Keychain.Identity }> + +export class SyncService { + static Sync(req: SyncRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq(`/gapi/sync/v1/sync?${fm.renderURLSearchParams(req, [])}`, {...initReq, method: "GET"}) + } + static Update(req: UpdateRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq(`/gapi/sync/v1/update`, {...initReq, method: "POST"}) + } +} \ No newline at end of file diff --git a/gen/proto/sync/v1/sync_service_grpc.pb.go b/gen/proto/sync/v1/sync_service_grpc.pb.go new file mode 100644 index 0000000..d544a1b --- /dev/null +++ b/gen/proto/sync/v1/sync_service_grpc.pb.go @@ -0,0 +1,150 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc (unknown) +// source: sync/v1/sync_service.proto + +package syncV1 + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +const ( + SyncService_Sync_FullMethodName = "/sync.v1.SyncService/Sync" + SyncService_Update_FullMethodName = "/sync.v1.SyncService/Update" +) + +// SyncServiceClient is the client API for SyncService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type SyncServiceClient interface { + // 拉取指定时间点之后的配置变动信息 + Sync(ctx context.Context, in *SyncRequest, opts ...grpc.CallOption) (*SyncResponse, error) + // 提交最新配置 若配置的ID为空,则创建新配置。若配置的删除时间不为空,则代表该配置已被删除。 + Update(ctx context.Context, in *UpdateRequest, opts ...grpc.CallOption) (*UpdateResponse, error) +} + +type syncServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewSyncServiceClient(cc grpc.ClientConnInterface) SyncServiceClient { + return &syncServiceClient{cc} +} + +func (c *syncServiceClient) Sync(ctx context.Context, in *SyncRequest, opts ...grpc.CallOption) (*SyncResponse, error) { + out := new(SyncResponse) + err := c.cc.Invoke(ctx, SyncService_Sync_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *syncServiceClient) Update(ctx context.Context, in *UpdateRequest, opts ...grpc.CallOption) (*UpdateResponse, error) { + out := new(UpdateResponse) + err := c.cc.Invoke(ctx, SyncService_Update_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// SyncServiceServer is the server API for SyncService service. +// All implementations must embed UnimplementedSyncServiceServer +// for forward compatibility +type SyncServiceServer interface { + // 拉取指定时间点之后的配置变动信息 + Sync(context.Context, *SyncRequest) (*SyncResponse, error) + // 提交最新配置 若配置的ID为空,则创建新配置。若配置的删除时间不为空,则代表该配置已被删除。 + Update(context.Context, *UpdateRequest) (*UpdateResponse, error) + mustEmbedUnimplementedSyncServiceServer() +} + +// UnimplementedSyncServiceServer must be embedded to have forward compatible implementations. +type UnimplementedSyncServiceServer struct { +} + +func (UnimplementedSyncServiceServer) Sync(context.Context, *SyncRequest) (*SyncResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Sync not implemented") +} +func (UnimplementedSyncServiceServer) Update(context.Context, *UpdateRequest) (*UpdateResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Update not implemented") +} +func (UnimplementedSyncServiceServer) mustEmbedUnimplementedSyncServiceServer() {} + +// UnsafeSyncServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to SyncServiceServer will +// result in compilation errors. +type UnsafeSyncServiceServer interface { + mustEmbedUnimplementedSyncServiceServer() +} + +func RegisterSyncServiceServer(s grpc.ServiceRegistrar, srv SyncServiceServer) { + s.RegisterService(&SyncService_ServiceDesc, srv) +} + +func _SyncService_Sync_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SyncRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SyncServiceServer).Sync(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SyncService_Sync_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SyncServiceServer).Sync(ctx, req.(*SyncRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SyncService_Update_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SyncServiceServer).Update(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: SyncService_Update_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SyncServiceServer).Update(ctx, req.(*UpdateRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// SyncService_ServiceDesc is the grpc.ServiceDesc for SyncService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var SyncService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "sync.v1.SyncService", + HandlerType: (*SyncServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Sync", + Handler: _SyncService_Sync_Handler, + }, + { + MethodName: "Update", + Handler: _SyncService_Update_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "sync/v1/sync_service.proto", +} diff --git a/gen/proto/user/v1/user_service.pb.go b/gen/proto/user/v1/user_service.pb.go index 7605ee9..2b04721 100644 --- a/gen/proto/user/v1/user_service.pb.go +++ b/gen/proto/user/v1/user_service.pb.go @@ -308,36 +308,36 @@ var file_user_v1_user_service_proto_rawDesc = []byte{ 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x22, 0x1e, 0x0a, 0x1c, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x43, - 0x6f, 0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0x86, 0x03, 0x0a, 0x0b, - 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x55, 0x0a, 0x07, 0x47, + 0x6f, 0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0x89, 0x03, 0x0a, 0x0b, + 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x58, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x17, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x66, - 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x17, 0x82, 0xd3, 0xe4, 0x93, 0x02, - 0x11, 0x12, 0x0f, 0x2f, 0x67, 0x61, 0x70, 0x69, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x69, 0x6e, - 0x66, 0x6f, 0x12, 0x8c, 0x01, 0x0a, 0x13, 0x53, 0x65, 0x6e, 0x64, 0x45, 0x6d, 0x61, 0x69, 0x6c, - 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x23, 0x2e, 0x75, 0x73, 0x65, - 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x56, 0x65, - 0x72, 0x69, 0x66, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x24, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x45, 0x6d, - 0x61, 0x69, 0x6c, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2a, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x24, 0x3a, 0x01, 0x2a, - 0x22, 0x1f, 0x2f, 0x67, 0x61, 0x70, 0x69, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x76, 0x31, 0x2f, - 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x2f, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x2f, 0x73, 0x65, 0x6e, - 0x64, 0x12, 0x90, 0x01, 0x0a, 0x14, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x45, 0x6d, 0x61, 0x69, 0x6c, - 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x24, 0x2e, 0x75, 0x73, 0x65, - 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x56, - 0x65, 0x72, 0x69, 0x66, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x25, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, - 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x25, 0x3a, - 0x01, 0x2a, 0x22, 0x20, 0x2f, 0x67, 0x61, 0x70, 0x69, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x76, - 0x31, 0x2f, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x2f, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x2f, 0x63, - 0x68, 0x65, 0x63, 0x6b, 0x42, 0x3c, 0x5a, 0x3a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, - 0x6f, 0x6d, 0x2f, 0x6a, 0x75, 0x61, 0x6e, 0x6a, 0x69, 0x54, 0x65, 0x63, 0x68, 0x2f, 0x6a, 0x54, - 0x65, 0x72, 0x6d, 0x2d, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x76, 0x31, 0x3b, 0x75, 0x73, 0x65, 0x72, - 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1a, 0x82, 0xd3, 0xe4, 0x93, 0x02, + 0x14, 0x12, 0x12, 0x2f, 0x67, 0x61, 0x70, 0x69, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x76, 0x31, + 0x2f, 0x69, 0x6e, 0x66, 0x6f, 0x12, 0x8c, 0x01, 0x0a, 0x13, 0x53, 0x65, 0x6e, 0x64, 0x45, 0x6d, + 0x61, 0x69, 0x6c, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x23, 0x2e, + 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x45, 0x6d, 0x61, 0x69, + 0x6c, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x24, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x6e, + 0x64, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x43, 0x6f, 0x64, 0x65, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2a, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x24, + 0x3a, 0x01, 0x2a, 0x22, 0x1f, 0x2f, 0x67, 0x61, 0x70, 0x69, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, + 0x76, 0x31, 0x2f, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x2f, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x2f, + 0x73, 0x65, 0x6e, 0x64, 0x12, 0x90, 0x01, 0x0a, 0x14, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x45, 0x6d, + 0x61, 0x69, 0x6c, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x24, 0x2e, + 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x45, 0x6d, 0x61, + 0x69, 0x6c, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x68, + 0x65, 0x63, 0x6b, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x43, 0x6f, + 0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2b, 0x82, 0xd3, 0xe4, 0x93, + 0x02, 0x25, 0x3a, 0x01, 0x2a, 0x22, 0x20, 0x2f, 0x67, 0x61, 0x70, 0x69, 0x2f, 0x75, 0x73, 0x65, + 0x72, 0x2f, 0x76, 0x31, 0x2f, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x2f, 0x65, 0x6d, 0x61, 0x69, + 0x6c, 0x2f, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x42, 0x3c, 0x5a, 0x3a, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6a, 0x75, 0x61, 0x6e, 0x6a, 0x69, 0x54, 0x65, 0x63, 0x68, + 0x2f, 0x6a, 0x54, 0x65, 0x72, 0x6d, 0x2d, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x65, 0x6e, + 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x76, 0x31, 0x3b, 0x75, + 0x73, 0x65, 0x72, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/gen/proto/user/v1/user_service.pb.gw.go b/gen/proto/user/v1/user_service.pb.gw.go index b78fab6..b97bf1d 100644 --- a/gen/proto/user/v1/user_service.pb.gw.go +++ b/gen/proto/user/v1/user_service.pb.gw.go @@ -131,7 +131,7 @@ func RegisterUserServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/user.v1.UserService/GetInfo", runtime.WithHTTPPathPattern("/gapi/user/info")) + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/user.v1.UserService/GetInfo", runtime.WithHTTPPathPattern("/gapi/user/v1/info")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -245,7 +245,7 @@ func RegisterUserServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/user.v1.UserService/GetInfo", runtime.WithHTTPPathPattern("/gapi/user/info")) + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/user.v1.UserService/GetInfo", runtime.WithHTTPPathPattern("/gapi/user/v1/info")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -309,7 +309,7 @@ func RegisterUserServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux } var ( - pattern_UserService_GetInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"gapi", "user", "info"}, "")) + pattern_UserService_GetInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"gapi", "user", "v1", "info"}, "")) pattern_UserService_SendEmailVerifyCode_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 2, 5}, []string{"gapi", "user", "v1", "verify", "email", "send"}, "")) diff --git a/gen/proto/user/v1/user_service.pb.ts b/gen/proto/user/v1/user_service.pb.ts index 55ca9fb..01ae130 100644 --- a/gen/proto/user/v1/user_service.pb.ts +++ b/gen/proto/user/v1/user_service.pb.ts @@ -30,7 +30,7 @@ export type CheckEmailVerifyCodeResponse = { export class UserService { static GetInfo(req: GetInfoRequest, initReq?: fm.InitReq): Promise { - return fm.fetchReq(`/gapi/user/info?${fm.renderURLSearchParams(req, [])}`, {...initReq, method: "GET"}) + return fm.fetchReq(`/gapi/user/v1/info?${fm.renderURLSearchParams(req, [])}`, {...initReq, method: "GET"}) } static SendEmailVerifyCode(req: SendEmailVerifyCodeRequest, initReq?: fm.InitReq): Promise { return fm.fetchReq(`/gapi/user/v1/verify/email/send`, {...initReq, method: "POST", body: JSON.stringify(req, fm.replacer)}) diff --git a/proto/auth/v1/auth_service.proto b/proto/auth/v1/auth_service.proto index 8a8ce6c..a916a33 100644 --- a/proto/auth/v1/auth_service.proto +++ b/proto/auth/v1/auth_service.proto @@ -1,21 +1,22 @@ syntax = "proto3"; package auth.v1; -option go_package = "github.com/juanjiTech/jTerm-proto/gen/proto/auth/v1;authV1"; import "google/api/annotations.proto"; +option go_package = "github.com/juanjiTech/jTerm-proto/gen/proto/auth/v1;authV1"; + service AuthService { // 用户注册 - rpc Register(RegisterRequest) returns(RegisterResponse) { - option(google.api.http) = { + rpc Register(RegisterRequest) returns (RegisterResponse) { + option (google.api.http) = { post: "/gapi/auth/v1/register", body: "*" }; } // 用户登录 - rpc Login(LoginRequest) returns(LoginResponse) { - option(google.api.http) = { + rpc Login(LoginRequest) returns (LoginResponse) { + option (google.api.http) = { post: "/gapi/auth/v1/login", body: "*" }; @@ -59,4 +60,4 @@ message RefreshTokenRequest { message RefreshTokenResponse { string access_token = 1; string refresh_token = 3; -} +} \ No newline at end of file diff --git a/proto/sync/v1/host.proto b/proto/sync/v1/host.proto new file mode 100644 index 0000000..24431f1 --- /dev/null +++ b/proto/sync/v1/host.proto @@ -0,0 +1,25 @@ +syntax = "proto3"; +package sync.v1; + +import "google/protobuf/timestamp.proto"; + +option go_package = "github.com/juanjiTech/jTerm-proto/gen/proto/sync/v1;syncV1"; + +message Host { + string id = 1; // 内部唯一ID ulid + google.protobuf.Timestamp created_at = 2; // 创建时间 + google.protobuf.Timestamp updated_at = 3; // 更新时间 + google.protobuf.Timestamp deleted_at = 4; // 删除时间 + + string label = 11; // 标签 + repeated string tags = 12; + + string address = 13; // ip或host + int64 port = 14; + string charset = 15; // 字符集 + + string username = 21; // 用户名 + string password = 22; // 密码 + string key_id = 23; // 密钥ID + string identity_id = 24; // 身份ID 若身份ID不为空,则覆盖手动配置 +} \ No newline at end of file diff --git a/proto/sync/v1/keychain.proto b/proto/sync/v1/keychain.proto new file mode 100644 index 0000000..34feb59 --- /dev/null +++ b/proto/sync/v1/keychain.proto @@ -0,0 +1,35 @@ +syntax = "proto3"; +package sync.v1; + +import "google/protobuf/timestamp.proto"; + +option go_package = "github.com/juanjiTech/jTerm-proto/gen/proto/sync/v1;syncV1"; + +// SSH 密钥 +message SshKey { + string id = 1; // 内部唯一ID ulid + google.protobuf.Timestamp created_at = 2; // 创建时间 + google.protobuf.Timestamp updated_at = 3; // 更新时间 + google.protobuf.Timestamp deleted_at = 4; // 删除时间 + + string label = 11; // 标签 + string private_key = 12; // 私钥 + string public_key = 13; // 公钥 + string certificate = 14; // 证书 +} + +// Identity(身份) 包含身份验证详细信息,如果某些服务器需要提供同一组凭据,则可以节省配置的时间。 +// 这些凭据可以快速添加为身份并与主机条目链接。当凭据发生更改时,不必更新每台主机而只需更新身份即可。 +message Identity { + string id = 1; // 内部唯一ID ulid + google.protobuf.Timestamp created_at = 2; // 创建时间 + google.protobuf.Timestamp updated_at = 3; // 更新时间 + google.protobuf.Timestamp deleted_at = 4; // 删除时间 + + string label = 11; // 标签 + string username = 12; + string password = 13; + string key_id = 14; // 密钥ID +} + +// TODO: FIDO2,Certificate,BiometricKey \ No newline at end of file diff --git a/proto/sync/v1/known_hosts.proto b/proto/sync/v1/known_hosts.proto new file mode 100644 index 0000000..44e18b8 --- /dev/null +++ b/proto/sync/v1/known_hosts.proto @@ -0,0 +1,16 @@ +syntax = "proto3"; +package sync.v1; + +import "google/protobuf/timestamp.proto"; + +option go_package = "github.com/juanjiTech/jTerm-proto/gen/proto/sync/v1;syncV1"; + +message KnownHost { + string id = 1; // 内部唯一ID ulid + google.protobuf.Timestamp created_at = 2; // 创建时间 + google.protobuf.Timestamp updated_at = 3; // 更新时间 + google.protobuf.Timestamp deleted_at = 4; // 删除时间 + + string address = 11; // ip或host + string public_key = 12; // 公钥 +} \ No newline at end of file diff --git a/proto/sync/v1/sync_service.proto b/proto/sync/v1/sync_service.proto new file mode 100644 index 0000000..f8b3f1e --- /dev/null +++ b/proto/sync/v1/sync_service.proto @@ -0,0 +1,51 @@ +syntax = "proto3"; +package sync.v1; + +import "google/api/annotations.proto"; +import "google/protobuf/timestamp.proto"; +import "sync/v1/host.proto"; +import "sync/v1/keychain.proto"; +import "sync/v1/known_hosts.proto"; + +option go_package = "github.com/juanjiTech/jTerm-proto/gen/proto/sync/v1;syncV1"; + +service SyncService { + // 拉取指定时间点之后的配置变动信息 + rpc Sync(SyncRequest) returns (SyncResponse) { + option (google.api.http) = {get: "/gapi/sync/v1/sync"}; + } + // 提交最新配置 若配置的ID为空,则创建新配置。若配置的删除时间不为空,则代表该配置已被删除。 + rpc Update(UpdateRequest) returns (UpdateResponse) { + option (google.api.http) = {post:"/gapi/sync/v1/update"}; + } +} + +message SyncRequest { + google.protobuf.Timestamp after = 1; // 获取该时间之后的设置变化,若不设置该字段,则拉取全量配置信息 +} + +message SyncResponse { + google.protobuf.Timestamp server_time = 1; // 当前服务器时间,用于给客户端下一次拉取变动时做一个参照,避免因客户端时间偏差导致同步混乱 + repeated Host host_set = 11; + repeated KnownHost known_host_set = 12; + repeated SshKey ssh_key_set = 13; + repeated Identity identity_set = 14; +} + +message UpdateRequest { + oneof data { + Host host = 11; + KnownHost known_host = 12; + SshKey ssh_key = 13; + Identity identity = 14; + } +} + +message UpdateResponse { + oneof data { // 返回更新数据的服务端版本,因为新建的数据会加上ID和时间 + Host host = 11; + KnownHost known_host = 12; + SshKey ssh_key = 13; + Identity identity = 14; + } +} \ No newline at end of file diff --git a/proto/user/v1/user.proto b/proto/user/v1/user.proto index 29e0a27..1c66199 100644 --- a/proto/user/v1/user.proto +++ b/proto/user/v1/user.proto @@ -1,5 +1,6 @@ syntax = "proto3"; package user.v1; + option go_package = "github.com/juanjiTech/jTerm-proto/gen/proto/user/v1;userV1"; enum UserStatus { @@ -15,4 +16,4 @@ message User { UserStatus status = 3; // 用户状态 string avatar = 4; // 头像链接 string email = 5; // 邮箱 -} +} \ No newline at end of file diff --git a/proto/user/v1/user_service.proto b/proto/user/v1/user_service.proto index 2479505..470af95 100644 --- a/proto/user/v1/user_service.proto +++ b/proto/user/v1/user_service.proto @@ -1,34 +1,31 @@ syntax = "proto3"; package user.v1; -option go_package = "github.com/juanjiTech/jTerm-proto/gen/proto/user/v1;userV1"; import "google/api/annotations.proto"; import "user/v1/user.proto"; +option go_package = "github.com/juanjiTech/jTerm-proto/gen/proto/user/v1;userV1"; + service UserService { - rpc GetInfo(GetInfoRequest) returns(GetInfoResponse){ - option(google.api.http) = { - get: "/gapi/user/info" - }; + rpc GetInfo(GetInfoRequest) returns (GetInfoResponse) { + option (google.api.http) = {get: "/gapi/user/v1/info"}; } - rpc SendEmailVerifyCode(SendEmailVerifyCodeRequest) returns(SendEmailVerifyCodeResponse) { - option(google.api.http) = { + rpc SendEmailVerifyCode(SendEmailVerifyCodeRequest) returns (SendEmailVerifyCodeResponse) { + option (google.api.http) = { post: "/gapi/user/v1/verify/email/send", body: "*" }; } - rpc CheckEmailVerifyCode(CheckEmailVerifyCodeRequest) returns(CheckEmailVerifyCodeResponse) { - option(google.api.http) = { + rpc CheckEmailVerifyCode(CheckEmailVerifyCodeRequest) returns (CheckEmailVerifyCodeResponse) { + option (google.api.http) = { post: "/gapi/user/v1/verify/email/check", body: "*" }; } } -message GetInfoRequest { - -} +message GetInfoRequest {} message GetInfoResponse { User info = 1;