httpproxy

package module
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2020 License: MIT Imports: 14 Imported by: 10

README

http proxy

HTTP proxy handler and dialer

Build Status Go Report Card GoDoc GitHub license gocover.io

Usage

API Documentation

Example

License

Pouch is licensed under the MIT License. See LICENSE for the full license text.

Documentation

Index

Constants

View Source
const (
	BasicAuthName         = "Basic"
	ProxyAuthorizationKey = "Proxy-Authorization"
	ProxyAuthenticateKey  = "Proxy-Authenticate"
)

Variables

View Source
var HTTP200 = []byte("HTTP/1.1 200 Connection Established\r\n\r\n")

Functions

This section is empty.

Types

type Authentication

type Authentication interface {
	Auth(http.ResponseWriter, *http.Request) bool
}

Authentication proxy authentication

func BasicAuth

func BasicAuth(username, password string) Authentication

BasicAuth HTTP Basic authentication for Header Proxy-Authorization

func BasicAuthFunc

func BasicAuthFunc(f func(username, password string) bool) Authentication

BasicAuthFunc HTTP Basic authentication for Header Proxy-Authorization

type AuthenticationFunc

type AuthenticationFunc func(http.ResponseWriter, *http.Request) bool

AuthenticationFunc Authentication interface is implemented

func (AuthenticationFunc) Auth

Auth authentication processing

type Dialer

type Dialer struct {
	// ProxyDial specifies the optional dial function for
	// establishing the transport connection.
	ProxyDial func(context.Context, string, string) (net.Conn, error)

	// TLSClientConfig specifies the TLS configuration to use with
	// tls.Client.
	// If nil, the TLS is not used.
	// If non-nil, HTTP/2 support may not be enabled by default.
	TLSClientConfig *tls.Config

	ProxyHeader http.Header

	Proxy    string
	Userinfo *url.Userinfo
}

Dialer holds HTTP CONNECT options.

func NewDialer

func NewDialer(addr string) (*Dialer, error)

NewDialer is create a new HTTP CONNECT connection

func (*Dialer) Dial

func (d *Dialer) Dial(network string, address string) (net.Conn, error)

Dial connects to the provided address on the provided network.

func (*Dialer) DialContext

func (d *Dialer) DialContext(ctx context.Context, network, address string) (net.Conn, error)

DialContext connects to the provided address on the provided network.

type ProxyHandler

type ProxyHandler struct {
	Client         *http.Client
	ProxyDial      func(context.Context, string, string) (net.Conn, error)
	Authentication Authentication
	NotFound       http.Handler
	Logger         *log.Logger
	// contains filtered or unexported fields
}

ProxyHandler Proxy handler

func (*ProxyHandler) ServeHTTP

func (p *ProxyHandler) 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