proxy

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

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

Go to latest
Published: Sep 14, 2019 License: MIT Imports: 23 Imported by: 0

README

proxy

Local Cache Proxy Server

Setup

macOS
# Install brotli
brew install brotli

# Install proxy
make install

# Setup config directory
mkdir -p ~/.proxy
cd !$
touch tunnels blacklists
mkdir cache

# Generate Self-signed ECDSA CA
openssl ecparam -name prime256v1 -genkey -out ca.key -noout
openssl req -new -x509 -key ca.key -out ca.crt -days 3650

# Run proxy
proxy \
    -port=18888 \
    -ca.key=$HOME/.proxy/ca.key -ca.crt=$HOME/.proxy/ca.crt \
    -cache.path=$HOME/.proxy/cache \
    -proxy.tunnel.file=$HOME/.proxy/tunnels \
    -proxy.tunnel.notbrowser \
    -proxy.blacklist.file=$HOME/.proxy/blacklists \
    -log

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CacheRangeItem

type CacheRangeItem interface {
	io.Reader
	Remove()
}

type CacheRanger

type CacheRanger func(r CacheRangeItem)

type CacheStorage

type CacheStorage interface {
	Create(key string) CacheWriter
	Open(key string) io.ReadCloser
	Remove(key string)
	Range(f CacheRanger)
}

type CacheWriter

type CacheWriter interface {
	io.WriteCloser
	Remove() error
}

type Proxy

type Proxy struct {
	Logger           *log.Logger
	PrivateKey       *ecdsa.PrivateKey
	Certificate      *x509.Certificate
	TLSConfig        *tls.Config
	Transport        *http.Transport
	CacheStorage     CacheStorage
	BlacklistHosts   []string
	TunnelHosts      []string
	TunnelNotBrowser bool
	RedirectHTTPS    bool
	Auth             func(r *http.Request) bool
	// contains filtered or unexported fields
}

func (*Proxy) Init

func (p *Proxy) Init()

Init proxy now instead of lazy init

func (*Proxy) ServeHTTP

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

type RetryDialer

type RetryDialer struct {
	net.Dialer

	MaxRetries int
}

func (*RetryDialer) DialContext

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

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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