handler

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

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

Go to latest
Published: Dec 1, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Configuration

type Configuration struct {
	Listen      string              `json:"listen"`
	Certificate string              `json:"certificate"`
	Key         string              `json:"key"`
	Log         string              `json:"log"`
	WhiteList   []string            `json:"whiteList"`
	Compression bool                `json:"compression"`
	Upstreams   map[string][]string `json:"upstreams"`
	Routes      []Route             `json:"routes"`
	Discovery   bool                `json:"discovery"`
}

func (Configuration) GetDiscoveryHandler

func (conf Configuration) GetDiscoveryHandler() (gin.HandlerFunc, *DiscoveryService)

func (Configuration) GetLoggingHandler

func (conf Configuration) GetLoggingHandler() gin.HandlerFunc

func (Configuration) GetWhitelistHandler

func (conf Configuration) GetWhitelistHandler() gin.HandlerFunc

func (*Configuration) Validate

func (conf *Configuration) Validate() error

type CorsConfig

type CorsConfig struct {
	Origin         string `json:"origin"`
	Methods        string `json:"methods"`
	Credentials    bool   `json:"credentials"`
	MaxAge         string `json:"maxAge"`
	AllowedHeaders string `json:"allowedHeaders"`
	CacheControl   string `json:"cacheControl"`
	Vary           string `json:"vary"`
}

type DiscoveryClient

type DiscoveryClient struct {
	Service string `json:"service"`
	Host    string `json:"host"`
	Port    int    `json:"port"`
	Active  bool
}

type DiscoveryService

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

func (*DiscoveryService) AppendService

func (s *DiscoveryService) AppendService(service *DiscoveryClient)

func (*DiscoveryService) GetService

func (s *DiscoveryService) GetService(serviceName string) (*DiscoveryClient, error)

func (*DiscoveryService) HeartBeatServices

func (s *DiscoveryService) HeartBeatServices()

func (*DiscoveryService) MarkInactive

func (s *DiscoveryService) MarkInactive(client *DiscoveryClient)

type Route

type Route struct {
	Path           string            `json:"path"`
	ForwardUrl     string            `json:"forwardUrl"`
	AllowedMethods []string          `json:"allowedMethods"`
	ForwardIp      bool              `json:"forwardIp"`
	AppendPath     bool              `json:"appendPath"`
	CustomHeaders  map[string]string `json:"customHeaders"`
	SecureHeaders  bool              `json:"secureHeaders"`
	Cors           CorsConfig        `json:"cors"`
	Cache          int               `json:"cache"`
	Timeout        int               `json:"timeout"`
}

func (Route) GetCoreHandler

func (route Route) GetCoreHandler(conf *Configuration, method string, discoveryService *DiscoveryService) gin.HandlerFunc

Jump to

Keyboard shortcuts

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