httpproxy

package
v0.0.0-...-588767e Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2024 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache interface {
	Set(key string, value io.Reader, valueSize int64) error
	Get(key string) (io.ReadSeekCloser, error)
}

type CacheRule

type CacheRule struct {
	*regexp.Regexp
	// contains filtered or unexported fields
}

func NewCacheRule

func NewCacheRule(pattern *regexp.Regexp, key string) *CacheRule

type Cacher

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

func NewCacher

func NewCacher(rules []*CacheRule, cache Cache) *Cacher

type HTTPProxyService

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

HTTPProxyService is a service that is used to proxy HTTP requests to the Region. Invocation of this service normally should happen via Temporal.

func NewHTTPProxyService

func NewHTTPProxyService(socketDir string, cache Cache) *HTTPProxyService

NewHTTPProxyService returns an instance of HTTPProxyService TODO: consider switching to opts pattern

func (*HTTPProxyService) ConfiguratorName

func (s *HTTPProxyService) ConfiguratorName() string

ConfiguratorName returns a name that will be used to register Configure method as Temporal workflow.

func (*HTTPProxyService) Configure

func (s *HTTPProxyService) Configure() interface{}

Configure represents a Temporal workflow that is capable for configuring Agent HTTP proxy service.

func (*HTTPProxyService) Error

func (s *HTTPProxyService) Error() error

type Proxy

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

Proxy is a caching reverse HTTP proxy that sends request to a target.

func NewProxy

func NewProxy(targets []*url.URL, options ...ProxyOption) (*Proxy, error)

NewProxy returns a new caching reverse HTTP proxy, that caches all HTTP 200 responses from the random pick target.

func (*Proxy) ServeHTTP

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

type ProxyOption

type ProxyOption func(*Proxy)

ProxyOption allows to set additional options for the proxy

func WithCacher

func WithCacher(c *Cacher) ProxyOption

WithCacher allows to set caching middleware

func WithRewriter

func WithRewriter(r *Rewriter) ProxyOption

WithRewriter allows to set URL rewriter middleware

type RewriteRule

type RewriteRule struct {
	*regexp.Regexp
	// contains filtered or unexported fields
}

func NewRewriteRule

func NewRewriteRule(pattern *regexp.Regexp, to string) *RewriteRule

func (*RewriteRule) Replace

func (r *RewriteRule) Replace(u *url.URL) string

func (*RewriteRule) Rewrite

func (r *RewriteRule) Rewrite(req *http.Request) bool

type Rewriter

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

func NewRewriter

func NewRewriter(rules []*RewriteRule) *Rewriter

Source Files

  • cache.go
  • proxy.go
  • rewrite.go
  • service.go

Jump to

Keyboard shortcuts

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