proxy

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultNotFound = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
	log.Infof("Not found: %v %v", r.Method, r.URL)
	w.Header().Set("Content-Type", "application/json")
	w.WriteHeader(http.StatusNotFound)
	fmt.Fprint(w, `{"error":"not found"}`)
})

DefaultNotFound is an HTTP handler that returns simple 404 Not Found response.

Functions

This section is empty.

Types

type FileDescriptor

type FileDescriptor struct {
	Address engine.Address
	File    *os.File
}

func (*FileDescriptor) String

func (fd *FileDescriptor) String() string

func (*FileDescriptor) ToListener

func (fd *FileDescriptor) ToListener() (net.Listener, error)

type NewProxyFn

type NewProxyFn func(id int) (Proxy, error)

type Options

type Options struct {
	MetricsClient             metrics.Client
	DialTimeout               time.Duration
	ReadTimeout               time.Duration
	WriteTimeout              time.Duration
	MaxHeaderBytes            int
	DefaultListener           *engine.Listener
	TrustForwardHeader        bool
	Files                     []*FileDescriptor
	TimeProvider              timetools.TimeProvider
	NotFoundMiddleware        plugin.Middleware
	Router                    router.Router
	IncomingConnectionTracker conntracker.ConnectionTracker
	FrontendListeners         plugin.FrontendListeners
	CacheProvider             cacheprovider.T
	Aliases                   map[string]string
}

type Proxy

type Proxy interface {
	engine.StatsProvider

	Init(snapshot engine.Snapshot) error

	UpsertHost(engine.Host) error
	DeleteHost(engine.HostKey) error

	UpsertListener(engine.Listener) error
	DeleteListener(engine.ListenerKey) error

	UpsertBackend(engine.Backend) error
	DeleteBackend(engine.BackendKey) error

	UpsertFrontend(engine.Frontend) error
	DeleteFrontend(engine.FrontendKey) error

	UpsertMiddleware(engine.FrontendKey, engine.Middleware) error
	DeleteMiddleware(engine.MiddlewareKey) error

	UpsertServer(engine.BackendKey, engine.Server) error
	DeleteServer(engine.ServerKey) error

	// TakeFiles takes file descriptors representing sockets in listening state to start serving on them
	// instead of binding. This is nessesary if the child process needs to inherit sockets from the parent
	// (e.g. for graceful restarts)
	TakeFiles([]*FileDescriptor) error

	// GetFiles exports listening socket's underlying dupped file descriptors, so they can later
	// be passed to child process or to another Server
	GetFiles() ([]*FileDescriptor, error)

	Start() error
	Stop(wait bool)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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