http

package
v0.23.2 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2026 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SigKey = "mal3d1ct10n"

SigKey JWT signature key, you need to set your own!

Functions

func New

func New(userID, level string, expiration time.Time) (token string, err error)

New creates new JWT with claims payload.

func NewStructuredLogger

func NewStructuredLogger(logger *logrus.Logger) func(next http.Handler) http.Handler

Types

type Claims

type Claims struct {
	UserID string
	Level  string
	jwt.RegisteredClaims
}

Claims represents JWT payload.

func Parse

func Parse(token string) (*Claims, error)

Parse validates and extracts claims from token.

func ParseFromHeader

func ParseFromHeader(h http.Header) (*Claims, error)

ParseFromHeader parses Authorization bearer token as JWT.

type Server

type Server struct {
	// Server settings.
	Addr string
	// contains filtered or unexported fields
}

Server represents http Server.

func (*Server) Run

func (s *Server) Run() error

Jump to

Keyboard shortcuts

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