proxytest

package
v0.0.0-...-2cf0735 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2026 License: MIT Imports: 6 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 proxytest is a plain HTTP proxy for tests that name one in a proxy setting (providers[].proxy, gateways.telegram.proxy): it relays every absolute-form request to its target directly and records the paths it carried, so a request that went around it is one the proxy never saw. Plain-HTTP targets only: a CONNECT tunnel is refused.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithoutProxyVariables

func WithoutProxyVariables(env []string) []string

WithoutProxyVariables drops the proxy variables from env, in either case, so a child process sees only the ones its test sets: net/http reads them once per process, so the real variables can only be staged in a child.

Types

type Proxy

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

Proxy is a forwarding HTTP proxy on a loopback port.

func New

func New() *Proxy

New starts a proxy. Close it when the test ends.

func (*Proxy) Carried

func (p *Proxy) Carried() []string

Carried lists the paths of the requests the proxy relayed, in order.

func (*Proxy) Close

func (p *Proxy) Close()

Close stops the proxy and drops its connections to the targets.

func (*Proxy) URL

func (p *Proxy) URL() string

URL is the proxy's address, the value a proxy setting takes.

Jump to

Keyboard shortcuts

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