package proxy

import "github.com/streadway/handy/proxy"

Package proxy contains a proxying HTTP transport.

Index

Types

type Transport

type Transport struct {
	// Proxy takes an http.Request and provides a URL to use for that request.
	// Note that the semantics are different from http.DefaultTransport: this
	// proxy is always invoked. If Proxy is nil, requests to the Transport are
	// unaltered.
	Proxy func(*http.Request) (*url.URL, error)

	// Next is the http.RoundTripper to which requests are forwarded.  If Next
	// is nil, http.DefaultTransport is used.
	Next http.RoundTripper
}

Transport is an implementation of the http.RoundTripper that uses a user supplied generator function to proxy requests to specific destinations.

func (Transport) RoundTrip

func (t Transport) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip implements the RoundTripper interface.

Source Files

proxy.go

Version
v0.0.0-20200128134331-0f66f006fb2e (latest)
Published
Jan 28, 2020
Platform
linux/amd64
Imports
2 packages
Last checked
2 months ago

Tools for package owners.