router

package
v0.0.0-...-5e0f84c Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2018 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FitRate

func FitRate(tags []*config.RouteTag, dest string) (tag *config.RouteTag, err error)

FitRate fit rate

func GetRouteRule

func GetRouteRule() map[string][]*config.RouteRule

GetRouteRule get route rule

func GetTemplates

func GetTemplates() map[string]*config.Match

GetTemplates get templates

func Init

func Init(nr map[string][]*config.RouteRule, t map[string]*config.Match)

Init sets route rule, and templates

func Match

func Match(match config.Match, headers map[string]string, source *registry.SourceInfo) bool

Match check the route rule

func QuickSort

func QuickSort(left int, right int, rules []*config.RouteRule) (s []*config.RouteRule)

QuickSort for sorting the routes it will follow quicksort technique

func Route

func Route(header map[string]string, si *registry.SourceInfo, inv *invocation.Invocation) error

Route route the APIs

func SetRouteRule

func SetRouteRule(nr map[string][]*config.RouteRule)

SetRouteRule set route rule

func SetTemplates

func SetTemplates(t map[string]*config.Match)

SetTemplates set templates

func SortRules

func SortRules(name string) []*config.RouteRule

SortRules sort route rules

func SourceMatch

func SourceMatch(match *config.Match, headers map[string]string, source *registry.SourceInfo) bool

SourceMatch check the source route

Types

type SafeMap

type SafeMap struct {
	sync.RWMutex
	Map map[string]int
}

SafeMap safe map structure

Jump to

Keyboard shortcuts

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