challtestsrvclient

package
v0.20251007.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2025 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is an HTTP client for https://github.com/letsencrypt/challtestsrv's management interface (test/chall-test-srv).

func NewClient

func NewClient(baseURL string) *Client

NewClient creates a new Client using the provided baseURL, or defaults to http://10.77.77.77:8055 if none is provided.

func (*Client) AddAAAARecord

func (c *Client) AddAAAARecord(host string, addresses []string) ([]byte, error)

AddAAAARecord adds a mock AAAA response to the challenge server's DNS interface for the given host and IPv6 addresses. Any failure returns an error that includes both the relevant operation and the payload.

func (*Client) AddARecord

func (c *Client) AddARecord(host string, addresses []string) ([]byte, error)

AddARecord adds a mock A response to the challenge server's DNS interface for the given host and IPv4 addresses. Any failure returns an error that includes both the relevant operation and the payload.

func (*Client) AddCAAIssue

func (c *Client) AddCAAIssue(host, value string) ([]byte, error)

AddCAAIssue adds a mock CAA response to the challenge server's DNS interface. The mock CAA response will contain one policy with an "issue" tag specifying the provided value. Any failure returns an error that includes both the relevant operation and the payload.

func (*Client) AddDNS01Response

func (c *Client) AddDNS01Response(host, value string) ([]byte, error)

AddDNS01Response adds an ACME DNS-01 challenge response for the provided host to the challenge test server's DNS interfaces. The value is hashed and base64-encoded using RawURLEncoding, and served for TXT queries to _acme-challenge.<host>. Any failure returns an error that includes both the relevant operation and the payload.

func (*Client) AddDNSAccount01Response added in v0.20250922.0

func (c *Client) AddDNSAccount01Response(accountURL, host, value string) ([]byte, error)

AddDNSAccount01Response adds an ACME DNS-ACCOUNT-01 challenge response for the provided host to the challenge test server's DNS interfaces. The TXT record name is constructed using the accountURL, and the TXT record value is the base64url encoded SHA-256 hash of the provided value. Any failure returns an error that includes the relevant operation and the payload.

func (*Client) AddHTTP01Response

func (c *Client) AddHTTP01Response(token, keyauth string) ([]byte, error)

AddHTTP01Response adds an ACME HTTP-01 challenge response for the provided token under the /.well-known/acme-challenge/ path of the challenge test server's HTTP interfaces. The given keyauth will be returned as the HTTP response body for requests to the challenge token. Any failure returns an error that includes both the relevant operation and the payload.

func (*Client) AddHTTPRedirect

func (c *Client) AddHTTPRedirect(path, targetURL string) ([]byte, error)

AddHTTPRedirect adds a redirect to the challenge server's HTTP interfaces for HTTP requests to the given path directing the client to the targetURL. Redirects are not served for HTTPS requests. Any failure returns an error that includes both the relevant operation and the payload.

func (*Client) AddServfailResponse

func (c *Client) AddServfailResponse(host string) ([]byte, error)

AddServfailResponse configures the challenge test server to return SERVFAIL for all queries made for the provided host. This will override any other mocks for the host until removed with remove_servfail_response. Any failure returns an error that includes both the relevant operation and the payload.

func (*Client) AddTLSALPN01Response

func (c *Client) AddTLSALPN01Response(host, value string) ([]byte, error)

AddTLSALPN01Response adds an ACME TLS-ALPN-01 challenge response certificate to the challenge test server's TLS-ALPN-01 interface for the given host. The provided key authorization value will be embedded in the response certificate served to clients that initiate a TLS-ALPN-01 challenge validation with the challenge test server for the provided host. Any failure returns an error that includes both the relevant operation and the payload.

func (*Client) ClearDNSRequestHistory

func (c *Client) ClearDNSRequestHistory(host string) ([]byte, error)

ClearDNSRequestHistory clears the history of DNS requests made to the challenge test server's DNS interfaces for the given host. Any failure returns an error that includes both the relevant operation and the payload.

func (*Client) ClearHTTPRequestHistory

func (c *Client) ClearHTTPRequestHistory(host string) ([]byte, error)

ClearHTTPRequestHistory clears the challenge server's HTTP request history for the given host. Any failure returns an error that includes both the relevant operation and the payload.

func (*Client) ClearTLSALPN01RequestHistory

func (c *Client) ClearTLSALPN01RequestHistory(host string) ([]byte, error)

ClearTLSALPN01RequestHistory clears the history of TLS-ALPN-01 requests made to the challenge test server's TLS-ALPN-01 interface for the given host. Any failure returns an error that includes both the relevant operation and the payload.

func (*Client) DNSRequestHistory

func (c *Client) DNSRequestHistory(host string) ([]DNSRequest, error)

DNSRequestHistory returns the history of DNS requests made to the challenge test server's DNS interfaces for the given host. Any failure returns an error that includes both the relevant operation and the payload.

func (*Client) HTTPRequestHistory

func (c *Client) HTTPRequestHistory(host string) ([]HTTPRequest, error)

