httpjson

package
v0.0.0-...-89e479d Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2026 License: Apache-2.0 Imports: 41 Imported by: 0

Documentation

Overview

Package httpjson will expose DKIM2 service operations over HTTP and JSON.

Index

Constants

View Source
const (
	// FinalDispositionAccept permits normal continuation.
	FinalDispositionAccept = outcome.DispositionAccept
	// FinalDispositionReject reports permanent local rejection.
	FinalDispositionReject = outcome.DispositionReject
	// FinalDispositionTempfail requests a retryable deferral.
	FinalDispositionTempfail = outcome.DispositionTempfail
	// FinalDispositionContinue withholds a terminal daemon decision.
	FinalDispositionContinue = outcome.DispositionContinue
)

Variables

This section is empty.

Functions

func IsMappingError

func IsMappingError(err error, code MappingErrorCode) bool

IsMappingError reports whether err belongs to one closed mapper class.

func IsServerConnContextFailure

func IsServerConnContextFailure(value any) bool

IsServerConnContextFailure reports whether a recovered panic is the private content-free connection-context invariant used by the guarded serve owner.

func IsServerRuntimeError

func IsServerRuntimeError(err error) bool

IsServerRuntimeError reports whether an error belongs to the stable HTTP server ownership class.

func IsStrictAdapterError

func IsStrictAdapterError(err error, class strictFailureClass) bool

IsStrictAdapterError reports whether err belongs to one closed adapter class.

func IsValidationError

func IsValidationError(err error) bool

IsValidationError reports whether err belongs to the closed validator class.

func MapBatchRevisionRequest

func MapBatchRevisionRequest(input generated.BatchRevisionRequest) (app.BatchRevisionRequest, error)

MapBatchRevisionRequest converts the generated complete-fanout contract to immutable domain evidence under the default aggregate message bound.

func MapBatchRevisionResult

func MapBatchRevisionResult(result app.BatchRevisionResult) (generated.BatchRevisionResponse, error)

MapBatchRevisionResult exposes only exact completed header fields and bound content digests.

func MapDeliveryStatusRequest

func MapDeliveryStatusRequest(input generated.DSNSignRequest) (app.DeliveryStatusRequest, error)

MapDeliveryStatusRequest maps one generated DSN-sign request to the dedicated daemon-owned evidence request.

func MapInboundResult

func MapInboundResult(
	result app.InboundResult,
	authservID string,
) (generated.ProcessResponse, error)

MapInboundResult maps one complete app result into the exact generated process response.

func MapOperationResult

func MapOperationResult(result app.OperationResult) (generated.OperationResponse, error)

MapOperationResult projects only complete signing-engine fields into an action plan.

func MapPropagationCommitRequest

func MapPropagationCommitRequest(input generated.DSNPropagateCommitRequest) (string, error)

MapPropagationCommitRequest extracts one bounded opaque commit token.

func MapPropagationCommitResult

func MapPropagationCommitResult(
	state app.PropagationCommitState,
) (generated.DSNPropagateCommitResponse, error)

MapPropagationCommitResult projects one closed commit state. An unresolved token has no success representation: the route answers 409 instead, so that the caller defers rather than leaving a coordinate uncommitted.

func MapPropagationRequest

func MapPropagationRequest(input generated.DSNPropagateRequest) (app.PropagationRequest, error)

MapPropagationRequest maps one generated propagation request to the daemon-owned domain request. The route admits exactly the null reverse path and one forward path; the signing domain is never a request member.

func MapPropagationResult

func MapPropagationResult(result app.PropagationResult) (generated.DSNPropagateResponse, error)

MapPropagationResult projects one coherent domain result into the generated response. It refuses every incoherent result, disposition, failure, and output combination so that an internal regression never reaches the wire. The delivery-status member is omitted when the evaluation never ran, so the response never carries a fabricated structure verdict.

func MapReviseRequest

func MapReviseRequest(input generated.ReviseRequest) (app.OperationRequest, error)

MapReviseRequest maps one generated ordinary-transit request to domain-owned values.

func MapSignRequest

