Help us shape the future of Go! Take the 2026 Go Developer Survey

dataplane

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Overview

Package dataplane is the function-invocation data plane (ADR-0033): the HTTP handler that serves function traffic, separate from the control-plane API (ADR-0028).

Front door (ADR-0110, F79): it first consults the edge Router — a compiled Route matcher — to resolve a request to a (namespace, function). On a hit it runs the existing activator hop (it resolves, it does not proxy — scale-to-zero is preserved). On a miss it falls back to the path form /function/<name>, in the namespace its host names (ADR-0240), else X-Funcd-Namespace, else "default": if the target namespace is `explicit` the request is 404ed BEFORE any activator call (default-deny ingress, no wake); otherwise it is served by name exactly as before. Internal fn-to-fn invoke (ADR-0064) reuses this same in-process handler but marks its context WithInternal, which bypasses the Route front door and the exposure gate — internal invocation is by name and is never gated (spoof-proof: the marker is a context value set in-process, unreachable from the public listener).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HTTPEnvelope added in v0.14.0

func HTTPEnvelope(ns v1.NamespaceName, name v1.ObjectName, body []byte) []byte

HTTPEnvelope returns body as the CloudEvents v1.0 envelope for a call to an http Function (ADR-0243 Decision 3): it wraps every JSON body, even one with a top-level "specversion" or "data" key that ADR-0134 passes through for event callers, so the shim's adapter unwraps it without ambiguity. An empty body carries data:null, and a body that is not JSON, or not UTF-8, which json.Valid lets through and the adapter would not decode, passes unchanged.

func Handler

func Handler(st store.Store, act *activator.Activator, rtr router.Router, baseDomain string, enf *authn.Enforcer,
	lim *limit.TargetLimiter, stat *static.Handler, defaultTimeout time.Duration, logger *slog.Logger) http.Handler

Handler builds the data-plane HTTP handler. The activator is the sole serving path; gateway.Handler() is not mounted here (ADR-0033). rtr is the F79 edge router (may be nil, in which case only the /function/<name> path is served — implicit-only, pre-F79 behavior). enf is the F77 edge authn PEP (may be nil ⇒ no enforcement for `open`; an `authenticated` stance fails closed). lim is the key: function rate step (may be nil ⇒ no per-target check, ADR-0164). stat is the F82 static-asset handler (may be nil ⇒ a static Route match 404s). defaultTimeout is invoke.defaultTimeout, the response deadline of an external invoke whose Function sets no spec.timeout (≤ 0 ⇒ v1.DefaultInvokeTimeout, ADR-0151).

func InvokeEnvelope added in v0.2.1

func InvokeEnvelope(ns v1.NamespaceName, name v1.ObjectName, body []byte) []byte

InvokeEnvelope returns body as the CloudEvents v1.0 envelope for an invoke of ns/name under the ADR-0134 rule, or body unchanged when it is not valid JSON. The edge normalizes only external traffic, so an internal producer (the fn-to-fn broker, ADR-0064) uses this to emit its envelope.

func WithInternal

func WithInternal(ctx context.Context) context.Context

WithInternal marks ctx as an internal (fn-to-fn, ADR-0064) invocation so the exposure gate is bypassed — internal invocation is never gated by a namespace's exposure mode (ADR-0110). It is a context value set only in-process by the worker-node local API broker; an external request on the public listener gets a fresh context and can never spoof it.

Types

type Server

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

Server serves function-invocation traffic through the activator.

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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