gateway

package
v0.0.0-...-9a61eb1 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAuthenticate

func NewAuthenticate(jwtSecret string, basics map[string]BasicAuth) middleware.Func

Types

type BasicAuth

type BasicAuth struct {
	Password string `yaml:"password"`
	Tenant   string `yaml:"tenant"`
}

type Config

type Config struct {
	JwtSecret string               `yaml:"secret"`
	Basics    map[string]BasicAuth `yaml:"basic"`
	Routes    []Route              `yaml:"routes"`
	Targets   map[string]string    `yaml:"targets"`
}

func (*Config) Load

func (cfg *Config) Load(loadPath string) error

type Gateway

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

Gateway hosts a reverse proxy for each upstream cortex service we'd like to tunnel after successful authentication

func New

func New(cfg Config, svr *server.Server) (*Gateway, error)

New instantiates a new Gateway

func (*Gateway) Start

func (g *Gateway) Start()

Start initializes the Gateway and starts it

type Proxy

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

Proxy pipes the traffic between the requester (Prometheus / Grafana) and upstream service

func (*Proxy) Handler

func (p *Proxy) Handler(res http.ResponseWriter, req *http.Request)

Handler is the route handler which must be bound to the routes

type Route

type Route struct {
	Path   string `yaml:"path"`
	Prefix bool   `yaml:"prefix"`
	Target string `yaml:"target"`
}

Jump to

Keyboard shortcuts

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