router

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2019 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrRouteNotFound = errors.New("unknown route to service")
)

Functions

func NewDynamic

func NewDynamic() *dynamic

NewDynamic creates a new dynamic router that can be have its routes updated.

func NewStatic

func NewStatic(routes []*pb.Route) *static

Types

type Error

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

func NewError

func NewError(status int, msg string) *Error

func (*Error) Error

func (e *Error) Error() string

func (*Error) StatusCode

func (e *Error) StatusCode() int

type Router

type Router interface {
	// Route returns a backend name for a given call, or an error.
	// Note: the request *must* be normalized.
	Route(req *http.Request) (backendName string, err error)
}

Jump to

Keyboard shortcuts

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