HTTPRequestHistory fetches the challenge server's HTTP request history for the given host.

func (*Client) RemoveAAAARecord

func (c *Client) RemoveAAAARecord(host string) ([]byte, error)

RemoveAAAARecord removes mock AAAA response from the challenge server's DNS interface for the given host. Any failure returns an error that includes both the relevant operation and the payload.

func (*Client) RemoveARecord

func (c *Client) RemoveARecord(host string) ([]byte, error)

RemoveARecord removes a mock A response from the challenge server's DNS interface for the given host. Any failure returns an error that includes both the relevant operation and the payload.

func (*Client) RemoveCAAIssue

func (c *Client) RemoveCAAIssue(host string) ([]byte, error)

RemoveCAAIssue removes a mock CAA response from the challenge server's DNS interface for the given host. Any failure returns an error that includes both the relevant operation and the payload.

func (*Client) RemoveDNS01Response

func (c *Client) RemoveDNS01Response(host string) ([]byte, error)

RemoveDNS01Response removes an ACME DNS-01 challenge response for the provided host from the challenge test server's DNS interfaces. Any failure returns an error that includes both the relevant operation and the payload.

func (*Client) RemoveDNSAccount01Response added in v0.20250922.0

func (c *Client) RemoveDNSAccount01Response(accountURL, host string) ([]byte, error)

RemoveDNSAccount01Response removes an ACME DNS-ACCOUNT-01 challenge response for the provided host and accountURL combination from the challenge test server's DNS interfaces. The TXT record name is constructed using the accountURL. Any failure returns an error that includes both the relevant operation and the payload.

func (*Client) RemoveHTTP01Response

func (c *Client) RemoveHTTP01Response(token string) ([]byte, error)

RemoveHTTP01Response removes an ACME HTTP-01 challenge response for the provided token from the challenge test server. Any failure returns an error that includes both the relevant operation and the payload.

func (*Client) RemoveHTTPRedirect

func (c *Client) RemoveHTTPRedirect(path string) ([]byte, error)

RemoveHTTPRedirect removes a redirect from the challenge server's HTTP interfaces for the given path. Any failure returns an error that includes both the relevant operation and the payload.

func (*Client) RemoveServfailResponse

func (c *Client) RemoveServfailResponse(host string) ([]byte, error)

RemoveServfailResponse undoes the work of AddServfailResponse, removing the SERVFAIL configuration for the given host. Any failure returns an error that includes both the relevant operation and the payload.

func (*Client) RemoveTLSALPN01Response

func (c *Client) RemoveTLSALPN01Response(host string) ([]byte, error)

RemoveTLSALPN01Response removes an ACME TLS-ALPN-01 challenge response certificate from the challenge test server's TLS-ALPN-01 interface for the given host. Any failure returns an error that includes both the relevant operation and the payload.

func (*Client) SetDefaultIPv4

func (c *Client) SetDefaultIPv4(addr string) ([]byte, error)

SetDefaultIPv4 sets the challenge server's default IPv4 address used to respond to A queries when there are no specific mock A addresses for the hostname being queried. Provide an empty string as the default address to disable answering A queries except for hosts that have mock A addresses added. Any failure returns an error that includes both the relevant operation and the payload.

func (*Client) SetDefaultIPv6

func (c *Client) SetDefaultIPv6(addr string) ([]byte, error)

SetDefaultIPv6 sets the challenge server's default IPv6 address used to respond to AAAA queries when there are no specific mock AAAA addresses for the hostname being queried. Provide an empty string as the default address to disable answering AAAA queries except for hosts that have mock AAAA addresses added. Any failure returns an error that includes both the relevant operation and the payload.

func (*Client) TLSALPN01RequestHistory

func (c *Client) TLSALPN01RequestHistory(host string) ([]TLSALPN01Request, error)

TLSALPN01RequestHistory returns the history of TLS-ALPN-01 requests made to the challenge test server's TLS-ALPN-01 interface for the given host. Any failure returns an error that includes both the relevant operation and the payload.

type DNSRequest

type DNSRequest struct {
	Question struct {
		Name   string `json:"Name"`
		Qtype  uint16 `json:"Qtype"`
		Qclass uint16 `json:"Qclass"`
	} `json:"Question"`
	UserAgent string `json:"UserAgent"`
}

DNSRequest is a single DNS request in the request history.

type HTTPRequest

type HTTPRequest struct {
	URL        string `json:"URL"`
	Host       string `json:"Host"`
	HTTPS      bool   `json:"HTTPS"`
	ServerName string `json:"ServerName"`
	UserAgent  string `json:"UserAgent"`
}

HTTPRequest is a single HTTP request in the request history.

type TLSALPN01Request

type TLSALPN01Request struct {
	ServerName      string   `json:"ServerName"`
	SupportedProtos []string `json:"SupportedProtos"`
}

TLSALPN01Request is a single TLS-ALPN-01 request in the request history.

Jump to

Keyboard shortcuts

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