acmehttp

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2026 License: Apache-2.0 Imports: 10 Imported by: 0 modules, 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 acmehttp 实现 ACME HTTP-01 验证的应答:登记 token 对应的密钥授权, 并在 /.well-known/acme-challenge/<token> 上返回。

应答有两条路径:Web 服务模块在 80 端口监听时直接调用 Serve 应答; 80 端口空闲时 Provider 会临时启动一个只应答验证请求的服务,验证结束后关闭。

Index

Constants

View Source
const PathPrefix = "/.well-known/acme-challenge/"

PathPrefix 是 HTTP-01 验证请求的路径前缀。

Variables

This section is empty.

Functions

func Delete

func Delete(token string)

Delete 移除登记。

func Put

func Put(token, keyAuth string)

Put 登记 token 对应的密钥授权。

func Serve

func Serve(w http.ResponseWriter, r *http.Request) bool

Serve 处理验证请求:路径匹配且 token 已登记时写出密钥授权并返回 true,其余请求返回 false。

Types

type Provider

type Provider struct {
	// Port 为临时服务监听的端口,默认 80
	Port int
	// Logf 记录过程,可为 nil
	Logf func(format string, args ...any)
	// contains filtered or unexported fields
}

Provider 实现 lego 的 challenge.Provider(HTTP-01)。

func (*Provider) CleanUp

func (p *Provider) CleanUp(domain, token, keyAuth string) error

CleanUp 移除登记;最后一个 token 清理后关闭临时服务。

func (*Provider) Present

func (p *Provider) Present(domain, token, keyAuth string) error

Present 登记密钥授权,并确保有服务在监听验证端口。

Jump to

Keyboard shortcuts

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