http

package
v0.3.17 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2023 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context struct {
	Writer      http.ResponseWriter
	Request     *http.Request
	Route       *Route
	RouteParams []string

	Aborted       bool
	HeaderWritten bool
	// contains filtered or unexported fields
}

func MakeContext

func MakeContext(writer http.ResponseWriter, request *http.Request) *Context

func (*Context) Abort

func (c *Context) Abort()

func (*Context) AbortWithResponse

func (c *Context) AbortWithResponse(response *http.Response)

func (*Context) AbortWithStatus

func (c *Context) AbortWithStatus(status int)

func (*Context) Get

func (c *Context) Get(key string) interface{}

func (*Context) JSON

func (c *Context) JSON(status int, data interface{})

func (*Context) Set

func (c *Context) Set(key string, value interface{})

type Decorator

type Decorator func(*Route) Handler

type H

type H map[string]interface{}

type HTTPServer

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

func MakeHTTPServer

func MakeHTTPServer(settings *HTTPServerSettings, routeGroups []*RouteGroup) (*HTTPServer, error)

func (*HTTPServer) ServeHTTP

func (s *HTTPServer) ServeHTTP(writer http.ResponseWriter, request *http.Request)

func (*HTTPServer) SetHooks

func (h *HTTPServer) SetHooks(hooks *Hooks)

func (*HTTPServer) SetListener

func (h *HTTPServer) SetListener(listener net.Listener)

func (*HTTPServer) SetTLSConfig

func (h *HTTPServer) SetTLSConfig(config *cryptoTls.Config)

func (*HTTPServer) Start

func (s *HTTPServer) Start() error

func (*HTTPServer) Stop

func (s *HTTPServer) Stop() error

type HTTPServerSettings

type HTTPServerSettings struct {
	TLS           *tls.TLSSettings `json:"tls"`
	BindAddress   string           `json:"bind_address"`
	TCPRateLimits []*net.RateLimit `json:"tcp_rate_limits"`
}

Settings for the JSON-RPC server

type Handler

type Handler func(*Context)

type Hooks

type Hooks struct {
	Finished Handler
}

type Route

type Route struct {
	Pattern  string
	Regexp   *regexp.Regexp
	Handlers []Handler
}

type RouteGroup

type RouteGroup struct {
	Routes    []*Route
	Handlers  []Handler
	Subgroups []*RouteGroup
}

Jump to

Keyboard shortcuts

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