kedge_map

package
v1.0.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2017 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotKedgeDestination = errors.New("not a kedge destination")
)

Functions

func RouteMapper

func RouteMapper(r []RouteGetter) *routeMapper

RouteMapper is a mapper that resolves Route based on given DNS.

Types

type Mapper

type Mapper interface {
	// Map maps a target's DNS name (e.g. myservice.prod.ext.europe-cluster.local) to a Route.
	// If the targets shouldn't be proxied, ErrNotKedgeDestination should be returned.
	Map(targetAuthorityDnsName string) (*Route, error)
}

Mapper is an interface that allows you to direct traffic to different kedges including various auth. These are used by client libraries.

func Simple

func Simple(mapping map[string]*Route) Mapper

Simple is a kedge mapper that returns route based on map provided in constructor.

func Single

func Single(kedgeUrl *url.URL) Mapper

Single is a simplistic kedge mapper that forwards all traffic through the same kedge. No auth is involved.

func Suffix

func Suffix(matchPattern string, suffix string, scheme string) (Mapper, error)

Suffix is a `kedge.Mapper` that copies over wildcarded parts of a URL.

For example: given a matchPattern of *.*.clusters.local, and a URL of `myservice.mynamespace.svc.us1.prod.clusters.local` and a suffixMapper of `.clusters.example.com`, it will return a kedge url of `us1.prod.clusters.example.com`.

Scheme needs to be `http` or `https`

type Route

type Route struct {
	// URL specifies public URL to the Kedge fronting route destination.
	// The returned Scheme is deciding whether the Kedge connection is secure.
	URL *url.URL

	// BackendAuth represents optional auth for end application. Sometimes it is required to be injected here, because of common
	// restriction blocking auth headers in plain HTTP requests (even when communication locally with local forward proxy).
	BackendAuth auth.Source
	// ProxyAuth represents optional auth for kedge.
	ProxyAuth auth.Source
}

type RouteGetter

type RouteGetter interface {
	Route(dns string) (*Route, bool, error)
}

Jump to

Keyboard shortcuts

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