context

package
v3.3.1 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JWT

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

func (*JWT) GetAccessToken

func (j *JWT) GetAccessToken() (jwt.Claims, error)

func (*JWT) GetRefreshTokenFromCookie

func (j *JWT) GetRefreshTokenFromCookie() (jwt.Claims, error)

func (*JWT) MakeAccessToken

func (j *JWT) MakeAccessToken(claims jwt.Claims) (string, error)

func (*JWT) MakeRefreshToken

func (j *JWT) MakeRefreshToken(claims jwt.Claims) (string, error)

func (*JWT) ParseAccessToken

func (j *JWT) ParseAccessToken(tk []byte) (jwt.Claims, error)

func (*JWT) ParseRefreshToken

func (j *JWT) ParseRefreshToken(token []byte) (jwt.Claims, error)

func (*JWT) SetAccessToken

func (j *JWT) SetAccessToken(claims jwt.Claims) (string, error)

func (*JWT) SetRefreshTokenWithClaims

func (j *JWT) SetRefreshTokenWithClaims(claims jwt.Claims) (string, error)

type JWTConfig

type JWTConfig struct {
	SigningKey       []byte
	SigningMethod    jwt.SigningMethod
	EncryptionKey    []byte
	EncryptionMethod cipher.AEAD
	Domain           string
	Path             string
}

type LuxContext

type LuxContext struct {
	Request        *http.Request
	Response       *Response
	RouteParams    httprouter.Params
	Context        context.Context
	RequestContext context.Context
	Logger         *zerolog.Logger
	JWTConfig      *JWTConfig
}

func (*LuxContext) GetBody

func (l *LuxContext) GetBody() ([]byte, error)

func (*LuxContext) GetBodyReader

func (l *LuxContext) GetBodyReader() io.ReadCloser

func (*LuxContext) GetCookie

func (l *LuxContext) GetCookie(key string) (*http.Cookie, error)

func (*LuxContext) GetFormData

func (l *LuxContext) GetFormData(key string) string

func (*LuxContext) GetFormFile

func (l *LuxContext) GetFormFile(name string) (multipart.File, *multipart.FileHeader, error)

func (*LuxContext) GetMultipartFile

func (l *LuxContext) GetMultipartFile(name string, maxMemoryBytes int64) ([]*multipart.FileHeader, error)

func (*LuxContext) GetPathVariable

func (l *LuxContext) GetPathVariable(key string) string

func (*LuxContext) GetRemoteAddress

func (l *LuxContext) GetRemoteAddress() string

func (*LuxContext) GetRemoteIP

func (l *LuxContext) GetRemoteIP() string

func (*LuxContext) GetRemotePort

func (l *LuxContext) GetRemotePort() string

func (*LuxContext) GetURLQuery

func (l *LuxContext) GetURLQuery(key string) string

func (*LuxContext) IsOk

func (l *LuxContext) IsOk() bool

func (*LuxContext) JWT

func (l *LuxContext) JWT() *JWT

func (*LuxContext) ParseJSON

func (l *LuxContext) ParseJSON(v interface{}) error

func (*LuxContext) Reply

func (l *LuxContext) Reply(contentType string, body []byte) error

func (*LuxContext) Reply7Z

func (l *LuxContext) Reply7Z(data []byte) error

func (*LuxContext) ReplyAuto added in v3.1.0

func (l *LuxContext) ReplyAuto(data []byte) error

func (*LuxContext) ReplyBinary

func (l *LuxContext) ReplyBinary(data []byte) error

func (*LuxContext) ReplyCSV

func (l *LuxContext) ReplyCSV(data []byte) error

func (*LuxContext) ReplyExcel

func (l *LuxContext) ReplyExcel(data []byte) error

func (*LuxContext) ReplyFile

func (l *LuxContext) ReplyFile(path string) error

func (*LuxContext) ReplyGZIP

func (l *LuxContext) ReplyGZIP(data []byte) error

func (*LuxContext) ReplyHTML

func (l *LuxContext) ReplyHTML(data []byte) error

func (*LuxContext) ReplyJPEG

func (l *LuxContext) ReplyJPEG(data []byte) error

func (*LuxContext) ReplyJSON

func (l *LuxContext) ReplyJSON(data interface{}) error

func (*LuxContext) ReplyMP4

func (l *LuxContext) ReplyMP4(data []byte) error

