Documentation
¶
Index ¶
- Constants
- func AuthorizeCloudDownload(endpoint, rawURL string) (string, error)
- func AuthorizeCloudUpload(endpoint, rawURL string) (string, error)
- func FetchPackage(ctx context.Context, endpoint, token, rawURL, destination string, ...) (string, error)
- func InspectArchive(archivePath, kind string) error
- func UploadPackage(ctx context.Context, endpoint, token, rawURL, archivePath string, size int64) error
- type Deps
- type DeviceIdentity
- type Error
- type Export
- type FileEntry
- type PluginCommit
- type PluginPreview
- type Service
- type SkillCommit
- type SkillPreview
Constants ¶
View Source
const ( KindSkill = "skill" KindPlugin = "plugin" // 与现有安装器相同的上限。云端资源库不能另定一套更大的包。 SkillArchiveLimit int64 = 128 << 20 PluginArchiveLimit int64 = 64 << 20 SkillExtractLimit int64 = 128 << 20 PluginExtractLimit int64 = 256 << 20 MaxPackageFiles = 10000 )
View Source
const ( ActionExportPrepare = "export_prepare" ActionExportUpload = "export_upload" ActionInstallPrepare = "install_prepare" ActionInstallCommit = "install_commit" OperationInstall = "install" OperationUpdate = "update" // ChallengeTTL 是用户在 Cloud 上确认后回到设备的短窗口。过期必须重新预检。 ChallengeTTL = 2 * time.Minute )
Variables ¶
This section is empty.
Functions ¶
func AuthorizeCloudDownload ¶
AuthorizeCloudDownload 确认候选包 URL 属于当前已配对的 Nexus 原点。 其他云、本机、链路本地和私网地址都拒绝。调用方随后只能用配对 endpoint 上的 Device Token 去下载。
func AuthorizeCloudUpload ¶
AuthorizeCloudUpload 确认上传 URL 是同一配对原点上的资源库传输路由。 ticket 由 Cloud 绑定 node、kind 和预期摘要;设备只校验原点、公网地址和路径形状。
func FetchPackage ¶
func FetchPackage(ctx context.Context, endpoint, token, rawURL, destination string, maxBytes int64) (string, error)
FetchPackage 用资源包专用客户端下载候选 ZIP。 重定向不跟随。Device Token 只出现在发往配对域名的请求里,连接地址是拨号时重新校验过的公网 IP。
func InspectArchive ¶
InspectArchive 在把候选 ZIP 交给原生安装器之前拒绝明显危险的包。 不对入站包施加源码扩展名白名单;Skill/Plugin 能否安装仍由原生安装器决定, 这里负责路径穿越、符号链接、特殊文件、文件数和解压大小。
Types ¶
type Deps ¶
type Deps struct {
Now func() time.Time
Identity func() (DeviceIdentity, error)
Lookup func(kind, name string) (string, error)
SkillValidate func(context.Context, string, string) (SkillPreview, error)
SkillInstall func(context.Context, string, string) (SkillCommit, error)
PluginValidate func(context.Context, string) (PluginPreview, error)
PluginInstall func(context.Context, string, string) (PluginCommit, error)
PluginUpdate func(context.Context, string, string) (PluginCommit, error)
PluginInstalled func(string) (bool, error)
Fetch func(context.Context, string, string, string, string, int64) (string, error)
Upload func(context.Context, string, string, string, string, int64) error
}
Deps 把网络和原生安装器留在资源库外面。资源库负责确认、摘要和一次性挑战。
type DeviceIdentity ¶
DeviceIdentity 只保留资源库需要的配对身份。Device Token 不得进入响应。
type Export ¶
Export 是受管资源的安全备份 ZIP 摘要。本地绝对路径不会出现在结果里。
func ExportDirectory ¶
ExportDirectory 把一个已安装的受管目录打成 ZIP。 从已安装的受管目录导出完整资源,不对凭据、缓存或普通文件做隐式剔除。
type PluginCommit ¶
type PluginPreview ¶
type SkillCommit ¶
Click to show internal directories.
Click to hide internal directories.