func MapSignRequest(input generated.SignRequest) (app.OperationRequest, error)

MapSignRequest maps one generated originator request to domain-owned values. The null_sender declaration is required exactly for a null reverse path.

Types

type BoundaryConfig

type BoundaryConfig struct {
	// MessageBytes bounds each decoded RFC 5322 input; zero selects 32 MiB.
	MessageBytes    int
	Authority       string
	RequestDeadline time.Duration
	MaxInFlight     int
	MaxWaiters      int
	AdmissionWait   time.Duration
	// WorkingSetBytes is the process working-set budget; zero selects 8 GiB.
	WorkingSetBytes uint64
	// BatchAggregateBytes enables a dedicated batch-revision sizing and
	// admission pool whose decoded aggregate is at most this value. Zero keeps
	// batch requests on the shared single-message sizing.
	BatchAggregateBytes int
	// BatchMaxInFlight is the dedicated batch permit count; zero selects one.
	BatchMaxInFlight int
}

BoundaryConfig contains the immutable HTTP containment policy.

type DomainProjection

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

DomainProjection owns mapped success DTOs behind a formatting-safe package boundary.

func MapDomainResult

func MapDomainResult(result dkim2.VerifyResult, decision dkim2.PolicyDecision) (DomainProjection, error)

MapDomainResult maps one complete verification and local-policy result atomically.

func (DomainProjection) Format

func (DomainProjection) Format(state fmt.State, _ rune)

Format prevents formatting from traversing response identifiers.

func (DomainProjection) GoString

func (DomainProjection) GoString() string

GoString returns a content-free Go-syntax representation.

func (DomainProjection) MarshalJSON

func (DomainProjection) MarshalJSON() ([]byte, error)

MarshalJSON rejects serialization outside the future package-owned wire assembler.

func (DomainProjection) MarshalText

func (DomainProjection) MarshalText() ([]byte, error)

MarshalText rejects diagnostic text serialization of response identifiers.

func (DomainProjection) String

func (DomainProjection) String() string

String returns a content-free mapped-result representation.

type DomainRequest

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

DomainRequest owns one byte-preserving request mapped away from generated DTOs.

func MapProcessRequest

func MapProcessRequest(input generated.ProcessRequest) (DomainRequest, error)

MapProcessRequest maps decoded values after lexical, schema, and resource preflight.

The decoded generated wrapper cannot prove the spelling of the original JSON string token; the HTTP lexical preflight owns rejection of escaped-equivalent Base64 spellings. This mapper validates the decoded canonical Base64 value and preserves exact message and SMTP bytes.

func (DomainRequest) AuthservID

func (r DomainRequest) AuthservID() string

AuthservID returns the optional validated local reporting authority.

func (DomainRequest) Format

func (DomainRequest) Format(state fmt.State, _ rune)

Format prevents formatting verbs from traversing request bytes.

func (DomainRequest) GoString

func (DomainRequest) GoString() string

GoString returns a content-free Go-syntax representation.

func (DomainRequest) InboundRequest

func (r DomainRequest) InboundRequest() (app.InboundRequest, error)

InboundRequest returns the app-owned request with its optional tenant.

func (DomainRequest) MarshalJSON

func (DomainRequest) MarshalJSON() ([]byte, error)

MarshalJSON rejects serialization outside the package-owned request assembler.

func (DomainRequest) MarshalText

func (DomainRequest) MarshalText() ([]byte, error)

MarshalText rejects diagnostic serialization of request bytes.

func (DomainRequest) String

func (DomainRequest) String() string

String returns a content-free diagnostic representation.

func (DomainRequest) Tenant

func (r DomainRequest) Tenant() string

Tenant returns the optional validated request tenant.

func (DomainRequest) VerifyRequest

func (r DomainRequest) VerifyRequest() (dkim2.VerifyRequest, error)

VerifyRequest returns the stored immutable library request by value.

type FatalNotifier

type FatalNotifier interface {
	NotifyFatal()
}

FatalNotifier marks readiness false and requests orderly process shutdown.

type FinalDisposition

type FinalDisposition = outcome.FinalDisposition

