proxytest

package
v0.27.92 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2026 License: Apache-2.0, MIT Imports: 22 Imported by: 0

Documentation

Overview

Package proxytest is a test infrastructure package to create TestProxy instances.

cert.go:

Generate a self-signed X.509 certificate for a TLS server.
Based on https://go.dev/src/crypto/tls/generate_cert.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCertificate added in v0.15.21

func NewCertificate(hosts ...string) tls.Certificate

Types

type Config added in v0.15.21

type Config struct {
	RoutingOptions routing.Options
	ProxyParams    proxy.Params
	Routes         []*eskip.Route
	Certificates   []tls.Certificate
	WaitTime       time.Duration // Optional wait time, defaults to 3s if zero
}

func (Config) Create added in v0.15.21

func (c Config) Create() *TestProxy

func (Config) CreateUnstarted added in v0.24.28

func (c Config) CreateUnstarted() *TestProxy

type TestClient added in v0.16.37

type TestClient struct {
	*http.Client
}

func (*TestClient) Do added in v0.27.59

func (c *TestClient) Do(req *http.Request) (*http.Response, error)

Do sends the HTTP request. If the request already has a Cookie header (manually added cookies), the cookie jar is temporarily disabled so that jar cookies do not interfere with the request. This allows tests that manually construct requests with specific cookies to avoid cross-test cookie interference while still supporting automatic cookie handling for full browser-like flows.

func (*TestClient) GetBody added in v0.16.37

func (c *TestClient) GetBody(url string) (rsp *http.Response, body []byte, err error)

GetBody issues a GET to the specified URL, reads and closes response body and returns response, response body bytes and error if any.

type TestProxy

type TestProxy struct {
	URL  string
	Port string
	Log  *loggingtest.Logger
	// contains filtered or unexported fields
}

func New

func New(fr filters.Registry, routes ...*eskip.Route) *TestProxy

func WithParams

func WithParams(fr filters.Registry, proxyParams proxy.Params, routes ...*eskip.Route) *TestProxy

func WithParamsAndRoutingOptions added in v0.13.258

func WithParamsAndRoutingOptions(fr filters.Registry, proxyParams proxy.Params, o routing.Options, routes ...*eskip.Route) *TestProxy

func WithParamsAndRoutingOptionsAndWait added in v0.22.171

func WithParamsAndRoutingOptionsAndWait(fr filters.Registry, proxyParams proxy.Params, o routing.Options, wait time.Duration, routes ...*eskip.Route) *TestProxy

func WithParamsAndRoutingOptionsAndWaitUnstarted added in v0.24.28

func WithParamsAndRoutingOptionsAndWaitUnstarted(fr filters.Registry, proxyParams proxy.Params, o routing.Options, wait time.Duration, routes ...*eskip.Route) *TestProxy

func WithRoutingOptions added in v0.9.206

func WithRoutingOptions(fr filters.Registry, o routing.Options, routes ...*eskip.Route) *TestProxy

func WithRoutingOptionsWithWait added in v0.22.133

func WithRoutingOptionsWithWait(fr filters.Registry, o routing.Options, wait time.Duration, routes ...*eskip.Route) *TestProxy

func (*TestProxy) Client added in v0.15.21

func (p *TestProxy) Client() *TestClient

func (*TestProxy) Close

func (p *TestProxy) Close() error

func (*TestProxy) SetListener added in v0.24.28

func (p *TestProxy) SetListener(l net.Listener)

func (*TestProxy) Start added in v0.24.28

func (p *TestProxy) Start()

Jump to

Keyboard shortcuts

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