server

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	X_Cloud_Signature = "X-Cloud-Signature"
)

Variables

This section is empty.

Functions

func Call

func Call(url string, data []byte) error

func Req

func Req(funcHandler Handle, protected RouteProtection) httprouter.Handle

Req request handler

func ReqFileWR

func ReqFileWR(funcHandler HandleWR, protected RouteProtection) httprouter.Handle

ReqFileWR request file handler with http.ResponseWriter and http.Request

func ReqWR

func ReqWR(funcHandler HandleWR, protected RouteProtection) httprouter.Handle

ReqWR request handler with http.ResponseWriter and http.Request

Types

type Handle

type Handle func(Request) (handler.Response, error)

type Request

type Request struct {
	Body        []byte
	Header      http.Header
	QueryString string
	Method      string
	IpAddress   string
	UserID      uuid.UUID
	Username    string
	Avatar      string
	DisplayName string
	SystemRole  string
	CookieMap   string
	// contains filtered or unexported fields
}

func (Request) GetParamByName

func (req Request) GetParamByName(name string) string

ByName returns the value of the first Param which key matches the given name. If no matching Param is found, an empty string is returned.

type RouteProtection

type RouteProtection int
const (
	RouteProtectionHMAC RouteProtection = iota
	RouteProtectionAdmin
	RouteProtectionCookie
	RouteProtectionPublic
)

type ServerRouter

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

func NewServerRouter

func NewServerRouter() *ServerRouter

func (*ServerRouter) DELETE

func (r *ServerRouter) DELETE(path string, handle Handle, protected RouteProtection)

DELETE is a shortcut for router.Handle("DELETE", path, handle)

func (*ServerRouter) DELETEWR

func (r *ServerRouter) DELETEWR(path string, handle HandleWR, protected RouteProtection)

DELETEWR is a shortcut for router.HandleWR("DELETE", path, handle)

func (*ServerRouter) GET

func (r *ServerRouter) GET(path string, handle Handle, protected RouteProtection)

GET is a shortcut for router.Handle("GET", path, handle)

func (*ServerRouter) GETWR

func (r *ServerRouter) GETWR(path string, handle HandleWR, protected RouteProtection)

GETWR with main http request parameters is a shortcut for router.HandleWR("GET", path, handle)

func (*ServerRouter) HEAD

func (r *ServerRouter) HEAD(path string, handle Handle, protected RouteProtection)

HEAD is a shortcut for router.Handle("HEAD", path, handle)

func (*ServerRouter) HEADWR

func (r *ServerRouter) HEADWR(path string, handle HandleWR, protected RouteProtection)

HEADWR is a shortcut for router.HandleWR("HEAD", path, handle)

func (*ServerRouter) OPTIONS

func (r *ServerRouter) OPTIONS(path string, handle Handle, protected RouteProtection)

OPTIONS is a shortcut for router.Handle("OPTIONS", path, handle)

func (*ServerRouter) OPTIONSWR

func (r *ServerRouter) OPTIONSWR(path string, handle HandleWR, protected RouteProtection)

OPTIONSWR is a shortcut for router.HandleWR("OPTIONS", path, handle)

func (*ServerRouter) PATCH

func (r *ServerRouter) PATCH(path string, handle Handle, protected RouteProtection)

PATCH is a shortcut for router.Handle("PATCH", path, handle)

func (*ServerRouter) PATCHWR

func (r *ServerRouter) PATCHWR(path string, handle HandleWR, protected RouteProtection)

PATCHWR is a shortcut for router.HandleWR("PATCH", path, handle)

func (*ServerRouter) POST

func (r *ServerRouter) POST(path string, handle Handle, protected RouteProtection)

POST is a shortcut for router.Handle("POST", path, handle)

func (*ServerRouter) POSTFILE

func (r *ServerRouter) POSTFILE(path string, handle HandleWR, protected RouteProtection)

POSTFILE is a shortcut for router.HandleWR("POST", path, handle)

func (*ServerRouter) POSTWR

func (r *ServerRouter) POSTWR(path string, handle HandleWR, protected RouteProtection)

POSTWR is a shortcut for router.HandleWR("POST", path, handle)

func (*ServerRouter) PUT

func (r *ServerRouter) PUT(path string, handle Handle, protected RouteProtection)

PUT is a shortcut for router.Handle("PUT", path, handle)

func (*ServerRouter) PUTWR

func (r *ServerRouter) PUTWR(path string, handle HandleWR, protected RouteProtection)

PUTWR is a shortcut for router.HandleWR("PUT", path, handle)

func (*ServerRouter) ServeHTTP

func (r *ServerRouter) ServeHTTP(w http.ResponseWriter, req *http.Request)

ServeHTTP makes the router implement the http.Handler interface.

Jump to

Keyboard shortcuts

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