Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

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

    HTTP API for managing a mail queue.

    func New

    func New(config *Config, queue *queue.Queue) *API

      Create a new API instance for the specified queue.

      func (*API) ServeHTTP

      func (a *API) ServeHTTP(w http.ResponseWriter, r *http.Request)

        Process an incoming request. This method logs the request and checks to ensure that HTTP basic auth credentials were supplied if required.

        func (*API) Start

        func (a *API) Start() error

          Start listening for new requests.

          func (*API) Stop

          func (a *API) Stop()

            Stop listening for new requests.

            type Config

            type Config struct {
            	Addr       string `json:"bind"`
            	CORSOrigin string `json:"cors-origin"`
            	TLSCert    string `json:"tls-cert"`
            	TLSKey     string `json:"tls-key"`
            	Username   string `json:"username"`
            	Password   string `json:"password"`
            }

              Configuration for the HTTP API.