routing

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2026 License: MIT Imports: 3 Imported by: 2 modules, 2 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 routing defines the Matcher interface for request-based routing decisions using HTTP-level context (hostname, method, path, headers, etc.).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Matcher

type Matcher interface {
	Match(*Request) bool
}

Matcher decides whether a Request matches a routing rule. It is used at the node level to filter which proxy nodes are eligible for a given request based on protocol-specific attributes.

type Request

type Request struct {
	// ClientIP is the client's IP address.
	ClientIP net.IP
	// Host is the target hostname.
	Host string
	// Network is the connection network type ("tcp", "udp").
	Network string
	// Protocol is the proxy protocol.
	Protocol string
	// Method is the HTTP request method.
	Method string
	// Path is the HTTP request path.
	Path string
	// Query is the HTTP query parameters.
	Query url.Values
	// Header is the HTTP request headers.
	Header http.Header
	// Body is a size-capped prefix of the HTTP request body, populated by
	// handlers that opt in to body matching (see hop.BodySizer). It is nil
	// or empty when no node requests body matching or the request is bodyless.
	// The full body is still forwarded; this prefix exists only for matching.
	Body []byte
}

Request carries the HTTP-level context for a routing decision. It is populated by protocol handlers (HTTP, SOCKS with hostname, TLS SNI) and used by Matchers to decide which route or node to select.

Jump to

Keyboard shortcuts

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