api

package
v0.0.0-...-269b0f3 Latest Latest
Warning

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

Go to latest
Published: May 10, 2023 License: MIT Imports: 8 Imported by: 2

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.

Jump to

Keyboard shortcuts

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