proxy

package
v0.0.0-...-10dc113 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2017 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Proxy

func Proxy(config ProxyConfig) makross.Handler

Proxy returns an HTTP/WebSocket reverse proxy middleware.

Types

type ProxyBalancer

type ProxyBalancer interface {
	Next() *ProxyTarget
}

ProxyBalancer defines an interface to implement a load balancing technique.

type ProxyConfig

type ProxyConfig struct {
	// Skipper defines a function to skip middleware.
	Skipper skipper.Skipper

	// Balancer defines a load balancing technique.
	// Required.
	// Possible values:
	// - RandomBalancer
	// - RoundRobinBalancer
	Balancer ProxyBalancer
}

ProxyConfig defines the config for Proxy middleware.

type ProxyTarget

type ProxyTarget struct {
	URL *url.URL
}

ProxyTarget defines the upstream target.

type RandomBalancer

type RandomBalancer struct {
	Targets []*ProxyTarget
	// contains filtered or unexported fields
}

RandomBalancer implements a random load balancing technique.

func (*RandomBalancer) Next

func (r *RandomBalancer) Next() *ProxyTarget

Next randomly returns an upstream target.

type RoundRobinBalancer

type RoundRobinBalancer struct {
	Targets []*ProxyTarget
	// contains filtered or unexported fields
}

RoundRobinBalancer implements a round-robin load balancing technique.

func (*RoundRobinBalancer) Next

func (r *RoundRobinBalancer) Next() *ProxyTarget

Next returns an upstream target using round-robin technique.

Jump to

Keyboard shortcuts

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