probs

package
v0.0.0-...-98addd5 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2017 License: MPL-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConnectionProblem            = ProblemType("urn:acme:error:connection")
	MalformedProblem             = ProblemType("urn:acme:error:malformed")
	ServerInternalProblem        = ProblemType("urn:acme:error:serverInternal")
	TLSProblem                   = ProblemType("urn:acme:error:tls")
	UnauthorizedProblem          = ProblemType("urn:acme:error:unauthorized")
	UnknownHostProblem           = ProblemType("urn:acme:error:unknownHost")
	RateLimitedProblem           = ProblemType("urn:acme:error:rateLimited")
	BadNonceProblem              = ProblemType("urn:acme:error:badNonce")
	InvalidEmailProblem          = ProblemType("urn:acme:error:invalidEmail")
	RejectedIdentifierProblem    = ProblemType("urn:acme:error:rejectedIdentifier")
	UnsupportedIdentifierProblem = ProblemType("urn:acme:error:unsupportedIdentifier")
)

Error types that can be used in ACME payloads

Variables

This section is empty.

Functions

func ProblemDetailsToStatusCode

func ProblemDetailsToStatusCode(prob *ProblemDetails) int

ProblemDetailsToStatusCode inspects the given ProblemDetails to figure out what HTTP status code it should represent. It should only be used by the WFE but is included in this package because of its reliance on ProblemTypes.

Types

type ProblemDetails

type ProblemDetails struct {
	Type   ProblemType `json:"type,omitempty"`
	Detail string      `json:"detail,omitempty"`
	// HTTPStatus is the HTTP status code the ProblemDetails should probably be sent
	// as.
	HTTPStatus int `json:"status,omitempty"`
}

ProblemDetails objects represent problem documents https://tools.ietf.org/html/draft-ietf-appsawg-http-problem-00

func BadNonce

func BadNonce(detail string) *ProblemDetails

BadNonce returns a ProblemDetails with a BadNonceProblem and a 400 Bad Request status code.

func Conflict

func Conflict(detail string) *ProblemDetails

Conflict returns a ProblemDetails with a MalformedProblem and a 409 Conflict status code.

func ConnectionFailure

func ConnectionFailure(detail string) *ProblemDetails

ConnectionFailure returns a ProblemDetails representing a ConnectionProblem error

func ContentLengthRequired

func ContentLengthRequired() *ProblemDetails

ContentLengthRequired returns a ProblemDetails representing a missing Content-Length header error

func InvalidEmail

func InvalidEmail(detail string) *ProblemDetails

InvalidEmail returns a ProblemDetails representing an invalid email address error

func Malformed

func Malformed(detail string, args ...interface{}) *ProblemDetails

Malformed returns a ProblemDetails with a MalformedProblem and a 400 Bad Request status code.

func MethodNotAllowed

func MethodNotAllowed() *ProblemDetails

MethodNotAllowed returns a ProblemDetails representing a disallowed HTTP method error.

func NotFound

func NotFound(detail string) *ProblemDetails

NotFound returns a ProblemDetails with a MalformedProblem and a 404 Not Found status code.

func RateLimited

func RateLimited(detail string) *ProblemDetails

RateLimited returns a ProblemDetails representing a RateLimitedProblem error

func RejectedIdentifier

func RejectedIdentifier(detail string) *ProblemDetails

RejectedIdentifier returns a ProblemDetails with a RejectedIdentifierProblem and a 400 Bad Request status code.

func ServerInternal

func ServerInternal(detail string) *ProblemDetails

ServerInternal returns a ProblemDetails with a ServerInternalProblem and a 500 Internal Server Failure status code.

func TLSError

func TLSError(detail string) *ProblemDetails

TLSError returns a ProblemDetails representing a TLSProblem error

func Unauthorized

func Unauthorized(detail string) *ProblemDetails

Unauthorized returns a ProblemDetails with an UnauthorizedProblem and a 403 Forbidden status code.

func UnknownHost

func UnknownHost(detail string) *ProblemDetails

UnknownHost returns a ProblemDetails representing an UnknownHostProblem error

func UnsupportedIdentifier

func UnsupportedIdentifier(detail string) *ProblemDetails

UnsupportedIdentifier returns a ProblemDetails with a UnsupportedIdentifierProblem and a 400 Bad Request status code.

func (*ProblemDetails) Error

func (pd *ProblemDetails) Error() string

type ProblemType

type ProblemType string

ProblemType defines the error types in the ACME protocol

Jump to

Keyboard shortcuts

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