falcore: github.com/fitstar/falcore/router Index | Files

package router

import "github.com/fitstar/falcore/router"

A collection of useful Routers

Index

Package Files

doc.go simple_routers.go

type HostRouter Uses

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

Route requsts based on hostname

func NewHostRouter Uses

func NewHostRouter() *HostRouter

Generate a new HostRouter instance

func (*HostRouter) AddMatch Uses

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

TODO: support for non-exact matches

func (*HostRouter) SelectPipeline Uses

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

type MatchAnyRoute Uses

type MatchAnyRoute struct {
    Filter falcore.RequestFilter
}

Will match any request. Useful for fallthrough filters.

func (*MatchAnyRoute) MatchString Uses

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

type PathRouter Uses

type PathRouter struct {
    Routes *list.List
}

Route requests based on path

func NewPathRouter Uses

func NewPathRouter() *PathRouter

Generate a new instance of PathRouter

func (*PathRouter) AddMatch Uses

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

convenience method for adding RegexpRoutes

func (*PathRouter) AddRoute Uses

func (r *PathRouter) AddRoute(route Route)

func (*PathRouter) SelectPipeline Uses

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 Uses

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

Will match based on a regular expression

func (*RegexpRoute) MatchString Uses

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

type Route Uses

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

Package router imports 3 packages (graph). Updated 2016-07-16. Refresh now. Tools for package owners.