protocol

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2016 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Copyright 2011 The Go Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FilterFunc

type FilterFunc func(*http.Request, *http.Response)

FilterFunc is a function that is called to process a proxy response Since it has handle to the response object, it can manipulate the content

type HttpProxy

type HttpProxy struct {
	Port          int    `required:"true"`
	Host          string `required:"true" default:"localhost"`
	Protocol      string `default:"http" required:"true"`
	ProxyHost     string `required:"true" mapstructure:"proxy_host"`
	ProxyPort     int    `required:"true" mapstructure:"proxy_port"`
	ProxyProtocol string `required:"true" default:"http" mapstructure:"proxy_protocol"`
	// contains filtered or unexported fields
}

func (*HttpProxy) Proxy

func (p *HttpProxy) Proxy()

func (*HttpProxy) Setup

func (p *HttpProxy) Setup(middleware []muxy.Middleware)

func (*HttpProxy) Teardown

func (p *HttpProxy) Teardown()

type ReverseProxy

type ReverseProxy struct {
	// Director must be a function which modifies
	// the request into a new request to be sent
	// using Transport. Its response is then copied
	// back to the original client unmodified.
	Director func(*http.Request)

	// Filters must be an array of functions which modify
	// the response before the body is written
	Middleware []muxy.Middleware

	// The transport used to perform proxy requests.
	// If nil, http.DefaultTransport is used.
	Transport http.RoundTripper

	// FlushInterval specifies the flush interval
	// to flush to the client while copying the
	// response body.
	// If zero, no periodic flushing is done.
	FlushInterval time.Duration
}

ReverseProxy is an HTTP Handler that takes an incoming request and sends it to another server, proxying the response back to the client.

func NewSingleHostReverseProxy

func NewSingleHostReverseProxy(target *url.URL) *ReverseProxy

NewSingleHostReverseProxy returns a new ReverseProxy that rewrites URLs to the scheme, host, and base path provided in target. If the target's path is "/base" and the incoming request was for "/dir", the target request will be for /base/dir.

func (*ReverseProxy) ServeHTTP

func (p *ReverseProxy) ServeHTTP(rw http.ResponseWriter, req *http.Request)

type TcpProxy

type TcpProxy struct {
	Port            int    `required:"true"`
	Host            string `required:"true" default:"localhost"`
	ProxyHost       string `required:"true" mapstructure:"proxy_host"`
	ProxyPort       int    `required:"true" mapstructure:"proxy_port"`
	NaglesAlgorithm bool   `mapstructure:"nagles_algorithm"`
	HexOutput       bool   `mapstructure:"hex_output"`
	PacketSize      int    `mapstructure:"packet_size" default:"64" required:"true"`
	// contains filtered or unexported fields
}

func (*TcpProxy) Proxy

func (p *TcpProxy) Proxy()

func (*TcpProxy) Setup

func (p *TcpProxy) Setup(middleware []muxy.Middleware)

func (*TcpProxy) Teardown

func (p *TcpProxy) Teardown()

Jump to

Keyboard shortcuts

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