dns

package
v1.4.3 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2026 License: MIT Imports: 4 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 dns 定义插件侧的最小 DNS-01 接口。

该接口刻意不依赖具体 lego 版本,这样上游包装可以通过结构类型满足该接口。

Package dns 提供官方 DNS helper 内部的服务商注册表。

每个 provider 包装包在 init 中注册;helper 只加载全部内置实现, 不区分「内置 / 外部」,因为 helper 本身就是外部插件。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Has

func Has(name string) bool

Has 判断服务商是否已注册(含别名)。

func IsVerifiable added in v1.3.8

func IsVerifiable(id string) bool

IsVerifiable 判断服务商是否声明了 verify-v1 能力。

func MarkVerifiable added in v1.3.8

func MarkVerifiable(ids ...string)

MarkVerifiable 在 init 中声明服务商支持只读验证。

func Register

func Register(p Provider)

Register 注册内置服务商。重复的 ID 或别名会直接 panic, 以便在开发阶段立刻发现冲突。

func ResetForTest

func ResetForTest()

ResetForTest 清空注册表,仅供测试使用。

Types

type ChallengeProvider added in v1.2.3

type ChallengeProvider interface {
	Present(domain, token, keyAuth string) error
	CleanUp(domain, token, keyAuth string) error
}

ChallengeProvider 是 DNS-01 所需的最小能力集合。

它与 lego 的 challenge.Provider 具有相同的方法签名, 因此原有 lego provider 无需修改即可继续使用。

type DuplicateError

type DuplicateError struct{ ID string }

DuplicateError 表示插件 ID 或别名冲突。

func (*DuplicateError) Error

func (e *DuplicateError) Error() string

type Provider

type Provider interface {
	// ID 是插件的规范标识,必须与主程序数据库中的 provider 值一致。
	ID() string
	// Aliases 是兼容别名。
	Aliases() []string
	// New 构造 DNS-01 challenge provider。配置通过 cfg 传入,
	// 同时 helper 仍会按 catalog 设置兼容的环境变量。
	New(cfg map[string]string) (ChallengeProvider, error)
}

Provider 是 DNS 服务商插件的统一接口。

func List

func List() []Provider

List 返回按 ID 排序的全部服务商。

func Lookup

func Lookup(name string) (Provider, bool)

Lookup 按 ID 或别名查找服务商。

type Verifier added in v1.3.8

type Verifier interface {
	Verify(ctx context.Context, domain string) (zone string, err error)
}

Verifier 是可选的只读探测接口:列出账号可管理的 zone,并确认域名归属。 返回的 zone 用于展示;未实现该接口的服务商由 helper 返回 unsupported, 宿主可回退到 DNS-01 写入测试。

Directories

Path Synopsis
Package state 在 present/cleanup 两次一次性进程调用之间传递 lego provider 的临时记录 ID。
Package state 在 present/cleanup 两次一次性进程调用之间传递 lego provider 的临时记录 ID。

Jump to

Keyboard shortcuts

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