FinalDisposition is the transport-neutral daemon outcome vocabulary.

type HTTPBoundary

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

HTTPBoundary owns route, admission, validation, and generated-adapter ordering.

func NewHTTPBoundary

func NewHTTPBoundary(
	config BoundaryConfig,
	matcher capabilityMatcher,
	readiness readinessSource,
	processor inboundProcessService,
	notifier FatalNotifier,
	validator *RequestValidator,
	dependencies ...any,
) (*HTTPBoundary, error)

NewHTTPBoundary constructs one immutable process-local HTTP handler.

func (*HTTPBoundary) Close

func (h *HTTPBoundary) Close()

Close rejects new process admission and interrupts ordinary waiters.

func (*HTTPBoundary) ServeHTTP

func (h *HTTPBoundary) ServeHTTP(writer http.ResponseWriter, request *http.Request)

ServeHTTP applies the frozen outer precedence and one-operation policy.

type HandlerRegistrationGate

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

HandlerRegistrationGate linearizes handler entry against instance shutdown.

func NewHandlerRegistrationGate

func NewHandlerRegistrationGate(next http.Handler) (*HandlerRegistrationGate, error)

NewHandlerRegistrationGate constructs a closed-until-open handler owner.

func (*HandlerRegistrationGate) Close

func (g *HandlerRegistrationGate) Close()

Close stops future registration without waiting for active handlers.

func (*HandlerRegistrationGate) Format

func (*HandlerRegistrationGate) Format(state fmt.State, _ rune)

Format prevents formatting verbs from traversing retained handler state.

func (*HandlerRegistrationGate) GoString

func (*HandlerRegistrationGate) GoString() string

GoString returns a content-free Go-syntax registration-gate representation.

func (*HandlerRegistrationGate) MarshalJSON

func (*HandlerRegistrationGate) MarshalJSON() ([]byte, error)

MarshalJSON rejects serialization of retained handler state.

func (*HandlerRegistrationGate) MarshalText

func (*HandlerRegistrationGate) MarshalText() ([]byte, error)

MarshalText rejects diagnostic serialization of retained handler state.

func (*HandlerRegistrationGate) Open

func (g *HandlerRegistrationGate) Open() bool

Open permits handler registration until the monotonic stopped transition.

func (*HandlerRegistrationGate) Quiescent

func (g *HandlerRegistrationGate) Quiescent() bool

Quiescent reports whether registration is closed and no admitted handler remains active.

func (*HandlerRegistrationGate) ServeHTTP

func (g *HandlerRegistrationGate) ServeHTTP(
	writer http.ResponseWriter,
	request *http.Request,
)

ServeHTTP registers before any boundary or dependency work and releases the registration on every ordinary, abort, and panic path.

func (*HandlerRegistrationGate) String

func (*HandlerRegistrationGate) String() string

String returns a content-free registration-gate representation.

func (*HandlerRegistrationGate) Wait

Wait joins active handlers after the stopped transition or returns the caller's bounded context state.

type MappingError

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

MappingError reports one bounded mapper failure without retaining input.

func (*MappingError) Code

func (e *MappingError) Code() MappingErrorCode

Code returns the closed mapper failure class.

func (*MappingError) Error

func (*MappingError) Error() string

Error returns a constant content-free mapper diagnostic.

func (*MappingError) Is

func (e *MappingError) Is(target error) bool

Is supports errors.Is without exposing a wrapped cause.

type MappingErrorCode

type MappingErrorCode uint8

MappingErrorCode identifies one content-free mapper failure class.

const (
	// MappingInvalidContract reports invalid or noncanonical transport values.
	MappingInvalidContract MappingErrorCode = iota + 1
	// MappingRequestTooLarge reports a request resource bound.
	MappingRequestTooLarge
	// MappingInternalContract reports an impossible domain result.
	MappingInternalContract
)

type RequestValidator

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

RequestValidator owns the immutable embedded OpenAPI router and filter options.

func NewRequestValidator

func NewRequestValidator() (*RequestValidator, error)

NewRequestValidator loads and validates the embedded contract without external references.

