proxy

package
v0.0.0-...-54cf837 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package proxy contains code for creating red-tape reverse proxies.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeProxy

func MakeProxy(cfg *ProxyConfig) (*httputil.ReverseProxy, error)

func MakeRoundTripper

func MakeRoundTripper(cfg *ProxyConfig) (http.RoundTripper, error)

Types

type ProxyConfig

type ProxyConfig struct {
	// The destination URL to which the request should be proxied
	DestURL string

	// The probability of dropping a packet
	ProbDrop float64

	// The rate of packet delay (sampled from an exponential
	// distribution) before passing the request to the server
	PreDelayRate float64

	// The maximum delay before passing the request to the server
	PreDelayMax float64

	// The rate of packet delay after receiving the response from
	// the server, before passing it back to the client
	PostDelayRate float64

	// The maximum delay after receiving the response from the server,
	// before passing it back to the client
	PostDelayMax float64

	// An optional seed for the random number generator
	// (0 is treated as no seed)
	Seed uint64

	// If not set, http.DefaultTransport is used.
	Transport http.RoundTripper

	// Logger to use
	Logger log.Logger
}

Jump to

Keyboard shortcuts

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