proxy

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2020 License: Apache-2.0 Imports: 23 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LeafCertSpec added in v1.0.1

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

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

func WithStreamDownloaderFactory added in v1.0.1

func WithStreamDownloaderFactory(f downloader.StreamFactory) Option

func WithStreamMode added in v1.0.1

func WithStreamMode(streamMode bool) Option

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