func (RequestValidator) Format

func (RequestValidator) Format(state fmt.State, _ rune)

Format prevents formatting from traversing validator internals.

func (RequestValidator) GoString

func (RequestValidator) GoString() string

GoString returns a content-free validator representation.

func (RequestValidator) String

func (RequestValidator) String() string

String returns a content-free validator representation.

func (*RequestValidator) ValidateOperation

func (v *RequestValidator) ValidateOperation(request *http.Request, body []byte) error

ValidateOperation validates one body snapshot through its exact embedded process, sign, or revise operation.

func (*RequestValidator) ValidateProcess

func (v *RequestValidator) ValidateProcess(request *http.Request, body []byte) error

ValidateProcess validates one body snapshot through the exact embedded operation.

type ServerFactory

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

ServerFactory performs pure HTTP transport assembly.

func NewServerFactory

func NewServerFactory() *ServerFactory

NewServerFactory constructs the production HTTP transport factory without acquiring any runtime resource.

func (*ServerFactory) Assemble

func (f *ServerFactory) Assemble(input app.HTTPAssemblyInput) (app.HTTPAssembly, error)

Assemble validates one immutable app snapshot and constructs its pure HTTP transport graph without opening a listener.

func (*ServerFactory) Format

func (*ServerFactory) Format(state fmt.State, _ rune)

Format prevents formatting verbs from traversing factory dependencies.

func (*ServerFactory) GoString

func (*ServerFactory) GoString() string

GoString returns a constant content-free factory representation.

func (*ServerFactory) MarshalJSON

func (*ServerFactory) MarshalJSON() ([]byte, error)

MarshalJSON rejects serialization of factory dependencies.

func (*ServerFactory) MarshalText

func (*ServerFactory) MarshalText() ([]byte, error)

MarshalText rejects text serialization of factory dependencies.

func (*ServerFactory) String

func (*ServerFactory) String() string

String returns a constant content-free factory representation.

type ServerListener

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

ServerListener exposes only the tracked listener operations needed by an instance-owned HTTP server.

func NewServerListener

func NewServerListener(
	listener net.Listener,
	dateProvider func() (string, bool),
) (*ServerListener, error)

NewServerListener constructs the fixed-cap server listener boundary.

func (*ServerListener) Accept

func (l *ServerListener) Accept() (net.Conn, error)

Accept returns one connection owned by the tracked transport boundary.

func (*ServerListener) Addr

func (l *ServerListener) Addr() net.Addr

Addr returns the configured listener address without exposing its owner.

func (*ServerListener) Close

func (l *ServerListener) Close() error

Close interrupts accept and closes the tracked listener exactly once.

func (*ServerListener) ConnContext

func (l *ServerListener) ConnContext(
	ctx context.Context,
	connection net.Conn,
) context.Context

ConnContext installs private tracked-connection state on the exact instance-owned server base context.

func (*ServerListener) Format

func (*ServerListener) Format(state fmt.State, _ rune)

Format prevents formatting verbs from traversing retained listener state.

func (*ServerListener) GoString

func (*ServerListener) GoString() string

GoString returns a content-free Go-syntax listener representation.

func (*ServerListener) MarshalJSON

func (*ServerListener) MarshalJSON() ([]byte, error)

MarshalJSON rejects serialization of retained listener state.

func (*ServerListener) MarshalText

func (*ServerListener) MarshalText() ([]byte, error)

MarshalText rejects diagnostic serialization of retained listener state.

func (*ServerListener) String

func (*ServerListener) String() string

String returns a content-free listener representation.

type ValidationError

type ValidationError struct{}

ValidationError reports a closed runtime OpenAPI failure.

func (*ValidationError) Error

func (*ValidationError) Error() string

Error returns a constant content-free validation diagnostic.

func (*ValidationError) Is

func (*ValidationError) Is(target error) bool

Is recognizes the bounded validator failure type.

Directories

Path Synopsis
Package generated provides primitives to interact with the openapi HTTP API.
Package generated provides primitives to interact with the openapi HTTP API.

Jump to

Keyboard shortcuts

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