router

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2014 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

A collection of useful Routers

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HostRouter

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

Route requsts based on hostname

func NewHostRouter

func NewHostRouter() *HostRouter

Generate a new HostRouter instance

func (*HostRouter) AddMatch

func (r *HostRouter) AddMatch(host string, pipe falcore.RequestFilter)

TODO: support for non-exact matches

func (*HostRouter) SelectPipeline

func (r *HostRouter) SelectPipeline(req *falcore.Request) (pipe falcore.RequestFilter)

type MatchAnyRoute

type MatchAnyRoute struct {
	Filter falcore.RequestFilter
}

Will match any request. Useful for fallthrough filters.

func (*MatchAnyRoute) MatchString

func (r *MatchAnyRoute) MatchString(str string) falcore.RequestFilter

type PathRouter

type PathRouter struct {
	Routes *list.List
}

Route requests based on path

func NewPathRouter

func NewPathRouter() *PathRouter

Generate a new instance of PathRouter

func (*PathRouter) AddMatch

func (r *PathRouter) AddMatch(match string, filter falcore.RequestFilter) (err error)

convenience method for adding RegexpRoutes

func (*PathRouter) AddRoute

func (r *PathRouter) AddRoute(route Route)

func (*PathRouter) SelectPipeline

func (r *PathRouter) SelectPipeline(req *falcore.Request) (pipe falcore.RequestFilter)

Will panic if r.Routes contains an object that isn't a Route

type RegexpRoute

type RegexpRoute struct {
	Match  *regexp.Regexp
	Filter falcore.RequestFilter
}

Will match based on a regular expression

func (*RegexpRoute) MatchString

func (r *RegexpRoute) MatchString(str string) falcore.RequestFilter

type Route

type Route interface {
	// Returns the route's filter if there's a match.  nil if there isn't
	MatchString(str string) falcore.RequestFilter
}

Interface for defining individual routes

Jump to

Keyboard shortcuts

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