proxy

package
v0.0.0-...-88f7cf5 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package proxy implements an HTTP forward proxy that exclusively listens on a UNIX domain socket for client requests. It uses a single http.Client to proxy requests, enabling connection pooling. Optionally, the proxy can expose metrics via prometheus client library.

Index

Constants

This section is empty.

Variables

View Source
var AppVersion = "0.8.x-dev"

AppVersion is set at compile time via make / ldflags

Functions

func ConnContext

func ConnContext(ctx context.Context, c net.Conn) context.Context

func GetNetConn

func GetNetConn(r *http.Request) net.Conn

Types

type Instance

type Instance struct {
	Options    Settings
	HTTPClient *http.Client
}

Instance provides state storage for a single proxy instance.

func NewProxyInstance

func NewProxyInstance(args Settings) *Instance

NewProxyInstance validates supplied Settings and returns a ready-to-run proxy instance.

func (*Instance) Run

func (proxy *Instance) Run()

Run starts the proxy's socket server accept loop, which will run until Shutdown() is called.

func (*Instance) Shutdown

func (proxy *Instance) Shutdown(sig os.Signal)

Shutdown cleanly terminates a proxy instance (and is invoked by signal handlers or during tests).

type Settings

type Settings struct {
	SocketPath          string
	SocketMode          int
	ClientTimeout       int
	MaxConnsPerHost     int
	MaxIdleConns        int
	MaxIdleConnsPerHost int
	IdleConnTimeout     int
	SocketReadTimeout   int
	SocketWriteTimeout  int
	PrintVersion        bool
	NoLogTimeStamps     bool
	RemoteHTTPS         bool
	ForceRemoteHost     string
	InsecureSkipVerify  bool
}

Settings configure a Instance and need to be passed to NewProxyInstance().

Jump to

Keyboard shortcuts

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