server

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2024 License: GPL-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNilConfig                  = errors.New("nil config parameter supplied")
	ErrDuplicateListeners         = errors.New("duplicate listener addr and port but different type")
	ErrUnknownListenerType        = errors.New("unknown listener type")
	ErrListenerNotFound           = errors.New("listener not found")
	ErrProxychainNotFound         = errors.New("proxychain for backend is not defined")
	ErrBackendInitFailed          = errors.New("backend initialization is not defined")
	ErrHostListenerClash          = errors.New("duplicate host already attached to listener")
	ErrAttachSiteToListenerFailed = errors.New("failed to attach site to listener")
)
View Source
var (
	ErrDirectProxyAfterNonDirectProxy = errors.New("direct connection does not make sense as non-first member of proxychain")
)

Functions

func Server

func Server(ctx context.Context, assets assets.Config, sc ServerCommand, cfg *config.Config) error

Server implements the Pathfinding Proxy Server.

Types

type DefaultSelector added in v0.0.2

type DefaultSelector struct {
}

DefaultSelector logic implements the default (not specificed) selector. Namely if the backend does not include a specific Host to target, then the Host on the incoming request is used.

func (DefaultSelector) GetTarget added in v0.0.2

func (d DefaultSelector) GetTarget(backend HTTPBackend, request *http.Request) string

GetTarget implements TargetSelector.

type ErrInvalidProxySpec

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

ErrInvalidProxySpec is the common type for proxy construction errors.

func (ErrInvalidProxySpec) Cause

func (e ErrInvalidProxySpec) Cause() error

func (ErrInvalidProxySpec) Error

func (e ErrInvalidProxySpec) Error() string

type HTTPBackend

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

func NewHTTPBackend

func NewHTTPBackend(config config.BackendConfig, proxychain Proxychain) (*HTTPBackend, error)

func (HTTPBackend) ServeHTTP

func (h HTTPBackend) ServeHTTP(writer http.ResponseWriter, request *http.Request)

ServerHTTP implements http.Handler.

type HTTPEdgeListener

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

func (*HTTPEdgeListener) AddSite

func (l *HTTPEdgeListener) AddSite(host string, backend http.Handler) error

type Listener

type Listener interface {
	AddSite(host string, backend http.Handler) error
}

func NewHTTPEdgeListener

func NewHTTPEdgeListener(ctx context.Context, cfg listenerKey) (Listener, error)

type PathIndexSelector added in v0.0.2

type PathIndexSelector struct {
	Index int `mapstructure:"Index"` // Index is the position of the path parameter
}

PathIndexSelector splits the URL path into components and extracts the hostname from the given Index. By default, the extracted parameter is removed.

func (PathIndexSelector) GetTarget added in v0.0.2

func (p PathIndexSelector) GetTarget(backend HTTPBackend, request *http.Request) string

GetTarget implements TargetSelector.

type Proxychain

type Proxychain interface {
	Dialer() proxy.ContextDialer
}

Proxychain provides an interface to constructed chains of proxies.

func NewProxychainFromConfig

func NewProxychainFromConfig(cfg []config.Proxy) (Proxychain, error)

NewProxychainFromConfig creates a new proxychain from the supplied list of configs.

type ServerCommand

type ServerCommand struct{}

type TargetSelector added in v0.0.2

type TargetSelector interface {
	// GetTarget returns the target
	GetTarget(backend HTTPBackend, request *http.Request) string
}

TargetSelector implements determining the target backend for an HTTP edge proxy.

func NewTargetSelector added in v0.0.2

func NewTargetSelector(name config.TargetSelectType, parameters map[string]interface{}) TargetSelector

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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