certs

package
v0.1.72 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2026 License: AGPL-3.0 Imports: 28 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 certs is the node's certificate source (engine.CertSource): ACME for a domain and a persisted self-signed certificate whose SHA-256 pin the panel puts into subscription URIs.

acme_domain uses golang.org/x/crypto/acme/autocert, one Manager per server name, cache in the state dir. The HostPolicy accepts exactly that name. TLS-ALPN-01 is answered by whatever TLS listener asks Cert.GetCertificate (the engine's own TCP 443 listener, see hysteria2), so that listener must be reachable on 443. HTTP-01 is answered on :80 when it is free; otherwise only TLS-ALPN-01 is offered. acme_ip is not supported yet.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SiteCertificate added in v0.1.69

func SiteCertificate(acmeCert, fallback engine.Cert) func(*tls.ClientHelloInfo) (*tls.Certificate, error)

SiteCertificate is what a decoy site of the node presents (VLESS "self", MTProto "decoy"). A TLS-ALPN-01 hello and, once a certificate has been issued for the name, every hello go to the ACME entry (autocert returns the cached certificate and renews it in the background). Before the first issuance a persisted self-signed certificate of the same name serves instead: autocert blocks a first handshake for the whole issuance, and that wait would hold up every visitor.

"Issued" is "Info reports a certificate": the leaf last handed out. It stays set after the leaf's expiry, on purpose: with no visitor in months the reported leaf is old while the cache already holds the renewed one, and only the ACME entry reads it.

Types

type Source

type Source struct {
	// DirectoryURL is the ACME directory; empty means Let's Encrypt production (use staging first).
	DirectoryURL string
	// HTTPAddr is where HTTP-01 is served; default ":80".
	HTTPAddr string
	Log      *slog.Logger
	// contains filtered or unexported fields
}

Source implements engine.CertSource. Create it with New; the exported fields may be set before the first Acquire.

func New

func New(stateDir string) *Source

New keeps certificates and ACME state under stateDir (created 0700).

func (*Source) Acquire

func (s *Source) Acquire(ctx context.Context, inboundID string, t plugin.TLS) (engine.Cert, error)

Acquire returns the live certificate source for an inbound. Self-signed certificates are created on first use and reused afterwards (same pin). ACME certificates are fetched lazily on the first handshake and in the background right after Acquire; Info is zero until one exists.

func (*Source) HTTP01State added in v0.1.35

func (s *Source) HTTP01State() string

HTTP01State reports whether an ACME inbound can answer the HTTP-01 probe on this node.

func (*Source) Mark added in v0.1.35

func (s *Source) Mark(token, answer []byte, until time.Time) bool

Mark arms one one-shot HTTP-01 delivery mark: a GET for the challenge path of token is answered once with the key authorization shaped body (tcpcheck.MarkPath, tcpcheck.MarkBody). It is held only in memory and expires at until.

func (*Source) Release

func (s *Source) Release(inboundID string)

Release forgets the inbound's ACME claim; the last release of a name stops its renewals and, when no ACME name is left, the :80 listener. Self-signed files stay.

Jump to

Keyboard shortcuts

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