proxy

package module
v0.0.0-...-ea4424c Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2016 License: ISC Imports: 8 Imported by: 0

README

This project is deprecated and unmaintained. Proceed with caution!

proxy
=====

[quote]
A development proxy with logging and redirect-rewriting

Installation
------------

Download a prebuilt binary for your platform and architecture from the
link:https://github.com/ciarand/proxy/releases[release page].

Or, build from source:

[source,bash]
----
# from source
go get -u github.com/ciarand/proxy
----

Usage
-----

[source,bash]
----
# start the proxy in one shell:
proxy -from=https://www.google.com -to=http://0.0.0.0:8080

# and in another, run curl:
curl -s http://localhost:8080/ | head -c 15
<!doctype html>

# result from proxy shell (shortened for width):
INFO[0022] request started   client_address=[::1]:58988 method=GET uri=/
INFO[0023] request complete  elapsed=624.644152ms status=200
----

License
-------
See the link:LICENSE[LICENSE] file.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LogIfErr

func LogIfErr(err error)

LogIfErr takes an error and, if the error is non-nil, logs it to stdout.

Types

type Proxy

type Proxy struct {
	From *url.URL
	To   *url.URL
	// contains filtered or unexported fields
}

Proxy is a wrapper around the httputil.ReverseProxy that does some extra logging of helpful information.

func NewProxy

func NewProxy(from, to string) (*Proxy, error)

NewProxy takes two strings, one that determines what to rewrite redirect hosts to (i.e. localhost:8080) and one that determines the location of the server we're proxying for.

func (*Proxy) ServeHTTP

func (p *Proxy) ServeHTTP(w http.ResponseWriter, r *http.Request)

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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