http

package
v0.3.6 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PostMiddleware = func(next echo.HandlerFunc) echo.HandlerFunc {
	return func(c echo.Context) error {
		c.Response().WriteHeader(http.StatusNoContent)
		_, _ = c.Response().Writer.Write(nil)

		return nil
	}
}
View Source
var PreMiddleware = func(next echo.HandlerFunc) echo.HandlerFunc {
	return func(c echo.Context) error {
		c.Response().Header().Set("Server", ServerInfo)
		return next(c)
	}
}
View Source
var ServerInfo = "Turna"

Functions

func EchoNew added in v0.3.6

func EchoNew() *echo.Echo

Types

type Certificate added in v0.3.5

type Certificate struct {
	CertFile string `cfg:"cert_file"`
	KeyFile  string `cfg:"key_file"`
}

type HTTP

type HTTP struct {
	Routers     map[string]Router         `cfg:"routers"`
	Middlewares map[string]HTTPMiddleware `cfg:"middlewares"`
	TLS         TLS                       `cfg:"tls"`
}

func (*HTTP) Set

func (h *HTTP) Set(ctx context.Context, wg *sync.WaitGroup) error

type HTTPMiddleware

type HTTPMiddleware struct {
	AddPrefixMiddleware   *middlewares.AddPrefix   `cfg:"add_prefix"`
	AuthMiddleware        *middlewares.Auth        `cfg:"auth"`
	HelloMiddleware       *middlewares.Hello       `cfg:"hello"`
	InfoMiddleware        *middlewares.Info        `cfg:"info"`
	SetMiddleware         *middlewares.Set         `cfg:"set"`
	StripPrefixMiddleware *middlewares.StripPrefix `cfg:"strip_prefix"`
	RoleMiddleware        *middlewares.Role        `cfg:"role"`
	ScopeMiddleware       *middlewares.Scope       `cfg:"scope"`
	ServiceMiddleware     *middlewares.Service     `cfg:"service"`
	FolderMiddleware      *middlewares.Folder      `cfg:"folder"`
	BasicAuthMiddleware   *middlewares.BasicAuth   `cfg:"basic_auth"`
	CorsMiddleware        *middlewares.Cors        `cfg:"cors"`
	HeadersMiddleware     *middlewares.Headers     `cfg:"headers"`
	BlockMiddleware       *middlewares.Block       `cfg:"block"`
	RegexPathMiddleware   *middlewares.RegexPath   `cfg:"regex_path"`
	GzipMiddleware        *middlewares.Gzip        `cfg:"gzip"`
	DecompressMiddleware  *middlewares.Decompress  `cfg:"decompress"`
	LogMiddleware         *middlewares.Log         `cfg:"log"`
}

func (*HTTPMiddleware) Set

func (h *HTTPMiddleware) Set(ctx context.Context, name string) error

type Router

type Router struct {
	Host        string    `cfg:"host"`
	Path        string    `cfg:"path"`
	Middlewares []string  `cfg:"middlewares"`
	TLS         *struct{} `cfg:"tls"`
	EntryPoints []string  `cfg:"entrypoints"`
}

func (*Router) Check

func (r *Router) Check() error

func (*Router) Set

func (r *Router) Set(_ string, ruleRouter *RuleRouter) error

type RuleRouter added in v0.3.6

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

func NewRuleRouter added in v0.3.6

func NewRuleRouter() *RuleRouter

func (*RuleRouter) GetEcho added in v0.3.6

func (s *RuleRouter) GetEcho(r RuleSelection) *echo.Echo

func (RuleRouter) Serve added in v0.3.6

func (s RuleRouter) Serve(entrypoint string) http.Handler

Serve implements the http.Handler interface with changing entrypoint selection.

func (*RuleRouter) ServeHTTP added in v0.3.6

func (s *RuleRouter) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*RuleRouter) SetRule added in v0.3.6

func (s *RuleRouter) SetRule(selection RuleSelection)

type RuleSelection added in v0.3.6

type RuleSelection struct {
	Host       string
	Entrypoint string
}

type TLS added in v0.3.5

type TLS struct {
	Store map[string][]Certificate `cfg:"store"`
}

Jump to

Keyboard shortcuts

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