Documentation
¶
Index ¶
- Constants
- type Client
- type ClientOption
- type CloudflareOriginCA
- func (CloudflareOriginCA) CaddyModule() caddy.ModuleInfo
- func (c *CloudflareOriginCA) Issue(ctx context.Context, csr *x509.CertificateRequest) (*certmagic.IssuedCertificate, error)
- func (c *CloudflareOriginCA) IssuerKey() string
- func (c *CloudflareOriginCA) PreCheck(_ context.Context, names []string, _ bool) error
- func (c *CloudflareOriginCA) Provision(ctx caddy.Context) error
- func (c *CloudflareOriginCA) Revoke(ctx context.Context, cert certmagic.CertificateResource, reason int) error
- func (c *CloudflareOriginCA) UnmarshalCaddyfile(d *caddyfile.Dispenser) error
- type RevokeResult
Constants ¶
View Source
const (
DefaultCertificateAPIBaseURL = "https://api.cloudflare.com/client/v4/certificates"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client handles communication with the Cloudflare Origin CA API
func NewClient ¶
func NewClient(serviceKey, accountAPIToken string, options ...ClientOption) *Client
NewClient creates a new Cloudflare Origin CA API client
func (*Client) RequestCertificate ¶
func (c *Client) RequestCertificate(ctx context.Context, csr string, hostnames []string, requestType string, requestedValidity int) (string, string, error)
RequestCertificate requests a new certificate from Cloudflare Origin CA
func (*Client) RevokeCertificate ¶
RevokeCertificate revokes a certificate by its ID
type ClientOption ¶
type ClientOption func(*Client)
ClientOption allows customization of the Client
func WithBaseURL ¶
func WithBaseURL(url string) ClientOption
WithBaseURL sets a custom base URL for the API
type CloudflareOriginCA ¶
type CloudflareOriginCA struct {
// Cloudflare Origin CA service key, a type of token
// only allowed to manage certificates for a given zone
ServiceKey string `json:"service_key,omitempty"`
// Cloudflare account-scoped API token
AccountAPIToken string `json:"account_api_token,omitempty"`
// RequestedValidity is the duration for certificate validity (optional, max 15 years)
// If not specified, lets Cloudflare pick a default (currently 15 years)
RequestedValidity int `json:"requested_validity,omitempty"`
// RevokeOnExit controls whether certificates issued by this module are
// automatically revoked when the Caddy process exits gracefully.
// Disabled by default.
RevokeOnExit bool `json:"revoke_on_exit,omitempty"`
// BaseURL allows overriding the API endpoint (optional, for testing)
BaseURL string `json:"base_url,omitempty"`
// contains filtered or unexported fields
}
func (CloudflareOriginCA) CaddyModule ¶
func (CloudflareOriginCA) CaddyModule() caddy.ModuleInfo
func (*CloudflareOriginCA) Issue ¶
func (c *CloudflareOriginCA) Issue(ctx context.Context, csr *x509.CertificateRequest) (*certmagic.IssuedCertificate, error)
func (*CloudflareOriginCA) IssuerKey ¶
func (c *CloudflareOriginCA) IssuerKey() string
func (*CloudflareOriginCA) PreCheck ¶
PreCheck checks to reject names that are not supported by Cloudflare note: it's likely wildcard names like these are a side effect of an incorrect Caddy config
func (*CloudflareOriginCA) Provision ¶
func (c *CloudflareOriginCA) Provision(ctx caddy.Context) error
func (*CloudflareOriginCA) Revoke ¶
func (c *CloudflareOriginCA) Revoke(ctx context.Context, cert certmagic.CertificateResource, reason int) error
func (*CloudflareOriginCA) UnmarshalCaddyfile ¶
func (c *CloudflareOriginCA) UnmarshalCaddyfile(d *caddyfile.Dispenser) error
type RevokeResult ¶
RevokeResult contains information about a revoked certificate
Click to show internal directories.
Click to hide internal directories.