devproxy

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

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

Go to latest
Published: Jun 3, 2017 License: MIT Imports: 10 Imported by: 0

README

Introduction

GoDoc

Installation

go get github.com/mikegleasonjr/devproxy/cmd/devproxy

Configuration example

By default, devproxy will look for a config file (.devproxy.yml) in the current working directory, then in the home folder.

---
bind: 0.0.0.0
port: 8080
debug: true

hosts:
  - ^api\.website\.dev:80$: localhost:3000
  - ^golang\.dev:80$: localhost:6060

A request to http://golang.dev/pkg will proxy the request to http://localhost:6060/pkg.

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithDebugOutput

func WithDebugOutput(d bool) option

WithDebugOutput prints each request headers to stdout

func WithHosts

func WithHosts(h []Spoofer) option

WithHosts configures which hosts to spoof

Types

type Proxy

type Proxy struct {
	*httputil.ReverseProxy
	// contains filtered or unexported fields
}

Proxy is the development proxy server

func New

func New(opts ...option) *Proxy

New creates a new development proxy

func (*Proxy) ServeHTTP

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

type Spoofer

type Spoofer interface {
	Match(string) bool
	Replace(string) string
}

Spoofer represent a spoofing rule.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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