tree

package
v1.60.3 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2024 License: Apache-2.0, BSD-3-Clause, Apache-2.0 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 `json:"hostname"`
	HTTPMethod   string `json:"http_method"`
	PathTemplate string `json:"path_template"`
	PathRegex    string `json:"path_regex"`
	ServiceName  string `json:"service_name"`
	ResourceName string `json:"resource_name"`
	// contains filtered or unexported fields
}

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

type Tree

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

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

func New

func New(es ...*Endpoint) (*Tree, error)

New creates a new Tree. You can optionally pass endpoints to add 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