api

package
v0.0.0-...-2d6eab0 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2020 License: GPL-3.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const MaxHostnames = 8

MaxHostnames is the maximum number of hostnames that can be specified for a single domain's TLS policy.

Variables

This section is empty.

Functions

func HandleSESNotification

func HandleSESNotification(database db.Database) func(http.ResponseWriter, *http.Request)

HandleSESNotification handles AWS SES bounces and complaints submitted to a webhook via AWS SNS (Simple Notification Service). The SNS webhook is configured to include a secret API key stored in the environment.

Types

type API

type API struct {
	Database db.Database

	List      PolicyList
	DontScan  map[string]bool
	Emailer   EmailSender
	Templates map[string]*template.Template
	// contains filtered or unexported fields
}

API is the HTTP API that this service provides. All requests respond with an response JSON, with fields:

{
    status_code // HTTP status code of request
    message // Any error message accompanying the status_code. If 200, empty.
    response // Response data (as JSON) from this request.
}

Any POST request accepts either URL query parameters or data value parameters, and prefers the latter if both are present.

func (*API) ParseTemplates

func (api *API) ParseTemplates(dir string)

ParseTemplates initializes our HTML template data

func (*API) RegisterHandlers

func (api *API) RegisterHandlers(mux *http.ServeMux) http.Handler

RegisterHandlers binds API functions to the given http server, and returns the resulting handler.

type EmailSender

type EmailSender interface {
	// SendValidation sends a validation e-mail for a particular domain,
	// with a particular validation token.
	SendValidation(*models.Domain, string) error
}

EmailSender interface wraps a back-end that can send e-mails.

type PolicyList

type PolicyList interface {
	HasDomain(string) bool
	Raw() policy.List
}

PolicyList interface wraps a policy-list like structure. The most important query you can perform is to fetch the policy for a particular domain.

Jump to

Keyboard shortcuts

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