Documentation
¶
Index ¶
- Constants
- type Account
- type AccountResponse
- type Authorization
- func (a *Authorization) AddChallenge(challenge *Challenge)
- func (a *Authorization) GetChallenges() []*Challenge
- func (a *Authorization) GetDNSChallenge() *Challenge
- func (a *Authorization) GetDomain() string
- func (a *Authorization) GetExpires() time.Time
- func (a *Authorization) GetTxtRecord() *Record
- type AuthorizationResponse
- type Certificate
- type Challenge
- type ChallengeResponse
- type Client
- func (c *Client) Authorize(order *Order) ([]*Authorization, error)
- func (c *Client) Close() error
- func (c *Client) CreateOrder(domains []string) (*Order, error)
- func (c *Client) GetAccount() (*Account, error)
- func (c *Client) GetCertificate(order *Order) (*Certificate, error)
- func (c *Client) GetOrder(id string) (*Order, error)
- func (c *Client) IsReady(order *Order) bool
- func (c *Client) SelfTest(authorization *Authorization) bool
- func (c *Client) SetMaxAttempts(attempts int)
- func (c *Client) Validate(challenge *Challenge, maxAttempts int) bool
- type ClientConfig
- type DirectoryResponse
- type JWK
- type JWKHeader
- type JWS
- type Order
- func (o *Order) GetAuthorizationURLs() []string
- func (o *Order) GetDomains() []string
- func (o *Order) GetExpiresAt() time.Time
- func (o *Order) GetFinalizeURL() string
- func (o *Order) GetID() string
- func (o *Order) GetIdentifiers() []map[string]string
- func (o *Order) GetStatus() string
- func (o *Order) GetURL() string
- type OrderResponse
- type Record
Constants ¶
const ( // Live and staging URLs DirectoryLive = "https://acme-v02.api.letsencrypt.org/directory" DirectoryStaging = "https://acme-staging-v02.api.letsencrypt.org/directory" // Modes ModeLive = "live" ModeStaging = "staging" // Directory endpoints DirectoryNewAccount = "newAccount" DirectoryNewNonce = "newNonce" DirectoryNewOrder = "newOrder" // Validation types - DNS only ValidationDNS = "dns-01" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account struct {
// contains filtered or unexported fields
}
Account represents a Let's Encrypt account
func NewAccount ¶
NewAccount creates a new Account
func (*Account) GetAccountURL ¶
GetAccountURL returns the account URL
func (*Account) GetContact ¶
GetContact returns the contact information
func (*Account) GetCreatedAt ¶
GetCreatedAt returns the account creation date
type AccountResponse ¶
type AccountResponse struct {
Contact []string `json:"contact"`
CreatedAt string `json:"createdAt"`
Status string `json:"status"`
}
AccountResponse represents the ACME account response
type Authorization ¶
type Authorization struct {
// contains filtered or unexported fields
}
Authorization represents an ACME authorization
func NewAuthorization ¶
func NewAuthorization(domain, expires, digest string) (*Authorization, error)
NewAuthorization creates a new Authorization
func (*Authorization) AddChallenge ¶
func (a *Authorization) AddChallenge(challenge *Challenge)
AddChallenge adds a challenge to the authorization
func (*Authorization) GetChallenges ¶
func (a *Authorization) GetChallenges() []*Challenge
GetChallenges returns all challenges
func (*Authorization) GetDNSChallenge ¶
func (a *Authorization) GetDNSChallenge() *Challenge
GetDNSChallenge returns the DNS challenge (only DNS validation supported)
func (*Authorization) GetDomain ¶
func (a *Authorization) GetDomain() string
GetDomain returns the domain being authorized
func (*Authorization) GetExpires ¶
func (a *Authorization) GetExpires() time.Time
GetExpires returns the expiry time
func (*Authorization) GetTxtRecord ¶
func (a *Authorization) GetTxtRecord() *Record
GetTxtRecord returns the TXT record for DNS validation
type AuthorizationResponse ¶
type AuthorizationResponse struct {
Identifier map[string]string `json:"identifier"`
Status string `json:"status"`
Expires string `json:"expires"`
Challenges []ChallengeResponse `json:"challenges"`
}
AuthorizationResponse represents the ACME authorization response
type Certificate ¶
type Certificate struct {
// contains filtered or unexported fields
}
Certificate represents an issued certificate
func NewCertificate ¶
func NewCertificate(privateKeyPEM, csr, chain string) (*Certificate, error)
NewCertificate creates a new Certificate
func (*Certificate) GetCSR ¶
func (c *Certificate) GetCSR() string
GetCSR returns the certificate signing request
func (*Certificate) GetCertificate ¶
func (c *Certificate) GetCertificate(asChain ...bool) string
GetCertificate returns the certificate, optionally as a chain
func (*Certificate) GetExpiryDate ¶
func (c *Certificate) GetExpiryDate() time.Time
GetExpiryDate returns the certificate expiry date
func (*Certificate) GetIntermediate ¶
func (c *Certificate) GetIntermediate() string
GetIntermediate returns the intermediate certificate
func (*Certificate) GetPrivateKey ¶
func (c *Certificate) GetPrivateKey() string
GetPrivateKey returns the private key
type Challenge ¶
type Challenge struct {
// contains filtered or unexported fields
}
Challenge represents an ACME challenge
func NewChallenge ¶
NewChallenge creates a new Challenge
func (*Challenge) GetAuthorizationURL ¶
GetAuthorizationURL returns the authorization URL
type ChallengeResponse ¶
type ChallengeResponse struct {
Type string `json:"type"`
Status string `json:"status"`
URL string `json:"url"`
Token string `json:"token"`
}
ChallengeResponse represents the ACME challenge response
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents the ACME client
func NewClient ¶
func NewClient(config *ClientConfig) (*Client, error)
NewClient creates a new ACME client
func (*Client) Authorize ¶
func (c *Client) Authorize(order *Order) ([]*Authorization, error)
Authorize obtains authorizations for an order
func (*Client) CreateOrder ¶
CreateOrder creates a new ACME order
func (*Client) GetAccount ¶
GetAccount retrieves account information (public method)
func (*Client) GetCertificate ¶
func (c *Client) GetCertificate(order *Order) (*Certificate, error)
GetCertificate retrieves the certificate for an order
func (*Client) SelfTest ¶
func (c *Client) SelfTest(authorization *Authorization) bool
SelfTest performs a DNS self-test for the authorization
func (*Client) SetMaxAttempts ¶ added in v1.0.2
SetMaxAttempts sets the maximum number of attempts for a request
type ClientConfig ¶
type ClientConfig struct {
Username string
Mode string
KeyLength int
BasePath string
SourceIP string
}
ClientConfig holds configuration for the ACME client
type DirectoryResponse ¶
type DirectoryResponse struct {
NewAccount string `json:"newAccount"`
NewNonce string `json:"newNonce"`
NewOrder string `json:"newOrder"`
RevokeCert string `json:"revokeCert"`
KeyChange string `json:"keyChange"`
}
DirectoryResponse represents the ACME directory structure
type JWKHeader ¶
type JWKHeader struct {
Alg string `json:"alg"`
JWK *JWK `json:"jwk,omitempty"`
KID string `json:"kid,omitempty"`
Nonce string `json:"nonce"`
URL string `json:"url"`
}
JWKHeader represents the JSON Web Key header
type JWS ¶
type JWS struct {
Protected string `json:"protected"`
Payload string `json:"payload"`
Signature string `json:"signature"`
}
JWS represents a JSON Web Signature
type Order ¶
type Order struct {
// contains filtered or unexported fields
}
Order represents an ACME order
func NewOrder ¶
func NewOrder(domains []string, url, status, expiresAt string, identifiers []map[string]string, authorizations []string, finalizeURL string) (*Order, error)
NewOrder creates a new Order
func (*Order) GetAuthorizationURLs ¶
GetAuthorizationURLs returns the authorization URLs
func (*Order) GetExpiresAt ¶
GetExpiresAt returns the expiry time
func (*Order) GetFinalizeURL ¶
GetFinalizeURL returns the finalize URL
func (*Order) GetIdentifiers ¶
GetIdentifiers returns the identifiers
type OrderResponse ¶
type OrderResponse struct {
Status string `json:"status"`
Expires string `json:"expires"`
Identifiers []map[string]string `json:"identifiers"`
Authorizations []string `json:"authorizations"`
Finalize string `json:"finalize"`
Certificate string `json:"certificate,omitempty"`
}
OrderResponse represents the ACME order response