protocol

package
v1.2.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 17, 2026 License: MIT Imports: 0 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package protocol 定义 LACTSSL 插件协议 v1 的线格式。

该包不依赖任何第三方库,主程序与插件仓库都直接引用它, 避免协议结构出现两份定义。

Index

Constants

View Source
const (
	// MemoryLimitEnv 是主程序传入的常驻内存预算(字节)。
	MemoryLimitEnv = "LACTSSL_PLUGIN_MEMORY_LIMIT"
	// ProtocolEnv 是主程序传入的协议版本。
	ProtocolEnv = "LACTSSL_PLUGIN_PROTOCOL"
	// DeployFeaturesEnv 是主程序声明的部署插件特性列表(逗号分隔)。
	DeployFeaturesEnv = "LACTSSL_DEPLOY_PLUGIN_FEATURES"
)

helper 进程的环境变量约定。

View Source
const FeatureMergedDeployers = "merged-deployers-v1"

FeatureMergedDeployers 告知部署 helper 只输出合并后的规范目标。

View Source
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

type DNSCondition struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

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 DNSOption

type DNSOption struct {
	Label string `json:"label"`
	Value string `json:"value"`
}

DNSOption 是下拉选项。

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

type DeployCondition struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

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

type DeployOption struct {
	Label string `json:"label"`
	Value string `json:"value"`
}

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 请求。

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL