router

package
Version: v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package router defines some interfaces for router adapters

Index

Constants

View Source
const (
	// HeaderCompleteResponseValue is the value of the CompleteResponseHeader
	// if the response is complete
	// Deprecated: HeaderCompleteResponseValue is deprecated
	HeaderCompleteResponseValue = http.HeaderCompleteResponseValue
	// HeaderIncompleteResponseValue is the value of the CompleteResponseHeader
	// if the response is not complete
	// Deprecated: HeaderIncompleteResponseValue is deprecated
	HeaderIncompleteResponseValue = http.HeaderIncompleteResponseValue
)

Variables

View Source
var (
	// CompleteResponseHeaderName is the header to flag incomplete responses to the client
	// Deprecated: HeaderIncompleteResponseValue is deprecated
	CompleteResponseHeaderName = http.CompleteResponseHeaderName
	// HeadersToSend are the headers to pass from the router request to the proxy
	// Deprecated: HeadersToSend is deprecated
	HeadersToSend = http.HeadersToSend
	// UserAgentHeaderValue is the value of the User-Agent header to add to the proxy request
	// Deprecated: UserAgentHeaderValue is deprecated
	UserAgentHeaderValue = http.UserAgentHeaderValue
	// ErrInternalError is the error returned by the router when something went wrong
	// Deprecated: ErrInternalError is deprecated
	ErrInternalError = http.ErrInternalError
)
View Source
var DefaultToHTTPError = http.DefaultToHTTPError

DefaultToHTTPError is a ToHTTPError transalator that always returns an internal server error Deprecated: DefaultToHTTPError is deprecated

View Source
var InitHTTPDefaultTransport = http.InitHTTPDefaultTransport

InitHTTPDefaultTransport ensures the default HTTP transport is configured just once per execution Deprecated: InitHTTPDefaultTransport is deprecated

View Source
var RunServer = http.RunServer

RunServer runs a http.Server with the given handler and configuration Deprecated: RunServer is deprecated

Functions

func IsValidSequentialEndpoint added in v1.2.0

func IsValidSequentialEndpoint(endpoint *config.EndpointConfig) bool

Types

type Factory

type Factory interface {
	New() Router
	NewWithContext(context.Context) Router
}

Factory creates new routers

type Router

type Router interface {
	Run(config.ServiceConfig)
}

Router sets up the public layer exposed to the users

type RouterFunc

type RouterFunc func(config.ServiceConfig)

RouterFunc type is an adapter to allow the use of ordinary functions as routers. If f is a function with the appropriate signature, RouterFunc(f) is a Router that calls f.

func (RouterFunc) Run

func (f RouterFunc) Run(cfg config.ServiceConfig)

Run implements the Router interface

type ToHTTPError

type ToHTTPError http.ToHTTPError

ToHTTPError translates an error into a HTTP status code Deprecated: ToHTTPError is deprecated

Directories

Path Synopsis
Package gin provides some basic implementations for building routers based on gin-gonic/gin
Package gin provides some basic implementations for building routers based on gin-gonic/gin
Package mux provides some basic implementations for building routers based on net/http mux Package mux provides some basic implementations for building routers based on net/http mux
Package mux provides some basic implementations for building routers based on net/http mux Package mux provides some basic implementations for building routers based on net/http mux

Jump to

Keyboard shortcuts

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