internal

package
v1.15.0 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2019 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Endpoint

type Endpoint struct {
	Hostname     string
	HTTPMethod   string
	PathTemplate string
	PathMatcher  *regexp.Regexp

	ServiceName  string
	ResourceName string
}

An Endpoint is an API endpoint associated with a (host, method, path)

func (Endpoint) String

func (e Endpoint) String() string

String returns a constructor without field names.

type Tree

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

A Tree is a prefix tree for matching endpoints based on http requests.

func NewTree

func NewTree(es ...Endpoint) *Tree

NewTree creates a new Tree. You can optionally pass endpoints to add to the tree.

func (*Tree) Add

func (t *Tree) Add(es ...Endpoint)

Add adds zero or more endpoints to the tree.

func (*Tree) Get

func (t *Tree) Get(hostname string, httpMethod string, httpPath string) (Endpoint, bool)

Get attempts to find the endpoints associated with the given hostname, http http method and http path. It returns false if no endpoints matched.

Jump to

Keyboard shortcuts

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