http_gateway

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2020 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultShutdownTimeout = 10 * time.Second

Variables

View Source
var HttpMethods = map[string]struct{}{
	http.MethodGet:    {},
	http.MethodPost:   {},
	http.MethodPut:    {},
	http.MethodDelete: {},
	http.MethodPatch:  {},
}

Functions

func Handle

func Handle(node *fiesta.Node, services []string, enableWS bool) http.Handler

func NoCache

func NoCache(h http.Handler) http.Handler

Types

type Config

type Config struct {
	Addr     string
	ConfHttp []ConfigHttp `toml:"http"`
}

func (Config) Validate

func (c Config) Validate() error

type ConfigHttp

type ConfigHttp struct {
	Domain  string
	Domains []string

	Addr  string
	Addrs []string

	EnableHttps bool

	RedirectTrailingSlash *bool `toml:"redirect_trailing_slash"`
	RedirectFixedPath     *bool `toml:"redirect_fixed_path"`

	Timeout struct {
		Read       Duration
		ReadHeader Duration
		Idle       Duration
		Write      Duration
		Shutdown   Duration
	}

	Min struct {
		BodySize *int `toml:"body_size"`
	}

	Max struct {
		HeaderSize int  `toml:"header_size"`
		BodySize   *int `toml:"body_size"`
	}

	ConfRoutes []ConfigRoute `toml:"routes"`
}

func (ConfigHttp) GetAddrs

func (h ConfigHttp) GetAddrs() []string

func (ConfigHttp) GetDomains

func (h ConfigHttp) GetDomains() []string

func (ConfigHttp) GetShutdownTimeout added in v0.0.2

func (h ConfigHttp) GetShutdownTimeout() time.Duration

func (ConfigHttp) Validate

func (h ConfigHttp) Validate() error

type ConfigRoute

type ConfigRoute struct {
	Path     string
	Dispatch string
	Static   string // static files
	Service  string
	Services []string

	NoCache         bool
	EnableWebSocket bool

	Min struct {
		BodySize *int `toml:"body_size"`
	}

	Max struct {
		BodySize *int `toml:"body_size"`
	}
}

func (ConfigRoute) GetServices

func (r ConfigRoute) GetServices() []string

func (ConfigRoute) Validate

func (r ConfigRoute) Validate() error

type Duration

type Duration struct {
	time.Duration
}

func (*Duration) UnmarshalText

func (d *Duration) UnmarshalText(text []byte) error

Jump to

Keyboard shortcuts

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