proxy

package
v1.0.0-alpha Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2019 License: Apache-2.0 Imports: 15 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(p *Proxy) error

Option is a functional option for configuring the proxy

func WithCert

func WithCert(cert *tls.Certificate) Option

WithCert sets the certificate to

func WithCertFromFile

func WithCertFromFile(certFile, keyFile string) Option

WithCertFromFile is a convenient wrapper for WithCert, to read certificate from the given file

func WithDirectHandler

func WithDirectHandler(h *http.ServeMux) Option

WithDirectHandler sets the handler for non-proxy requests

func WithDownloaderFactory added in v0.4.0

func WithDownloaderFactory(f downloader.Factory) Option

WithDownloaderFactory sets the factory function to get a downloader

func WithHTTPSHosts

func WithHTTPSHosts(hosts ...*config.HijackHost) Option

WithHTTPSHosts sets the rules for hijacking https requests

func WithRegistryMirror

func WithRegistryMirror(r *config.RegistryMirror) Option

WithRegistryMirror sets the registry mirror for the proxy

func WithRules

func WithRules(rules []*config.Proxy) Option

WithRules sets the proxy rules

type Proxy

type Proxy struct {
	// contains filtered or unexported fields
}

Proxy is an http proxy handler. It proxies requests with dfget if any defined proxy rules is matched

func New

func New(opts ...Option) (*Proxy, error)

New returns a new transparent proxy with the given rules

func NewFromConfig

func NewFromConfig(c config.Properties) (*Proxy, error)

NewFromConfig returns a new transparent proxy from the given properties

func (*Proxy) ServeHTTP

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

ServeHTTP implements http.Handler.ServeHTTP

func (*Proxy) SetRules

func (proxy *Proxy) SetRules(rules []*config.Proxy) error

SetRules changes the rule lists of the proxy to the given rules.

Jump to

Keyboard shortcuts

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