func (*LuxContext) ReplyPDF

func (l *LuxContext) ReplyPDF(data []byte) error

func (*LuxContext) ReplyPNG

func (l *LuxContext) ReplyPNG(data []byte) error

func (*LuxContext) ReplyPlainText

func (l *LuxContext) ReplyPlainText(text string) error

func (*LuxContext) ReplyPowerpoint

func (l *LuxContext) ReplyPowerpoint(data []byte) error

func (*LuxContext) ReplyProtobuf

func (l *LuxContext) ReplyProtobuf(data protoreflect.ProtoMessage) error

func (*LuxContext) ReplyString

func (l *LuxContext) ReplyString(text string) error

func (*LuxContext) ReplyTar

func (l *LuxContext) ReplyTar(data []byte) error

func (*LuxContext) ReplyWebM

func (l *LuxContext) ReplyWebM(data []byte) error

func (*LuxContext) ReplyWebP

func (l *LuxContext) ReplyWebP(data []byte) error

func (*LuxContext) ReplyWord

func (l *LuxContext) ReplyWord(data []byte) error

func (*LuxContext) ReplyXML

func (l *LuxContext) ReplyXML(data []byte) error

func (*LuxContext) ReplyZip

func (l *LuxContext) ReplyZip(data []byte) error

func (*LuxContext) SaveFile

func (l *LuxContext) SaveFile(file multipart.File, path string) error

func (*LuxContext) SaveMultipartFile

func (l *LuxContext) SaveMultipartFile(headers []*multipart.FileHeader, path string) error

func (*LuxContext) SetAccepted

func (l *LuxContext) SetAccepted()

func (*LuxContext) SetBadRequest

func (l *LuxContext) SetBadRequest()

func (*LuxContext) SetConflict

func (l *LuxContext) SetConflict()

func (*LuxContext) SetCookie

func (l *LuxContext) SetCookie(name string, value string, maxAge int, path string, domain string, secure bool, httpOnly bool)

func (*LuxContext) SetForbidden

func (l *LuxContext) SetForbidden()

func (*LuxContext) SetFound

func (l *LuxContext) SetFound()

func (*LuxContext) SetInternalServerError

func (l *LuxContext) SetInternalServerError()

func (*LuxContext) SetNoContent

func (l *LuxContext) SetNoContent()

func (*LuxContext) SetNotFound

func (l *LuxContext) SetNotFound()

func (*LuxContext) SetNotImplemented

func (l *LuxContext) SetNotImplemented()

func (*LuxContext) SetOK

func (l *LuxContext) SetOK()

func (*LuxContext) SetResetContent

func (l *LuxContext) SetResetContent()

func (*LuxContext) SetSecureCookie

func (l *LuxContext) SetSecureCookie(name string, value string, maxAge int, path string, domain string)

func (*LuxContext) SetServiceUnavailable

func (l *LuxContext) SetServiceUnavailable()

func (*LuxContext) SetStatus

func (l *LuxContext) SetStatus(status int)

func (*LuxContext) SetUnauthorized

func (l *LuxContext) SetUnauthorized()

func (*LuxContext) SetUnsupportedMediaType

func (l *LuxContext) SetUnsupportedMediaType()

type Response

type Response struct {
	StatusCode int
	Headers    http.Header
	Body       []byte
}

func NewResponse

func NewResponse() *Response

func (*Response) Header

func (r *Response) Header() http.Header

func (*Response) Write

func (r *Response) Write(p []byte) (int, error)

func (*Response) WriteHeader

func (r *Response) WriteHeader(code int)

type WSContext

type WSContext struct {
	Conn net.Conn
}

func (*WSContext) Close

func (w *WSContext) Close() error

func (*WSContext) ReadBinary

func (w *WSContext) ReadBinary() ([]byte, error)

func (*WSContext) ReadData

func (w *WSContext) ReadData() ([]byte, ws.OpCode, error)

func (*WSContext) ReadText

func (w *WSContext) ReadText() ([]byte, error)

func (*WSContext) WriteBinary

func (w *WSContext) WriteBinary(bin []byte) error

func (*WSContext) WriteData

func (w *WSContext) WriteData(data []byte, opCode ws.OpCode) error

func (*WSContext) WriteText

func (w *WSContext) WriteText(text []byte) error

Jump to

Keyboard shortcuts

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