lambdaext

package
v4.10.2 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: AGPL-3.0 Imports: 17 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package lambdaext runs the sensor inside AWS Lambda as an external extension.

Lambda gives the sensor no kernel hooks and no port in front of the function, so it uses the one seam Lambda does offer: the Runtime API. The layer's exec wrapper points the function's runtime at the sensor (AWS_LAMBDA_RUNTIME_API=127.0.0.1:<port>), and the sensor forwards every call to the real Runtime API. When the runtime asks for its next invocation, the sensor inspects the event first: an API Gateway or function URL event is an HTTP request, and runs through the same engines and verdicts as the inbound proxy. A blocked or held request is answered with a 403 response on the function's behalf, the handler never sees it, and the sensor fetches the next invocation for the runtime.

Anything that is not an HTTP event passes through untouched, as does every event when the rules have not loaded or inspection fails.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Events

func Events(ctx context.Context, client *http.Client, runtimeAPI, id string, onInvoke func()) error

Events blocks on the extension event stream, calling onInvoke after each INVOKE, and returns when Lambda says SHUTDOWN or ctx ends.

func HTTPEvent

func HTTPEvent(event []byte) (*http.Request, []byte, bool)

HTTPEvent reads an API Gateway (REST v1 or HTTP v2) or function URL event as an HTTP request. ok is false for any other event.

func Register

func Register(ctx context.Context, client *http.Client, runtimeAPI, name string) (string, error)

Register registers the extension for INVOKE and SHUTDOWN and returns its id.

Types

type RuntimeProxy

type RuntimeProxy struct {
	// Upstream is the real Runtime API, host:port.
	Upstream string
	Rules    func() *engine.Set
	Verdicts *decide.Engine
	Report   func(uplink.Event)
	Client   *http.Client
	Now      func() time.Time
}

RuntimeProxy is the Runtime API as the function's runtime sees it.

func (*RuntimeProxy) ServeHTTP

func (p *RuntimeProxy) 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