fasthttp

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2022 License: BSD-3-Clause, BSD-3-Clause Imports: 19 Imported by: 3

Documentation

Index

Constants

View Source
const (
	MethodGet      = "GET"     // RFC 7231, 4.3.1
	MethodHead     = "HEAD"    // RFC 7231, 4.3.2
	MethodPost     = "POST"    // RFC 7231, 4.3.3
	MethodPut      = "PUT"     // RFC 7231, 4.3.4
	MethodPatch    = "PATCH"   // RFC 5789
	MethodDelete   = "DELETE"  // RFC 7231, 4.3.5
	MethodConnect  = "CONNECT" // RFC 7231, 4.3.6
	MethodOptions  = "OPTIONS" // RFC 7231, 4.3.7
	MethodTrace    = "TRACE"   // RFC 7231, 4.3.8
	MethodWildcard = "*"
)

HTTP methods were copied from net/http.

Variables

This section is empty.

Functions

func MustNew

func MustNew(opts ...Option) ronykit.Gateway

func New

func New(opts ...Option) (ronykit.Gateway, error)

Types

type CORSConfig

type CORSConfig struct {
	AllowedHeaders []string
	AllowedMethods []string
	AllowedOrigins []string
	ExposedHeaders []string
}

type DecoderFunc

type DecoderFunc = func(bag Params, data []byte) (ronykit.Message, error)

type Option

type Option func(b *bundle)

func Listen

func Listen(addr string) Option

func WithBufferSize

func WithBufferSize(read, write int) Option

func WithCORS

func WithCORS(cfg CORSConfig) Option

func WithLogger

func WithLogger(l ronykit.Logger) Option

func WithPredicateKey

func WithPredicateKey(key string) Option

func WithServerName

func WithServerName(name string) Option

func WithWebsocketEndpoint

func WithWebsocketEndpoint(endpoint string) Option

type Params

type Params = httpmux.Params

type Selector

type Selector struct {
	Method    string
	Path      string
	Predicate string
	Decoder   DecoderFunc
	Encoding  ronykit.Encoding
}

Selector implements ronykit.RouteSelector and also ronykit.RPCRouteSelector and ronykit.RESTRouteSelector

func DELETE added in v0.6.18

func DELETE(path string) Selector

DELETE a shortcut for REST(http.MethodDelete, path)

func GET added in v0.6.18

func GET(path string) Selector

GET a shortcut for REST(http.MethodGet, path)

func PATCH added in v0.6.18

func PATCH(path string) Selector

PATCH a shortcut for REST(http.MethodPatch, path)

func POST added in v0.6.18

func POST(path string) Selector

POST a shortcut for REST(http.MethodPost, path)

func PUT added in v0.6.18

func PUT(path string) Selector

PUT a shortcut for REST(http.MethodPut, path)

func REST added in v0.6.4

func REST(method, path string) Selector

REST returns a Selector which acts on http requests.

func RPC added in v0.6.4

func RPC(predicate string) Selector

RPC returns a Selector which acts on websocket requests

func (Selector) GetEncoding added in v0.6.0

func (r Selector) GetEncoding() ronykit.Encoding

func (Selector) GetMethod

func (r Selector) GetMethod() string

func (Selector) GetPath

func (r Selector) GetPath() string

func (Selector) GetPredicate

func (r Selector) GetPredicate() string

func (Selector) Query

func (r Selector) Query(q string) interface{}

func (*Selector) SetEncoding added in v0.6.4

func (r *Selector) SetEncoding(enc ronykit.Encoding) *Selector

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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