finder

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2018 License: MPL-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StripDefaultNS

func StripDefaultNS(v string) string

StripDefaultNS strips the default namespace from an argument. For now, the API and lookups strip this value from string output so we strip it.

Types

type Finder

type Finder struct {
	// Client is the API client to use for any requests.
	Client *api.Client
	// contains filtered or unexported fields
}

Finder finds intentions by a src/dst exact match. There is currently no direct API to do this so this struct downloads all intentions and caches them once, and searches in-memory for this. For now this works since even with a very large number of intentions, the size of the data gzipped over HTTP will be relatively small.

The Finder will only downlaod the intentions one time. This struct is not expected to be used over a long period of time. Though it may be reused multile times, the intentions list is only downloaded once.

func (*Finder) Find

func (f *Finder) Find(src, dst string) (*api.Intention, error)

Find finds the intention that matches the given src and dst. This will return nil when the result is not found.

func (*Finder) IDFromArgs

func (f *Finder) IDFromArgs(args []string) (string, error)

ID returns the intention ID for the given CLI args. An error is returned if args is not 1 or 2 elements.

Jump to

Keyboard shortcuts

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