flathttp

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2020 License: MIT Imports: 10 Imported by: 1

Documentation

Index

Constants

View Source
const DefaultShutdownTimeout = 10 * time.Second

Variables

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

Functions

func Handle

func Handle(node *flatend.Node, services []string) http.Handler

func NoCache

func NoCache(h http.Handler) http.Handler

Types

type Config

type Config struct {
	Addr string
	HTTP []ConfigHTTP
}

func (Config) Validate

func (c Config) Validate() error

type ConfigHTTP

type ConfigHTTP struct {
	Domain  string
	Domains []string

	Addr  string
	Addrs []string

	HTTPS 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"`
	}

	Routes []ConfigRoute
}

func (ConfigHTTP) GetAddrs

func (h ConfigHTTP) GetAddrs() []string

func (ConfigHTTP) GetDomains

func (h ConfigHTTP) GetDomains() []string

func (ConfigHTTP) GetShutdownTimeout added in v0.0.5

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

	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