Documentation
¶
Overview ¶
Package protocol 定义 LACTSSL 插件协议 v1 的线格式。
该包不依赖任何第三方库,主程序与插件仓库都直接引用它, 避免协议结构出现两份定义。
Index ¶
- Constants
- type Certificate
- type DNSCondition
- type DNSField
- type DNSManifest
- type DNSOption
- type DNSProvider
- type DNSRequest
- type DeployCondition
- type DeployField
- type DeployManifest
- type DeployOption
- type DeployRequest
- type Deployer
- type NotifyChannel
- type NotifyField
- type NotifyManifest
- type NotifyOption
- type NotifyRequest
Constants ¶
const ( // MemoryLimitEnv 是主程序传入的常驻内存预算(字节)。 MemoryLimitEnv = "LACTSSL_PLUGIN_MEMORY_LIMIT" // ProtocolEnv 是主程序传入的协议版本。 ProtocolEnv = "LACTSSL_PLUGIN_PROTOCOL" // DeployFeaturesEnv 是主程序声明的部署插件特性列表(逗号分隔)。 DeployFeaturesEnv = "LACTSSL_DEPLOY_PLUGIN_FEATURES" )
helper 进程的环境变量约定。
const FeatureMergedDeployers = "merged-deployers-v1"
FeatureMergedDeployers 告知部署 helper 只输出合并后的规范目标。
const ProtocolVersion = "v1"
ProtocolVersion 是当前 helper 协议版本。
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Certificate ¶
type Certificate struct {
Domain string `json:"domain"`
Domains []string `json:"domains,omitempty"`
Issuer string `json:"issuer,omitempty"`
Serial string `json:"serial,omitempty"`
NotBefore string `json:"not_before,omitempty"`
NotAfter string `json:"not_after,omitempty"`
CertPEM string `json:"cert_pem"`
FullchainPEM string `json:"fullchain_pem"`
KeyPEM string `json:"key_pem"`
}
Certificate 是交给插件的最小证书材料。 私钥只通过 stdin 传递,不写入 argv 或环境变量。
type DNSCondition ¶
DNSCondition 描述字段显示条件。
type DNSField ¶
type DNSField struct {
Key string `json:"key"`
Label string `json:"label"`
Type string `json:"type"`
Required bool `json:"required,omitempty"`
Secret bool `json:"secret,omitempty"`
Placeholder string `json:"placeholder,omitempty"`
Help string `json:"help,omitempty"`
Default string `json:"default,omitempty"`
Options []DNSOption `json:"options,omitempty"`
ShowIf *DNSCondition `json:"show_if,omitempty"`
}
DNSField 描述外部服务商的配置字段,与内置 FieldDef 的 JSON 结构保持兼容。
type DNSManifest ¶
type DNSManifest struct {
// Protocol 目前固定为 v1。
Protocol string `json:"protocol"`
// Name 是 helper 的可读名称,仅用于日志与展示。
Name string `json:"name,omitempty"`
// Version 是 helper 版本号,仅用于展示。
Version string `json:"version,omitempty"`
// SHA256 是 helper 可执行文件的 sha256;非空时主程序会校验。
SHA256 string `json:"sha256,omitempty"`
// Providers 是该 helper 支持的服务商列表。
Providers []DNSProvider `json:"providers"`
}
DNSManifest 是 DNS helper 通过 `manifest` 子命令输出的协议描述。
type DNSProvider ¶
type DNSProvider struct {
ID string `json:"id"`
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
Aliases []string `json:"aliases,omitempty"`
Fields []DNSField `json:"fields,omitempty"`
}
DNSProvider 描述一个由 helper 提供的 DNS 服务商。
type DNSRequest ¶
type DNSRequest struct {
Action string `json:"action"`
Provider string `json:"provider"`
Config map[string]string `json:"config,omitempty"`
Domain string `json:"domain,omitempty"`
Token string `json:"token,omitempty"`
KeyAuth string `json:"key_auth,omitempty"`
}
DNSRequest 是 present / cleanup 的 stdin 请求。
type DeployCondition ¶
DeployCondition 描述字段显示条件。
type DeployField ¶
type DeployField struct {
Key string `json:"key"`
Label string `json:"label"`
Type string `json:"type"`
Required bool `json:"required,omitempty"`
Secret bool `json:"secret,omitempty"`
Placeholder string `json:"placeholder,omitempty"`
Help string `json:"help,omitempty"`
Default string `json:"default,omitempty"`
Options []DeployOption `json:"options,omitempty"`
ShowIf *DeployCondition `json:"show_if,omitempty"`
}
DeployField 描述外部部署目标的配置字段。
type DeployManifest ¶
type DeployManifest struct {
Protocol string `json:"protocol"`
Name string `json:"name,omitempty"`
Version string `json:"version,omitempty"`
SHA256 string `json:"sha256,omitempty"`
// Deployers 是该 helper 支持的部署目标列表。
Deployers []Deployer `json:"deployers"`
}
DeployManifest 是部署 helper 通过 `manifest` 子命令输出的协议描述。
type DeployOption ¶
DeployOption 是下拉选项。
type DeployRequest ¶
type DeployRequest struct {
Action string `json:"action"`
Protocol string `json:"protocol,omitempty"`
Provider string `json:"provider"`
Auth map[string]string `json:"auth,omitempty"`
Config map[string]string `json:"config,omitempty"`
Certificate Certificate `json:"certificate"`
}
DeployRequest 是 deploy 的 stdin 请求。
type Deployer ¶
type Deployer struct {
ID string `json:"id"`
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
Aliases []string `json:"aliases,omitempty"`
Fields []DeployField `json:"fields,omitempty"`
// DeployFields 是任务流程部署节点中的参数。
DeployFields []DeployField `json:"deploy_fields,omitempty"`
}
Deployer 描述一个由 helper 提供的部署目标。
type NotifyChannel ¶
type NotifyChannel struct {
ID string `json:"id"`
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
Aliases []string `json:"aliases,omitempty"`
// Fields 是渠道配置字段;secret 或 password 字段会被脱敏并加密保存。
Fields []NotifyField `json:"fields,omitempty"`
}
NotifyChannel 描述一个由 helper 提供的通知渠道。
type NotifyField ¶
type NotifyField struct {
Key string `json:"key"`
Label string `json:"label,omitempty"`
LabelKey string `json:"label_key,omitempty"`
Type string `json:"type,omitempty"`
Required bool `json:"required,omitempty"`
Secret bool `json:"secret,omitempty"`
Placeholder string `json:"placeholder,omitempty"`
Help string `json:"help,omitempty"`
Default string `json:"default,omitempty"`
Options []NotifyOption `json:"options,omitempty"`
}
NotifyField 描述通知渠道的配置字段。 LabelKey 供官方前端做本地化;第三方插件可以直接使用 Label。
type NotifyManifest ¶
type NotifyManifest struct {
Protocol string `json:"protocol"`
Name string `json:"name,omitempty"`
Version string `json:"version,omitempty"`
SHA256 string `json:"sha256,omitempty"`
// Channels 是该 helper 支持的通知渠道列表。
Channels []NotifyChannel `json:"channels"`
}
NotifyManifest 是通知 helper 通过 `manifest` 子命令输出的协议描述。
type NotifyOption ¶
type NotifyOption struct {
Label string `json:"label,omitempty"`
LabelKey string `json:"label_key,omitempty"`
Value string `json:"value"`
}
NotifyOption 是下拉选项。
type NotifyRequest ¶
type NotifyRequest struct {
Action string `json:"action"`
Protocol string `json:"protocol,omitempty"`
Channel string `json:"channel"`
Config map[string]any `json:"config,omitempty"`
Title string `json:"title,omitempty"`
Body string `json:"body,omitempty"`
}
NotifyRequest 是 send 的 stdin 请求。