proxy

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HttpsHandler

func HttpsHandler(clientConn net.Conn, p *Proxy)

Types

type Handler

type Handler func(conn net.Conn, p *Proxy)

func ServerFrontHandler

func ServerFrontHandler(certFile, keyFile string) Handler

ServerFrontHandler returns a Handler that terminates incoming TLS using certFile/keyFile, then forwards to p.BackendAddr using the configured fingerprint.

type LocalCA

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

LocalCA is a self-signed CA used to issue per-host certificates for MitM TLS interception in client-front mode.

func GenerateCA

func GenerateCA() (*LocalCA, error)

func LoadOrGenerateCA

func LoadOrGenerateCA(certPath, keyPath string) (*LocalCA, error)

LoadOrGenerateCA loads the CA from certPath + keyPath. If the files do not exist it generates a new CA and writes it to those paths. Pass empty strings for an ephemeral in-memory CA.

func (*LocalCA) CertPEM

func (ca *LocalCA) CertPEM() []byte

CertPEM returns the CA certificate as PEM, suitable for curl --cacert or importing into a system trust store.

func (*LocalCA) Save

func (ca *LocalCA) Save(certPath, keyPath string) error

type Proxy

type Proxy struct {
	ListenAddr  string
	BackendAddr string // server-front: backend host:port
	CAPool      *x509.CertPool
	Fingerprint fingerprint.TLSApplier
	LocalCA     *LocalCA // client-front: MitM CA for TLS interception
	// contains filtered or unexported fields
}

func (*Proxy) RegisterHandler

func (p *Proxy) RegisterHandler(h Handler)

func (*Proxy) Run

func (p *Proxy) Run() error

Jump to

Keyboard shortcuts

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