Documentation
¶
Overview ¶
Package origin parses and matches web origins (scheme://host[:port]) with one strict grammar shared by every Credo surface that accepts an allow-list of origins (the WebSocket adapter, CORS). An origin is canonicalized to a lowercase scheme and host and an explicit port; an allow-list pattern may additionally carry one wildcard that stands for exactly one left-most DNS label ("https://*.example.com" matches "https://app.example.com" but not "https://example.com" or "https://a.b.example.com").
Index ¶
Constants ¶
const MaxLength = 2048
MaxLength bounds the raw text accepted by Parse and ParsePattern.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Origin ¶
Origin is a canonical web origin: lowercase scheme and host, explicit port. IPv6 hosts are stored unbracketed in their canonical textual form.
type Pattern ¶
Pattern is one allow-list entry: an exact origin, or a wildcard that matches exactly one left-most DNS label in front of Origin.Host.
func ParsePattern ¶
ParsePattern parses an allow-list entry, accepting one left-most wildcard label.