router

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2026 License: Apache-2.0 Imports: 3 Imported by: 1 module, 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 router decides, before any rule runs, how much of a request needs inspection (pipeline tier T0). Skipping is how most traffic avoids the cost of rule evaluation, so matching is deliberately conservative: a request is only skipped when its path is unambiguous.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UnambiguousPath added in v0.2.3

func UnambiguousPath(rawURI string) (string, bool)

UnambiguousPath returns the request path if every component that sees it (Inkwall, the proxy, the application) would read it the same way. Only plain ASCII path characters are accepted (see plainPath); percent-encoding, non-ASCII or invalid UTF-8 bytes (fullwidth or overlong dots), backslashes, semicolons, repeated slashes and dot segments are rejected, because applications differ in how they interpret them, and that difference is how a skip rule becomes a bypass. Path exclusions (pkg/rules/coraza) use it for the same reason.

Types

type Decision

type Decision uint8

Decision is how much of a request to inspect.

const (
	// InspectAll inspects headers, URI and body. It is the default.
	InspectAll Decision = iota
	// SkipBody inspects headers and URI but not the body.
	SkipBody
	// SkipAll does not inspect the request at all.
	SkipAll
)

type Table

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

Table maps paths to decisions. The zero value inspects everything. It is safe for concurrent use once built.

func New

func New(skipAll, skipBody []string) (*Table, error)

New builds a table. Patterns are exact paths ("/healthz") or prefixes ending in "*" ("/static/*"). Patterns must be absolute and clean.

func (*Table) Decide

func (t *Table) Decide(rawURI string) Decision

Decide returns the decision for a request URI (path and query, as received). Anything that cannot be matched unambiguously is inspected.

Jump to

Keyboard shortcuts

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