proxy

package
v0.36.0 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2026 License: MIT Imports: 3 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 proxy declares the endpoint that reaches peers through their tunnels: where it serves and how it routes. The data plane underneath is package revproxy.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option interface{ ApplyProxy(*Proxy) }

Option configures a Proxy; every EndpointOption is one too.

func WithErrorHook

func WithErrorHook(hook revproxy.ErrorHook) Option

WithErrorHook observes requests the proxy could not serve, with a low-cardinality reason. See revproxy.ErrorHook.

func WithRequestHook added in v0.36.0

func WithRequestHook(hook reqlog.Hook) Option

WithRequestHook reports every request the proxy carried, once the response is done. See reqlog.Hook.

func WithResolvers

func WithResolvers(resolvers ...revproxy.Resolver) Option

WithResolvers appends custom resolvers to the chain, tried after the ones WithRouting names (or instead of the default when no strategy is configured). Repeatable.

func WithRouting

func WithRouting(routing revproxy.Routing, domain string) Option

WithRouting sets how the proxy picks the target peer; domain is the base domain for the subdomain strategies. The pair is resolved when the server runs — an unusable combination is an error there, not a proxy that routes nothing. See revproxy.Routing.

type Proxy

type Proxy struct {
	utils.Endpoint

	Opts []revproxy.Option

	// Routing and Domain hold the configured strategy; the server
	// resolves them at Run, so a bad pair fails before binding.
	Routing revproxy.Routing
	Domain  string

	// Resolvers are custom resolvers appended after the strategy's.
	Resolvers []revproxy.Resolver
}

Proxy is the endpoint that reaches peers through their tunnels. Build it with NewProxy.

func NewProxy

func NewProxy(addr string, opts ...Option) *Proxy

NewProxy declares the peer-reaching reverse proxy on addr. By default it routes on the x-tunnel-peer header; WithRouting adds subdomain routing, WithErrorHook observability.

Jump to

Keyboard shortcuts

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