httpproxy

package
v0.0.0-...-6ebb1da Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2026 License: GPL-3.0 Imports: 20 Imported by: 0

Documentation

Overview

Package httpproxy implements the HTTP/1.x and HTTP/2 proxy servers for anzu-proxy, including HTTPS CONNECT tunnelling and optional MITM caching.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTP2Handler

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

HTTP2Handler handles HTTP/2 proxy connections.

func NewHTTP2Handler

func NewHTTP2Handler(conn net.Conn, cfg *config.Config) *HTTP2Handler

NewHTTP2Handler creates a handler for one accepted HTTP/2 connection.

func (*HTTP2Handler) Handle

func (h *HTTP2Handler) Handle()

Handle drives the HTTP/2 server loop for one connection.

type Handler

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

Handler handles HTTP/1.1 and HTTPS proxy connections on a single client TCP/TLS socket. It supports keep-alive (HTTP/1.1 pipelining of subsequent requests on the same connection).

func NewHandler

func NewHandler(conn net.Conn, cfg *config.Config) *Handler

NewHandler creates a handler for one accepted connection.

func (*Handler) Handle

func (h *Handler) Handle() error

Handle is the main per-connection loop.

type Server

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

Server represents the HTTP/HTTPS proxy server (supports HTTP/1.x and HTTP/2).

func NewServer

func NewServer(cfg *config.Config) *Server

NewServer creates a new HTTP proxy server instance.

func (*Server) Shutdown

func (s *Server) Shutdown(ctx context.Context) error

Shutdown closes the listener and waits for in-flight handlers to drain, bounded by ctx. Returns ctx.Err() if the deadline expires.

func (*Server) Start

func (s *Server) Start() error

Start begins listening for HTTP proxy connections. If config.TLSCert and config.TLSKey are set, TLS with ALPN (h2 / http/1.1) is used. Otherwise plain TCP is used and the HTTP/2 client preface is peeked to detect the protocol version.

func (*Server) Stop

func (s *Server) Stop()

Stop is the deadline-free shim around Shutdown. New code should prefer Shutdown(ctx).

Jump to

Keyboard shortcuts

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