proxy

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2026 License: GPL-3.0 Imports: 15 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 exposes the router through the two entry points a client can reach it by: an HTTP CONNECT proxy that terminates TLS for the intercepted hosts, and a direct TLS listener presenting the intercepted host's name.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Serve

func Serve(ctx context.Context, name, addr string, handler http.Handler, authority *ca.Bundle, fallbackHost string) error

Serve runs handler on addr until ctx is cancelled. When authority is non-nil the listener speaks TLS, presenting a certificate for whichever name the client asks for and falling back to fallbackHost without SNI. This is the entry point for clients redirected by DNS or a hosts file rather than by proxy settings.

Types

type Dialer

type Dialer interface {
	DialContext(ctx context.Context, network, addr string) (net.Conn, error)
}

Dialer opens outbound connections. The proxy's own resolver satisfies it.

type Server

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

Server is the HTTP CONNECT proxy.

func NewServer

func NewServer(cfg *config.Config, authority *ca.Bundle, handler http.Handler, transport http.RoundTripper, dial Dialer) *Server

NewServer builds the CONNECT proxy around handler. transport forwards plain-HTTP requests for hosts that are not intercepted and must not route through this proxy; dial opens the CONNECT tunnels. Both fall back to the operating system's defaults when nil.

func (*Server) ServeHTTP

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

ServeHTTP handles both CONNECT tunnels and absolute-URI proxy requests.

Jump to

Keyboard shortcuts

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