proxy

package
v1.0.9 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2023 License: Apache-2.0 Imports: 39 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigWatcher

type ConfigWatcher interface {
	Watch(*config.ProxyOption)
}

type LeafCertSpec

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

type Manager

type Manager interface {
	ConfigWatcher
	Serve(net.Listener) error
	ServeSNI(net.Listener) error
	Stop() error
	IsEnabled() bool
}

func NewProxyManager

func NewProxyManager(peerHost *schedulerv1.PeerHost, peerTaskManager peer.TaskManager, proxyOption *config.ProxyOption) (Manager, error)

type Option

type Option func(p *Proxy) *Proxy

Option is a functional option for configuring the proxy

func WithBasicAuth

func WithBasicAuth(auth *config.BasicAuth) Option

WithBasicAuth sets basic auth info for proxy

func WithCert

func WithCert(cert *tls.Certificate) Option

WithCert sets the certificate

func WithDefaultApplication

func WithDefaultApplication(t string) Option

WithDefaultApplication sets default tag for http requests without X-Dragonfly-Application Header

func WithDefaultFilter

func WithDefaultFilter(f string) Option

WithDefaultFilter sets default filter for http requests without X-Dragonfly-Filter Header

func WithDefaultPriority

func WithDefaultPriority(priority commonv1.Priority) Option

WithDefaultPriority sets default priority for http requests without X-Dragonfly-Priority Header

func WithDefaultTag

func WithDefaultTag(t string) Option

WithDefaultTag sets default tag for http requests without X-Dragonfly-Tag Header

func WithDirectHandler

func WithDirectHandler(h *http.ServeMux) Option

WithDirectHandler sets the handler for non-proxy requests

func WithDumpHTTPContent

func WithDumpHTTPContent(dump bool) Option

func WithHTTPSHosts

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

WithHTTPSHosts sets the rules for hijacking https requests

func WithMaxConcurrency

func WithMaxConcurrency(con int64) Option

WithMaxConcurrency sets max concurrent for process http request

func WithPeerHost

func WithPeerHost(peerHost *schedulerv1.PeerHost) Option

WithPeerHost sets the *schedulerv1.PeerHost

func WithPeerIDGenerator

func WithPeerIDGenerator(peerIDGenerator peer.IDGenerator) Option

WithPeerIDGenerator sets the *transport.PeerIDGenerator

func WithPeerTaskManager

func WithPeerTaskManager(peerTaskManager peer.TaskManager) Option

WithPeerTaskManager sets the peer.PeerTaskManager

func WithRegistryMirror

func WithRegistryMirror(r *config.RegistryMirror) Option

WithRegistryMirror sets the registry mirror for the proxy

func WithRules

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

WithRules sets the proxy rules

func WithWhiteList

func WithWhiteList(whiteList []*config.WhiteList) Option

WithWhiteList sets the proxy whitelist

type Proxy

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

Proxy is a http proxy handler. It proxies requests with dragonfly if any defined proxy rules is matched

func NewProxy

func NewProxy(options ...Option) (*Proxy, error)

NewProxy returns a new transparent proxy from the given options

func NewProxyWithOptions

func NewProxyWithOptions(options ...Option) (*Proxy, error)

NewProxyWithOptions constructs a new instance of a Proxy with additional options.

func (*Proxy) ServeHTTP

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

ServeHTTP implements http.Handler.ServeHTTP

func (*Proxy) ServeSNI

func (proxy *Proxy) ServeSNI(l net.Listener) error

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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