proxy - ActiveState ActiveGo 1.8
...

Package proxy

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

Overview ▾

Package proxy contains a proxying HTTP transport.

type Transport

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

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
}

func (Transport) RoundTrip

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

RoundTrip implements the RoundTripper interface.