cert

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2026 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package cert automates certificates via sing-box certificate_provider (ACME) with file/none fallback. Placeholder — implemented in Phase 1 (doc/03 T10).

Index

Constants

View Source
const (
	CertModeDNS  = "dns"
	CertModeHTTP = "http"
	CertModeTLS  = "tls"
	CertModeFile = "file"
	CertModeNone = "none"
)

Cert mode identifiers (case-insensitive on input).

Variables

This section is empty.

Functions

func BuildInboundTLS

func BuildInboundTLS(cfg CertConfig, serverName string) (*option.InboundTLSOptions, error)

BuildInboundTLS maps cfg onto a sing-box inbound TLS option block.

  • none → nil (inbound serves plaintext; no error).
  • file → {Enabled, ServerName, CertificatePath, KeyPath}.
  • dns/http/tls → {Enabled, ServerName, ACME:{Domain, Email, <challenge>}}.

serverName is the SNI hint (typically the node Host); when cfg.CertDomain is empty the ACME domain falls back to serverName.

Types

type CertConfig

type CertConfig struct {
	// CertMode selects the certificate source: "dns", "http", "tls" (ACME via
	// the three challenge types), "file" (load from disk), or "none" (no TLS).
	CertMode string
	// CertDomain is the certificate's domain (ACME). Falls back to serverName.
	CertDomain string
	// CertFile / KeyFile are the on-disk PEM paths for CertMode "file".
	CertFile string
	KeyFile  string
	// Provider is the ACME DNS-01 provider id for CertMode "dns" (one of
	// constant.DNSProvider*: "alidns", "cloudflare", "acmedns").
	Provider string
	// Email is the ACME account email.
	Email string
	// DNSEnv carries the DNS-01 provider credentials (e.g. Cloudflare API token,
	// AliDNS access key). Keys are matched case-insensitively against a set of
	// known aliases per provider.
	DNSEnv map[string]string
}

CertConfig is the neutral certificate policy consumed by BuildInboundTLS. It is a field-for-field mirror of panel.CertConfig (doc/09 §5.3).

Jump to

Keyboard shortcuts

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