krakend

package module
v0.0.0-...-395dcfc Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2020 License: Apache-2.0 Imports: 74 Imported by: 0

README

Krakend logo

KrakenD API Gateway

Ultra-High performance API Gateway with middlewares

Build Status

KrakenD Community Edition (or KrakenD-CE) is the binary distribution of KrakenD.

In this repository, you'll find the utils to build the KrakenD binary yourself. If you want to use KrakenD download the binary

KrakenD Site | Documentation | Blog | Twitter

Features

Some of the features you get with KrakenD are:

  • Ultra-High performance API Gateway
  • Backend for Frontend
  • Efficient: Super low memory consumption with high traffic (usually under 50MB w/ +1000 concurrent) and even lower with low traffic (under 5MB)
  • Easy to use: Declaration of endpoints by just writing the /url/patterns/and/{variables}
  • Unlimited number of backends and endpoints associated with each endpoint. The limit is your kernel.
  • Aggregation of all the data in the backends for a single endpoint
  • Response composition and data manipulation (capture, groups, renames...)
  • Response filtering (whitelist and blacklist)
  • Concurrent API calls to the backend for the same request
  • Simple configuration: All application configuration and behavior declared in a krakend.json.
  • Friendly: No development needed to build your gateway. Use the Visual API Designer (UI to generate the krakend.json)
  • SSL
  • HTTP2 ready
  • Circuit breaker (fail fast and avoid smashing stressed backends)
  • Bursting on High-load
  • Logging and statistics of usage
  • API with statistics
  • Service Discovery: DNS SRV, ETCD or add your own
  • Multiple encodings supported (json, XML, RSS or response as single string)
  • Injections via DSL in the configuration (Martian)
  • Throttling: Limits of usage in the router and proxy layers.
  • User quota: Restrict usage of users by IP or custom headers
  • Basic Firewalling: Restrict connections by host, drop connections on certain limits
  • Automatic load balancing
  • HTTP Cache headers
  • In-memory backend response cache
  • Multiple installation options (bin, docker, rpm, deb, brew)
  • Cloud native
  • Loved by orchestrators (Kubernetes, Mesos + Marathon, Nomad, Docker Swarm, and others)
  • Secure:
    • Support for SSL
    • OAuth client grant
    • JSON Web Tokens (JWT) and JSON Object Signing and Encryption (JOSE)
    • HTTP Strict Transport Security (HSTS)
    • Clickjacking protection
    • HTTP Public Key Pinning (HPKP)
    • MIME-Sniffing prevention
    • Cross-site scripting (XSS) protection
    • Cross-origin resource sharing (CORS)

For a more nice description of the features have a look in the website.

Gateway documentation

Full, comprehensive documentation is viewable on the KrakenD website:

http://www.krakend.io/docs/overview/introduction/

Build Requirements

  • golang 1.11

Build

    make build

Building with docker

If you don't have or don't want to install go you can build it using the golang docker container.

make docker_build

FPM

You can set up your fpm docker image to run setting DOCKER_FPM on the Makefile.

Using the generated packages

The package creates a krakend user to run the service and configures the service to run under systemd.

Linux Distributions

  • just any Linux (using the tar.gz)
  • ubuntu 14.04, 16.04 (should run un 17.04/10 too)
  • Debian 7, 8, 9
  • centos 6, 7
deb: ubuntu debian
rpm: el6 el7

ubuntu: ubuntu-trusty ubuntu-xenial
debian: debian-wheezy debian-jessie debian-stretch

Documentation

Index

Constants

View Source
const LoggerNamespace = "github_com/openrm/logging"

Variables

This section is empty.

Functions

func ErrorHTTPStatusHandler

func ErrorHTTPStatusHandler(next client.HTTPStatusHandler, name string) client.HTTPStatusHandler

func GetHTTPStatusHandler

func GetHTTPStatusHandler(cfg *config.Backend) client.HTTPStatusHandler

func LoadPlugins

func LoadPlugins(folder, pattern string, logger logging.Logger)

LoadPlugins loads and registers the plugins so they can be used if enabled at the configuration

func NewBackendFactoryWithContext

func NewBackendFactoryWithContext(ctx context.Context, logger logging.Logger, lcfg loggingConfig, metricCollector *metrics.Metrics) proxy.BackendFactory

NewBackendFactory creates a BackendFactory by stacking all the available middlewares and injecting the received context

func NewEngine

func NewEngine(cfg config.ServiceConfig, logger logging.Logger, lcfg loggingConfig, w io.Writer) *gin.Engine

NewEngine creates a new gin engine with some default values and a secure middleware

func NewExecutor

func NewExecutor(ctx context.Context) cmd.Executor

NewExecutor returns an executor for the cmd package. The executor initalizes the entire gateway by registering the components and composing a RouterFactory wrapping all the middlewares.

func NewHandlerFactory

func NewHandlerFactory(logger logging.Logger, lcfg loggingConfig, metricCollector *metrics.Metrics, rejecter jose.RejecterFactory) router.HandlerFactory

NewHandlerFactory returns a HandlerFactory with a rate-limit and a metrics collector middleware injected

func NewOpenCensusClient

func NewOpenCensusClient(lcfg loggingConfig, clientFactory client.HTTPClientFactory) client.HTTPClientFactory

func NewOpenCensusHandlerFactory

func NewOpenCensusHandlerFactory(hf router.HandlerFactory, lcfg loggingConfig) router.HandlerFactory

func NewProxyFactory

func NewProxyFactory(logger logging.Logger, backendFactory proxy.BackendFactory, metricCollector *metrics.Metrics) proxy.Factory

NewProxyFactory returns a new ProxyFactory wrapping the injected BackendFactory with the default proxy stack and a metrics collector

func NewRouterLogger

func NewRouterLogger(cfg loggingConfig, w io.Writer) gin.HandlerFunc

func NewSentryMiddleware

func NewSentryMiddleware(cfg config.ServiceConfig) gin.HandlerFunc

func RegisterBloomd

func RegisterBloomd(scfg config.ServiceConfig, logger logging.Logger) (jose.Rejecter, error)

func RegisterEncoders

func RegisterEncoders()

RegisterEncoders registers all the available encoders

func RegisterSubscriberFactories

func RegisterSubscriberFactories(ctx context.Context, cfg config.ServiceConfig, logger logging.Logger) func(n string, p int)

RegisterSubscriberFactories registers all the available sd adaptors

Types

type ResponseError

type ResponseError struct {
	Code int         `json:"status"`
	Body interface{} `json:"body,omitempty"`
	// contains filtered or unexported fields
}

func (*ResponseError) Error

func (r *ResponseError) Error() string

func (*ResponseError) Name

func (r *ResponseError) Name() string

func (*ResponseError) StatusCode

func (r *ResponseError) StatusCode() int

Directories

Path Synopsis
cmd
Package tests implements utility functions to help with API Gateway testing.
Package tests implements utility functions to help with API Gateway testing.

Jump to

Keyboard shortcuts

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