Documentation
¶
Overview ¶
Package callbackurl validates and constructs the static callback URL boundary shared by providerd configuration and callback builders.
Index ¶
Constants ¶
const (
// ProvisionPath is the only backend callback ingress path.
ProvisionPath = "/callbacks/provision"
)
Variables ¶
This section is empty.
Functions ¶
func ValidateRawQuery ¶
ValidateRawQuery restricts an already-escaped wire representation to RFC 3986 query characters. net/url intentionally treats RawQuery as opaque: it will place a raw space, backslash, or non-UTF-8 byte directly in an HTTP/1 request line instead of escaping it. Different servers and proxies can then reject or rewrite bytes that the callback HMAC signed. Percent-encoded forms remain valid and byte-preserving; url.ParseQuery above proves every percent triplet is complete and rejects Go's unsupported raw semicolon separator.
Types ¶
type Base ¶
type Base struct {
// contains filtered or unexported fields
}
Base is a validated, canonical callback URL base. Its zero value is invalid; ParseBase is the only constructor. The parsed URL is private so callers cannot accidentally mutate validated authority into a different destination.
func ParseBase ¶
ParseBase validates and canonicalizes a callback base while preserving its RawQuery byte-for-byte. Path spelling is canonicalized before HMAC-bound URLs are built: trailing separators are removed and RawPath is cleared so equivalent escapes and literal Unicode have one RequestURI representation.
func (Base) EscapedPath ¶
EscapedPath returns the canonical path bytes that an HTTP request will carry. It is the value a path-stripping verifier prefix must match byte-for-byte.
func (Base) ProvisionURL ¶
ProvisionURL returns an independent URL value with ProvisionPath appended. The returned copy may be given one typed query capability by the provisioner; mutating it cannot invalidate Base itself.
type Endpoint ¶
type Endpoint struct {
// contains filtered or unexported fields
}
Endpoint is an immutable, wire-stable HTTP callback destination. ParseEndpoint is its only constructor; keeping url.URL private prevents callers from mutating a validated destination before it is persisted or sent.
func ParseEndpoint ¶
ParseEndpoint validates a complete callback destination without rewriting it. In particular, Path and RawQuery must already be in the exact form that net/http will put in RequestURI, because callback authentication signs those bytes and durable queues must be able to replay them unchanged.
func (Endpoint) EscapedPath ¶
EscapedPath returns the exact path bytes carried by RequestURI.
func (Endpoint) String ¶
String returns the exact validated destination, or the empty string for an invalid zero value.
func (Endpoint) WithRawQuery ¶
WithRawQuery returns the same validated destination with a replacement wire-stable query. It is used only to exchange typed callback capabilities while preserving the already-proved authority and path.