Documentation
¶
Overview ¶
Package policy is the policy document an administrator writes for the gateway: its types, strict decoding, the canonical encoding (one byte form per meaning, so two policies compare byte for byte) and an offline check of how a policy decides a described request.
The types are the gateway's own; a policy built or changed here is accepted or refused by the gateway exactly as written. Publishing a policy is never done here: it goes through the gateway's Admin API and its confirmed activation.
Index ¶
Constants ¶
const ( SchemaVersion = document.SchemaVersion LatestSchemaVersion = document.LatestSchemaVersion ProfileCore = document.ProfileCore )
SchemaVersion is the policy schema version written when nothing newer is needed; LatestSchemaVersion adds upstream URLs, TLS profiles and the Host header choice. The gateway reads both. ProfileCore is the only profile it supports.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Decision ¶
Decision is how a policy decides a Request. Check and Code name the refusing check and its error code; NotChecked lists what an offline check cannot decide.
func Check ¶
Check compiles p as the gateway would publish it and decides req in the request handler's order: route, access, roles, forward path. It cannot check a token, rate limits, bodies, blocked accounts or addresses, which need a running gateway. A policy the gateway would refuse is returned as its *PolicyError; an invalid request names the refused field.
type Policy ¶
The policy document's types.
func Decode ¶
Decode strictly decodes a policy document: unknown, repeated or non-lower-case members, anything after the document and a document larger than the gateway's default limit are refused with a *PolicyError. It checks the document's shape; Check also checks what it means, against the gateway's default capacity limits.
type PolicyError ¶
type PolicyError = document.PolicyError
PolicyError is a refusal: a stable code and the field it concerns.