Documentation ¶
Index ¶
Constants ¶
const ( // DefaultIdleConnsPerHost the default value set for http.Transport.MaxIdleConnsPerHost. DefaultIdleConnsPerHost = 64 // DefaultCloseIdleConnsPeriod the default period at which the idle connections are forcibly // closed. DefaultCloseIdleConnsPeriod = 20 * time.Second )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Definition ¶
type Definition struct { PreserveHost bool `bson:"preserve_host" json:"preserve_host" mapstructure:"preserve_host"` ListenPath string `bson:"listen_path" json:"listen_path" mapstructure:"listen_path" valid:"required"` UpstreamURL string `bson:"upstream_url" json:"upstream_url" mapstructure:"upstream_url" valid:"url,required"` InsecureSkipVerify bool `bson:"insecure_skip_verify" json:"insecure_skip_verify" mapstructure:"insecure_skip_verify"` StripPath bool `bson:"strip_path" json:"strip_path" mapstructure:"strip_path"` AppendPath bool `bson:"append_path" json:"append_path" mapstructure:"append_path"` EnableLoadBalancing bool `bson:"enable_load_balancing" json:"enable_load_balancing" mapstructure:"enable_load_balancing"` Methods []string `bson:"methods" json:"methods"` Hosts []string `bson:"hosts" json:"hosts"` }
Definition defines proxy rules for a route
func NewDefinition ¶
func NewDefinition() *Definition
NewDefinition creates a new Proxy Definition with default values
func (*Definition) Validate ¶
func (d *Definition) Validate() (bool, error)
Validate validates proxy data
type InChain ¶
type InChain []router.Constructor
InChain typed array for inbound plugin sequence, normally this is a middleware chain
func NewInChain ¶
func NewInChain(in ...router.Constructor) InChain
NewInChain variadic constructor for inbound plugin sequence
type OutChain ¶
type OutChain []OutLink
OutChain typed array for outbound plugin sequence
func NewOutChain ¶
NewOutChain variadic constructor for outbound plugin sequence
type Params ¶
type Params struct { // StatsClient defines the stats client for tracing StatsClient stats.Client // When set, the proxy will skip the TLS verification on outgoing requests. InsecureSkipVerify bool // Same as net/http.Transport.MaxIdleConnsPerHost, but the default // is 64. This value supports scenarios with relatively few remote // hosts. When the routing table contains different hosts in the // range of hundreds, it is recommended to set this options to a // lower value. IdleConnectionsPerHost int // Defines the time period of how often the idle connections are // forcibly closed. The default is 12 seconds. When set to less than // 0, the proxy doesn't force closing the idle connections. CloseIdleConnsPeriod time.Duration // The Flush interval for copying upgraded connections FlushInterval time.Duration Outbound OutChain }
Params initialization options.
type Register ¶
Register handles the register of proxies into the chosen router. It also handles the conversion from a proxy to an http.HandlerFunc
func NewRegister ¶
NewRegister creates a new instance of Register
type Route ¶
type Route struct { Proxy *Definition Inbound InChain Outbound OutChain }
Route is the container for a proxy and it's handlers
func JSONUnmarshalRoute ¶
JSONUnmarshalRoute decodes route struct from JSON
func NewRouteWithInOut ¶
func NewRouteWithInOut(proxy *Definition, inbound InChain, outbound OutChain) *Route
NewRouteWithInOut creates an instance of Route with inbound and outbound handlers
func (*Route) AddInbound ¶
func (r *Route) AddInbound(in ...router.Constructor)
AddInbound adds inbound middlewares
func (*Route) AddOutbound ¶
AddOutbound adds outbound middlewares
func (*Route) JSONMarshal ¶
JSONMarshal encodes route struct to JSON
type Transport ¶
type Transport struct {
// contains filtered or unexported fields
}
Transport construct holding plugin sequences
func NewTransport ¶
NewTransport creates a new instance of Transport
func NewTransportWithParams ¶
NewTransportWithParams creates a new instance of Transport with the given params