Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
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 and optional port (e.g. myservice.prod.ext.europe-cluster.local and 80) to a Route.
// If the targets shouldn't be proxied, ErrNotKedgeDestination should be returned.
Map(targetAuthorityDnsName string, port 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 SimpleHost ¶
SimpleHost is a kedge mapper that returns route based on map provided in constructor. It does not care about port.
func SimpleHostPort ¶
SimpleHostPort is a kedge mapper that returns route based on map provided in constructor.
func Single ¶
Single is a simplistic kedge mapper that forwards all traffic through the same kedge. No auth is involved.
func SingleWithProxyAuth ¶
SingleWithProxyAuth is kedge mapper that always returns predefined route with given Proxy auth and no backend auth. Used for loadtest.
func Suffix ¶
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`.
NOTE: It does not care about port.
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 tokenauth.Source
// ProxyAuth represents optional auth for kedge.
ProxyAuth tokenauth.Source
}